Skip to content

Commit

Permalink
[New] Added ChannelEmpty event that triggers after voice channel is e…
Browse files Browse the repository at this point in the history
…mpty and disconnects the bot
  • Loading branch information
naseif committed Aug 31, 2021
1 parent 98e904e commit 54c2a82
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions playerEvents/channelEmpty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { embedMessage } = require("../modules/embedSimple");

module.exports = {
name: "channelEmpty",
async execute(queue) {
try {
setTimeout(async () => {
if (queue) {
await queue.metadata.followUp({
embeds: [
embedMessage(
"#9dcc37",
`✅ **${queue.metadata.client.user.username}** disconnected from [<#${queue.connection.channel.id}>] because channel was empty!`
),
],
});
queue.connection.disconnect();
}
}, 5000);
} catch (err) {
console.error(err.message);
}
},
};

0 comments on commit 54c2a82

Please sign in to comment.