Record some parameters for /remind

This commit is contained in:
jude
2024-02-15 17:28:43 +00:00
parent 2f6d035efe
commit b81c3c80c1
4 changed files with 64 additions and 20 deletions

View File

@ -1,10 +1,13 @@
use log::warn;
use poise::{serenity_prelude::model::channel::Channel, CreateReply};
use poise::{serenity_prelude::model::channel::Channel, CommandInteractionType, CreateReply};
use crate::{consts::MACRO_MAX_COMMANDS, models::command_macro::RecordedCommand, Context, Error};
async fn macro_check(ctx: Context<'_>) -> bool {
if let Context::Application(app_ctx) = ctx {
if app_ctx.interaction_type != CommandInteractionType::Command {
return true;
}
if let Some(guild_id) = ctx.guild_id() {
if ctx.command().identifying_name != "finish_macro" {
let mut lock = ctx.data().recording_macros.write().await;
@ -12,12 +15,12 @@ async fn macro_check(ctx: Context<'_>) -> bool {
if let Some(command_macro) = lock.get_mut(&(guild_id, ctx.author().id)) {
if ctx.command().identifying_name != "remind" {
let _ = ctx
.send(
CreateReply::default()
.ephemeral(true)
.content("Macro recording only supports `/remind`. Please stop recording with `/macro finish` before using other commands.")
)
.await;
.send(
CreateReply::default()
.ephemeral(true)
.content("Macro recording only supports `/remind`. Please stop recording with `/macro finish` before using other commands.")
)
.await;
return false;
}