K
K
Killsayden2020-10-19 14:59:53
Node.js
Killsayden, 2020-10-19 14:59:53

How to check when a bot is connected and when Discord.js is disconnected?

if (i == 1 && message.member.voice.channel && message.channel.id == "767705276266184716" && !message.author.bot) {
        const connection = await message.member.voice.channel.join();
        connection.play('http://ep256.streamr.ru');


How can I do to check when the bot is in the channel and when it is disabled, so that I can add the i variable and change its value, depending on whether the bot is in the channel or not

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-10-19
@Killsayden

use message.guild.me.voice.channel:

if (message.guild.me.voice.channel) {
  message.channel.send("бот находится в голосовом канале")
} else {
  message.channel.send("бот не находится в голосовом канале")
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question