mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 03:53:17 +00:00
commit
d3296efa57
@ -1,4 +1,5 @@
|
|||||||
# RadioX by EximiaBots
|
# RadioX by EximiaBots
|
||||||
|
We will bring you finnish radio to your discord server.
|
||||||
|
|
||||||
Join our Discord Server
|
Join our Discord Server
|
||||||
https://discord.gg/rRA65Mn
|
https://discord.gg/rRA65Mn
|
||||||
|
@ -3,13 +3,24 @@ module.exports = {
|
|||||||
alias: 'none',
|
alias: 'none',
|
||||||
usage: '',
|
usage: '',
|
||||||
description: 'Report a bug',
|
description: 'Report a bug',
|
||||||
onlyDev: false,
|
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
async execute(msg, args, client, Discord, prefix) {
|
async execute(msg, args, client, Discord, prefix) {
|
||||||
|
|
||||||
|
let developers = "";
|
||||||
|
let user = "";
|
||||||
|
for(i = 0; i < client.config.devId.length; i++){
|
||||||
|
user = await client.users.fetch(client.config.devId[i]);
|
||||||
|
if(i == client.config.devId.length-1){
|
||||||
|
developers += user.tag;
|
||||||
|
} else {
|
||||||
|
developers += user.tag + " & ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`)
|
.setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`)
|
||||||
.setDescription(`Matte#0002\nOr join the support server: ${client.config.supportGuild}`)
|
.setDescription(`${developers}\nOr join the support server: ${client.config.supportGuild}`)
|
||||||
.setColor(client.config.embedColor);
|
.setColor(client.config.embedColor);
|
||||||
msg.channel.send(embed);
|
msg.channel.send(embed);
|
||||||
},
|
},
|
||||||
|
@ -3,12 +3,11 @@ module.exports = {
|
|||||||
alias: 'h',
|
alias: 'h',
|
||||||
usage: '<command(opt)>',
|
usage: '<command(opt)>',
|
||||||
description: 'See the help for RadioX.',
|
description: 'See the help for RadioX.',
|
||||||
onlyDev: false,
|
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(msg, args, client, Discord, prefix, command) {
|
execute(msg, args, client, Discord, prefix, command) {
|
||||||
if (args[1]) {
|
if (args[1]) {
|
||||||
if (!client.commands.has(args[1]) || (client.commands.has(args[1]) && client.commands.get(args[1]).omitFromHelp === true && msg.guild.id !== '489083836240494593')) return msg.channel.send('That command does not exist');
|
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]);
|
const command = client.commands.get(args[1]);
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(`${client.global.db.guilds[msg.guild.id].prefix}${command.name} ${command.usage}`)
|
.setTitle(`${client.global.db.guilds[msg.guild.id].prefix}${command.name} ${command.usage}`)
|
||||||
@ -23,7 +22,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
let commands = '';
|
let commands = '';
|
||||||
for (let i = 0; i < categories.length; i++) {
|
for (let i = 0; i < categories.length; i++) {
|
||||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp && !x.onlyDev).map(x => `\`${x.name}\``).join(', ')}\n`;
|
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`;
|
||||||
}
|
}
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(`${client.user.username} help:`)
|
.setTitle(`${client.user.username} help:`)
|
||||||
|
@ -3,7 +3,6 @@ module.exports = {
|
|||||||
alias: 'i',
|
alias: 'i',
|
||||||
usage: '',
|
usage: '',
|
||||||
description: 'Invite RadioX.',
|
description: 'Invite RadioX.',
|
||||||
onlyDev: false,
|
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(msg, args, client, Discord, prefix) {
|
execute(msg, args, client, Discord, prefix) {
|
||||||
|
@ -3,7 +3,6 @@ module.exports = {
|
|||||||
alias: 'np',
|
alias: 'np',
|
||||||
usage: '',
|
usage: '',
|
||||||
description: 'See the currently playing song position and length.',
|
description: 'See the currently playing song position and length.',
|
||||||
onlyDev: false,
|
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'music',
|
category: 'music',
|
||||||
async execute(msg, args, client, Discord, prefix) {
|
async execute(msg, args, client, Discord, prefix) {
|
||||||
@ -11,11 +10,10 @@ module.exports = {
|
|||||||
if (!radio) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.');
|
if (!radio) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.');
|
||||||
if (!radio.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.');
|
if (!radio.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.');
|
||||||
radio.time = radio.connection.dispatcher.streamTime;
|
radio.time = radio.connection.dispatcher.streamTime;
|
||||||
let completed = (radio.time.toFixed(0));
|
const completed = (radio.time.toFixed(0));
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle("__Now playing__")
|
.setTitle("__Now playing__")
|
||||||
.setDescription(`<a:aNotes:674602408105476106>**Now playing:** ${radio.url}\n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``)
|
.setDescription(`<a:aNotes:674602408105476106>**Now playing:** ${radio.url}\n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``)
|
||||||
.setThumbnail(thumbnail._rejectionHandler0)
|
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
return msg.channel.send(embed);
|
return msg.channel.send(embed);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ module.exports = {
|
|||||||
alias: 'p',
|
alias: 'p',
|
||||||
usage: '<song name>',
|
usage: '<song name>',
|
||||||
description: 'Play some music.',
|
description: 'Play some music.',
|
||||||
onlyDev: false,
|
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'music',
|
category: 'music',
|
||||||
async execute(msg, args, client, Discord, prefix) {
|
async execute(msg, args, client, Discord, prefix) {
|
||||||
@ -25,7 +24,8 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (radio) {
|
if (radio) {
|
||||||
radio.connection.dispatcher.end();
|
radio.connection.dispatcher.destroy();
|
||||||
|
client.funcs.play(msg.guild, client, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
const construct = {
|
const construct = {
|
||||||
|
@ -3,14 +3,13 @@ module.exports = {
|
|||||||
description: 'Stop command.',
|
description: 'Stop command.',
|
||||||
alias: 'none',
|
alias: 'none',
|
||||||
usage: '',
|
usage: '',
|
||||||
onlyDev: false,
|
permission: 'none',
|
||||||
permission: 'MANAGE_CHANNELS',
|
|
||||||
category: 'music',
|
category: 'music',
|
||||||
execute(msg, args, client, Discord, prefix, command) {
|
execute(msg, args, client, Discord, prefix, command) {
|
||||||
const radio = client.radio.get(msg.guild.id);
|
const radio = client.radio.get(msg.guild.id);
|
||||||
if (client.funcs.check(client, msg, command)) {
|
radio.connection.dispatcher.destroy();
|
||||||
radio.connection.dispatcher.end();
|
radio.voiceChannel.leave();
|
||||||
msg.channel.send('<:stop:674685626108477519> Stopped the music!')
|
client.radio.delete(guild.id);
|
||||||
}
|
msg.channel.send('<:stop:674685626108477519> Stopped the music!');
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -3,7 +3,6 @@ module.exports = {
|
|||||||
description: 'Volume command.',
|
description: 'Volume command.',
|
||||||
alias: 'none',
|
alias: 'none',
|
||||||
usage: '<volume>',
|
usage: '<volume>',
|
||||||
onlyDev: false,
|
|
||||||
permission: 'MANAGE_MESSAGES',
|
permission: 'MANAGE_MESSAGES',
|
||||||
category: 'music',
|
category: 'music',
|
||||||
execute(msg, args, client, Discord, prefix, command) {
|
execute(msg, args, client, Discord, prefix, command) {
|
||||||
|
23
config.js
Normal file
23
config.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
require('dotenv/config');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
//credentials
|
||||||
|
token: "Njg0MTA5NTM1MzEyNjA5NDA5.XmOUxg.u2XChDQMZtokzueQRqGWc-CAvWE",
|
||||||
|
|
||||||
|
//support
|
||||||
|
supportGuild: "https://discord.gg/rRA65Mn",
|
||||||
|
devId: [
|
||||||
|
"493174343484833802",
|
||||||
|
"360363051792203779"
|
||||||
|
],
|
||||||
|
|
||||||
|
//misc
|
||||||
|
embedColor: "#88aa00",
|
||||||
|
invite: "https://discordapp.com/api/oauth2/authorize?client_id=684109535312609409&permissions=3427328&scope=bot",
|
||||||
|
|
||||||
|
//Settings
|
||||||
|
prefix: "rx>",
|
||||||
|
volume: 5
|
||||||
|
|
||||||
|
}
|
@ -2,8 +2,7 @@ module.exports = {
|
|||||||
name: 'message',
|
name: 'message',
|
||||||
async execute(client, msg, Discord) {
|
async execute(client, msg, Discord) {
|
||||||
if (msg.author.bot || !msg.guild) return;
|
if (msg.author.bot || !msg.guild) return;
|
||||||
let prefix = client.config.prefix
|
let prefix = client.config.prefix;
|
||||||
if (client.config.devMode) prefix = client.config.devPrefix;
|
|
||||||
const args = msg.content.slice(prefix.length).split(' ');
|
const args = msg.content.slice(prefix.length).split(' ');
|
||||||
if (msg.mentions.users.first()) {
|
if (msg.mentions.users.first()) {
|
||||||
if (msg.mentions.users.first().id === client.user.id) {
|
if (msg.mentions.users.first().id === client.user.id) {
|
||||||
@ -20,8 +19,6 @@ module.exports = {
|
|||||||
const commandName = args[0].toLowerCase();
|
const commandName = args[0].toLowerCase();
|
||||||
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
|
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
|
||||||
if (!command && msg.content !== `${prefix}`) return;
|
if (!command && msg.content !== `${prefix}`) return;
|
||||||
if (command.onlyDev && msg.author.id !== client.config.devId) return msg.channel.send('<:redx:674263474704220182> You are not allowed to do that!');
|
|
||||||
if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send('<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!');
|
|
||||||
client.funcs.exe(msg, args, client, Discord, prefix, command);
|
client.funcs.exe(msg, args, client, Discord, prefix, command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'ready',
|
name: 'ready',
|
||||||
async execute(client, Discord) {
|
async execute(client, Discord) {
|
||||||
const debugChannel = await client.channels.fetch(client.config.debug_channel);
|
console.log('RadioX');
|
||||||
client.debug_channel = debugChannel
|
console.log('We will bring you finnish radio to your discord server');
|
||||||
if (client.config.devMode) {
|
console.log('(c)2020 EximiaBots by Warén Media / Christer Warén & MatteZ02');
|
||||||
console.log('dev mode');
|
|
||||||
}
|
|
||||||
console.log('- Activated -');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
17
package.json
17
package.json
@ -1,18 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "radiox",
|
"name": "radiox",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "We will bring you finnish radio to your discord server",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"start": "node ."
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/warengroup/eximiabots-radiox.git"
|
||||||
|
},
|
||||||
|
"author": "EximiaBots",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/warengroup/eximiabots-radiox/issues"
|
||||||
},
|
},
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@discordjs/opus": "^0.1.0",
|
||||||
"discord.js": "^12.0.1",
|
"discord.js": "^12.0.1",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security",
|
||||||
"node-opus": "^0.3.3",
|
|
||||||
"path": "^0.12.7"
|
"path": "^0.12.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ module.exports = class extends Client {
|
|||||||
this.radio = new Map();
|
this.radio = new Map();
|
||||||
this.funcs = {};
|
this.funcs = {};
|
||||||
this.dispatcher = {};
|
this.dispatcher = {};
|
||||||
this.config = require('./config/config.js');
|
this.config = require('../config.js');
|
||||||
|
|
||||||
fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
|
fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
|
||||||
this.funcs[filename.slice(0, -3)] = require(`./funcs/${filename}`);
|
this.funcs[filename.slice(0, -3)] = require(`./funcs/${filename}`);
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
require('dotenv/config');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
//credentials
|
|
||||||
token: process.env.TOKEN,
|
|
||||||
devToken: process.env.DEVTOKEN,
|
|
||||||
//support guild
|
|
||||||
supportGuild: "https://discord.gg/rRA65Mn",
|
|
||||||
//channels
|
|
||||||
debug_channel: "634718645188034560",
|
|
||||||
primary_test_channel: "617633098296721409",
|
|
||||||
secondary_test_channel: "570531724002328577",
|
|
||||||
devId: "360363051792203779",
|
|
||||||
//misc
|
|
||||||
embedColor: "",
|
|
||||||
invite: "https://discordapp.com/api/oauth2/authorize?client_id=684109535312609409&permissions=3427328&scope=bot",
|
|
||||||
//Settings
|
|
||||||
devMode: false,
|
|
||||||
prefix: "rx>",
|
|
||||||
devPrefix: "-",
|
|
||||||
volume: 5,
|
|
||||||
}
|
|
@ -6,11 +6,6 @@ module.exports = function (msg, args, client, Discord, prefix, command) {
|
|||||||
command.execute(msg, args, client, Discord, prefix, command);
|
command.execute(msg, args, client, Discord, prefix, command);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
msg.reply(`<:redx:674263474704220182> there was an error trying to execute that command! Please contact support with \`${prefix}bug\`!`);
|
msg.reply(`<:redx:674263474704220182> there was an error trying to execute that command! Please contact support with \`${prefix}bug\`!`);
|
||||||
const embed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(`Musix ${error.toString()}`)
|
|
||||||
.setDescription(error.stack.replace(/at /g, '**at **'))
|
|
||||||
.setColor('#b50002');
|
|
||||||
client.debug_channel.send(embed);
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
17
struct/funcs/msToTime.js
Normal file
17
struct/funcs/msToTime.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
module.exports = function msToTime(duration, format) {
|
||||||
|
var seconds = Math.floor((duration / 1000) % 60),
|
||||||
|
minutes = Math.floor((duration / (1000 * 60)) % 60),
|
||||||
|
hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
|
||||||
|
days = Math.floor((duration / (1000 * 60 * 60 * 24)) % 24);
|
||||||
|
|
||||||
|
days = (days < 10) ? "0" + days : days;
|
||||||
|
hours = (hours < 10) ? "0" + hours : hours;
|
||||||
|
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
||||||
|
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
||||||
|
|
||||||
|
if (format === "hh:mm:ss") {
|
||||||
|
return `${hours}:${minutes}:${seconds}`;
|
||||||
|
} else if (format === "dd:hh:mm:ss") {
|
||||||
|
return `${days}:${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ module.exports = async function (guild, client, url) {
|
|||||||
.play(url, { bitrate: 1024, passes: 10, volume: 1, highWaterMark: 1 << 25 })
|
.play(url, { bitrate: 1024, passes: 10, volume: 1, highWaterMark: 1 << 25 })
|
||||||
.on("finish", () => {
|
.on("finish", () => {
|
||||||
radio.voiceChannel.leave();
|
radio.voiceChannel.leave();
|
||||||
radio.delete();
|
client.radio.delete(guild.id);
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
dispatcher.on('start', () => {
|
dispatcher.on('start', () => {
|
||||||
@ -13,7 +13,6 @@ module.exports = async function (guild, client, url) {
|
|||||||
});
|
});
|
||||||
dispatcher.on('error', error => {
|
dispatcher.on('error', error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
client.channels.fetch(client.config.debug_channel).send('Error with the dispatcher: ' + error);
|
|
||||||
radio.voiceChannel.leave();
|
radio.voiceChannel.leave();
|
||||||
client.radio.delete(guild.id);
|
client.radio.delete(guild.id);
|
||||||
return radio.textChannel.send('<:redx:674263474704220182> An error has occured while playing radio!');
|
return radio.textChannel.send('<:redx:674263474704220182> An error has occured while playing radio!');
|
||||||
|
Loading…
Reference in New Issue
Block a user