/[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 260 by rakin, Mon Jul 29 17:29:15 2024 UTC revision 271 by rakin, Mon Jul 29 17:29:18 2024 UTC
# Line 14  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}\``).join(', ')}.`);  
             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    
26          if (command) {          if (command) {
             if (!options.isInteraction)  
                 options.args.shift();  
27              await command.execute(client, message, options);              await command.execute(client, message, options);
28          }          }
29      }      }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26