/[sudobot]/trunk/src/events/interaction/InteractionCreateEvent.ts
ViewVC logotype

Diff of /trunk/src/events/interaction/InteractionCreateEvent.ts

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

revision 51 by rakin, Mon Jul 29 17:28:23 2024 UTC revision 58 by rakin, Mon Jul 29 17:28:25 2024 UTC
# Line 10  export default class InteractionCreateEv Line 10  export default class InteractionCreateEv
10      }      }
11    
12      async run(client: DiscordClient, interaction: Interaction) {      async run(client: DiscordClient, interaction: Interaction) {
         console.log('inside');  
           
13          if (interaction.isCommand()) {          if (interaction.isCommand()) {
14              await client.setMessage(interaction);              await client.setMessage(interaction);
15    
16              const { commandName } = interaction;              const { commandName } = interaction;
17    
18              const command = await client.commands.get(commandName);              const command = await client.commands.get(commandName);
             const allowed = await client.auth.verify(interaction.member! as GuildMember, commandName);  
19    
20              if (command && command.supportsInteractions) {              if (command && command.supportsInteractions) {
21                    const allowed = await client.auth.verify(interaction.member! as GuildMember, command);
22    
23                  if (!allowed) {                  if (!allowed) {
24                      await interaction.reply({                      await interaction.reply({
25                          embeds: [                          embeds: [
# Line 34  export default class InteractionCreateEv Line 33  export default class InteractionCreateEv
33                      return;                      return;
34                  }                  }
35    
36                  await command.run(client, interaction, {                  const options = {
37                      cmdName: commandName,                      cmdName: commandName,
38                      options: interaction.options,                      options: interaction.options,
39                      isInteraction: true                      isInteraction: true
40                  } as InteractionOptions);                  } as InteractionOptions;
41    
42                    if (!await client.cooldown.start(interaction, options))
43                        return;
44    
45                    await command.run(client, interaction, options);
46              }              }
47          }          }
48      }      }

Legend:
Removed from v.51  
changed lines
  Added in v.58

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26