All messages reworked

This commit is contained in:
MatteZ02 2020-03-12 02:50:05 +02:00
parent 035173b6cc
commit 0a1806c9ac
9 changed files with 22 additions and 32 deletions

View File

@ -7,7 +7,7 @@ module.exports = {
category: 'music',
async execute(msg, args, client, Discord, prefix) {
const radio = client.radio.get(msg.guild.id);
if (!radio || !radio.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.');
if (!radio || !radio.playing) return msg.channel.send('There is nothing playing.');
radio.time = radio.connection.dispatcher.streamTime;
const completed = (radio.time.toFixed(0));

View File

@ -10,17 +10,17 @@ module.exports = {
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('<:redx:674263474704220182> I\'m sorry but you need to be in a voice channel to play music!');
if (!msg.member.voice.channel) return msg.channel.send('you need to be in a voice channel to play music!');
} else {
if (voiceChannel !== radio.voiceChannel) return msg.channel.send('<:redx:674263474704220182> I\'m sorry but you need to be in the same voice channel as RadioX to play music!');
if (voiceChannel !== radio.voiceChannel) return msg.channel.send('you need to be in the same voice channel as RadioX to play music!');
}
if (!args[1]) return msg.channel.send('<:redx:674263474704220182> You need to use a link or search for a song!');
if (!args[1]) return msg.channel.send('You need to use a number or search for a supported station!');
const permissions = voiceChannel.permissionsFor(msg.client.user);
if (!permissions.has('CONNECT')) {
return msg.channel.send('<:redx:674263474704220182> I cannot connect to your voice channel, make sure I have the proper permissions!');
return msg.channel.send('I cannot connect to your voice channel.');
}
if (!permissions.has('SPEAK')) {
return msg.channel.send('<:redx:674263474704220182> I cannot speak in your voice channel, make sure I have the proper permissions!');
return msg.channel.send('I cannot speak in your voice channel.');
}
let station;
const number = parseInt(args[1] - 1);
@ -28,7 +28,7 @@ module.exports = {
return;
} else if (!isNaN(number)) {
if (number > client.stations.length - 1) {
return msg.channel.send('<:redx:674263474704220182> no such station!');
return msg.channel.send('no such station!');
} else {
url = client.stations[number].stream[client.stations[number].stream.default];
station = client.stations[number];
@ -65,7 +65,7 @@ module.exports = {
} catch (error) {
client.radio.delete(msg.guild.id);
client.debug_channel.send("Error with connecting to voice channel: " + error);
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`);
return msg.channel.send(`An error occured: ${error}`);
}
}
};

View File

@ -10,6 +10,6 @@ module.exports = {
radio.connection.dispatcher.destroy();
radio.voiceChannel.leave();
client.radio.delete(msg.guild.id);
msg.channel.send('<:stop:674685626108477519> Stopped the music!');
msg.channel.send('Stopped playback!');
}
};

View File

@ -7,15 +7,15 @@ module.exports = {
category: 'music',
execute(msg, args, client, Discord, prefix, command) {
const radio = client.radio.get(msg.guild.id);
if (!args[1] && radio) return msg.channel.send(`:loud_sound: The current volume is: **${radio.volume}**`);
if (!args[1] && radio) return msg.channel.send(`current volume: **${radio.volume}**`);
const volume = parseFloat(args[1]);
if (client.funcs.check(client, msg, command)) {
if (isNaN(volume)) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.');
if (volume > 100) return msg.channel.send('<:redx:674263474704220182> The max volume is `100`!');
if (volume < 0) return msg.channel.send('<:redx:674263474704220182> The volume needs to be a positive number!');
if (isNaN(volume)) return msg.channel.send('you need to enter a valid __number__.');
if (volume > 100) return msg.channel.send('The max volume is `100`!');
if (volume < 0) return msg.channel.send('The volume needs to be a positive number!');
radio.volume = volume;
radio.connection.dispatcher.setVolume(volume / 5);
return msg.channel.send(`<:volumehigh:674685637626167307> I set the volume to: **${volume}**`);
return msg.channel.send(`volume is now: **${volume}**`);
}
}
};

View File

@ -4,16 +4,6 @@ module.exports = {
if (msg.author.bot || !msg.guild) return;
let prefix = client.config.prefix;
const args = msg.content.slice(prefix.length).split(' ');
if (msg.mentions.users.first()) {
if (msg.mentions.users.first().id === client.user.id) {
if (!args[1]) return;
if (args[1] === 'prefix') return msg.channel.send(`My prefix here is: \`${prefix}\`.`);
if (args[1] === 'help') {
const command = client.commands.get("help");
return client.funcs.exe(msg, args, client, Discord, prefix, command);
}
}
}
if (!msg.content.startsWith(prefix)) return;
if (!args[0]) return;
const commandName = args[0].toLowerCase();

View File

@ -24,7 +24,7 @@ module.exports = {
radio.voiceChannel.leave();
client.radio.delete(msg.guild.id);
client.debug_channel.send("Error with connecting to voice channel: " + error);
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`);
return msg.channel.send(`An error occured: ${error}`);
}
}
if (newState.channel !== radio.voiceChannel) {

View File

@ -1,11 +1,11 @@
module.exports = function (client, msg, command) {
const radio = client.radio.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author);
if (!radio || !radio.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing!');
if (!radio || !radio.playing) return msg.channel.send('There is nothing playing!');
if (msg.author.id !== client.config.devId) {
if (msg.member.voice.channel !== radio.voiceChannel) return msg.channel.send(`<:redx:674263474704220182> I'm sorry but you need to be in the same voice channel as RadioX to use this command!`);
if (msg.member.voice.channel !== radio.voiceChannel) return msg.channel.send(`you need to be in the same voice channel as RadioX to use this command!`);
if (!permissions.has(command.permission)) {
msg.channel.send(`<:redx:674263474704220182> You need the \`${command.permission}\` permission to use this command!`);
msg.channel.send(`You need the \`${command.permission}\` permission to use this command!`);
return false;
} else return true;
} else return true;

View File

@ -1,11 +1,11 @@
module.exports = function (msg, args, client, Discord, prefix, command) {
const permissions = msg.channel.permissionsFor(msg.client.user);
if (!permissions.has('EMBED_LINKS')) return msg.channel.send('<:redx:674263474704220182> I cannot send embeds (Embed links), make sure I have the proper permissions!');
if (!permissions.has('EMBED_LINKS')) return msg.channel.send('I cannot send embeds (Embed links).');
try {
command.uses++;
command.execute(msg, args, client, Discord, prefix, command);
} catch (error) {
msg.reply(`<:redx:674263474704220182> there was an error trying to execute that command! Please contact support with \`${prefix}bug\`!`);
msg.reply(`Error!`);
console.error(error);
}
};

View File

@ -18,12 +18,12 @@ module.exports = async function (guild, client, url) {
console.error(error);
radio.voiceChannel.leave();
client.radio.delete(guild.id);
return radio.textChannel.send('<:redx:674263474704220182> An error has occured while playing radio!');
return radio.textChannel.send('An error has occured while playing radio!');
});
dispatcher.setVolume(radio.volume / 10);
radio.textChannel.send('Start playing');
radio.textChannel.send(`Start playing: ${radio.station.name}`);
radio.playing = true;
}