Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { MessageButton, MessageActionRow } = require('discord.js');
- module.exports = {
- name: 'interactionCreate',
- async execute(interaction, client) {
- if (interaction.isCommand()) {
- const command = client.slash.get(interaction.commandName); // We need to change this to the new collection called slash. You can change the name to whatever you want but you need to do it in index.js as well
- if(!command) return;
- try{
- await command.execute(interaction);
- }catch(error){
- console.error(error);
- await interaction.reply({content : "There was an error while executing action"})
- }
- console.log(`${interaction.user.tag} in #${interaction.channel.name} triggered an interaction.`);
- return;
- } else if (interaction.isButton()) {
- interaction.reply("you clicked" + interaction.customId);
- console.log(interaction);
- if (interaction.customId === 'offense') {
- console.log(`${interaction.user.tag} in #${interaction.channel.name} clicked the offense button.`);
- const ActionRow = new MessageActionRow().setComponents(new MessageButton()
- .setCustomId('CustomId')
- .setLabel('Label')
- .setStyle('PRIMARY'));
- return interaction.update({
- content: 'Hey',
- components: [ActionRow],
- ephemeral: true
- });
- }
- }
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement