Closed ODHG1 closed 6 months ago
Oh i forgot the most important part lol the command:
const { EmbedBuilder, ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType } = require('discord.js')
const { channel, author, content } = (message)
if (channel.type === ChannelType.DM){
const openticket = new ButtonBuilder()
.setCustomId('openticket')
.setLabel('🎟️ Open Modmail Ticket')
.setStyle(ButtonStyle.Danger)
const row69 = new ActionRowBuilder()
.addComponents(openticket)
const embed69 = new EmbedBuilder()
.setTitle('FrankyBotv2 Modmail')
.setColor('DarkBlue')
.setDescription(`Welcome, <@${message.author.id}>! You can use this menu to contact the staff members of the server. You may use this menu to report people or ask questions from the moderators. 👍\n**Please note that abusing this feature will lead to punishment**`)
.setFooter({text:'Click the button below to open a ticket!'})
channel.send({embeds: [embed69], components: [row69]})}}}
I removed the button linking part here just because i had a doubt about it
On reading your error, it is clear that the error is in slashCreate.js, it appears to me that it is a modified slashCreate file.
The error is in line 27 (which you have created a custom cooldown system):
if (!cooldowns.has(command.data.name)) {
command
is undefined. It appears to me that you have added the cooldown command section (or do I say, copy pasted) at wrong place. The original slash file is checking whether it is a slash interaction or not. Please run your cooldown system AFTER verification of interaction. That should fix your issue.
On a side note, I will be removing the bug label because it is not a bug on the template end. Feel free to reach out to us on discord if you want further help! https://discord.gg/N7AJFYf8EP
Describe the bug I made a command with a button (a prefix command), when i try linking the button or pressing it without even linking it, it crashes and says that command is undefined in slashCreate, thing is, i didn't touch slashCreate while making this, and command is defined in that file, else no slash command would even work. Error
Additional context Here is my slashCreate (i only added cooldowns following the djs guide):
Line 60 in bot.js is
async (...args) => await event.execute(...args, client)
Whole loop would be