Compare commits
3 Commits
next
...
a6525f3052
Author | SHA1 | Date | |
---|---|---|---|
a6525f3052 | |||
348639270d | |||
37177c2431 |
1389
Cargo.lock
generated
1389
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
Cargo.toml
@ -1,18 +1,18 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reminder-rs"
|
name = "reminder-rs"
|
||||||
version = "1.6.40"
|
version = "1.6.38"
|
||||||
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0 only"
|
license = "AGPL-3.0 only"
|
||||||
description = "Reminder Bot for Discord, now in Rust"
|
description = "Reminder Bot for Discord, now in Rust"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
poise = "0.5"
|
poise = "0.5.5"
|
||||||
dotenv = "0.15"
|
dotenv = "0.15"
|
||||||
tokio = { version = "1", features = ["process", "full"] }
|
tokio = { version = "1", features = ["process", "full"] }
|
||||||
reqwest = "0.11"
|
reqwest = "0.11"
|
||||||
lazy-regex = "3.0"
|
lazy-regex = "2.3.0"
|
||||||
regex = "1.9"
|
regex = "1.6"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
@ -25,7 +25,7 @@ serde_repr = "0.1"
|
|||||||
rmp-serde = "1.1"
|
rmp-serde = "1.1"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
levenshtein = "1.0"
|
levenshtein = "1.0"
|
||||||
sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono", "migrate"]}
|
sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono", "migrate"]}
|
||||||
base64 = "0.21.0"
|
base64 = "0.21.0"
|
||||||
|
|
||||||
[dependencies.postman]
|
[dependencies.postman]
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
-- Drop existing constraint
|
|
||||||
ALTER TABLE `reminders` DROP CONSTRAINT `reminders_ibfk_1`;
|
|
||||||
|
|
||||||
ALTER TABLE `reminders` MODIFY COLUMN `channel_id` INT UNSIGNED;
|
|
||||||
ALTER TABLE `reminders` ADD COLUMN `guild_id` INT UNSIGNED;
|
|
||||||
|
|
||||||
ALTER TABLE `reminders`
|
|
||||||
ADD CONSTRAINT `guild_id_fk`
|
|
||||||
FOREIGN KEY (`guild_id`)
|
|
||||||
REFERENCES `guilds`(`id`)
|
|
||||||
ON DELETE CASCADE;
|
|
||||||
|
|
||||||
ALTER TABLE `reminders`
|
|
||||||
ADD CONSTRAINT `channel_id_fk`
|
|
||||||
FOREIGN KEY (`channel_id`)
|
|
||||||
REFERENCES `channels`(`id`)
|
|
||||||
ON DELETE SET NULL;
|
|
||||||
|
|
||||||
UPDATE `reminders` SET `guild_id` = (SELECT guilds.`id` FROM `channels` INNER JOIN `guilds` ON channels.guild_id = guilds.id WHERE reminders.channel_id = channels.id);
|
|
@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE reminders ADD COLUMN `status_change_time` DATETIME;
|
|
||||||
|
|
||||||
-- This is a best-guess as to the status change time.
|
|
||||||
UPDATE reminders SET `status_change_time` = `utc_time` WHERE `status` != 'pending';
|
|
@ -5,12 +5,12 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1", features = ["process", "full"] }
|
tokio = { version = "1", features = ["process", "full"] }
|
||||||
regex = "1.9"
|
regex = "1.4"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
chrono-tz = { version = "0.8", features = ["serde"] }
|
chrono-tz = { version = "0.5", features = ["serde"] }
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
num-integer = "0.1"
|
num-integer = "0.1"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono", "json"]}
|
sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "chrono", "json"]}
|
||||||
serenity = { version = "0.11", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] }
|
serenity = { version = "0.11.1", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] }
|
||||||
|
@ -237,11 +237,11 @@ impl Into<CreateEmbed> for Embed {
|
|||||||
pub struct Reminder {
|
pub struct Reminder {
|
||||||
id: u32,
|
id: u32,
|
||||||
|
|
||||||
channel_id: Option<u64>,
|
channel_id: u64,
|
||||||
webhook_id: Option<u64>,
|
webhook_id: Option<u64>,
|
||||||
webhook_token: Option<String>,
|
webhook_token: Option<String>,
|
||||||
|
|
||||||
channel_paused: Option<bool>,
|
channel_paused: bool,
|
||||||
channel_paused_until: Option<NaiveDateTime>,
|
channel_paused_until: Option<NaiveDateTime>,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ SELECT
|
|||||||
reminders.`username` AS username
|
reminders.`username` AS username
|
||||||
FROM
|
FROM
|
||||||
reminders
|
reminders
|
||||||
LEFT JOIN
|
INNER JOIN
|
||||||
channels
|
channels
|
||||||
ON
|
ON
|
||||||
reminders.channel_id = channels.id
|
reminders.channel_id = channels.id
|
||||||
@ -343,10 +343,7 @@ WHERE
|
|||||||
|
|
||||||
async fn reset_webhook(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
async fn reset_webhook(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
||||||
let _ = sqlx::query!(
|
let _ = sqlx::query!(
|
||||||
"
|
"UPDATE channels SET webhook_id = NULL, webhook_token = NULL WHERE channel = ?",
|
||||||
UPDATE channels SET webhook_id = NULL, webhook_token = NULL
|
|
||||||
WHERE channel = ?
|
|
||||||
",
|
|
||||||
self.channel_id
|
self.channel_id
|
||||||
)
|
)
|
||||||
.execute(pool)
|
.execute(pool)
|
||||||
@ -418,9 +415,7 @@ WHERE
|
|||||||
self.set_sent(pool).await;
|
self.set_sent(pool).await;
|
||||||
} else {
|
} else {
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"
|
"UPDATE reminders SET `utc_time` = ? WHERE `id` = ?",
|
||||||
UPDATE reminders SET `utc_time` = ? WHERE `id` = ?
|
|
||||||
",
|
|
||||||
updated_reminder_time.with_timezone(&Utc),
|
updated_reminder_time.with_timezone(&Utc),
|
||||||
self.id
|
self.id
|
||||||
)
|
)
|
||||||
@ -453,10 +448,7 @@ WHERE
|
|||||||
|
|
||||||
if *LOG_TO_DATABASE {
|
if *LOG_TO_DATABASE {
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"
|
"INSERT INTO stat (type, reminder_id, message) VALUES ('reminder_failed', ?, ?)",
|
||||||
INSERT INTO stat (type, reminder_id, message)
|
|
||||||
VALUES ('reminder_failed', ?, ?)
|
|
||||||
",
|
|
||||||
self.id,
|
self.id,
|
||||||
message,
|
message,
|
||||||
)
|
)
|
||||||
@ -469,10 +461,7 @@ WHERE
|
|||||||
async fn log_success(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
async fn log_success(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
||||||
if *LOG_TO_DATABASE {
|
if *LOG_TO_DATABASE {
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"
|
"INSERT INTO stat (type, reminder_id) VALUES ('reminder_sent', ?)",
|
||||||
INSERT INTO stat (type, reminder_id)
|
|
||||||
VALUES ('reminder_sent', ?)
|
|
||||||
",
|
|
||||||
self.id,
|
self.id,
|
||||||
)
|
)
|
||||||
.execute(pool)
|
.execute(pool)
|
||||||
@ -482,17 +471,10 @@ WHERE
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn set_sent(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
async fn set_sent(&self, pool: impl Executor<'_, Database = Database> + Copy) {
|
||||||
sqlx::query!(
|
sqlx::query!("UPDATE reminders SET `status` = 'sent' WHERE `id` = ?", self.id)
|
||||||
"
|
.execute(pool)
|
||||||
UPDATE reminders
|
.await
|
||||||
SET `status` = 'sent', `status_change_time` = NOW()
|
.expect(&format!("Could not delete Reminder {}", self.id));
|
||||||
WHERE `id` = ?
|
|
||||||
",
|
|
||||||
self.id
|
|
||||||
)
|
|
||||||
.execute(pool)
|
|
||||||
.await
|
|
||||||
.expect(&format!("Could not delete Reminder {}", self.id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn set_failed(
|
async fn set_failed(
|
||||||
@ -501,11 +483,7 @@ WHERE
|
|||||||
message: &'static str,
|
message: &'static str,
|
||||||
) {
|
) {
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"
|
"UPDATE reminders SET `status` = 'failed', `status_message` = ? WHERE `id` = ?",
|
||||||
UPDATE reminders
|
|
||||||
SET `status` = 'failed', `status_message` = ?, `status_change_time` = NOW()
|
|
||||||
WHERE `id` = ?
|
|
||||||
",
|
|
||||||
message,
|
message,
|
||||||
self.id
|
self.id
|
||||||
)
|
)
|
||||||
@ -515,9 +493,7 @@ WHERE
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn pin_message<M: Into<u64>>(&self, message_id: M, http: impl AsRef<Http>) {
|
async fn pin_message<M: Into<u64>>(&self, message_id: M, http: impl AsRef<Http>) {
|
||||||
if let Some(channel_id) = self.channel_id {
|
let _ = http.as_ref().pin_message(self.channel_id, message_id.into(), None).await;
|
||||||
let _ = http.as_ref().pin_message(channel_id, message_id.into(), None).await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn send(
|
pub async fn send(
|
||||||
@ -527,11 +503,10 @@ WHERE
|
|||||||
) {
|
) {
|
||||||
async fn send_to_channel(
|
async fn send_to_channel(
|
||||||
cache_http: impl CacheHttp,
|
cache_http: impl CacheHttp,
|
||||||
channel_id: u64,
|
|
||||||
reminder: &Reminder,
|
reminder: &Reminder,
|
||||||
embed: Option<CreateEmbed>,
|
embed: Option<CreateEmbed>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let channel = ChannelId(channel_id).to_channel(&cache_http).await;
|
let channel = ChannelId(reminder.channel_id).to_channel(&cache_http).await;
|
||||||
|
|
||||||
match channel {
|
match channel {
|
||||||
Ok(Channel::Guild(channel)) => {
|
Ok(Channel::Guild(channel)) => {
|
||||||
@ -563,7 +538,6 @@ WHERE
|
|||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Channel::Private(channel)) => {
|
Ok(Channel::Private(channel)) => {
|
||||||
match channel
|
match channel
|
||||||
.send_message(&cache_http.http(), |m| {
|
.send_message(&cache_http.http(), |m| {
|
||||||
@ -593,9 +567,7 @@ WHERE
|
|||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
|
|
||||||
_ => Err(Error::Other("Channel not of valid type")),
|
_ => Err(Error::Other("Channel not of valid type")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -650,151 +622,124 @@ WHERE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.channel_id {
|
if self.enabled
|
||||||
Some(channel_id) => {
|
&& !(self.channel_paused
|
||||||
if self.enabled
|
&& self
|
||||||
&& !(self.channel_paused.unwrap_or(false)
|
.channel_paused_until
|
||||||
&& self
|
.map_or(true, |inner| inner >= Utc::now().naive_local()))
|
||||||
.channel_paused_until
|
{
|
||||||
.map_or(true, |inner| inner >= Utc::now().naive_local()))
|
let _ = sqlx::query!(
|
||||||
{
|
"UPDATE `channels` SET paused = 0, paused_until = NULL WHERE `channel` = ?",
|
||||||
let _ = sqlx::query!(
|
self.channel_id
|
||||||
"
|
)
|
||||||
UPDATE `channels`
|
.execute(pool)
|
||||||
SET paused = 0, paused_until = NULL
|
.await;
|
||||||
WHERE `channel` = ?
|
|
||||||
",
|
|
||||||
self.channel_id
|
|
||||||
)
|
|
||||||
.execute(pool)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let embed = Embed::from_id(pool, self.id).await.map(|e| e.into());
|
let embed = Embed::from_id(pool, self.id).await.map(|e| e.into());
|
||||||
|
|
||||||
let result = if let (Some(webhook_id), Some(webhook_token)) =
|
let result = if let (Some(webhook_id), Some(webhook_token)) =
|
||||||
(self.webhook_id, &self.webhook_token)
|
(self.webhook_id, &self.webhook_token)
|
||||||
{
|
{
|
||||||
let webhook_res = cache_http
|
let webhook_res =
|
||||||
.http()
|
cache_http.http().get_webhook_with_token(webhook_id, webhook_token).await;
|
||||||
.get_webhook_with_token(webhook_id, webhook_token)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
if let Ok(webhook) = webhook_res {
|
if let Ok(webhook) = webhook_res {
|
||||||
send_to_webhook(cache_http, &self, webhook, embed).await
|
send_to_webhook(cache_http, &self, webhook, embed).await
|
||||||
} else {
|
} else {
|
||||||
warn!("Webhook vanished for reminder {}: {:?}", self.id, webhook_res);
|
warn!("Webhook vanished for reminder {}: {:?}", self.id, webhook_res);
|
||||||
|
|
||||||
self.reset_webhook(pool).await;
|
self.reset_webhook(pool).await;
|
||||||
send_to_channel(cache_http, channel_id, &self, embed).await
|
send_to_channel(cache_http, &self, embed).await
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send_to_channel(cache_http, channel_id, &self, embed).await
|
send_to_channel(cache_http, &self, embed).await
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
if let Error::Http(error) = e {
|
if let Error::Http(error) = e {
|
||||||
if let HttpError::UnsuccessfulRequest(http_error) = *error {
|
if let HttpError::UnsuccessfulRequest(http_error) = *error {
|
||||||
match http_error.error.code {
|
match http_error.error.code {
|
||||||
10003 => {
|
10003 => {
|
||||||
self.log_error(
|
self.log_error(
|
||||||
pool,
|
pool,
|
||||||
"Could not be sent as channel does not exist",
|
"Could not be sent as channel does not exist",
|
||||||
None::<&'static str>,
|
None::<&'static str>,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
self.set_failed(
|
self.set_failed(
|
||||||
pool,
|
pool,
|
||||||
"Could not be sent as channel does not exist",
|
"Could not be sent as channel does not exist",
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
10004 => {
|
10004 => {
|
||||||
self.log_error(
|
self.log_error(
|
||||||
pool,
|
pool,
|
||||||
"Could not be sent as guild does not exist",
|
"Could not be sent as guild does not exist",
|
||||||
None::<&'static str>,
|
None::<&'static str>,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
self.set_failed(
|
self.set_failed(pool, "Could not be sent as guild does not exist")
|
||||||
pool,
|
.await;
|
||||||
"Could not be sent as guild does not exist",
|
}
|
||||||
)
|
50001 => {
|
||||||
.await;
|
self.log_error(
|
||||||
}
|
pool,
|
||||||
50001 => {
|
"Could not be sent as missing access",
|
||||||
self.log_error(
|
None::<&'static str>,
|
||||||
pool,
|
)
|
||||||
"Could not be sent as missing access",
|
.await;
|
||||||
None::<&'static str>,
|
self.set_failed(pool, "Could not be sent as missing access").await;
|
||||||
)
|
}
|
||||||
.await;
|
50007 => {
|
||||||
self.set_failed(
|
self.log_error(
|
||||||
pool,
|
pool,
|
||||||
"Could not be sent as missing access",
|
"Could not be sent as user has DMs disabled",
|
||||||
)
|
None::<&'static str>,
|
||||||
.await;
|
)
|
||||||
}
|
.await;
|
||||||
50007 => {
|
self.set_failed(pool, "Could not be sent as user has DMs disabled")
|
||||||
self.log_error(
|
.await;
|
||||||
pool,
|
}
|
||||||
"Could not be sent as user has DMs disabled",
|
50013 => {
|
||||||
None::<&'static str>,
|
self.log_error(
|
||||||
)
|
pool,
|
||||||
.await;
|
"Could not be sent as permissions are invalid",
|
||||||
self.set_failed(
|
None::<&'static str>,
|
||||||
pool,
|
)
|
||||||
"Could not be sent as user has DMs disabled",
|
.await;
|
||||||
)
|
self.set_failed(
|
||||||
.await;
|
pool,
|
||||||
}
|
"Could not be sent as permissions are invalid",
|
||||||
50013 => {
|
)
|
||||||
self.log_error(
|
.await;
|
||||||
pool,
|
}
|
||||||
"Could not be sent as permissions are invalid",
|
_ => {
|
||||||
None::<&'static str>,
|
self.log_error(
|
||||||
)
|
pool,
|
||||||
.await;
|
"HTTP error sending reminder",
|
||||||
self.set_failed(
|
Some(http_error),
|
||||||
pool,
|
)
|
||||||
"Could not be sent as permissions are invalid",
|
.await;
|
||||||
)
|
|
||||||
.await;
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
self.log_error(
|
|
||||||
pool,
|
|
||||||
"HTTP error sending reminder",
|
|
||||||
Some(http_error),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
self.refresh(pool).await;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.log_error(pool, "(Likely) a parsing error", Some(error)).await;
|
|
||||||
self.refresh(pool).await;
|
self.refresh(pool).await;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
self.log_error(pool, "Non-HTTP error", Some(e)).await;
|
|
||||||
self.refresh(pool).await;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.log_success(pool).await;
|
self.log_error(pool, "(Likely) a parsing error", Some(error)).await;
|
||||||
self.refresh(pool).await;
|
self.refresh(pool).await;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info!("Reminder {} is paused", self.id);
|
self.log_error(pool, "Non-HTTP error", Some(e)).await;
|
||||||
|
|
||||||
self.refresh(pool).await;
|
self.refresh(pool).await;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.log_success(pool).await;
|
||||||
|
self.refresh(pool).await;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
info!("Reminder {} is paused", self.id);
|
||||||
|
|
||||||
None => {
|
self.refresh(pool).await;
|
||||||
info!("Reminder {} is orphaned", self.id);
|
|
||||||
|
|
||||||
self.log_error(pool, "Orphaned", Option::<u8>::None).await;
|
|
||||||
self.set_failed(pool, "Could not be sent as channel was deleted").await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ pub async fn migrate_macro(ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
"SELECT name, command FROM command_aliases WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)",
|
"SELECT name, command FROM command_aliases WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)",
|
||||||
guild_id.0
|
guild_id.0
|
||||||
)
|
)
|
||||||
.fetch_all(&mut *transaction)
|
.fetch_all(&mut transaction)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let mut added_aliases = 0;
|
let mut added_aliases = 0;
|
||||||
@ -42,7 +42,7 @@ pub async fn migrate_macro(ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
cmd_macro.description,
|
cmd_macro.description,
|
||||||
cmd_macro.commands
|
cmd_macro.commands
|
||||||
)
|
)
|
||||||
.execute(&mut *transaction)
|
.execute(&mut transaction)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
added_aliases += 1;
|
added_aliases += 1;
|
||||||
|
@ -166,21 +166,15 @@ impl ComponentDataModel {
|
|||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
ComponentDataModel::DelSelector(selector) => {
|
ComponentDataModel::DelSelector(selector) => {
|
||||||
for id in &component.data.values {
|
let selected_id = component.data.values.join(",");
|
||||||
match id.parse::<u32>() {
|
|
||||||
Ok(id) => {
|
|
||||||
if let Some(reminder) = Reminder::from_id(&data.database, id).await {
|
|
||||||
reminder.delete(&data.database).await.unwrap();
|
|
||||||
} else {
|
|
||||||
warn!("Attempt to delete non-existent reminder");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Err(e) => {
|
sqlx::query!(
|
||||||
warn!("Error casting ID to integer: {:?}.", e);
|
"UPDATE reminders SET `status` = 'deleted' WHERE FIND_IN_SET(id, ?)",
|
||||||
}
|
selected_id
|
||||||
}
|
)
|
||||||
}
|
.execute(&data.database)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let reminders = Reminder::from_guild(
|
let reminders = Reminder::from_guild(
|
||||||
&ctx,
|
&ctx,
|
||||||
|
@ -10,7 +10,6 @@ pub struct ChannelData {
|
|||||||
pub webhook_id: Option<u64>,
|
pub webhook_id: Option<u64>,
|
||||||
pub webhook_token: Option<String>,
|
pub webhook_token: Option<String>,
|
||||||
pub paused: bool,
|
pub paused: bool,
|
||||||
pub db_guild_id: Option<u32>,
|
|
||||||
pub paused_until: Option<NaiveDateTime>,
|
pub paused_until: Option<NaiveDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,11 +22,7 @@ impl ChannelData {
|
|||||||
|
|
||||||
if let Ok(c) = sqlx::query_as_unchecked!(
|
if let Ok(c) = sqlx::query_as_unchecked!(
|
||||||
Self,
|
Self,
|
||||||
"
|
"SELECT id, name, nudge, blacklisted, webhook_id, webhook_token, paused, paused_until FROM channels WHERE channel = ?",
|
||||||
SELECT id, name, nudge, blacklisted, webhook_id, webhook_token, paused, paused_until,
|
|
||||||
guild_id AS db_guild_id
|
|
||||||
FROM channels WHERE channel = ?
|
|
||||||
",
|
|
||||||
channel_id
|
channel_id
|
||||||
)
|
)
|
||||||
.fetch_one(pool)
|
.fetch_one(pool)
|
||||||
@ -35,18 +30,12 @@ impl ChannelData {
|
|||||||
{
|
{
|
||||||
Ok(c)
|
Ok(c)
|
||||||
} else {
|
} else {
|
||||||
let props =
|
let props = channel.to_owned().guild().map(|g| (g.guild_id.as_u64().to_owned(), g.name));
|
||||||
channel.to_owned().guild().map(|g| (g.guild_id.as_u64().to_owned(), g.name));
|
|
||||||
|
|
||||||
let (guild_id, channel_name) =
|
let (guild_id, channel_name) = if let Some((a, b)) = props { (Some(a), Some(b)) } else { (None, None) };
|
||||||
if let Some((a, b)) = props { (Some(a), Some(b)) } else { (None, None) };
|
|
||||||
|
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"
|
"INSERT IGNORE INTO channels (channel, name, guild_id) VALUES (?, ?, (SELECT id FROM guilds WHERE guild = ?))",
|
||||||
INSERT IGNORE INTO channels
|
|
||||||
(channel, name, guild_id)
|
|
||||||
VALUES (?, ?, (SELECT id FROM guilds WHERE guild = ?))
|
|
||||||
",
|
|
||||||
channel_id,
|
channel_id,
|
||||||
channel_name,
|
channel_name,
|
||||||
guild_id
|
guild_id
|
||||||
@ -57,10 +46,7 @@ impl ChannelData {
|
|||||||
Ok(sqlx::query_as_unchecked!(
|
Ok(sqlx::query_as_unchecked!(
|
||||||
Self,
|
Self,
|
||||||
"
|
"
|
||||||
SELECT id, name, nudge, blacklisted, webhook_id, webhook_token, paused,
|
SELECT id, name, nudge, blacklisted, webhook_id, webhook_token, paused, paused_until FROM channels WHERE channel = ?
|
||||||
paused_until, guild_id AS db_guild_id
|
|
||||||
FROM channels
|
|
||||||
WHERE channel = ?
|
|
||||||
",
|
",
|
||||||
channel_id
|
channel_id
|
||||||
)
|
)
|
||||||
@ -72,10 +58,8 @@ impl ChannelData {
|
|||||||
pub async fn commit_changes(&self, pool: &MySqlPool) {
|
pub async fn commit_changes(&self, pool: &MySqlPool) {
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"
|
"
|
||||||
UPDATE channels
|
UPDATE channels SET name = ?, nudge = ?, blacklisted = ?, webhook_id = ?, webhook_token = ?, paused = ?, paused_until \
|
||||||
SET name = ?, nudge = ?, blacklisted = ?, webhook_id = ?, webhook_token = ?,
|
= ? WHERE id = ?
|
||||||
paused = ?, paused_until = ?
|
|
||||||
WHERE id = ?
|
|
||||||
",
|
",
|
||||||
self.name,
|
self.name,
|
||||||
self.nudge,
|
self.nudge,
|
||||||
|
@ -51,7 +51,6 @@ pub struct ReminderBuilder {
|
|||||||
pool: MySqlPool,
|
pool: MySqlPool,
|
||||||
uid: String,
|
uid: String,
|
||||||
channel: u32,
|
channel: u32,
|
||||||
guild: Option<u32>,
|
|
||||||
thread_id: Option<u64>,
|
thread_id: Option<u64>,
|
||||||
utc_time: NaiveDateTime,
|
utc_time: NaiveDateTime,
|
||||||
timezone: String,
|
timezone: String,
|
||||||
@ -87,7 +86,6 @@ impl ReminderBuilder {
|
|||||||
INSERT INTO reminders (
|
INSERT INTO reminders (
|
||||||
`uid`,
|
`uid`,
|
||||||
`channel_id`,
|
`channel_id`,
|
||||||
`guild_id`,
|
|
||||||
`utc_time`,
|
`utc_time`,
|
||||||
`timezone`,
|
`timezone`,
|
||||||
`interval_seconds`,
|
`interval_seconds`,
|
||||||
@ -112,13 +110,11 @@ INSERT INTO reminders (
|
|||||||
?,
|
?,
|
||||||
?,
|
?,
|
||||||
?,
|
?,
|
||||||
?,
|
|
||||||
?
|
?
|
||||||
)
|
)
|
||||||
",
|
",
|
||||||
self.uid,
|
self.uid,
|
||||||
self.channel,
|
self.channel,
|
||||||
self.guild,
|
|
||||||
utc_time,
|
utc_time,
|
||||||
self.timezone,
|
self.timezone,
|
||||||
self.interval_seconds,
|
self.interval_seconds,
|
||||||
@ -251,10 +247,10 @@ impl<'a> MultiReminderBuilder<'a> {
|
|||||||
{
|
{
|
||||||
Err(ReminderError::UserBlockedDm)
|
Err(ReminderError::UserBlockedDm)
|
||||||
} else {
|
} else {
|
||||||
Ok((user_data.dm_channel, None))
|
Ok(user_data.dm_channel)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ok((user_data.dm_channel, None))
|
Ok(user_data.dm_channel)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(ReminderError::InvalidTag)
|
Err(ReminderError::InvalidTag)
|
||||||
@ -301,13 +297,13 @@ impl<'a> MultiReminderBuilder<'a> {
|
|||||||
.commit_changes(&self.ctx.data().database)
|
.commit_changes(&self.ctx.data().database)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
Ok((channel_data.id, channel_data.db_guild_id))
|
Ok(channel_data.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(e) => Err(ReminderError::DiscordError(e.to_string())),
|
Err(e) => Err(ReminderError::DiscordError(e.to_string())),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ok((channel_data.id, channel_data.db_guild_id))
|
Ok(channel_data.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -321,8 +317,7 @@ impl<'a> MultiReminderBuilder<'a> {
|
|||||||
let builder = ReminderBuilder {
|
let builder = ReminderBuilder {
|
||||||
pool: self.ctx.data().database.clone(),
|
pool: self.ctx.data().database.clone(),
|
||||||
uid: generate_uid(),
|
uid: generate_uid(),
|
||||||
channel: c.0,
|
channel: c,
|
||||||
guild: c.1,
|
|
||||||
thread_id,
|
thread_id,
|
||||||
utc_time: self.utc_time,
|
utc_time: self.utc_time,
|
||||||
timezone: self.timezone.to_string(),
|
timezone: self.timezone.to_string(),
|
||||||
|
@ -304,13 +304,10 @@ WHERE
|
|||||||
&self,
|
&self,
|
||||||
db: impl Executor<'_, Database = Database>,
|
db: impl Executor<'_, Database = Database>,
|
||||||
) -> Result<(), sqlx::Error> {
|
) -> Result<(), sqlx::Error> {
|
||||||
sqlx::query!(
|
sqlx::query!("UPDATE reminders SET `status` = 'deleted' WHERE uid = ?", self.uid)
|
||||||
"UPDATE reminders SET `status` = 'deleted', `status_change_time` = NOW() WHERE uid = ?",
|
.execute(db)
|
||||||
self.uid
|
.await
|
||||||
)
|
.map(|_| ())
|
||||||
.execute(db)
|
|
||||||
.await
|
|
||||||
.map(|_| ())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn display_content(&self) -> &str {
|
pub fn display_content(&self) -> &str {
|
||||||
|
@ -7,14 +7,14 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tls", "secrets", "json"] }
|
rocket = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tls", "secrets", "json"] }
|
||||||
rocket_dyn_templates = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tera"] }
|
rocket_dyn_templates = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", features = ["tera"] }
|
||||||
serenity = { version = "0.11", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] }
|
serenity = { version = "0.11.1", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] }
|
||||||
oauth2 = "4"
|
oauth2 = "4"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
reqwest = "0.11"
|
reqwest = "0.11"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "macros", "mysql", "chrono", "json"] }
|
sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "macros", "mysql", "chrono", "json"] }
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
chrono-tz = "0.8"
|
chrono-tz = "0.5"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
|
@ -150,8 +150,7 @@ pub async fn initialize(
|
|||||||
.mount(
|
.mount(
|
||||||
"/dashboard",
|
"/dashboard",
|
||||||
routes![
|
routes![
|
||||||
routes::dashboard::dashboard_1,
|
routes::dashboard::dashboard,
|
||||||
routes::dashboard::dashboard_2,
|
|
||||||
routes::dashboard::dashboard_home,
|
routes::dashboard::dashboard_home,
|
||||||
routes::dashboard::user::get_user_info,
|
routes::dashboard::user::get_user_info,
|
||||||
routes::dashboard::user::update_user_info,
|
routes::dashboard::user::update_user_info,
|
||||||
|
@ -12,7 +12,8 @@ use sqlx::{MySql, Pool};
|
|||||||
|
|
||||||
use crate::routes::{
|
use crate::routes::{
|
||||||
dashboard::{
|
dashboard::{
|
||||||
create_reminder, ImportBody, ReminderCreate, ReminderCsv, ReminderTemplateCsv, TodoCsv,
|
create_reminder, generate_uid, ImportBody, Reminder, ReminderCsv, ReminderTemplateCsv,
|
||||||
|
TodoCsv,
|
||||||
},
|
},
|
||||||
JsonResult,
|
JsonResult,
|
||||||
};
|
};
|
||||||
@ -140,7 +141,7 @@ pub async fn import_reminders(
|
|||||||
|
|
||||||
match channel_id.parse::<u64>() {
|
match channel_id.parse::<u64>() {
|
||||||
Ok(channel_id) => {
|
Ok(channel_id) => {
|
||||||
let reminder = ReminderCreate {
|
let reminder = Reminder {
|
||||||
attachment: record.attachment,
|
attachment: record.attachment,
|
||||||
attachment_name: record.attachment_name,
|
attachment_name: record.attachment_name,
|
||||||
avatar: record.avatar,
|
avatar: record.avatar,
|
||||||
@ -167,6 +168,7 @@ pub async fn import_reminders(
|
|||||||
name: record.name,
|
name: record.name,
|
||||||
restartable: record.restartable,
|
restartable: record.restartable,
|
||||||
tts: record.tts,
|
tts: record.tts,
|
||||||
|
uid: generate_uid(),
|
||||||
username: record.username,
|
username: record.username,
|
||||||
utc_time: record.utc_time,
|
utc_time: record.utc_time,
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ use crate::{
|
|||||||
routes::{
|
routes::{
|
||||||
dashboard::{
|
dashboard::{
|
||||||
create_database_channel, create_reminder, template_name_default, DeleteReminder,
|
create_database_channel, create_reminder, template_name_default, DeleteReminder,
|
||||||
DeleteReminderTemplate, PatchReminder, Reminder, ReminderCreate, ReminderTemplate,
|
DeleteReminderTemplate, PatchReminder, Reminder, ReminderTemplate,
|
||||||
},
|
},
|
||||||
JsonResult,
|
JsonResult,
|
||||||
},
|
},
|
||||||
@ -298,7 +298,7 @@ pub async fn delete_reminder_template(
|
|||||||
#[post("/api/guild/<id>/reminders", data = "<reminder>")]
|
#[post("/api/guild/<id>/reminders", data = "<reminder>")]
|
||||||
pub async fn create_guild_reminder(
|
pub async fn create_guild_reminder(
|
||||||
id: u64,
|
id: u64,
|
||||||
reminder: Json<ReminderCreate>,
|
reminder: Json<Reminder>,
|
||||||
cookies: &CookieJar<'_>,
|
cookies: &CookieJar<'_>,
|
||||||
serenity_context: &State<Context>,
|
serenity_context: &State<Context>,
|
||||||
pool: &State<Pool<MySql>>,
|
pool: &State<Pool<MySql>>,
|
||||||
@ -318,65 +318,76 @@ pub async fn create_guild_reminder(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/api/guild/<id>/reminders?<status>")]
|
#[get("/api/guild/<id>/reminders")]
|
||||||
pub async fn get_reminders(
|
pub async fn get_reminders(
|
||||||
id: u64,
|
id: u64,
|
||||||
cookies: &CookieJar<'_>,
|
cookies: &CookieJar<'_>,
|
||||||
|
ctx: &State<Context>,
|
||||||
serenity_context: &State<Context>,
|
serenity_context: &State<Context>,
|
||||||
pool: &State<Pool<MySql>>,
|
pool: &State<Pool<MySql>>,
|
||||||
status: Option<String>,
|
|
||||||
) -> JsonResult {
|
) -> JsonResult {
|
||||||
check_authorization!(cookies, serenity_context.inner(), id);
|
check_authorization!(cookies, serenity_context.inner(), id);
|
||||||
|
|
||||||
let status = status.unwrap_or("pending".to_string());
|
let channels_res = GuildId(id).channels(&ctx.inner()).await;
|
||||||
|
|
||||||
sqlx::query_as_unchecked!(
|
match channels_res {
|
||||||
Reminder,
|
Ok(channels) => {
|
||||||
"
|
let channels = channels
|
||||||
SELECT
|
.keys()
|
||||||
reminders.attachment,
|
.into_iter()
|
||||||
reminders.attachment_name,
|
.map(|k| k.as_u64().to_string())
|
||||||
reminders.avatar,
|
.collect::<Vec<String>>()
|
||||||
channels.channel,
|
.join(",");
|
||||||
reminders.content,
|
|
||||||
reminders.embed_author,
|
|
||||||
reminders.embed_author_url,
|
|
||||||
reminders.embed_color,
|
|
||||||
reminders.embed_description,
|
|
||||||
reminders.embed_footer,
|
|
||||||
reminders.embed_footer_url,
|
|
||||||
reminders.embed_image_url,
|
|
||||||
reminders.embed_thumbnail_url,
|
|
||||||
reminders.embed_title,
|
|
||||||
IFNULL(reminders.embed_fields, '[]') AS embed_fields,
|
|
||||||
reminders.enabled,
|
|
||||||
reminders.expires,
|
|
||||||
reminders.interval_seconds,
|
|
||||||
reminders.interval_days,
|
|
||||||
reminders.interval_months,
|
|
||||||
reminders.name,
|
|
||||||
reminders.restartable,
|
|
||||||
reminders.tts,
|
|
||||||
reminders.uid,
|
|
||||||
reminders.username,
|
|
||||||
reminders.utc_time,
|
|
||||||
reminders.status,
|
|
||||||
reminders.status_change_time,
|
|
||||||
reminders.status_message
|
|
||||||
FROM reminders
|
|
||||||
LEFT JOIN channels ON channels.id = reminders.channel_id
|
|
||||||
WHERE FIND_IN_SET(`status`, ?) AND reminders.guild_id = (SELECT id FROM guilds WHERE guild = ?)",
|
|
||||||
status,
|
|
||||||
id
|
|
||||||
)
|
|
||||||
.fetch_all(pool.inner())
|
|
||||||
.await
|
|
||||||
.map(|r| Ok(json!(r)))
|
|
||||||
.unwrap_or_else(|e| {
|
|
||||||
warn!("Failed to complete SQL query: {:?}", e);
|
|
||||||
|
|
||||||
json_err!("Could not load reminders")
|
sqlx::query_as_unchecked!(
|
||||||
})
|
Reminder,
|
||||||
|
"SELECT
|
||||||
|
reminders.attachment,
|
||||||
|
reminders.attachment_name,
|
||||||
|
reminders.avatar,
|
||||||
|
channels.channel,
|
||||||
|
reminders.content,
|
||||||
|
reminders.embed_author,
|
||||||
|
reminders.embed_author_url,
|
||||||
|
reminders.embed_color,
|
||||||
|
reminders.embed_description,
|
||||||
|
reminders.embed_footer,
|
||||||
|
reminders.embed_footer_url,
|
||||||
|
reminders.embed_image_url,
|
||||||
|
reminders.embed_thumbnail_url,
|
||||||
|
reminders.embed_title,
|
||||||
|
IFNULL(reminders.embed_fields, '[]') AS embed_fields,
|
||||||
|
reminders.enabled,
|
||||||
|
reminders.expires,
|
||||||
|
reminders.interval_seconds,
|
||||||
|
reminders.interval_days,
|
||||||
|
reminders.interval_months,
|
||||||
|
reminders.name,
|
||||||
|
reminders.restartable,
|
||||||
|
reminders.tts,
|
||||||
|
reminders.uid,
|
||||||
|
reminders.username,
|
||||||
|
reminders.utc_time
|
||||||
|
FROM reminders
|
||||||
|
LEFT JOIN channels ON channels.id = reminders.channel_id
|
||||||
|
WHERE `status` = 'pending' AND FIND_IN_SET(channels.channel, ?)",
|
||||||
|
channels
|
||||||
|
)
|
||||||
|
.fetch_all(pool.inner())
|
||||||
|
.await
|
||||||
|
.map(|r| Ok(json!(r)))
|
||||||
|
.unwrap_or_else(|e| {
|
||||||
|
warn!("Failed to complete SQL query: {:?}", e);
|
||||||
|
|
||||||
|
json_err!("Could not load reminders")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
warn!("Could not fetch channels from {}: {:?}", id, e);
|
||||||
|
|
||||||
|
Ok(json!([]))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[patch("/api/guild/<id>/reminders", data = "<reminder>")]
|
#[patch("/api/guild/<id>/reminders", data = "<reminder>")]
|
||||||
@ -550,8 +561,7 @@ pub async fn edit_reminder(
|
|||||||
|
|
||||||
match sqlx::query_as_unchecked!(
|
match sqlx::query_as_unchecked!(
|
||||||
Reminder,
|
Reminder,
|
||||||
"
|
"SELECT reminders.attachment,
|
||||||
SELECT reminders.attachment,
|
|
||||||
reminders.attachment_name,
|
reminders.attachment_name,
|
||||||
reminders.avatar,
|
reminders.avatar,
|
||||||
channels.channel,
|
channels.channel,
|
||||||
@ -576,10 +586,7 @@ pub async fn edit_reminder(
|
|||||||
reminders.tts,
|
reminders.tts,
|
||||||
reminders.uid,
|
reminders.uid,
|
||||||
reminders.username,
|
reminders.username,
|
||||||
reminders.utc_time,
|
reminders.utc_time
|
||||||
reminders.status,
|
|
||||||
reminders.status_change_time,
|
|
||||||
reminders.status_message
|
|
||||||
FROM reminders
|
FROM reminders
|
||||||
LEFT JOIN channels ON channels.id = reminders.channel_id
|
LEFT JOIN channels ON channels.id = reminders.channel_id
|
||||||
WHERE uid = ?",
|
WHERE uid = ?",
|
||||||
@ -603,12 +610,9 @@ pub async fn delete_reminder(
|
|||||||
reminder: Json<DeleteReminder>,
|
reminder: Json<DeleteReminder>,
|
||||||
pool: &State<Pool<MySql>>,
|
pool: &State<Pool<MySql>>,
|
||||||
) -> JsonResult {
|
) -> JsonResult {
|
||||||
match sqlx::query!(
|
match sqlx::query!("UPDATE reminders SET `status` = 'deleted' WHERE uid = ?", reminder.uid)
|
||||||
"UPDATE reminders SET `status` = 'deleted', `status_change_time` = NOW() WHERE uid = ?",
|
.execute(pool.inner())
|
||||||
reminder.uid
|
.await
|
||||||
)
|
|
||||||
.execute(pool.inner())
|
|
||||||
.await
|
|
||||||
{
|
{
|
||||||
Ok(_) => Ok(json!({})),
|
Ok(_) => Ok(json!({})),
|
||||||
|
|
||||||
|
@ -118,8 +118,8 @@ pub struct EmbedField {
|
|||||||
inline: bool,
|
inline: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct ReminderCreate {
|
pub struct Reminder {
|
||||||
#[serde(with = "base64s")]
|
#[serde(with = "base64s")]
|
||||||
attachment: Option<Vec<u8>>,
|
attachment: Option<Vec<u8>>,
|
||||||
attachment_name: Option<String>,
|
attachment_name: Option<String>,
|
||||||
@ -146,45 +146,10 @@ pub struct ReminderCreate {
|
|||||||
name: String,
|
name: String,
|
||||||
restartable: bool,
|
restartable: bool,
|
||||||
tts: bool,
|
tts: bool,
|
||||||
username: Option<String>,
|
|
||||||
utc_time: NaiveDateTime,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub struct Reminder {
|
|
||||||
#[serde(with = "base64s")]
|
|
||||||
attachment: Option<Vec<u8>>,
|
|
||||||
attachment_name: Option<String>,
|
|
||||||
avatar: Option<String>,
|
|
||||||
#[serde(with = "string_opt")]
|
|
||||||
channel: Option<u64>,
|
|
||||||
content: String,
|
|
||||||
embed_author: String,
|
|
||||||
embed_author_url: Option<String>,
|
|
||||||
embed_color: u32,
|
|
||||||
embed_description: String,
|
|
||||||
embed_footer: String,
|
|
||||||
embed_footer_url: Option<String>,
|
|
||||||
embed_image_url: Option<String>,
|
|
||||||
embed_thumbnail_url: Option<String>,
|
|
||||||
embed_title: String,
|
|
||||||
embed_fields: Option<Json<Vec<EmbedField>>>,
|
|
||||||
enabled: bool,
|
|
||||||
expires: Option<NaiveDateTime>,
|
|
||||||
interval_seconds: Option<u32>,
|
|
||||||
interval_days: Option<u32>,
|
|
||||||
interval_months: Option<u32>,
|
|
||||||
#[serde(default = "name_default")]
|
|
||||||
name: String,
|
|
||||||
restartable: bool,
|
|
||||||
tts: bool,
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
uid: String,
|
uid: String,
|
||||||
username: Option<String>,
|
username: Option<String>,
|
||||||
utc_time: NaiveDateTime,
|
utc_time: NaiveDateTime,
|
||||||
status: String,
|
|
||||||
status_message: Option<String>,
|
|
||||||
status_change_time: Option<NaiveDateTime>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
@ -323,7 +288,15 @@ pub fn generate_uid() -> String {
|
|||||||
mod string {
|
mod string {
|
||||||
use std::{fmt::Display, str::FromStr};
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
use serde::{de, Deserialize, Deserializer};
|
use serde::{de, Deserialize, Deserializer, Serializer};
|
||||||
|
|
||||||
|
pub fn serialize<T, S>(value: &T, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
T: Display,
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
serializer.collect_str(value)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
|
pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
|
||||||
where
|
where
|
||||||
@ -335,34 +308,6 @@ mod string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod string_opt {
|
|
||||||
use std::{fmt::Display, str::FromStr};
|
|
||||||
|
|
||||||
use serde::{de, Deserialize, Deserializer, Serializer};
|
|
||||||
|
|
||||||
pub fn serialize<T, S>(value: &Option<T>, serializer: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
T: Display,
|
|
||||||
S: Serializer,
|
|
||||||
{
|
|
||||||
match value {
|
|
||||||
Some(value) => serializer.collect_str(value),
|
|
||||||
None => serializer.serialize_none(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deserialize<'de, T, D>(deserializer: D) -> Result<Option<T>, D::Error>
|
|
||||||
where
|
|
||||||
T: FromStr,
|
|
||||||
T::Err: Display,
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
Option::deserialize(deserializer)?
|
|
||||||
.map(|d: String| d.parse().map_err(de::Error::custom))
|
|
||||||
.transpose()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod base64s {
|
mod base64s {
|
||||||
use serde::{de, Deserialize, Deserializer, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serializer};
|
||||||
|
|
||||||
@ -407,7 +352,7 @@ pub async fn create_reminder(
|
|||||||
pool: impl sqlx::Executor<'_, Database = Database> + Copy,
|
pool: impl sqlx::Executor<'_, Database = Database> + Copy,
|
||||||
guild_id: GuildId,
|
guild_id: GuildId,
|
||||||
user_id: UserId,
|
user_id: UserId,
|
||||||
reminder: ReminderCreate,
|
reminder: Reminder,
|
||||||
) -> JsonResult {
|
) -> JsonResult {
|
||||||
// check guild in db
|
// check guild in db
|
||||||
match sqlx::query!("SELECT 1 as A FROM guilds WHERE guild = ?", guild_id.0)
|
match sqlx::query!("SELECT 1 as A FROM guilds WHERE guild = ?", guild_id.0)
|
||||||
@ -435,7 +380,7 @@ pub async fn create_reminder(
|
|||||||
|
|
||||||
if !channel_matches_guild || !channel_exists {
|
if !channel_matches_guild || !channel_exists {
|
||||||
warn!(
|
warn!(
|
||||||
"Error in `create_reminder`: channel {:?} not found for guild {} (channel exists: {})",
|
"Error in `create_reminder`: channel {} not found for guild {} (channel exists: {})",
|
||||||
reminder.channel, guild_id, channel_exists
|
reminder.channel, guild_id, channel_exists
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -529,13 +474,11 @@ pub async fn create_reminder(
|
|||||||
|
|
||||||
// write to db
|
// write to db
|
||||||
match sqlx::query!(
|
match sqlx::query!(
|
||||||
"
|
"INSERT INTO reminders (
|
||||||
INSERT INTO reminders (
|
|
||||||
uid,
|
uid,
|
||||||
attachment,
|
attachment,
|
||||||
attachment_name,
|
attachment_name,
|
||||||
channel_id,
|
channel_id,
|
||||||
guild_id,
|
|
||||||
avatar,
|
avatar,
|
||||||
content,
|
content,
|
||||||
embed_author,
|
embed_author,
|
||||||
@ -558,14 +501,11 @@ pub async fn create_reminder(
|
|||||||
tts,
|
tts,
|
||||||
username,
|
username,
|
||||||
`utc_time`
|
`utc_time`
|
||||||
) VALUES (?, ?, ?, ?,
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||||
(SELECT id FROM guilds WHERE guild = ?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
||||||
?, ?, ?, ?, ?)",
|
|
||||||
new_uid,
|
new_uid,
|
||||||
attachment_data,
|
attachment_data,
|
||||||
reminder.attachment_name,
|
reminder.attachment_name,
|
||||||
channel,
|
channel,
|
||||||
guild_id.0,
|
|
||||||
reminder.avatar,
|
reminder.avatar,
|
||||||
reminder.content,
|
reminder.content,
|
||||||
reminder.embed_author,
|
reminder.embed_author,
|
||||||
@ -620,10 +560,7 @@ pub async fn create_reminder(
|
|||||||
reminders.tts,
|
reminders.tts,
|
||||||
reminders.uid,
|
reminders.uid,
|
||||||
reminders.username,
|
reminders.username,
|
||||||
reminders.utc_time,
|
reminders.utc_time
|
||||||
reminders.status,
|
|
||||||
reminders.status_change_time,
|
|
||||||
reminders.status_message
|
|
||||||
FROM reminders
|
FROM reminders
|
||||||
LEFT JOIN channels ON channels.id = reminders.channel_id
|
LEFT JOIN channels ON channels.id = reminders.channel_id
|
||||||
WHERE uid = ?",
|
WHERE uid = ?",
|
||||||
@ -725,17 +662,7 @@ pub async fn dashboard_home(cookies: &CookieJar<'_>) -> Result<Template, Redirec
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[get("/<_>")]
|
#[get("/<_>")]
|
||||||
pub async fn dashboard_1(cookies: &CookieJar<'_>) -> Result<Template, Redirect> {
|
pub async fn dashboard(cookies: &CookieJar<'_>) -> Result<Template, Redirect> {
|
||||||
if cookies.get_private("userid").is_some() {
|
|
||||||
let map: HashMap<&str, String> = HashMap::new();
|
|
||||||
Ok(Template::render("dashboard", &map))
|
|
||||||
} else {
|
|
||||||
Err(Redirect::to("/login/discord"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("/<_>/<_>")]
|
|
||||||
pub async fn dashboard_2(cookies: &CookieJar<'_>) -> Result<Template, Redirect> {
|
|
||||||
if cookies.get_private("userid").is_some() {
|
if cookies.get_private("userid").is_some() {
|
||||||
let map: HashMap<&str, String> = HashMap::new();
|
let map: HashMap<&str, String> = HashMap::new();
|
||||||
Ok(Template::render("dashboard", &map))
|
Ok(Template::render("dashboard", &map))
|
||||||
|
@ -18,7 +18,6 @@ const $downloader = document.querySelector("a#downloader");
|
|||||||
const $uploader = document.querySelector("input#uploader");
|
const $uploader = document.querySelector("input#uploader");
|
||||||
|
|
||||||
let channels = [];
|
let channels = [];
|
||||||
let reminderErrors = [];
|
|
||||||
let guildNames = {};
|
let guildNames = {};
|
||||||
let roles = [];
|
let roles = [];
|
||||||
let templates = {};
|
let templates = {};
|
||||||
@ -34,11 +33,7 @@ let globalPatreon = false;
|
|||||||
let guildPatreon = false;
|
let guildPatreon = false;
|
||||||
|
|
||||||
function guildId() {
|
function guildId() {
|
||||||
return document.querySelector("li > a.is-active").parentElement.dataset["guild"];
|
return document.querySelector(".guildList a.is-active").dataset["guild"];
|
||||||
}
|
|
||||||
|
|
||||||
function guildName() {
|
|
||||||
return guildNames[guildId()];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorToInt(r, g, b) {
|
function colorToInt(r, g, b) {
|
||||||
@ -57,7 +52,7 @@ function switch_pane(selector) {
|
|||||||
el.classList.add("is-hidden");
|
el.classList.add("is-hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector(`*[data-name=${selector}]`).classList.remove("is-hidden");
|
document.getElementById(selector).classList.remove("is-hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_select(sel) {
|
function update_select(sel) {
|
||||||
@ -454,27 +449,21 @@ document.addEventListener("guildSwitched", async (e) => {
|
|||||||
.querySelectorAll(".patreon-only")
|
.querySelectorAll(".patreon-only")
|
||||||
.forEach((el) => el.classList.add("is-locked"));
|
.forEach((el) => el.classList.add("is-locked"));
|
||||||
|
|
||||||
let $li = document.querySelectorAll(`li[data-guild="${e.detail.guild_id}"]`);
|
let $anchor = document.querySelector(
|
||||||
|
`.switch-pane[data-guild="${e.detail.guild_id}"]`
|
||||||
|
);
|
||||||
|
|
||||||
if ($li.length === 0) {
|
let hasError = false;
|
||||||
|
|
||||||
|
if ($anchor === null) {
|
||||||
switch_pane("user-error");
|
switch_pane("user-error");
|
||||||
|
hasError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_pane(e.detail.pane);
|
switch_pane($anchor.dataset["pane"]);
|
||||||
reset_guild_pane();
|
reset_guild_pane();
|
||||||
document
|
$anchor.classList.add("is-active");
|
||||||
.querySelectorAll(`li[data-guild="${e.detail.guild_id}"] > a`)
|
|
||||||
.forEach((el) => {
|
|
||||||
el.classList.add("is-active");
|
|
||||||
});
|
|
||||||
document
|
|
||||||
.querySelectorAll(
|
|
||||||
`li[data-guild="${e.detail.guild_id}"] *[data-pane="${e.detail.pane}"]`
|
|
||||||
)
|
|
||||||
.forEach((el) => {
|
|
||||||
el.classList.add("is-active");
|
|
||||||
});
|
|
||||||
|
|
||||||
if (globalPatreon || (await fetch_patreon(e.detail.guild_id))) {
|
if (globalPatreon || (await fetch_patreon(e.detail.guild_id))) {
|
||||||
document
|
document
|
||||||
@ -482,26 +471,15 @@ document.addEventListener("guildSwitched", async (e) => {
|
|||||||
.forEach((el) => el.classList.remove("is-locked"));
|
.forEach((el) => el.classList.remove("is-locked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const event = new CustomEvent("paneLoad", {
|
hasError = await fetch_channels(e.detail.guild_id);
|
||||||
detail: {
|
|
||||||
guild_id: e.detail.guild_id,
|
|
||||||
pane: e.detail.pane,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
document.dispatchEvent(event);
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener("paneLoad", async (ev) => {
|
|
||||||
const hasError = await fetch_channels(ev.detail.guild_id);
|
|
||||||
if (!hasError) {
|
if (!hasError) {
|
||||||
fetch_roles(ev.detail.guild_id);
|
fetch_roles(e.detail.guild_id);
|
||||||
fetch_templates(ev.detail.guild_id);
|
fetch_templates(e.detail.guild_id);
|
||||||
fetch_reminders(ev.detail.guild_id);
|
fetch_reminders(e.detail.guild_id);
|
||||||
|
|
||||||
document.querySelectorAll("p.pageTitle").forEach((el) => {
|
document.querySelectorAll("p.pageTitle").forEach((el) => {
|
||||||
el.textContent = `${guildName()} Reminders`;
|
el.textContent = `${e.detail.guild_name} Reminders`;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelectorAll("select.channel-selector").forEach((el) => {
|
document.querySelectorAll("select.channel-selector").forEach((el) => {
|
||||||
el.addEventListener("change", (e) => {
|
el.addEventListener("change", (e) => {
|
||||||
update_select(e.target);
|
update_select(e.target);
|
||||||
@ -706,56 +684,36 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
"%guildname%",
|
"%guildname%",
|
||||||
guild.name
|
guild.name
|
||||||
);
|
);
|
||||||
|
$anchor.dataset["guild"] = guild.id;
|
||||||
$anchor.dataset["name"] = guild.name;
|
$anchor.dataset["name"] = guild.name;
|
||||||
$anchor.href = `/dashboard/${guild.id}/reminders`;
|
$anchor.href = `/dashboard/${guild.id}?name=${guild.name}`;
|
||||||
|
|
||||||
const $li = $anchor.parentElement;
|
$anchor.addEventListener("click", async (e) => {
|
||||||
$li.dataset["guild"] = guild.id;
|
e.preventDefault();
|
||||||
|
window.history.pushState({}, "", `/dashboard/${guild.id}`);
|
||||||
$li.querySelectorAll("a").forEach((el) => {
|
const event = new CustomEvent("guildSwitched", {
|
||||||
el.addEventListener("click", (e) => {
|
detail: {
|
||||||
const pane = el.dataset["pane"];
|
guild_name: guild.name,
|
||||||
const slug = el.dataset["slug"];
|
guild_id: guild.id,
|
||||||
|
},
|
||||||
if (pane !== undefined && slug !== undefined) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
switch_pane(pane);
|
|
||||||
|
|
||||||
window.history.pushState(
|
|
||||||
{},
|
|
||||||
"",
|
|
||||||
`/dashboard/${guild.id}/${slug}`
|
|
||||||
);
|
|
||||||
const event = new CustomEvent("guildSwitched", {
|
|
||||||
detail: {
|
|
||||||
guild_id: guild.id,
|
|
||||||
pane,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
document.dispatchEvent(event);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.dispatchEvent(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
element.append($clone);
|
element.append($clone);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const matches = window.location.href.match(
|
const matches = window.location.href.match(/dashboard\/(\d+)/);
|
||||||
/dashboard\/(\d+)(\/)?([a-zA-Z\-]+)?/
|
|
||||||
);
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
let id = matches[1];
|
let id = matches[1];
|
||||||
let kind = matches[3];
|
|
||||||
let name = guildNames[id];
|
let name = guildNames[id];
|
||||||
|
|
||||||
const event = new CustomEvent("guildSwitched", {
|
const event = new CustomEvent("guildSwitched", {
|
||||||
detail: {
|
detail: {
|
||||||
guild_name: name,
|
guild_name: name,
|
||||||
guild_id: id,
|
guild_id: id,
|
||||||
pane: kind,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
function loadErrors() {
|
|
||||||
return fetch(
|
|
||||||
`/dashboard/api/guild/${guildId()}/reminders?status=deleted,sent,failed`
|
|
||||||
).then((response) => response.json());
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("paneLoad", (ev) => {
|
|
||||||
if (ev.detail.pane !== "errors") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.querySelectorAll(".reminderError").forEach((el) => el.remove());
|
|
||||||
|
|
||||||
const template = document.getElementById("reminderError");
|
|
||||||
const container = document.getElementById("reminderLog");
|
|
||||||
|
|
||||||
loadErrors()
|
|
||||||
.then((res) => {
|
|
||||||
res = res
|
|
||||||
.filter((r) => r.status_change_time !== null)
|
|
||||||
.sort((a, b) => a.status_change_time < b.status_change_time);
|
|
||||||
|
|
||||||
for (const reminder of res) {
|
|
||||||
const newRow = template.content.cloneNode(true);
|
|
||||||
|
|
||||||
newRow.querySelector(".reminderError").dataset["case"] = reminder.status;
|
|
||||||
|
|
||||||
const statusTime = new luxon.DateTime.fromISO(
|
|
||||||
reminder.status_change_time,
|
|
||||||
{ zone: "UTC" }
|
|
||||||
);
|
|
||||||
newRow.querySelector(".reminderName").textContent = reminder.name;
|
|
||||||
newRow.querySelector(".reminderMessage").textContent =
|
|
||||||
reminder.status_message;
|
|
||||||
newRow.querySelector(".reminderTime").textContent = statusTime
|
|
||||||
.toLocal()
|
|
||||||
.toLocaleString(luxon.DateTime.DATETIME_MED);
|
|
||||||
|
|
||||||
container.appendChild(newRow);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
$loader.classList.add("is-hidden");
|
|
||||||
});
|
|
||||||
});
|
|
19
web/static/js/reminder_errors.ts
Normal file
19
web/static/js/reminder_errors.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
let _reminderErrors = [];
|
||||||
|
|
||||||
|
const reminderErrors = () => {
|
||||||
|
return _reminderErrors;
|
||||||
|
}
|
||||||
|
|
||||||
|
const guildId = () => {
|
||||||
|
let selected: HTMLElement = document.querySelector(".guildList a.is-active");
|
||||||
|
return selected.dataset["guild"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function loadErrors() {
|
||||||
|
fetch(`/dashboard/api/guild/${guildId()}/errors`).then(response => response.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
|
})
|
@ -333,16 +333,16 @@
|
|||||||
<p class="subtitle is-hidden-desktop">Press the <span class="icon"><i class="fal fa-bars"></i></span> to get started</p>
|
<p class="subtitle is-hidden-desktop">Press the <span class="icon"><i class="fal fa-bars"></i></span> to get started</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section data-name="reminders" class="is-hidden">
|
<section id="guild" class="is-hidden">
|
||||||
{% include "reminder_dashboard/reminder_dashboard" %}
|
{% include "reminder_dashboard/reminder_dashboard" %}
|
||||||
</section>
|
</section>
|
||||||
<section data-name="errors" class="is-hidden">
|
<section id="reminder-errors" class="is-hidden">
|
||||||
{% include "reminder_dashboard/reminder_errors" %}
|
{% include "reminder_dashboard/reminder_errors" %}
|
||||||
</section>
|
</section>
|
||||||
<section data-name="guild-error" class="is-hidden">
|
<section id="guild-error" class="is-hidden">
|
||||||
{% include "reminder_dashboard/guild_error" %}
|
{% include "reminder_dashboard/guild_error" %}
|
||||||
</section>
|
</section>
|
||||||
<section data-name="user-error" class="is-hidden">
|
<section id="user-error" class="is-hidden">
|
||||||
{% include "reminder_dashboard/user_error" %}
|
{% include "reminder_dashboard/user_error" %}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@ -376,28 +376,14 @@
|
|||||||
|
|
||||||
<template id="guildListEntry">
|
<template id="guildListEntry">
|
||||||
<li>
|
<li>
|
||||||
<a class="switch-pane" data-pane="reminders" data-slug="reminders">
|
<a class="switch-pane" data-pane="guild">
|
||||||
<span class="icon"><i class="fas fa-map-pin"></i></span> <span class="guild-name">%guildname%</span>
|
<span class="icon"><i class="fas fa-map-pin"></i></span> <span class="guild-name">%guildname%</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="guild-submenu">
|
|
||||||
<li>
|
|
||||||
<a class="switch-pane" data-pane="reminders" data-slug="reminders">
|
|
||||||
<span class="icon"><i class="fas fa-calendar-alt"></i></span> Reminders
|
|
||||||
</a>
|
|
||||||
<a class="switch-pane" data-pane="errors" data-slug="errors">
|
|
||||||
<span class="icon"><i class="fas fa-file-alt"></i></span> Logs
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="guildReminder">
|
<template id="guildReminder">
|
||||||
{% include "reminder_dashboard/templates/guild_reminder" %}
|
{% include "reminder_dashboard/guild_reminder" %}
|
||||||
</template>
|
|
||||||
|
|
||||||
<template id="reminderError">
|
|
||||||
{% include "reminder_dashboard/templates/reminder_error" %}
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script src="/static/js/iro.js"></script>
|
<script src="/static/js/iro.js"></script>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<strong>Create Reminder</strong>
|
<strong>Create Reminder</strong>
|
||||||
<div id="reminderCreator">
|
<div id="reminderCreator">
|
||||||
{% set creating = true %}
|
{% set creating = true %}
|
||||||
{% include "reminder_dashboard/templates/guild_reminder" %}
|
{% include "reminder_dashboard/guild_reminder" %}
|
||||||
{% set creating = false %}
|
{% set creating = false %}
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
@ -46,10 +46,6 @@
|
|||||||
<div id="guildReminders">
|
<div id="guildReminders">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="guildErrors">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/sort.js"></script>
|
<script src="/static/js/sort.js"></script>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div id="reminderLog">
|
<div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
<div class="reminderError" data-case="success">
|
|
||||||
<div class="errorHead">
|
|
||||||
<div class="errorIcon">
|
|
||||||
<span class="icon">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
<i class="fas fa-check"></i>
|
|
||||||
<i class="fas fa-exclamation-triangle"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="reminderName">
|
|
||||||
Reminder
|
|
||||||
</div>
|
|
||||||
<div class="reminderMessage">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="reminderTime">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
Reference in New Issue
Block a user