/[sudobot]/trunk/src/utils/structures/BaseCommand.ts
ViewVC logotype

Diff of /trunk/src/utils/structures/BaseCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 207 by rakin, Mon Jul 29 17:29:01 2024 UTC revision 245 by rakin, Mon Jul 29 17:29:11 2024 UTC
# Line 12  export default abstract class BaseComman Line 12  export default abstract class BaseComman
12      coolDown?: number;      coolDown?: number;
13      ownerOnly: boolean = false;      ownerOnly: boolean = false;
14      permissions: PermissionResolvable[] = [];      permissions: PermissionResolvable[] = [];
15    
16            
17      constructor(private name: string, private category: string, private aliases: Array<string>) {      constructor(private name: string, private category: string, private aliases: Array<string>) {
18            
19      }      }
20        
21      getName(): string {      getName(): string {
22          return this.name;          return this.name;
23      }      }
24        
25      getCategory(): string {      getCategory(): string {
26          return this.category;          return this.category;
27      }      }
28        
29      getAliases(): Array<string> {      getAliases(): Array<string> {
30          return this.aliases;          return this.aliases;
31      }      }
32        
33        async permissionValidation(client: DiscordClient, member: GuildMember): Promise <boolean> {
34            return true;
35        }
36    
37      async autoComplete(client: DiscordClient, interaction: AutocompleteInteraction, options: AutoCompleteOptions): Promise <void> {      async autoComplete(client: DiscordClient, interaction: AutocompleteInteraction, options: AutoCompleteOptions): Promise <void> {
38    
# Line 83  export default abstract class BaseComman Line 88  export default abstract class BaseComman
88              }              }
89          }          }
90    
91            if (message instanceof Interaction && !message.isRepliable())
92                return;
93    
94            if (!(await this.permissionValidation(client, member!))) {
95                await message.reply({
96                    embeds: [
97                        {
98                            description: ":x: You don't have enough permissions to run this command.",
99                            color: 0xf14a60
100                        }
101                    ]
102                });
103    
104                return false;
105            }
106    
107          return true;          return true;
108      }      }
109    

Legend:
Removed from v.207  
changed lines
  Added in v.245

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26