mirror of
https://github.com/Burn-E99/TheArtificer.git
synced 2026-06-04 09:03:50 -04:00
Sonar Cleanup - Phase 1
This commit is contained in:
@@ -11,29 +11,29 @@ import { EmojiConf } from '../mod.d.ts';
|
||||
|
||||
const allEmojiAliases: string[] = [];
|
||||
|
||||
config.emojis.forEach((emoji: EmojiConf) => {
|
||||
allEmojiAliases.push(...emoji.aliases);
|
||||
config.emojis.forEach((emji: EmojiConf) => {
|
||||
allEmojiAliases.push(...emji.aliases);
|
||||
});
|
||||
|
||||
export const emoji = (message: DiscordenoMessage, command: string) => {
|
||||
// shortcut
|
||||
if (allEmojiAliases.indexOf(command)) {
|
||||
// Start looping thru the possible emojis
|
||||
config.emojis.some((emoji: EmojiConf) => {
|
||||
log(LT.LOG, `Checking if command was emoji ${JSON.stringify(emoji)}`);
|
||||
config.emojis.some((emji: EmojiConf) => {
|
||||
log(LT.LOG, `Checking if command was emoji ${JSON.stringify(emji)}`);
|
||||
// If a match gets found
|
||||
if (emoji.aliases.indexOf(command || '') > -1) {
|
||||
if (emji.aliases.indexOf(command || '') > -1) {
|
||||
// Light telemetry to see how many times a command is being run
|
||||
dbClient.execute(`CALL INC_CNT("emojis");`).catch((e) => {
|
||||
log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
|
||||
});
|
||||
|
||||
// Send the needed emoji1
|
||||
message.send(`<${emoji.animated ? 'a' : ''}:${emoji.name}:${emoji.id}>`).catch((e) => {
|
||||
// Send the needed emoji
|
||||
message.send(`<${emji.animated ? 'a' : ''}:${emji.name}:${emji.id}>`).catch((e) => {
|
||||
log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
|
||||
});
|
||||
// And attempt to delete if needed
|
||||
if (emoji.deleteSender) {
|
||||
if (emji.deleteSender) {
|
||||
message.delete().catch((e) => {
|
||||
log(LT.WARN, `Failed to delete message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user