added check for guild only commands
This commit is contained in:
		
							
								
								
									
										20
									
								
								src/hooks.rs
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/hooks.rs
									
									
									
									
									
								
							@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user