#Anyone know how i can fix this?

1 messages · Page 1 of 1 (latest)

primal locust
#

You gave us almost no info at all

fleet hemlock
#

Alright my bad

primal locust
#

Look into CommandProps, there's no channel property

fleet hemlock
#

So whats happening is, i'm trying to make help embed with buttons and this error pops up everytime

primal locust
#

Ok, and why you need channel in the first place?

fleet hemlock
#
const collector = await channel.createMessageComponentCollector
primal locust
#

How does the user interact with the bot? Command or message?

fleet hemlock
#

I had this like this but it didn't seem to work because of the message

message.createMessageComponentCollector
fleet hemlock
primal locust
#

You can get the channel using msg.channel

fleet hemlock
primal locust
#

But to be honest, I wouldn't use a collector

fleet hemlock
#

Hmm

#

I can do it without a collector?

primal locust
#

Let's go back to what's actually wrong right now with the code:

#

Your e doesn't have channel property probably

fleet hemlock
#
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
primal locust
#

How CommandProps looks like?

#

The class

fleet hemlock
primal locust
#

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

fleet hemlock
#

Can i get the channel as string like this?

primal locust
#

How is this related to solving your initial issue?

fleet hemlock
#

hm?

primal locust
#

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

fleet hemlock
#

Ahh

primal locust
#

Though I wonder why string[]..

#

What do you intend to store?

fleet hemlock
#

Nothin

primal locust
#

Then you could just remove it altogether

#

As I suggested above:

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