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

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

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

revision 63 by rakin, Mon Jul 29 17:28:25 2024 UTC revision 64 by rakin, Mon Jul 29 17:28:27 2024 UTC
# Line 3  import { GuildMember, Interaction, Messa Line 3  import { GuildMember, Interaction, Messa
3  import DiscordClient from '../../client/Client';  import DiscordClient from '../../client/Client';
4  import CommandOptions from '../../types/CommandOptions';  import CommandOptions from '../../types/CommandOptions';
5  import InteractionOptions from '../../types/InteractionOptions';  import InteractionOptions from '../../types/InteractionOptions';
6    import AutoCompleteOptions from '../../types/AutoCompleteOptions';
7    
8  export default class InteractionCreateEvent extends BaseEvent {  export default class InteractionCreateEvent extends BaseEvent {
9      constructor() {      constructor() {
# Line 45  export default class InteractionCreateEv Line 46  export default class InteractionCreateEv
46                  await command.run(client, interaction, options);                  await command.run(client, interaction, options);
47              }              }
48          }          }
49            else if (interaction.isAutocomplete()) {
50                await client.setMessage(interaction);
51    
52                const { commandName } = interaction;
53    
54                const command = await client.commands.get(commandName);
55    
56                if (command && command.supportsInteractions) {
57                    const allowed = await client.auth.verify(interaction.member! as GuildMember, command);
58    
59                    if (!allowed) {
60                        return;
61                    }
62    
63                    const options = {
64                        cmdName: commandName,
65                        options: interaction.options,
66                        isInteraction: true,
67                        optionName: interaction.options.getFocused(true).name,
68                        query: interaction.options.getFocused(true).value.toString()
69                    } as AutoCompleteOptions;
70    
71                    await command.autoComplete(client, interaction, options);
72                }
73            }
74      }      }
75  }  }

Legend:
Removed from v.63  
changed lines
  Added in v.64

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26