diff --git a/migration/04-reminder_templates.sql b/migration/04-reminder_templates.sql index 49c5bdc..28afe79 100644 --- a/migration/04-reminder_templates.sql +++ b/migration/04-reminder_templates.sql @@ -32,3 +32,20 @@ CREATE TABLE reminder_template ( ); ALTER TABLE reminders ADD COLUMN embed_fields JSON; + +update reminders + inner join embed_fields as E + on E.reminder_id = reminders.id +set embed_fields = ( + select JSON_ARRAYAGG( + JSON_OBJECT( + 'title', E.title, + 'value', E.value, + 'inline', + if(inline = 1, cast(TRUE as json), cast(FALSE as json)) + ) + ) + from embed_fields + group by reminder_id + having reminder_id = reminders.id + ); diff --git a/src/event_handlers.rs b/src/event_handlers.rs index f1a786f..700fa87 100644 --- a/src/event_handlers.rs +++ b/src/event_handlers.rs @@ -14,6 +14,9 @@ pub async fn listener( data: &Data, ) -> Result<(), Error> { match event { + poise::Event::Ready { .. } => { + ctx.set_activity(serenity::Activity::watching("for /remind")).await; + } poise::Event::CacheReady { .. } => { info!("Cache Ready! Preparing extra processes"); diff --git a/src/main.rs b/src/main.rs index 9b8eb70..cda6210 100644 --- a/src/main.rs +++ b/src/main.rs @@ -171,8 +171,6 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { .token(discord_token) .user_data_setup(move |ctx, _bot, framework| { Box::pin(async move { - ctx.set_activity(Activity::watching("for /remind")).await; - register_application_commands( ctx, framework,