Clarify code
This commit is contained in:
@@ -1,21 +1,18 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
module.exports.run = async (client, message) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`)
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||
|
||||
client.player.clearQueue(message.guild.id);
|
||||
|
||||
message.channel.send(`**Queue cleared ${emotes.success}**`);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.config = {
|
||||
name: "clear-queue",
|
||||
aliases: []
|
||||
}
|
||||
name: "clear-queue",
|
||||
aliases: []
|
||||
};
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
module.exports.run = async (client, message) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`)
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||
|
||||
let song = await client.player.nowPlaying(message.guild.id);
|
||||
const song = await client.player.nowPlaying(message.guild.id);
|
||||
|
||||
message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.config = {
|
||||
name: "now-playing",
|
||||
aliases: []
|
||||
}
|
||||
name: "now-playing",
|
||||
aliases: []
|
||||
};
|
||||
|
||||
@@ -2,18 +2,17 @@ const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
module.exports.run = async (client, message) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
|
||||
let song = await client.player.pause(message.guild.id);
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||
|
||||
const song = await client.player.pause(message.guild.id);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`)
|
||||
|
||||
message.channel.send(`**Song ${song.name} paused ${emotes.success}**`);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.config = {
|
||||
name: "pause",
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
if (!args[0]) return message.channel.send(`**Please enter a music ${emotes.error}**`)
|
||||
if (!args[0]) return message.channel.send(`**Please enter a music ${emotes.error}**`);
|
||||
|
||||
let aSongIsAlreadyPlaying = client.player.isPlaying(message.guild.id);
|
||||
const aSongIsAlreadyPlaying = client.player.isPlaying(message.guild.id);
|
||||
|
||||
// If there's already a song playing
|
||||
if(aSongIsAlreadyPlaying){
|
||||
// Add the song to the queue
|
||||
let song = await client.player.addToQueue(message.guild.id, args.join(" "));
|
||||
const song = await client.player.addToQueue(message.guild.id, args.join(" "));
|
||||
message.channel.send(`**Song ${song.name} added to queue ${emotes.music}**`);
|
||||
} else {
|
||||
// Else, play the song
|
||||
let song = await client.player.play(message.member.voice.channel, args.join(" "));
|
||||
const song = await client.player.play(message.member.voice.channel, args.join(" "));
|
||||
message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
module.exports.config = {
|
||||
name: "play",
|
||||
aliases: []
|
||||
}
|
||||
name: "play",
|
||||
aliases: []
|
||||
};
|
||||
@@ -1,12 +1,10 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
module.exports.run = async (client, message) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
|
||||
let queue = client.player.getQueue(message.guild.id);
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
const queue = client.player.getQueue(message.guild.id);
|
||||
|
||||
if(!queue) return message.channel.send(`**No songs currently playing ${emotes.error}**`);
|
||||
|
||||
@@ -14,10 +12,10 @@ module.exports.run = async (client, message, args) => {
|
||||
return `${i === 0 ? 'Current' : `#${i+1}`} - ${song.name} | ${song.author}`
|
||||
}).join('\n')));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
module.exports.config = {
|
||||
name: "queue",
|
||||
aliases: []
|
||||
}
|
||||
name: "queue",
|
||||
aliases: []
|
||||
};
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
module.exports.run = async (client, message) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
|
||||
let song = await client.player.resume(message.guild.id);
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
const song = await client.player.resume(message.guild.id);
|
||||
|
||||
if(!song) return message.channel.send(`**No songs currently playing ${emotes.error}**`);
|
||||
|
||||
|
||||
message.channel.send(`**Song ${song.name} resumed ${emotes.success}**`);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.config = {
|
||||
name: "resume",
|
||||
aliases: []
|
||||
}
|
||||
name: "resume",
|
||||
aliases: []
|
||||
};
|
||||
@@ -1,23 +1,21 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||
if(!args[0]) return message.channel.send(`**Please enter a number ${emotes.error}**`);
|
||||
if(isNaN(args[0])) return message.channel.send(`**Please enter a valid number ${emotes.error}**`);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`)
|
||||
if (!args[0]) return message.channel.send(`**Please enter a number ${emotes.error}**`)
|
||||
if (isNaN(args[0])) return message.channel.send(`**Please enter a valid number ${emotes.error}**`)
|
||||
|
||||
client.player.setVolume(message.guild.id, parseInt(args.join(" ")));
|
||||
|
||||
|
||||
message.channel.send("**Volume set to** `" + args.join(" ") + "`" + `** ** ${emotes.success}`);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.config = {
|
||||
name: "set-volume",
|
||||
aliases: []
|
||||
}
|
||||
name: "set-volume",
|
||||
aliases: []
|
||||
};
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
module.exports.run = async (client, message) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`)
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||
|
||||
let song = await client.player.skip(message.guild.id);
|
||||
const song = await client.player.skip(message.guild.id);
|
||||
|
||||
message.channel.send(`**Song ${song.name} skipped ${emotes.success}**`);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.config = {
|
||||
name: "skip",
|
||||
aliases: []
|
||||
}
|
||||
name: "skip",
|
||||
aliases: []
|
||||
};
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
const Discord = require("discord.js")
|
||||
const fs = require("fs")
|
||||
const emotes = require ("../config/emojis.json")
|
||||
const emotes = require ("../config/emojis.json");
|
||||
|
||||
module.exports.run = async (client, message, args) => {
|
||||
module.exports.run = async (client, message) => {
|
||||
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`)
|
||||
if(!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`)
|
||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||
|
||||
client.player.stop(message.guild.id);
|
||||
|
||||
|
||||
message.channel.send(`**Music stopped ${emotes.success}**`);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.config = {
|
||||
name: "stop",
|
||||
aliases: []
|
||||
}
|
||||
name: "stop",
|
||||
aliases: []
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user