【发布时间】:2020-06-29 00:33:58
【问题描述】:
所以我的机器人要做的是,当有人加入某个频道时,它会向日志频道发送一条消息“SomeGuy123 加入了该频道!”。所以我像一个小时一样构建它,现在我解决了所有错误,但它什么也没说,也没有给出任何错误。如果你愿意,我可以发送整个代码。这里只是加入时发送消息的部分:
client.on("voiceStateUpdate", (oldState, newState) => {
const newUserChannel = newState.ChannelID;
const oldUserChannel = oldState.ChannelID
const textChannel = newState.guild.channels.cache.get('715141269395079208')
if(newUserChannel === '715141827644358707') {
textChannel.send(`${newState.user.username} (${newState.id}) has joined the channel`)
} else if (oldUserChannel === '715141827644358707' && newUserChannel !== '715141827644358707') {
textChannel.send(`${newState.user.username} (${newState.id}) has left the channel`)
}
})
提前谢谢你。
【问题讨论】:
标签: node.js bots discord discord.js