【问题标题】:Music bot discord.js mentioning vcs音乐机器人 discord.js 提到 vcs
【发布时间】:2020-12-01 18:34:40
【问题描述】:

我将如何提及语音频道,以便我可以让用户指定它希望机器人在哪个频道中播放音乐?

任何关于能够做到这一点的见解都会很好,因为你不能提及语音频道,所以你不能做 message.channels.mentions.first()

【问题讨论】:

  • 您实际上可以提及 VoiceChannel。 <#ChannelID>.

标签: discord.js


【解决方案1】:

您可以指定语音频道的名称,或直接创建对该频道的邀请,以便他们只需单击它并加入语音频道。

const channelToFind = "general"; //name of the voice channel you wanna find, MUST be a VC.
const channel = message.guild.channels.cache.find(x => x.name == channelToFind);
const inv = await channel.createInvite();

message.channel.send(`Click on the link to join the VC: ${inv}`)

【讨论】:

  • 是的,但我希望它的动态含义是用户可以使用诸如 !musicchannel (name) 之类的命令来设置它
  • 您是否在代码中的任何位置定义了args?如果是这样,请在那里使用它。
猜你喜欢
  • 2020-06-27
  • 2020-09-22
  • 2020-08-04
  • 2021-02-07
  • 2021-11-29
  • 2021-09-18
  • 2019-10-22
  • 2021-07-25
  • 2020-09-30
相关资源
最近更新 更多