MCPcopy
hub / github.com/LAION-AI/Open-Assistant / execute

Function execute

discord-bots/oa-bot-js/src/events/commands.ts:20–47  ·  view source on GitHub ↗
(interaction, client)

Source from the content-addressed store, hash-verified

18 name: Events.InteractionCreate,
19 once: false,
20 async execute(interaction, client) {
21 if (
22 !interaction.isChatInputCommand() &&
23 !interaction.isContextMenuCommand()
24 )
25 return;
26 var commands = await client.commands.toJSON();
27 const command = interaction.client.commands.get(interaction.commandName);
28
29 if (!command) {
30 console.error(
31 `No command matching ${interaction.commandName} was found.`
32 );
33 return;
34 }
35 var guildId;
36 if (interaction.guild) guildId = interaction.guild.id;
37
38 try {
39 await command.execute(interaction, client, commands, interactionType);
40 } catch (error) {
41 console.log(error);
42 await interactionType.reply(interaction, {
43 content: "There was an error while executing this command!",
44 ephemeral: true,
45 });
46 }
47 },
48};

Callers

nothing calls this directly

Calls 2

logMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected