removed look all, fixed look #channel with other switches. added a changelog to be posted to discord
This commit is contained in:
parent
9bb969c642
commit
6402a9b705
34
1.3.0-changelog
Normal file
34
1.3.0-changelog
Normal file
@ -0,0 +1,34 @@
|
||||
**Reminder Bot Update 1.3.0**
|
||||
|
||||
- `help` command reworked:
|
||||
+ The help command now shows all information within Discord, rather than redirecting to an external website
|
||||
+ The help command has separate pages for different commands with examples, and detailed information on arguments
|
||||
|
||||
- `timezone` command reworked:
|
||||
+ Timezone was a notoriously annoying and confusing command to use, so these changes will hopefully improve its usability
|
||||
+ Typing `$timezone` will now show you a list of the most popular timezones and the time in those timezones, to make it easy for many users to select their timezones
|
||||
+ If a timezone is not recognised, the bot will show you a list of 'similar' timezones by name, and the times in these timezones
|
||||
+ Outputs are more descriptive
|
||||
|
||||
- `language` command reworked:
|
||||
+ Language has been made to look somewhat nicer and you can now use reactions to respond with what language you wish to switch to
|
||||
|
||||
- `timer` visual improvements:
|
||||
+ Some emojis have been added to the timer command to make it look nicer
|
||||
|
||||
- `look` fixes:
|
||||
+ `$look all` has been removed again, as some users pointed out that this was flawed and allowed random users to check reminders in private channels
|
||||
+ Fixed a bug where channels would be ignored if other switches were provided to the command
|
||||
|
||||
- `remind` command reworked:
|
||||
+ Backend of this command completely reworked to be much cleaner code
|
||||
+ Fixed providing times in exact format sometimes not working if a day was provided but not a month/year
|
||||
+ This command can now be used to bulk-set reminders to multiple locations
|
||||
|
||||
- General changes:
|
||||
+ More command outputs use embeds to look nicer
|
||||
+ Commands that fail provide help outputs that are the same as the help command
|
||||
+ Remind commands now provide output that is more detailed. This includes showing the exact errors that occurred for each reminder that couldn't be set, if bulk-setting reminders
|
||||
+ Translations are now loaded from a JSON file included within the executable, which should be faster
|
||||
+ Reduced user caching by individually querying some attributes like language and timezone
|
||||
|
@ -338,16 +338,10 @@ enum TimeDisplayType {
|
||||
Relative,
|
||||
}
|
||||
|
||||
enum Selection<T> {
|
||||
None,
|
||||
Single(T),
|
||||
All,
|
||||
}
|
||||
|
||||
struct LookFlags {
|
||||
pub limit: u16,
|
||||
pub show_disabled: bool,
|
||||
pub channel_id: Selection<u64>,
|
||||
pub channel_id: Option<u64>,
|
||||
time_display: TimeDisplayType,
|
||||
}
|
||||
|
||||
@ -356,7 +350,7 @@ impl Default for LookFlags {
|
||||
Self {
|
||||
limit: u16::MAX,
|
||||
show_disabled: true,
|
||||
channel_id: Selection::None,
|
||||
channel_id: None,
|
||||
time_display: TimeDisplayType::Relative,
|
||||
}
|
||||
}
|
||||
@ -376,20 +370,18 @@ impl LookFlags {
|
||||
new_flags.time_display = TimeDisplayType::Absolute;
|
||||
}
|
||||
|
||||
"all" => {
|
||||
new_flags.channel_id = Selection::All;
|
||||
}
|
||||
|
||||
param => {
|
||||
if let Ok(val) = param.parse::<u16>() {
|
||||
new_flags.limit = val;
|
||||
} else {
|
||||
new_flags.channel_id = REGEX_CHANNEL
|
||||
.captures(&args)
|
||||
if let Some(channel) = REGEX_CHANNEL
|
||||
.captures(&arg)
|
||||
.map(|cap| cap.get(1))
|
||||
.flatten()
|
||||
.map(|c| c.as_str().parse::<u64>().unwrap())
|
||||
.map_or(Selection::None, Selection::Single);
|
||||
{
|
||||
new_flags.channel_id = Some(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -442,13 +434,10 @@ async fn look(ctx: &Context, msg: &Message, args: String) {
|
||||
let enabled = if flags.show_disabled { "0,1" } else { "1" };
|
||||
|
||||
let reminders = if let Some(guild_id) = msg.guild_id.map(|f| f.as_u64().to_owned()) {
|
||||
let channel_id_opt = match flags.channel_id {
|
||||
Selection::None => Some(msg.channel_id.as_u64().to_owned()),
|
||||
Selection::Single(id) => Some(id),
|
||||
Selection::All => None,
|
||||
};
|
||||
let channel_id = flags
|
||||
.channel_id
|
||||
.unwrap_or_else(|| msg.channel_id.as_u64().to_owned());
|
||||
|
||||
if let Some(channel_id) = channel_id_opt {
|
||||
sqlx::query_as!(
|
||||
LookReminder,
|
||||
"
|
||||
@ -484,41 +473,6 @@ LIMIT
|
||||
)
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
} else {
|
||||
sqlx::query_as!(
|
||||
LookReminder,
|
||||
"
|
||||
SELECT
|
||||
reminders.id, reminders.time, channels.channel, messages.content, embeds.description
|
||||
FROM
|
||||
reminders
|
||||
INNER JOIN
|
||||
channels
|
||||
ON
|
||||
reminders.channel_id = channels.id
|
||||
INNER JOIN
|
||||
messages
|
||||
ON
|
||||
messages.id = reminders.message_id
|
||||
LEFT JOIN
|
||||
embeds
|
||||
ON
|
||||
embeds.id = messages.embed_id
|
||||
WHERE
|
||||
channels.guild_id = (SELECT id FROM guilds WHERE guild = ?) AND
|
||||
FIND_IN_SET(reminders.enabled, ?)
|
||||
ORDER BY
|
||||
reminders.time
|
||||
LIMIT
|
||||
?
|
||||
",
|
||||
guild_id,
|
||||
enabled,
|
||||
flags.limit
|
||||
)
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
}
|
||||
} else {
|
||||
sqlx::query_as_unchecked!(
|
||||
LookReminder,
|
||||
@ -570,6 +524,7 @@ LIMIT
|
||||
.timestamp(reminder.time as i64, 0)
|
||||
.format("%Y-%m-%d %H:%M:%S")
|
||||
.to_string(),
|
||||
|
||||
TimeDisplayType::Relative => {
|
||||
let now = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
|
Loading…
Reference in New Issue
Block a user