简体   繁体   中英

my serverlist commands discord bot error, anyone can help me

since I'm still a beginner, I'm really struggling to fix this... can you guys help me? i am very grateful if you guys want to help me on this issue.

MessageCreate code

!channel.permissionsFor(message.guild.me)?.has(Permissions.FLAGS.EMBED_LINKS) &&
      client.user.id !== userId
    ) {
      return channel.send({ content: `Error: I need \`EMBED_LINKS\` permission to work.` });
    }
    if (command.owner) {
      if (client.owner) {
        const devs = client.owner.find((x) => x === message.author.id);
        if (!devs)
          return message.channel.send({
            embeds: [embed.setDescription('Only <@959276033683628122> can use this command!')],
          });
      }
    }

Error Logs

One reason why this error could be coming is because there is no property called as client.owner in a Client . But one way, you could use client.owner is if you created a Collection and then set it to an array. An example would be like this:

import { Collection } from 'discord.js'
// ...
client.owner = new Collection()
const ownerArray = [{
    username: '',
    id: ''
}] // Use something like a hardcoded value for the array of owners
ownerArray.forEach(owner => {
    client.owner.set(owner.id, owner.username)
})
// ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM