【问题标题】:How to send the guild owners name?如何发送公会老板姓名?
【发布时间】:2021-03-02 09:53:14
【问题描述】:
module.exports = {    
name: 'owner',
description: "This command sends the Server Owner's Name'!",
execute(message, args) {
const guild = client.guilds.get('500170876243935247');
message.channel.send(message.guild.member(guild.owner) ? guild.owner.toString() : guild.owner.user.tag);
}
}

这是我的代码,我正在使用高级命令处理程序,这是命令的文件,我想创建一个 &owner 的命令,它应该检查公会所有者的名称并在频道中提及它,但它似乎无法上班有人可以帮我吗?

【问题讨论】:

  • 抛出了什么错误?
  • 请使用反引号正确格式化您的代码,并向我们提供有关该问题的一些详细信息!代码运行时会发生什么?代码运行时应该发生什么?那种东西

标签: discord.js


【解决方案1】:

好像你已经看过this thread了。

您的问题是您没有使用最新的语法:cache

试试这个:

const guild = client.guilds.cache.get('<guild id here>');

还请确保您使用有效的公会 ID,因为链接中的公会 ID 不是您的机器人能够访问的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-06
    • 1970-01-01
    • 2017-05-14
    • 1970-01-01
    • 2021-09-24
    • 1970-01-01
    相关资源
    最近更新 更多