繁体   English   中英

我的服务器列表命令不和谐机器人错误,任何人都可以帮助我

[英]my serverlist commands discord bot error, anyone can help me

因为我还是一个初学者,我真的很难解决这个问题......你们能帮帮我吗? 如果你们想在这个问题上帮助我,我将非常感激。

消息创建代码

!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!')],
          });
      }
    }

错误日志

可能出现此错误的一个原因是因为在Client中没有称为client.owner的属性。 但是,您可以使用client.owner的一种方法是,如果您创建了一个Collection ,然后将其设置为一个数组。 一个例子是这样的:

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)
})
// ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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