Move all commands to their own files
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/utils.rs
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/utils.rs
									
									
									
									
									
								
							@@ -2,12 +2,15 @@ use poise::{
 | 
			
		||||
    serenity_prelude::{
 | 
			
		||||
        http::CacheHttp,
 | 
			
		||||
        model::id::{GuildId, UserId},
 | 
			
		||||
        CreateInteractionResponseMessage,
 | 
			
		||||
        CreateEmbedFooter, CreateInteractionResponseMessage,
 | 
			
		||||
    },
 | 
			
		||||
    CreateReply,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
use crate::consts::{CNC_GUILD, SUBSCRIPTION_ROLES};
 | 
			
		||||
use crate::{
 | 
			
		||||
    consts::{CNC_GUILD, SUBSCRIPTION_ROLES},
 | 
			
		||||
    Context,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
pub async fn check_subscription(cache_http: impl CacheHttp, user_id: impl Into<UserId>) -> bool {
 | 
			
		||||
    if let Some(subscription_guild) = *CNC_GUILD {
 | 
			
		||||
@@ -49,3 +52,15 @@ pub fn reply_to_interaction_response_message(
 | 
			
		||||
 | 
			
		||||
    builder
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn footer(ctx: Context<'_>) -> CreateEmbedFooter {
 | 
			
		||||
    let shard_count = ctx.serenity_context().cache.shard_count();
 | 
			
		||||
    let shard = ctx.serenity_context().shard_id;
 | 
			
		||||
 | 
			
		||||
    CreateEmbedFooter::new(format!(
 | 
			
		||||
        "{}\nshard {} of {}",
 | 
			
		||||
        concat!(env!("CARGO_PKG_NAME"), " ver ", env!("CARGO_PKG_VERSION")),
 | 
			
		||||
        shard,
 | 
			
		||||
        shard_count,
 | 
			
		||||
    ))
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user