mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 11:43:38 +00:00
Updated src
This commit is contained in:
23
src/client/commands/bug.js
Normal file
23
src/client/commands/bug.js
Normal file
@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
name: 'bug',
|
||||
alias: 'none',
|
||||
usage: '',
|
||||
description: 'Report a bug',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
|
||||
message.bugDescription = message.bugDescription.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.bugTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.bugDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
|
||||
},
|
||||
};
|
51
src/client/commands/help.js
Normal file
51
src/client/commands/help.js
Normal file
@ -0,0 +1,51 @@
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
alias: 'h',
|
||||
usage: '<command(opt)>',
|
||||
description: 'Get help using bot',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
if (args[1]) {
|
||||
if (!client.commands.has(args[1]) || (client.commands.has(args[1]) && client.commands.get(args[1]).omitFromHelp === true)) return msg.channel.send('That command does not exist');
|
||||
const command = client.commands.get(args[1]);
|
||||
|
||||
message.helpCommandTitle = client.messages.helpCommandTitle.replace("%client.config.prefix%", client.config.prefix);
|
||||
message.helpCommandTitle = message.helpCommandTitle.replace("%command.name%", command.name);
|
||||
message.helpCommandTitle = message.helpCommandTitle.replace("%command.usage%", command.usage);
|
||||
message.helpCommandDescription = client.messages.helpCommandDescription.replace("%command.description%", command.description);
|
||||
message.helpCommandDescription = message.helpCommandDescription.replace("%command.alias%", command.alias);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.helpCommandTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.helpCommandDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
} else {
|
||||
const categories = [];
|
||||
for (let i = 0; i < client.commands.size; i++) {
|
||||
if (!categories.includes(client.commands.array()[i].category)) categories.push(client.commands.array()[i].category);
|
||||
}
|
||||
let commands = '';
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`;
|
||||
}
|
||||
|
||||
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
|
||||
message.helpDescription = client.messages.helpDescription.replace("%commands%", commands);
|
||||
message.helpDescription = message.helpDescription.replace("%client.config.prefix%", client.config.prefix);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.helpTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.helpDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
}
|
||||
}
|
||||
};
|
18
src/client/commands/invite.js
Normal file
18
src/client/commands/invite.js
Normal file
@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
name: 'invite',
|
||||
alias: 'i',
|
||||
usage: '',
|
||||
description: 'Invite Bot',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.inviteTitle)
|
||||
.setColor(client.config.embedColor)
|
||||
.setURL(client.config.invite)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
28
src/client/commands/list.js
Normal file
28
src/client/commands/list.js
Normal file
@ -0,0 +1,28 @@
|
||||
module.exports = {
|
||||
name: 'list',
|
||||
alias: 'l',
|
||||
usage: '',
|
||||
description: 'List radio stations.',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}`
|
||||
const hashs = stations.split('**#**').length;
|
||||
for (let i = 0; i < hashs; i++) {
|
||||
stations = stations.replace('**#**', `**${i + 1}**`);
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.listTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(stations)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
53
src/client/commands/maintenance.js
Normal file
53
src/client/commands/maintenance.js
Normal file
@ -0,0 +1,53 @@
|
||||
module.exports = {
|
||||
name: 'maintenance',
|
||||
alias: 'm',
|
||||
usage: '',
|
||||
description: 'Bot Maintenance',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
if(!client.funcs.isDev(client.config.devId, msg.author.id)) return msg.channel.send(client.messageEmojis["error"] + client.messages.notAllowed);
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
let currentRadios = client.radio.keys();
|
||||
let radio = currentRadios.next();
|
||||
let stoppedRadios = "";
|
||||
|
||||
client.user.setStatus('dnd');
|
||||
|
||||
while (!radio.done) {
|
||||
let currentRadio = client.radio.get(radio.value);
|
||||
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
||||
|
||||
if(currentRadio){
|
||||
client.funcs.statisticsUpdate(client, currentRadio.currentGuild.guild, currentRadio);
|
||||
currentRadio.connection.dispatcher?.destroy();
|
||||
currentRadio.voiceChannel.leave();
|
||||
const cembed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(client.messages.sendedMaintenanceMessage)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
currentRadio.textChannel.send(cembed);
|
||||
client.radio.delete(radio.value);
|
||||
stoppedRadios += "-" + radio.value + ": " + currentRadio.currentGuild.guild.name + "\n";
|
||||
}
|
||||
radio = currentRadios.next();
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
30
src/client/commands/nowplaying.js
Normal file
30
src/client/commands/nowplaying.js
Normal file
@ -0,0 +1,30 @@
|
||||
module.exports = {
|
||||
name: 'nowplaying',
|
||||
alias: 'np',
|
||||
usage: '',
|
||||
description: 'Current Radio Station',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
if (!radio) return msg.channel.send('There is nothing playing.');
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
const completed = (radio.connection.dispatcher.streamTime.toFixed(0));
|
||||
|
||||
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%", radio.station.owner);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed, \"hh:mm:ss\")%", client.funcs.msToTime(completed, "hh:mm:ss"));
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.nowplayingTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.nowplayingDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
206
src/client/commands/play.js
Normal file
206
src/client/commands/play.js
Normal file
@ -0,0 +1,206 @@
|
||||
const {
|
||||
createAudioPlayer,
|
||||
createAudioResource,
|
||||
getVoiceConnection,
|
||||
joinVoiceChannel
|
||||
} = require("@discordjs/voice");
|
||||
const { createDiscordJSAdapter } = require("../utils/adapter");
|
||||
|
||||
module.exports = {
|
||||
name: "play",
|
||||
alias: "p",
|
||||
usage: "<song name>",
|
||||
description: "Play some music.",
|
||||
permission: "none",
|
||||
category: "radio",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
let url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
if (!radio) {
|
||||
if (!msg.member.voice.channel)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.noVoiceChannel
|
||||
);
|
||||
} else {
|
||||
if (voiceChannel !== radio.voiceChannel)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.wrongVoiceChannel
|
||||
);
|
||||
}
|
||||
if (!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace(
|
||||
"%client.config.supportGuild%",
|
||||
client.config.supportGuild
|
||||
);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
if (!args[1]) return msg.channel.send(client.messages.noQuery);
|
||||
const permissions = voiceChannel.permissionsFor(msg.client.user);
|
||||
if (!permissions.has("CONNECT")) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsConnect);
|
||||
}
|
||||
if (!permissions.has("SPEAK")) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsSpeak);
|
||||
}
|
||||
let station;
|
||||
const number = parseInt(args[1] - 1);
|
||||
if (url.startsWith("http")) {
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.errorStationURL
|
||||
);
|
||||
} else if (!isNaN(number)) {
|
||||
if (number > client.stations.length - 1) {
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.wrongStationNumber
|
||||
);
|
||||
} else {
|
||||
url = client.stations[number].stream[client.stations[number].stream.default];
|
||||
station = client.stations[number];
|
||||
}
|
||||
} else {
|
||||
if (args[1].length < 3)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.tooShortSearch
|
||||
);
|
||||
const sstation = await searchStation(args.slice(1).join(" "), client);
|
||||
if (!sstation)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.noSearchResults
|
||||
);
|
||||
url = sstation.stream[sstation.stream.default];
|
||||
station = sstation;
|
||||
}
|
||||
|
||||
if (radio) {
|
||||
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.station = station;
|
||||
radio.textChannel = msg.channel;
|
||||
play(msg.guild, client, url);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const construct = {
|
||||
textChannel: msg.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
audioPlayer: createAudioPlayer(),
|
||||
station: station,
|
||||
volume: 5
|
||||
};
|
||||
client.radio.set(msg.guild.id, construct);
|
||||
|
||||
try {
|
||||
const connection =
|
||||
getVoiceConnection(voiceChannel.guild.id) ??
|
||||
joinVoiceChannel({
|
||||
channelId: voiceChannel.id,
|
||||
guildId: voiceChannel.guild.id,
|
||||
adapterCreator: createDiscordJSAdapter(voiceChannel)
|
||||
});
|
||||
construct.connection = connection;
|
||||
let date = new Date();
|
||||
construct.startTime = date.getTime();
|
||||
play(msg.guild, client, url);
|
||||
|
||||
client.datastore.checkEntry(msg.guild.id);
|
||||
construct.currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
|
||||
if (!construct.currentGuild.statistics[construct.station.name]) {
|
||||
construct.currentGuild.statistics[construct.station.name] = {};
|
||||
construct.currentGuild.statistics[construct.station.name].time = 0;
|
||||
construct.currentGuild.statistics[construct.station.name].used = 0;
|
||||
client.datastore.updateEntry(msg.guild, construct.currentGuild);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
client.radio.delete(msg.guild.id);
|
||||
return msg.channel.send(client.messageEmojis["error"] + `An error occured: ${error}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
function play(guild, client, url) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(guild.id);
|
||||
const resource = createAudioResource(url);
|
||||
radio.connection.subscribe(radio.audioPlayer);
|
||||
radio.audioPlayer.play(resource);
|
||||
resource.playStream
|
||||
.on("readable", () => {
|
||||
console.log("Stream started");
|
||||
})
|
||||
.on("finish", () => {
|
||||
console.log("Stream finished");
|
||||
client.funcs.statisticsUpdate(client, guild, radio);
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(guild.id);
|
||||
return;
|
||||
})
|
||||
.on("error", error => {
|
||||
console.error(error);
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(guild.id);
|
||||
return radio.textChannel.send(client.messages.errorPlaying);
|
||||
});
|
||||
|
||||
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
|
||||
radio.textChannel.send(client.messageEmojis["play"] + message.play);
|
||||
}
|
||||
|
||||
function searchStation(key, client) {
|
||||
if (client.stations === null) return false;
|
||||
let foundStations = [];
|
||||
if (!key) return false;
|
||||
if (key == "radio") return false;
|
||||
if (key.startsWith("radio ")) key = key.slice(6);
|
||||
const probabilityIncrement = 100 / key.split(" ").length / 2;
|
||||
for (let i = 0; i < key.split(" ").length; i++) {
|
||||
client.stations
|
||||
.filter(
|
||||
x => x.name.toUpperCase().includes(key.split(" ")[i].toUpperCase()) || x === key
|
||||
)
|
||||
.forEach(x =>
|
||||
foundStations.push({ station: x, name: x.name, probability: probabilityIncrement })
|
||||
);
|
||||
}
|
||||
if (foundStations.length === 0) return false;
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
for (let j = 0; j < foundStations.length; j++) {
|
||||
if (foundStations[i] === foundStations[j] && i !== j) foundStations.splice(i, 1);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
if (foundStations[i].name.length > key.length) {
|
||||
foundStations[i].probability -=
|
||||
(foundStations[i].name.split(" ").length - key.split(" ").length) *
|
||||
(probabilityIncrement * 0.5);
|
||||
} else if (foundStations[i].name.length === key.length) {
|
||||
foundStations[i].probability += probabilityIncrement * 0.9;
|
||||
}
|
||||
|
||||
for (let j = 0; j < key.split(" ").length; j++) {
|
||||
if (!foundStations[i].name.toUpperCase().includes(key.toUpperCase().split(" ")[j])) {
|
||||
foundStations[i].probability -= probabilityIncrement * 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
let highestProbabilityStation;
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
if (
|
||||
!highestProbabilityStation ||
|
||||
highestProbabilityStation.probability < foundStations[i].probability
|
||||
)
|
||||
highestProbabilityStation = foundStations[i];
|
||||
if (
|
||||
highestProbabilityStation &&
|
||||
highestProbabilityStation.probability === foundStations[i].probability
|
||||
) {
|
||||
highestProbabilityStation = foundStations[i].station;
|
||||
}
|
||||
}
|
||||
return highestProbabilityStation;
|
||||
}
|
39
src/client/commands/statistics.js
Normal file
39
src/client/commands/statistics.js
Normal file
@ -0,0 +1,39 @@
|
||||
module.exports = {
|
||||
name: 'statistics',
|
||||
alias: 'stats',
|
||||
usage: '',
|
||||
description: 'Show usage statistics.',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
let stations = client.stations;
|
||||
let currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
let statistics = "";
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
||||
statistics = "You have not listened any radio station";
|
||||
} else {
|
||||
Object.keys(stations).forEach(function(station) {
|
||||
if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) > 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) > 0){
|
||||
statistics += `**${parseInt(station) + 1}** ` + stations[station].name + " \n";
|
||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "dd:hh:mm:ss") + "\n";
|
||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.statisticsTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(statistics)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
27
src/client/commands/status.js
Normal file
27
src/client/commands/status.js
Normal file
@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
name: 'status',
|
||||
alias: 'none',
|
||||
usage: '',
|
||||
description: 'Bot Status',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
|
||||
let uptime = client.funcs.msToTime(client.uptime, "dd:hh:mm:ss");
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.statusTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.addField(client.messages.statusField1, Date.now() - msg.createdTimestamp + "ms", true)
|
||||
.addField(client.messages.statusField2, client.ws.ping + "ms", true)
|
||||
.addField(client.messages.statusField3, uptime, true)
|
||||
.addField(client.messages.statusField4, client.config.version, true)
|
||||
.addField(client.messages.statusField5, client.config.hostedBy, true)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
|
||||
}
|
||||
};
|
18
src/client/commands/stop.js
Normal file
18
src/client/commands/stop.js
Normal file
@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
name: 'stop',
|
||||
description: 'Stop command.',
|
||||
alias: 's',
|
||||
usage: '',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(msg.guild.id);
|
||||
msg.channel.send(client.messageEmojis["stop"] + client.messages.stop);
|
||||
}
|
||||
}
|
||||
};
|
27
src/client/commands/volume.js
Normal file
27
src/client/commands/volume.js
Normal file
@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
name: 'volume',
|
||||
description: 'Volume command.',
|
||||
alias: 'none',
|
||||
usage: '<volume>',
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'radio',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
|
||||
if (!args[1] && radio) {
|
||||
message.currentVolume = client.messages.currentVolume.replace("%radio.volume%", radio.volume)
|
||||
return msg.channel.send(message.currentVolume);
|
||||
}
|
||||
const volume = parseFloat(args[1]);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (isNaN(volume)) return msg.channel.send(client.messages.invalidVolume);
|
||||
if (volume > 100) return msg.channel.send(client.messages.maxVolume);
|
||||
if (volume < 0) return msg.channel.send(client.messages.negativeVolume);
|
||||
radio.volume = volume;
|
||||
radio.connection.dispatcher.setVolume(volume / 5);
|
||||
message.newVolume = client.messages.newVolume.replace("%volume%", volume);
|
||||
return msg.channel.send(message.newVolume);
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user