more commands. fixed an issue with text only commands

This commit is contained in:
2021-09-11 00:14:23 +01:00
parent 471948bed3
commit 9b5333dc87
18 changed files with 562 additions and 897 deletions

View File

@ -42,22 +42,50 @@ pub enum ReminderError {
impl ReminderError {
pub fn display(&self, is_natural: bool) -> String {
match self {
ReminderError::LongTime => "That time is too far in the future. Please specify a shorter time.".to_string(),
ReminderError::LongInterval => format!("Please ensure the interval specified is less than {max_time} days", max_time = *MAX_TIME / 86_400),
ReminderError::PastTime => "Please ensure the time provided is in the future. If the time should be in the future, please be more specific with the definition.".to_string(),
ReminderError::ShortInterval => format!("Please ensure the interval provided is longer than {min_interval} seconds", min_interval = *MIN_INTERVAL),
ReminderError::InvalidTag => "Couldn't find a location by your tag. Your tag must be either a channel or a user (not a role)".to_string(),
ReminderError::InvalidTime => if is_natural {
"Your time failed to process. Please make it as clear as possible, for example `\"16th of july\"` or `\"in 20 minutes\"`".to_string()
} else {
"Make sure the time you have provided is in the format of [num][s/m/h/d][num][s/m/h/d] etc. or `day/month/year-hour:minute:second`".to_string()
},
ReminderError::InvalidExpiration => if is_natural {
"Your expiration time failed to process. Please make it as clear as possible, for example `\"16th of july\"` or `\"in 20 minutes\"`".to_string()
} else {
"Make sure the expiration time you have provided is in the format of [num][s/m/h/d][num][s/m/h/d] etc. or `day/month/year-hour:minute:second`".to_string()
},
ReminderError::DiscordError(s) => format!("A Discord error occurred: **{}**", s)
ReminderError::LongTime => {
"That time is too far in the future. Please specify a shorter time.".to_string()
}
ReminderError::LongInterval => format!(
"Please ensure the interval specified is less than {max_time} days",
max_time = *MAX_TIME / 86_400
),
ReminderError::PastTime => {
"Please ensure the time provided is in the future. If the time should be in \
the future, please be more specific with the definition."
.to_string()
}
ReminderError::ShortInterval => format!(
"Please ensure the interval provided is longer than {min_interval} seconds",
min_interval = *MIN_INTERVAL
),
ReminderError::InvalidTag => {
"Couldn't find a location by your tag. Your tag must be either a channel or \
a user (not a role)"
.to_string()
}
ReminderError::InvalidTime => {
if is_natural {
"Your time failed to process. Please make it as clear as possible, for example `\"16th of july\"` \
or `\"in 20 minutes\"`"
.to_string()
} else {
"Make sure the time you have provided is in the format of [num][s/m/h/d][num][s/m/h/d] etc. or \
`day/month/year-hour:minute:second`"
.to_string()
}
}
ReminderError::InvalidExpiration => {
if is_natural {
"Your expiration time failed to process. Please make it as clear as possible, for example `\"16th \
of july\"` or `\"in 20 minutes\"`"
.to_string()
} else {
"Make sure the expiration time you have provided is in the format of [num][s/m/h/d][num][s/m/h/d] \
etc. or `day/month/year-hour:minute:second`"
.to_string()
}
}
ReminderError::DiscordError(s) => format!("A Discord error occurred: **{}**", s),
}
}
}