Radio Stations from JSON file

This commit is contained in:
Christer Warén
2020-03-09 01:26:24 +02:00
parent e0d25d97a5
commit 6e11029461
9 changed files with 60 additions and 23 deletions

View File

@ -20,8 +20,9 @@ module.exports = {
const embed = new Discord.MessageEmbed()
.setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`)
.setColor(client.config.embedColor)
.setDescription(`${developers}\nOr join the support server: ${client.config.supportGuild}`)
.setColor(client.config.embedColor);
.setFooter('EximiaBots by Warén Media');
msg.channel.send(embed);
},
};

View File

@ -11,9 +11,9 @@ module.exports = {
const command = client.commands.get(args[1]);
const embed = new Discord.MessageEmbed()
.setTitle(`${client.global.db.guilds[msg.guild.id].prefix}${command.name} ${command.usage}`)
.setDescription(command.description)
.setFooter(`Command Alias: \`${command.alias}\``)
.setColor(client.config.embedColor)
.setDescription(command.description + `\n Command Alias: \`${command.alias}\``)
.setFooter('EximiaBots by Warén Media')
msg.channel.send(embed);
} else {
const categories = [];
@ -26,9 +26,9 @@ module.exports = {
}
const embed = new Discord.MessageEmbed()
.setTitle(`${client.user.username} help:`)
.setDescription(commands)
.setFooter(`"${client.config.prefix}help <command>" to see more information about a command.`)
.setColor(client.config.embedColor)
.setDescription(commands + `\n "${client.config.prefix}help <command>" to see more information about a command.`)
.setFooter('EximiaBots by Warén Media');
msg.channel.send(embed);
}
}

View File

@ -8,8 +8,9 @@ module.exports = {
execute(msg, args, client, Discord, prefix) {
const embed = new Discord.MessageEmbed()
.setTitle(`Invite ${client.user.username} to your Discord server!`)
.setURL(client.config.invite)
.setColor(client.config.embedColor)
.setURL(client.config.invite)
.setFooter('EximiaBots by Warén Media');
return msg.channel.send(embed);
}
};

View File

@ -11,11 +11,14 @@ module.exports = {
if (!radio.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.');
radio.time = radio.connection.dispatcher.streamTime;
const completed = (radio.time.toFixed(0));
const stations = await client.funcs.radiostations();
const embed = new Discord.MessageEmbed()
.setTitle("__Now playing__")
.setDescription(`<a:aNotes:674602408105476106>**Now playing:** ${radio.url}\n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``)
.setTitle("<a:aNotes:674602408105476106> Now Playing")
.setColor(client.config.embedColor)
.setDescription(`**${stations[radio.station].name}** \n Owner: ${stations[radio.station].owner} \n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``)
.setFooter('EximiaBots by Warén Media');
return msg.channel.send(embed);
}
};
};

View File

@ -6,7 +6,7 @@ module.exports = {
permission: 'none',
category: 'music',
async execute(msg, args, client, Discord, prefix) {
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
const station = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
const radio = client.radio.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
if (!radio) {
@ -25,25 +25,26 @@ module.exports = {
if (radio) {
radio.connection.dispatcher.destroy();
client.funcs.play(msg.guild, client, url);
radio.station = station;
client.funcs.play(msg.guild, client, station);
return;
}
const construct = {
const construct = {
textChannel: msg.channel,
voiceChannel: voiceChannel,
connection: null,
playing: false,
url: url,
station: station-1,
name: null,
volume: client.config.volume,
};
client.radio.set(msg.guild.id, construct);
try {
const connection = await voiceChannel.join();
construct.connection = connection;
client.funcs.play(msg.guild, client, url);
client.funcs.play(msg.guild, client, station);
} catch (error) {
client.radio.delete(msg.guild.id);
client.debug_channel.send("Error with connecting to voice channel: " + error);