【发布时间】:2019-02-25 06:36:49
【问题描述】:
我在尝试使案例陈述起作用时遇到了麻烦,由于这是一个特定的问题,我找不到任何足够广泛的搜索词来获得任何良好的结果。
我试图让我的不和谐机器人通过在语音频道中播放特定的 youtube 视频来响应“倒计时”命令。
我以前从未在 discord bot 中做过音乐或语音频道工作,所以我观看了一个教程,但它展示了如何使用“play”之类的命令,后跟一个 youtube 视频链接的参数。我希望该命令没有任何参数并在每次使用“倒计时”命令时播放特定的 youtube 视频。
这是我现在所拥有的,在使用命令后需要一个参数。
case "countdown":
if (!message.member.voiceChannel) {
message.channel.sendMessage("You must be in a voice channel to initiate a countdown.");
return;
}
if (!servers[message.guild.id]) servers[message.guild.id] = {
queue: []
};
var server = servers[message.guild.id];
server.queue.push(args[1]);
if (!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection) {
play(connection, message);
})
break;
当我希望机器人播放任何想要的音乐时,这很有用,但我只想要一个与此命令相关联的视频。任何帮助将不胜感激,谢谢。
【问题讨论】:
标签: discord.js