#Anyone know how i can fix this?
1 messages · Page 1 of 1 (latest)
Alright my bad
Look into CommandProps, there's no channel property
So whats happening is, i'm trying to make help embed with buttons and this error pops up everytime
Ok, and why you need channel in the first place?
const collector = await channel.createMessageComponentCollector
How does the user interact with the bot? Command or message?
I had this like this but it didn't seem to work because of the message
message.createMessageComponentCollector
So the user types the command .help and the embed pops up and he can interact with the buttons
You can get the channel using msg.channel
But to be honest, I wouldn't use a collector
Let's go back to what's actually wrong right now with the code:
Your e doesn't have channel property probably
import { CommandProps, Command } from "../../@types";
import Discord, { ButtonInteraction, Interaction, MessageActionRow, MessageButton, MessageEmbed } from 'discord.js'
export = {
name: "button",
category: "",
aliases: [],
description: "",
usage: "",
run: async function (e: CommandProps) {
const {
message, args, client } = e;
if (!message.guild)
return;
const embed = new MessageEmbed()
.setAuthor('Help Desk')
.setColor('GOLD')
.setDescription(`Select your category by pressing a button of your choice!`)
const button = new MessageActionRow()
.addComponents(
new MessageButton()
.setLabel('Moderation')
.setCustomId('mod')
.setEmoji('👑')
.setStyle('SUCCESS')
)
message.reply({ embeds: [embed], components: [button]})
const filter = (i: { customId: string; user: { id: string; }; }) => i.customId === 'primary' && i.user.id === '756909881793183826';
const collector = await message.channel.createMessageComponentCollector({ componentType: 'BUTTON', filter, time: 15000 });
collector.on('collect', async (i: { customId: string; update: (arg0: { content: string; components: never[]; }) => any; }) => {
if(i.customId === 'mod') {
await i.update({ content: 'A Button was clicked!', components: []})
}
});
collector.on('end', (collected: { size: any; }) => console.log(`Collected ${collected.size} items`));
}
} as unknown as Command
As you can see there's no member called channel
Also, if you don't intend to add one, just remove channel from assigment. Seems like you don't use it anyway, and you do what I was saying with msg.channel
Can i get the channel as string like this?
How is this related to solving your initial issue?
hm?
Oh, that screenshot is of the class? You sent 2 lines, and it didn't pop in my eyes
You can store it in whatever way if you convert it
Ahh
Nothin