added check for guild only commands

This commit is contained in:
2021-11-13 22:30:18 +00:00
parent 5230101a8d
commit ebd1efa990
5 changed files with 27 additions and 4 deletions

View File

@ -7,6 +7,26 @@ use crate::{
moderation_cmds, RecordingMacros,
};
#[check]
pub async fn guild_only(
ctx: &Context,
invoke: &mut CommandInvoke,
_args: &CommandOptions,
) -> HookResult {
if invoke.guild_id().is_some() {
HookResult::Continue
} else {
let _ = invoke
.respond(
&ctx,
CreateGenericResponse::new().content("This command can only be used in servers"),
)
.await;
HookResult::Halt
}
}
#[check]
pub async fn macro_check(
ctx: &Context,