Move emojis to messages variable

This commit is contained in:
Christer Warén 2023-06-06 02:27:46 +03:00
parent 2d17c33d21
commit 348ac90cba
19 changed files with 68 additions and 106 deletions

View File

@ -6,9 +6,10 @@ import Streamer from "./client/classes/Streamer";
import Statistics from "./client/classes/Statistics"; import Statistics from "./client/classes/Statistics";
import { command } from "./client/commands"; import { command } from "./client/commands";
import config from "./config"; import config from "./config";
import { messages } from "./client/messages";
import { events } from "./client/events" import { events } from "./client/events"
import { funcs } from "./client/funcs"; import { funcs } from "./client/funcs";
import { messages } from "./client/messages";
const GatewayIntents = new IntentsBitField(); const GatewayIntents = new IntentsBitField();
GatewayIntents.add( GatewayIntents.add(
@ -28,7 +29,6 @@ export default class RadioClient extends Client {
public streamer: Streamer | null; public streamer: Streamer | null;
public statistics: Statistics | null; public statistics: Statistics | null;
public radio: Radio | null; public radio: Radio | null;
public messageEmojis: any | null;
public developers: string | undefined; public developers: string | undefined;
constructor() { constructor() {
@ -41,7 +41,6 @@ export default class RadioClient extends Client {
this.streamer = null; this.streamer = null;
this.statistics = null; this.statistics = null;
this.radio = null; this.radio = null;
this.messageEmojis = null;
console.log('RadioX ' + this.config.version); console.log('RadioX ' + this.config.version);
console.log('Internet Radio to your Discord guild'); console.log('Internet Radio to your Discord guild');

View File

@ -7,7 +7,7 @@ export default {
category: 'info', category: 'info',
async execute(interaction: ChatInputCommandInteraction, client: RadioClient) { async execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
if(!client.user) return interaction.reply({ if(!client.user) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
@ -18,13 +18,13 @@ export default {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(message.bugTitle) .setTitle(message.bugTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.setDescription(message.bugDescription) .setDescription(message.bugDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -8,7 +8,7 @@ export default {
execute(interaction: ChatInputCommandInteraction, client: RadioClient) { execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
if(!client.user) return interaction.reply({ if(!client.user) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
@ -28,13 +28,13 @@ export default {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(message.helpTitle) .setTitle(message.helpTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.setDescription(message.helpDescription) .setDescription(message.helpDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -8,7 +8,7 @@ export default {
execute(interaction: ChatInputCommandInteraction, client: RadioClient) { execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
if(!client.user) return interaction.reply({ if(!client.user) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
@ -21,7 +21,7 @@ export default {
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -11,7 +11,7 @@ export default {
if(!client.stations) { if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + message.errorToGetPlaylist, content: client.messages.emojis["error"] + message.errorToGetPlaylist,
ephemeral: true ephemeral: true
}); });
} }
@ -29,13 +29,13 @@ export default {
let embed = new EmbedBuilder() let embed = new EmbedBuilder()
.setTitle(client.messages.listTitle) .setTitle(client.messages.listTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["list"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.setDescription(stations) .setDescription(stations)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -14,7 +14,7 @@ export default {
let message: any = {}; let message: any = {};
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply({ if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.notAllowed, content: client.messages.emojis["error"] + client.messages.notAllowed,
ephemeral: true ephemeral: true
}); });
@ -123,7 +123,7 @@ export default {
.setDescription(options.find((option: APISelectMenuOption) => option.value == action)?.label || "-") .setDescription(options.find((option: APISelectMenuOption) => option.value == action)?.label || "-")
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -11,7 +11,7 @@ export default {
const radio = client.radio?.get(interaction.guild?.id); const radio = client.radio?.get(interaction.guild?.id);
if(!client.stations) return interaction.reply({ if(!client.stations) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
@ -21,7 +21,7 @@ export default {
let station = client.stations[index]; let station = client.stations[index];
if(!station) return interaction.reply({ if(!station) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noSearchResults, content: client.messages.emojis["error"] + client.messages.noSearchResults,
ephemeral: true ephemeral: true
}); });

View File

@ -21,13 +21,13 @@ export default {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(client.messages.nowplayingTitle) .setTitle(client.messages.nowplayingTitle)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))) .setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messages.emojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.setDescription(message.nowplayingDescription) .setDescription(message.nowplayingDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -16,7 +16,7 @@ export default {
if(!client.stations) { if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + message.errorToGetPlaylist, content: client.messages.emojis["error"] + message.errorToGetPlaylist,
ephemeral: true ephemeral: true
}); });
} }
@ -39,12 +39,12 @@ export default {
if(!(interaction.member instanceof GuildMember)) return; if(!(interaction.member instanceof GuildMember)) return;
const voiceChannel = interaction.member?.voice.channel; const voiceChannel = interaction.member?.voice.channel;
if (!voiceChannel) return interaction.reply({ if (!voiceChannel) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noVoiceChannel, content: client.messages.emojis["error"] + client.messages.noVoiceChannel,
ephemeral: true ephemeral: true
}); });
if (radio) { if (radio) {
if (voiceChannel !== radio.voiceChannel) return interaction.reply({ if (voiceChannel !== radio.voiceChannel) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.wrongVoiceChannel, content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
ephemeral: true ephemeral: true
}); });
} }
@ -55,13 +55,13 @@ export default {
const permissions = voiceChannel.permissionsFor(interaction.client.user); const permissions = voiceChannel.permissionsFor(interaction.client.user);
if (!permissions?.has(PermissionFlagsBits.Connect)) { if (!permissions?.has(PermissionFlagsBits.Connect)) {
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noPermsConnect, content: client.messages.emojis["error"] + client.messages.noPermsConnect,
ephemeral: true ephemeral: true
}); });
} }
if (!permissions?.has(PermissionFlagsBits.Speak)) { if (!permissions?.has(PermissionFlagsBits.Speak)) {
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noPermsSpeak, content: client.messages.emojis["error"] + client.messages.noPermsSpeak,
ephemeral: true ephemeral: true
}); });
} }
@ -71,7 +71,7 @@ export default {
const number = parseInt((query - 1) as unknown as string); const number = parseInt((query - 1) as unknown as string);
if (number > client.stations.length - 1) { if (number > client.stations.length - 1) {
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + client.messages.wrongStationNumber, content: client.messages.emojis["error"] + client.messages.wrongStationNumber,
ephemeral: true ephemeral: true
}); });
} else { } else {
@ -80,7 +80,7 @@ export default {
} else { } else {
if(!(typeof query === 'string')) return; if(!(typeof query === 'string')) return;
if(query.length < 3) return interaction.reply({ if(query.length < 3) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.tooShortSearch, content: client.messages.emojis["error"] + client.messages.tooShortSearch,
ephemeral: true ephemeral: true
}); });
@ -96,7 +96,7 @@ export default {
const sstation = await client.stations.search(query, type); const sstation = await client.stations.search(query, type);
if (!sstation) return interaction.reply({ if (!sstation) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noSearchResults, content: client.messages.emojis["error"] + client.messages.noSearchResults,
ephemeral: true ephemeral: true
}); });
station = sstation; station = sstation;
@ -142,7 +142,7 @@ export default {
console.log(error); console.log(error);
client.radio?.delete(interaction.guild?.id); client.radio?.delete(interaction.guild?.id);
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + `An error occured: ${error}`, content: client.messages.emojis["error"] + `An error occured: ${error}`,
ephemeral: true ephemeral: true
}); });
} }

View File

@ -12,7 +12,7 @@ export default {
const radio = client.radio?.get(interaction.guild?.id); const radio = client.radio?.get(interaction.guild?.id);
if(!client.stations) return interaction.reply({ if(!client.stations) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
@ -22,7 +22,7 @@ export default {
let station = client.stations[index]; let station = client.stations[index];
if(!station) return interaction.reply({ if(!station) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noSearchResults, content: client.messages.emojis["error"] + client.messages.noSearchResults,
ephemeral: true ephemeral: true
}); });

View File

@ -10,7 +10,7 @@ export default {
let message: any = {}; let message: any = {};
if(!interaction.guild) return interaction.reply({ if(!interaction.guild) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
@ -22,7 +22,7 @@ export default {
if(!client.stations) { if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + message.errorToGetPlaylist, content: client.messages.emojis["error"] + message.errorToGetPlaylist,
ephemeral: true ephemeral: true
}); });
} }
@ -35,13 +35,13 @@ export default {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(client.messages.statisticsTitle) .setTitle(client.messages.statisticsTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["statistics"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.setDescription(statistics) .setDescription(statistics)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -9,7 +9,7 @@ export default {
let message: any = {}; let message: any = {};
if(!client.user) return interaction.reply({ if(!client.user) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
@ -18,7 +18,7 @@ export default {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(message.statusTitle) .setTitle(message.statusTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.addFields([ .addFields([
{ name: client.messages.statusField1, value: uptime }, { name: client.messages.statusField1, value: uptime },
@ -30,7 +30,7 @@ export default {
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
interaction.reply({ interaction.reply({

View File

@ -14,7 +14,7 @@ export default {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(client.user?.username || "-") .setTitle(client.user?.username || "-")
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["stop"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.addFields({ .addFields({
name: client.messages.nowplayingTitle, name: client.messages.nowplayingTitle,
@ -23,7 +23,7 @@ export default {
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
if(!radio.message){ if(!radio.message){
@ -43,7 +43,7 @@ export default {
client.radio?.delete(interaction.guild?.id); client.radio?.delete(interaction.guild?.id);
interaction.reply({ interaction.reply({
content: client.messageEmojis["stop"] + client.messages.stop, content: client.messages.emojis["stop"] + client.messages.stop,
ephemeral: true ephemeral: true
}); });
} }

View File

@ -1,44 +0,0 @@
import RadioClient from "../Client";
export const emojis = {
name: 'emojis',
async execute(client: RadioClient): Promise<any> {
let customEmojis: any = {
logo: "<:RadioX:688765708808487072>",
eximiabots: "<:EximiaBots:693277919929303132>",
list: "<:RadioXList:688541155519889482>",
play: "<:RadioXPlay:688541155712827458>",
stop: "<:RadioXStop:688541155377414168>",
statistics: "<:RadioXStatistics:694954485507686421>",
maintenance: "<:RadioXMaintenance:695043843057254493>",
error: "<:RadioXError:688541155792781320>",
prev: "<:RadioXPrev:882153637370023957>",
next: "<:RadioXNext:882153637474893834>"
};
let fallbackEmojis: any = {
logo: "RadioX",
eximiabots: "EximiaBots",
list: "📜",
play: "▶️",
stop: "⏹️",
statistics: "📊",
maintenance: "🛠️",
error: "❌",
prev: "⏪",
next: "⏩"
};
client.messageEmojis = {};
for (const customEmojiName in customEmojis) {
const customEmojiID = customEmojis[customEmojiName].replace(/[^0-9]+/g, '');
const customEmoji = client.emojis.cache.get(customEmojiID);
if (customEmoji) {
client.messageEmojis[customEmojiName] = customEmojis[customEmojiName];
} else {
client.messageEmojis[customEmojiName] = fallbackEmojis[customEmojiName];
}
}
}
}

View File

@ -7,7 +7,7 @@ export default {
if(client.config.maintenanceMode){ if(client.config.maintenanceMode){
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messages.emojis["error"] + client.messages.maintenance,
ephemeral: true ephemeral: true
}); });
} }
@ -16,7 +16,7 @@ export default {
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return; if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
if (!permissions.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({ if (!permissions.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noPermsEmbed, content: client.messages.emojis["error"] + client.messages.noPermsEmbed,
ephemeral: true ephemeral: true
}); });
@ -29,7 +29,7 @@ export default {
command.execute(interaction, client); command.execute(interaction, client);
} catch (error) { } catch (error) {
interaction.reply({ interaction.reply({
content: client.messageEmojis["error"] + client.messages.runningCommandFailed, content: client.messages.emojis["error"] + client.messages.runningCommandFailed,
ephemeral: true ephemeral: true
}); });
console.error(error); console.error(error);
@ -43,7 +43,7 @@ export default {
command.execute(interaction, client, command); command.execute(interaction, client, command);
} catch (error) { } catch (error) {
interaction.reply({ interaction.reply({
content: client.messageEmojis["error"] + client.messages.runningCommandFailed, content: client.messages.emojis["error"] + client.messages.runningCommandFailed,
ephemeral: true ephemeral: true
}); });
console.error(error); console.error(error);

View File

@ -4,7 +4,6 @@ import Radio from "../classes/Radio";
import Stations from "../classes/Stations"; import Stations from "../classes/Stations";
import Streamer from "../classes/Streamer"; import Streamer from "../classes/Streamer";
import Statistics from "../classes/Statistics"; import Statistics from "../classes/Statistics";
import { emojis } from "../emojis"
import commands from "../commands"; import commands from "../commands";
export default { export default {
@ -65,9 +64,6 @@ export default {
client.statistics = new Statistics(); client.statistics = new Statistics();
client.statistics.calculateGlobal(client); client.statistics.calculateGlobal(client);
/*EMOJIS*/
emojis.execute(client);
/*COMMANDS*/ /*COMMANDS*/
commands.execute(client); commands.execute(client);

View File

@ -1,27 +1,26 @@
import RadioClient from "../../Client"; import RadioClient from "../../Client";
import { command } from "../commands"; import { command } from "../commands";
export default function check(client: RadioClient, interaction: any, command: command) { export default function check(client: RadioClient, interaction: any, command: command) {
let message: any = {}; let message: any = {};
const radio = client.radio?.get(interaction.guild.id); const radio = client.radio?.get(interaction.guild.id);
if(!client.stations) { if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
interaction.reply({ interaction.reply({
content: client.messageEmojis["error"] + message.errorToGetPlaylist, content: client.messages.emojis["error"] + message.errorToGetPlaylist,
ephemeral: true ephemeral: true
}); });
return false; return false;
} }
if (!radio) { if (!radio) {
interaction.reply({ interaction.reply({
content: client.messageEmojis["error"] + client.messages.notPlaying, content: client.messages.emojis["error"] + client.messages.notPlaying,
ephemeral: true ephemeral: true
}); });
return false; return false;
} }
if (interaction.member.voice.channel !== radio.voiceChannel) { if (interaction.member.voice.channel !== radio.voiceChannel) {
interaction.reply({ interaction.reply({
content: client.messageEmojis["error"] + client.messages.wrongVoiceChannel, content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
ephemeral: true ephemeral: true
}); });
return false; return false;

View File

@ -16,7 +16,7 @@ export default async function play(client: RadioClient, interaction: any, guild:
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(client.user?.username || "-") .setTitle(client.user?.username || "-")
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))) .setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messages.emojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor as ColorResolvable) .setColor(client.config.embedColor as ColorResolvable)
.addFields({ .addFields({
name: client.messages.nowplayingTitle, name: client.messages.nowplayingTitle,
@ -25,38 +25,38 @@ export default async function play(client: RadioClient, interaction: any, guild:
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
const buttons = new ActionRowBuilder() const buttons = new ActionRowBuilder()
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId('list') .setCustomId('list')
.setEmoji(client.messageEmojis["list"]) .setEmoji(client.messages.emojis["list"])
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId('prev') .setCustomId('prev')
.setEmoji(client.messageEmojis["prev"]) .setEmoji(client.messages.emojis["prev"])
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId('stop') .setCustomId('stop')
.setEmoji(client.messageEmojis["stop"]) .setEmoji(client.messages.emojis["stop"])
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId('next') .setCustomId('next')
.setEmoji(client.messageEmojis["next"]) .setEmoji(client.messages.emojis["next"])
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId('statistics') .setCustomId('statistics')
.setEmoji(client.messageEmojis["statistics"]) .setEmoji(client.messages.emojis["statistics"])
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
); );
@ -74,7 +74,7 @@ export default async function play(client: RadioClient, interaction: any, guild:
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name); message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
interaction?.reply({ interaction?.reply({
content: client.messageEmojis["play"] + message.play, content: client.messages.emojis["play"] + message.play,
ephemeral: true ephemeral: true
}); });

View File

@ -35,5 +35,17 @@ export const messages = {
statusField4: ":hourglass: Latency", statusField4: ":hourglass: Latency",
statusField5: ":globe_with_meridians: Hosted by", statusField5: ":globe_with_meridians: Hosted by",
errorStationURL: "Station can't be URL", errorStationURL: "Station can't be URL",
maintenance: "Shhhh... We are now sleeping and dreaming about new features to implement. Will be back soon." maintenance: "Shhhh... We are now sleeping and dreaming about new features to implement. Will be back soon.",
emojis: {
logo: "<:RadioX:688765708808487072>",
eximiabots: "<:EximiaBots:693277919929303132>",
list: "<:RadioXList:688541155519889482>",
play: "<:RadioXPlay:688541155712827458>",
stop: "<:RadioXStop:688541155377414168>",
statistics: "<:RadioXStatistics:694954485507686421>",
maintenance: "<:RadioXMaintenance:695043843057254493>",
error: "<:RadioXError:688541155792781320>",
prev: "<:RadioXPrev:882153637370023957>",
next: "<:RadioXNext:882153637474893834>"
}
}; };