show user who created reminder

This commit is contained in:
jellywx 2021-07-10 18:24:43 +01:00
parent 7bcb3c4a70
commit bef33c6dac

View File

@ -350,6 +350,7 @@ struct LookReminder {
channel: u64, channel: u64,
content: String, content: String,
description: String, description: String,
set_by: Option<u64>,
} }
impl LookReminder { impl LookReminder {
@ -386,18 +387,24 @@ impl LookReminder {
if let Some(interval) = self.interval { if let Some(interval) = self.interval {
format!( format!(
"'{}' *{}* **{}**, repeating every **{}**", "'{}' *{}* **{}**, repeating every **{}** (set by {})",
self.display_content(), self.display_content(),
&inter, &inter,
time_display, time_display,
longhand_displacement(interval as u64) longhand_displacement(interval as u64),
self.set_by
.map(|i| format!("<@{}>", i))
.unwrap_or_else(|| "unknown".to_string())
) )
} else { } else {
format!( format!(
"'{}' *{}* **{}**", "'{}' *{}* **{}** (set by {})",
self.display_content(), self.display_content(),
&inter, &inter,
time_display time_display,
self.set_by
.map(|i| format!("<@{}>", i))
.unwrap_or_else(|| "unknown".to_string())
) )
} }
} }
@ -439,13 +446,18 @@ SELECT
reminders.interval, reminders.interval,
channels.channel, channels.channel,
reminders.content, reminders.content,
reminders.embed_description AS description reminders.embed_description AS description,
users.user AS set_by
FROM FROM
reminders reminders
INNER JOIN INNER JOIN
channels channels
ON ON
reminders.channel_id = channels.id reminders.channel_id = channels.id
LEFT JOIN
users
ON
reminders.set_by = users.id
WHERE WHERE
channels.channel = ? AND channels.channel = ? AND
FIND_IN_SET(reminders.enabled, ?) FIND_IN_SET(reminders.enabled, ?)
@ -511,13 +523,18 @@ SELECT
reminders.interval, reminders.interval,
channels.channel, channels.channel,
reminders.content, reminders.content,
reminders.embed_description AS description reminders.embed_description AS description,
users.user AS set_by
FROM FROM
reminders reminders
LEFT OUTER JOIN LEFT JOIN
channels channels
ON ON
channels.id = reminders.channel_id channels.id = reminders.channel_id
LEFT JOIN
users
ON
reminders.set_by = users.id
WHERE WHERE
FIND_IN_SET(channels.channel, ?) FIND_IN_SET(channels.channel, ?)
", ",
@ -535,13 +552,18 @@ SELECT
reminders.interval, reminders.interval,
channels.channel, channels.channel,
reminders.content, reminders.content,
reminders.embed_description AS description reminders.embed_description AS description,
users.user AS set_by
FROM FROM
reminders reminders
LEFT OUTER JOIN LEFT JOIN
channels channels
ON ON
channels.id = reminders.channel_id channels.id = reminders.channel_id
LEFT JOIN
users
ON
reminders.set_by = users.id
WHERE WHERE
channels.guild_id = (SELECT id FROM guilds WHERE guild = ?) channels.guild_id = (SELECT id FROM guilds WHERE guild = ?)
", ",
@ -560,13 +582,18 @@ SELECT
reminders.interval, reminders.interval,
channels.channel, channels.channel,
reminders.content, reminders.content,
reminders.embed_description AS description reminders.embed_description AS description,
users.user AS set_by
FROM FROM
reminders reminders
INNER JOIN INNER JOIN
channels channels
ON ON
channels.id = reminders.channel_id channels.id = reminders.channel_id
LEFT JOIN
users
ON
reminders.set_by = users.id
WHERE WHERE
channels.channel = ? channels.channel = ?
", ",