Skip to content

Commit

Permalink
✨ Add auto play command
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Apr 25, 2021
1 parent cffa589 commit 4eaccbf
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
43 changes: 43 additions & 0 deletions commands/Music/autoplay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const Command = require("../../base/Command.js");

class AutoPlay extends Command {

constructor (client) {
super(client, {
name: "autoplay",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [],
memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ],
nsfw: false,
ownerOnly: false,
cooldown: 5000
});
}

async run (message) {

const queue = this.client.player.getQueue(message);

const voice = message.member.voice.channel;
if (!voice){
return message.error("music/play:NO_VOICE_CHANNEL");
}

if(!queue){
return message.error("music:play:NOT_PLAYING");
}

// Gets the current song
await this.client.player.setAutoPlay(message, !queue.autoPlay);

// Send the embed in the current channel
message.sendT(`music/autoplay:SUCCESS_${queue.autoPlay ? "ENABLED" : "DISABLED"}`);

}

}

module.exports = AutoPlay;
7 changes: 7 additions & 0 deletions languages/en-US/music/autoplay.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DESCRIPTION": "Enable or disable the autoplay feature",
"USAGE": "{{prefix}}autoplay",
"EXAMPLES": "{{prefix}}autoplay",
"SUCCESS_ENABLED": "{{success}} Auto play is now enabled!",
"SUCCESS_DISABLED": "{{success}} Auto play is now disabled!"
}

0 comments on commit 4eaccbf

Please sign in to comment.