Record some parameters for /remind
This commit is contained in:
19
src/hooks.rs
19
src/hooks.rs
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user