mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 03:13:20 +00:00
Check client.stations exists in list, nowplaying and play commands.
This commit is contained in:
parent
75ff8fa34b
commit
e8080fb205
@ -6,6 +6,11 @@ module.exports = {
|
|||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(msg, args, client, Discord, command) {
|
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')}`
|
let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}`
|
||||||
const hashs = stations.split('**#**').length;
|
const hashs = stations.split('**#**').length;
|
||||||
for (let i = 0; i < hashs; i++) {
|
for (let i = 0; i < hashs; i++) {
|
||||||
|
@ -9,6 +9,10 @@ module.exports = {
|
|||||||
let message = {};
|
let message = {};
|
||||||
const radio = client.radio.get(msg.guild.id);
|
const radio = client.radio.get(msg.guild.id);
|
||||||
if (!radio) return msg.channel.send('There is nothing playing.');
|
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));
|
const completed = (radio.connection.dispatcher.streamTime.toFixed(0));
|
||||||
|
|
||||||
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
|
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
|
||||||
|
@ -6,6 +6,7 @@ module.exports = {
|
|||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'music',
|
category: 'music',
|
||||||
async execute(msg, args, client, Discord, command) {
|
async execute(msg, args, client, Discord, command) {
|
||||||
|
let message = {};
|
||||||
let url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
let url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||||
const radio = client.radio.get(msg.guild.id);
|
const radio = client.radio.get(msg.guild.id);
|
||||||
const voiceChannel = msg.member.voice.channel;
|
const voiceChannel = msg.member.voice.channel;
|
||||||
@ -14,7 +15,10 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
if (voiceChannel !== radio.voiceChannel) return msg.channel.send(client.messageEmojis["error"] + client.messages.wrongVoiceChannel);
|
if (voiceChannel !== radio.voiceChannel) return msg.channel.send(client.messageEmojis["error"] + client.messages.wrongVoiceChannel);
|
||||||
}
|
}
|
||||||
if(!client.stations) return msg.channel.send(client.messageEmojis["error"] + client.messages.errorToGetPlaylist);
|
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);
|
if (!args[1]) return msg.channel.send(client.messages.noQuery);
|
||||||
const permissions = voiceChannel.permissionsFor(msg.client.user);
|
const permissions = voiceChannel.permissionsFor(msg.client.user);
|
||||||
if (!permissions.has('CONNECT')) {
|
if (!permissions.has('CONNECT')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user