update example bot

This commit is contained in:
Snowflake107 2021-06-13 22:37:37 +05:45
parent a43df93abe
commit 397d7c7f30

View file

@ -23,6 +23,10 @@ client.on("warn", console.warn);
const player = new Player(client);
player.on("error", console.error);
player.on("debug", (queue, message) => {
console.log(`DEBUG :: ${queue.guild.name}`);
console.log(message);
});
player.on("trackStart", (queue, track) => {
const guildQueue = queue as Queue<TextChannel>;
@ -34,6 +38,16 @@ player.on("trackAdd", (queue, track) => {
guildQueue.metadata.send(`🎶 | Track **${track.title}** queued!`);
});
player.on("botDisconnect", (queue) => {
const guildQueue = queue as Queue<TextChannel>;
guildQueue.metadata.send("❌ | I was manually disconnected from the voice channel, clearing queue!");
});
player.on("channelEmpty", (queue) => {
const guildQueue = queue as Queue<TextChannel>;
guildQueue.metadata.send("❌ | Nobody is in the voice channel, leaving...");
});
client.on("message", async (message) => {
if (message.author.bot || !message.guild) return;
if (!client.application?.owner) await client.application?.fetch();