【问题标题】:Discord js message sending to specific channelDiscord js消息发送到特定频道
【发布时间】:2021-10-28 14:05:21
【问题描述】:

首先,我知道有类似的线程,但我找不到一个使用与我想要的相同方法的线程。我的代码:

            ticketChannel.send({
                embeds: supportEmbed, 
                components: new MessageActionRow().addComponent(supportButton).addComponent(claimButton),
                message.ticketChannel.send("<@&874175844422135808> Prosím o vyřešení ticketu"); 
            })

最后一行应该发送一条消息,用该 ID ping 一个角色。好吧,它没有。消息必须发送到 ticketChannel 频道。

谢谢你帮助我

【问题讨论】:

  • 这能回答你的问题吗? How to send a message to a specific channel
  • 不,它没有。与那个不同,我在控制台中没有错误
  • 该问题的answer 是否回答了您的问题?
  • 你定义了ticketChannel吗?如果是这样,您能否将其包含在您的代码中。

标签: javascript discord.js


【解决方案1】:

如果您想始终将其发送到特定频道,则需要使用频道的 id 来定义它:(假设您已定义公会)

let channelid = "your channel id"
let ticketchannel = guild.channels.fetch(channelid)
ticketchannel.send("<@&874175844422135808> Prosím o vyřešení ticketu")

【讨论】: