Changes to branding, custom and fallback emojis. Fixed help command.

This commit is contained in:
Christer Warén 2020-03-15 03:30:15 +02:00
parent d0d6841353
commit c15076f834
10 changed files with 58 additions and 20 deletions

View File

@ -14,9 +14,10 @@ module.exports = {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(message.bugTitle) .setTitle(message.bugTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/686296221433725076.png")
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setDescription(message.bugDescription) .setDescription(message.bugDescription)
.setFooter('EximiaBots by Warén Media'); .setFooter('EximiaBots by Warén Media', 'https://cdn.discordapp.com/emojis/687022937978568760.png');
msg.channel.send(embed); msg.channel.send(embed);
}, },

View File

@ -15,14 +15,15 @@ module.exports = {
message.helpCommandTitle = client.messages.helpCommandTitle.replace("%client.config.prefix%", client.config.prefix); 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.name%", command.name);
message.helpCommandTitle = message.helpCommandTitle.replace("%command.usage%", command.usage); message.helpCommandTitle = message.helpCommandTitle.replace("%command.usage%", command.usage);
message.helpCommandDescription = client.messages.helpCommandTitle.replace("%command.description%", command.description); message.helpCommandDescription = client.messages.helpCommandDescription.replace("%command.description%", command.description);
message.helpCommandDescription = message.helpCommandDescription.replace("%command.alias%", command.alias); message.helpCommandDescription = message.helpCommandDescription.replace("%command.alias%", command.alias);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(message.helpCommandTitle) .setTitle(message.helpCommandTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/686296221433725076.png")
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setDescription(message.helpCommandDescription) .setDescription(message.helpCommandDescription)
.setFooter('EximiaBots by Warén Media') .setFooter('EximiaBots by Warén Media', 'https://cdn.discordapp.com/emojis/687022937978568760.png');
msg.channel.send(embed); msg.channel.send(embed);
} else { } else {
const categories = []; const categories = [];
@ -40,9 +41,10 @@ module.exports = {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(message.helpTitle) .setTitle(message.helpTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/686296221433725076.png")
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setDescription(message.helpDescription) .setDescription(message.helpDescription)
.setFooter('EximiaBots by Warén Media'); .setFooter('EximiaBots by Warén Media', 'https://cdn.discordapp.com/emojis/687022937978568760.png');
msg.channel.send(embed); msg.channel.send(embed);
} }
} }

View File

@ -10,9 +10,10 @@ module.exports = {
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username); message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(message.inviteTitle) .setTitle(message.inviteTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/686296221433725076.png")
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setURL(client.config.invite) .setURL(client.config.invite)
.setFooter('EximiaBots by Warén Media'); .setFooter('EximiaBots by Warén Media', 'https://cdn.discordapp.com/emojis/687022937978568760.png');
return msg.channel.send(embed); return msg.channel.send(embed);
} }
}; };

View File

@ -14,9 +14,10 @@ module.exports = {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(client.messages.listTitle) .setTitle(client.messages.listTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setDescription(stations) .setDescription(stations)
.setFooter('EximiaBots by Warén Media') .setFooter('EximiaBots by Warén Media', 'https://cdn.discordapp.com/emojis/687022937978568760.png');
return msg.channel.send(embed); return msg.channel.send(embed);
} }
}; };

View File

@ -18,9 +18,10 @@ module.exports = {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(client.messages.nowplayingTitle) .setTitle(client.messages.nowplayingTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setDescription(message.nowplayingDescription) .setDescription(message.nowplayingDescription)
.setFooter('EximiaBots by Warén Media'); .setFooter('EximiaBots by Warén Media', 'https://cdn.discordapp.com/emojis/687022937978568760.png');
return msg.channel.send(embed); return msg.channel.send(embed);
} }
}; };

View File

@ -10,17 +10,17 @@ module.exports = {
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;
if (!radio) { if (!radio) {
if (!msg.member.voice.channel) return msg.channel.send(client.messages.noVoiceChannel); if (!msg.member.voice.channel) return msg.channel.send(client.messageEmojis["x"] + client.messages.noVoiceChannel);
} else { } else {
if (voiceChannel !== radio.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel); if (voiceChannel !== radio.voiceChannel) return msg.channel.send(client.messageEmojis["x"] + client.messages.wrongVoiceChannel);
} }
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')) {
return msg.channel.send(client.messages.noPermsConnect); return msg.channel.send(client.messageEmojis["x"] + client.messages.noPermsConnect);
} }
if (!permissions.has('SPEAK')) { if (!permissions.has('SPEAK')) {
return msg.channel.send(client.messages.noPermsSpeak); return msg.channel.send(client.messageEmojis["x"] + client.messages.noPermsSpeak);
} }
let station; let station;
const number = parseInt(args[1] - 1); const number = parseInt(args[1] - 1);
@ -28,15 +28,15 @@ module.exports = {
return; return;
} else if (!isNaN(number)) { } else if (!isNaN(number)) {
if (number > client.stations.length - 1) { if (number > client.stations.length - 1) {
return msg.channel.send(client.messages.wrongStationNumber); return msg.channel.send(client.messageEmojis["x"] + client.messages.wrongStationNumber);
} else { } else {
url = client.stations[number].stream[client.stations[number].stream.default]; url = client.stations[number].stream[client.stations[number].stream.default];
station = client.stations[number]; station = client.stations[number];
} }
} else { } else {
if (args[1].length < 3) return msg.channel.send(client.messages.tooShortSearch); if (args[1].length < 3) return msg.channel.send(client.messageEmojis["x"] + client.messages.tooShortSearch);
const sstation = await searchStation(args.slice(1).join(' '), client); const sstation = await searchStation(args.slice(1).join(' '), client);
if (!sstation) return msg.channel.send(client.messages.noSearchResults); if (!sstation) return msg.channel.send(client.messageEmojis["x"] + client.messages.noSearchResults);
url = sstation.stream[sstation.stream.default]; url = sstation.stream[sstation.stream.default];
station = sstation station = sstation
} }
@ -65,7 +65,7 @@ module.exports = {
play(msg.guild, client, url); play(msg.guild, client, url);
} catch (error) { } catch (error) {
client.radio.delete(msg.guild.id); client.radio.delete(msg.guild.id);
return msg.channel.send(`An error occured: ${error}`); return msg.channel.send(client.messageEmojis["x"] + `An error occured: ${error}`);
} }
} }
}; };
@ -95,7 +95,7 @@ function play(guild, client, url) {
dispatcher.setVolume(radio.volume / 10); dispatcher.setVolume(radio.volume / 10);
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name); message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
radio.textChannel.send(message.play); radio.textChannel.send(client.messageEmojis["play"] + message.play);
radio.playing = true; radio.playing = true;
}; };

View File

@ -11,7 +11,7 @@ module.exports = {
radio.connection.dispatcher.destroy(); radio.connection.dispatcher.destroy();
radio.voiceChannel.leave(); radio.voiceChannel.leave();
client.radio.delete(msg.guild.id); client.radio.delete(msg.guild.id);
msg.channel.send(client.messages.stop); msg.channel.send(client.messageEmojis["stop"] + client.messages.stop);
} }
} }
}; };

View File

@ -31,5 +31,7 @@ module.exports = {
client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json') client.stations = await fetch('https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json')
.then(res => res.json()); .then(res => res.json());
}, 3600000); }, 3600000);
require(`../struct/emojis.js`).execute(client, Discord);
} }
} }

View File

@ -3,16 +3,16 @@ module.exports = function (client, msg, command) {
const radio = client.radio.get(msg.guild.id); const radio = client.radio.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author); const permissions = msg.channel.permissionsFor(msg.author);
if (!radio || !radio.playing){ if (!radio || !radio.playing){
msg.channel.send(client.messages.notPlaying); msg.channel.send(client.messageEmojis["x"] + client.messages.notPlaying);
return false; return false;
} }
if (msg.member.voice.channel !== radio.voiceChannel){ if (msg.member.voice.channel !== radio.voiceChannel){
msg.channel.send(client.messages.wrongVoiceChannel); msg.channel.send(client.messageEmojis["x"] + client.messages.wrongVoiceChannel);
return false; return false;
} }
if (!permissions.has(command.permission)) { if (!permissions.has(command.permission)) {
message.noPerms = client.messages.noPerms.replace("%commands.permissions%", commands.permissions); message.noPerms = client.messages.noPerms.replace("%commands.permissions%", commands.permissions);
msg.channel.send(message.noPerms); msg.channel.send(client.messageEmojis["x"] + message.noPerms);
return false; return false;
} else return true; } else return true;
}; };

30
struct/emojis.js Normal file
View File

@ -0,0 +1,30 @@
module.exports = {
name: 'emojis',
async execute(client, Discord) {
let customEmojis = {
list: "<:RadioXList:688541155519889482>",
play: "<:RadioXPlay:688541155712827458>",
stop: "<:RadioXStop:688541155377414168>",
x: "<:RadioXX:688541155792781320>"
};
let fallbackEmojis = {
list: "📜",
play: "▶️",
stop: "⏹️",
x: "❌"
};
client.messageEmojis = {};
for(customEmojiName in customEmojis){
customEmojiID = customEmojis[customEmojiName].replace(/[^0-9]+/g, '');
customEmoji = client.emojis.cache.get(customEmojiID);
if(customEmoji){
client.messageEmojis[customEmojiName] = customEmojis[customEmojiName];
} else {
client.messageEmojis[customEmojiName] = fallbackEmojis[customEmojiName];
}
}
}
}