【问题标题】:How to define 'guild'?如何定义“公会”?
【发布时间】:2019-08-15 00:49:04
【问题描述】:

我需要公会定义的“公会”我收到以下错误

错误: (node:8576) UnhandledPromiseRejectionWarning: ReferenceError: guild is not defined

js

 if(msg.content.startsWith (prefix + 'mp')) {
    var text = msg.content.split(' ').slice(1).join(' ')
    if(!text) return msg.reply('Veuillez spécifié votre message !')
    msg.guild.send(text)
  }

【问题讨论】:

  • mplungjan x) 帮帮我,

标签: javascript discord discord.js


【解决方案1】:

您不能向公会发送消息,但您可以但是向公会频道发送消息。因此,您可以使用任一 msg.guild.send(text) 来代替

// Send a message to the channel where the user entered the command
msg.channel.send(text);

或使用

// Send a message to a specific Guild Channel
let channel = msg.guild.channels.find((channel) => channel.name === '<channel name here>');
channel.send(text);

【讨论】:

    猜你喜欢
    • 2021-12-04
    • 2021-10-06
    • 1970-01-01
    • 2017-07-03
    • 2021-04-06
    • 2020-12-24
    • 2020-08-25
    • 2020-11-28
    • 2022-01-21
    相关资源
    最近更新 更多