emoji stuff, auto format emojis in the format func
This commit is contained in:
parent
190bab9c41
commit
8bfd4d2cc5
@ -1,6 +1,6 @@
|
||||
const escapeRegex = require('escape-string-regexp');
|
||||
const { Structures } = require('discord.js');
|
||||
const { Collection } = require('../../util');
|
||||
const { Collection, Emojis } = require('../../util');
|
||||
|
||||
const Guild = Structures.extend('Guild', (Guild) => {
|
||||
|
||||
@ -123,12 +123,16 @@ const Guild = Structures.extend('Guild', (Guild) => {
|
||||
parameters.prefix = this.prefix;
|
||||
let template = this.client.localeLoader.template(language, index);
|
||||
|
||||
for(const emoji of Object.keys(Emojis)) {
|
||||
parameters[`emoji_${emoji}`] = Emojis[emoji];
|
||||
}
|
||||
|
||||
if (!template) {
|
||||
return `**Missing language index \`${language} [${index}]\` in languages. Contact a bot developer about this.**`;
|
||||
}
|
||||
|
||||
for (const [param, val] of Object.entries(parameters)) {
|
||||
template = template.replace(new RegExp(`{${escapeRegex(param.toLowerCase())}}`, 'giu'), val);
|
||||
template = template.replace(new RegExp(`{${escapeRegex(param.toLowerCase())}}`, 'gi'), val);
|
||||
}
|
||||
|
||||
if (code) {
|
||||
|
@ -3,7 +3,7 @@ const { Structures } = require('discord.js');
|
||||
const escapeRegex = require('escape-string-regexp');
|
||||
const emojis = require('../../util/emojis.json');
|
||||
|
||||
const { Util } = require('../../util/');
|
||||
const { Util, Emojis } = require('../../util/');
|
||||
const { stripIndents } = require('common-tags')
|
||||
|
||||
const Message = Structures.extend('Message', (Message) => {
|
||||
@ -30,6 +30,10 @@ const Message = Structures.extend('Message', (Message) => {
|
||||
parameters.prefix = this.guild?.prefix;
|
||||
let template = this.client.localeLoader.template(language, index); //.languages[language][index];
|
||||
|
||||
for(const emoji of Object.keys(Emojis)) {
|
||||
parameters[`emoji_${emoji}`] = Emojis[emoji];
|
||||
}
|
||||
|
||||
if(!template) {
|
||||
return `**Missing language index \`${language} [${index}]\` in languages. Contact a bot developer about this.**`;
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
{
|
||||
"success": "👍",
|
||||
"failure": "👎",
|
||||
"loading": "⚙",
|
||||
"success": "<:success:723595130808041512>",
|
||||
"failure": "<:failure:723595130912637018>",
|
||||
"loading": "<a:loading:723589386356129832>",
|
||||
"warning": "⚠",
|
||||
"enabled": "<:enabled:591893186884927508>",
|
||||
"disabled": "<:disabled:591893185995735050>",
|
||||
"enabled": "<:enabled:723589993733423215>",
|
||||
"disabled": "<:disabled:723589993506799618>",
|
||||
"text-channel": "<:textchannel:716414423094525952>",
|
||||
"voice-channel": "<:voicechannel:716414422662512762>"
|
||||
"voice-channel": "<:voicechannel:716414422662512762>",
|
||||
"pin": "📌",
|
||||
"note": "📝",
|
||||
"trash": "🗑️"
|
||||
}
|
Loading…
Reference in New Issue
Block a user