/[sudobot]/trunk/src/commands/automation/EmbedCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/automation/EmbedCommand.ts

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

revision 249 by rakin, Mon Jul 29 17:29:12 2024 UTC revision 271 by rakin, Mon Jul 29 17:29:18 2024 UTC
# Line 7  import { emoji } from '../../utils/Emoji Line 7  import { emoji } from '../../utils/Emoji
7    
8  export default class EmbedCommand extends BaseCommand {  export default class EmbedCommand extends BaseCommand {
9      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
     supportsLegacy = false;  
10      subcommands = ['send', 'schema', 'build'];      subcommands = ['send', 'schema', 'build'];
11    
12      constructor() {      constructor() {
# Line 15  export default class EmbedCommand extend Line 14  export default class EmbedCommand extend
14      }      }
15    
16      async run(client: DiscordClient, message: Message | CommandInteraction, options: CommandOptions | InteractionOptions) {      async run(client: DiscordClient, message: Message | CommandInteraction, options: CommandOptions | InteractionOptions) {
17          if (!options.isInteraction && options.args[0] === undefined) {          if (!options.isInteraction) {
             await message.reply(`${emoji('error')} No subcommand provided.`);  
             return;  
         }  
   
         if (!options.isInteraction && (options.args[0] === 'send' || options.args[0] === 'schema')) {  
18              await message.reply(`${emoji('error')} This command can not be used in legacy mode. Use slash commands instead.`);              await message.reply(`${emoji('error')} This command can not be used in legacy mode. Use slash commands instead.`);
19              return;              return;
20          }          }
21    
22          if (!options.isInteraction && !this.subcommands.includes(options.args[0])) {          const subcommand = options.options.getSubcommand();
             await message.reply(`${emoji('error')} Invalid subcommand provided. Must be one of ${this.subcommands.map(c => `\`${c}\``)}.`);  
             return;  
         }  
   
         const subcommand = options.isInteraction ? options.options.getSubcommand() : options.args[0];  
23    
24          const command = client.commands.get('embed__' + subcommand);          const command = client.commands.get('embed__' + subcommand);
25    

Legend:
Removed from v.249  
changed lines
  Added in v.271

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26