Guest User

Untitled

a guest
Jun 18th, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. const { Events } = require('discord.js');
  2.  
  3. module.exports = {
  4. name: Events.InteractionCreate,
  5. async execute(interaction) {
  6. if (interaction.isChatInputCommand()) {
  7. const command = interaction.client.commands.get(interaction.commandName);
  8.  
  9. if (!command) {
  10. console.error(`No command matching ${interaction.commandName} was found.`);
  11. return;
  12. }
  13.  
  14. try {
  15. await command.execute(interaction);
  16. } catch (error) {
  17. console.error(`Error executing ${interaction.commandName}`);
  18. console.error(error);
  19. }
  20. } else if (interaction.isButton()) {
  21. // respond to the button
  22. } else if (interaction.isStringSelectMenu()) {
  23. // respond to the select menu
  24. }
  25. },
  26. };
Advertisement
Add Comment
Please, Sign In to add comment