From d7b884e3319abd85b8d630c442631d1023015b13 Mon Sep 17 00:00:00 2001 From: Navy Date: Sat, 19 Jun 2021 23:59:42 +0300 Subject: [PATCH] tweaks, improvements --- config.example.js | 1 + structure/Modmail.js | 9 ++++++--- structure/commands/Eval.js | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config.example.js b/config.example.js index 2f7b66e..2e27a27 100644 --- a/config.example.js +++ b/config.example.js @@ -14,6 +14,7 @@ module.exports = { channelSweepInterval: 10, // How often channel transitions should be processed in minutes saveInterval: 1, // How often modmail history should be written to file in minutes evalAccess: [], // Array of IDs that should have access to the bot's eval function + anonColor: 0, // A colour value, 0 will default to the bot's highest coloured role clientOptions: { intents: [ // Needs at least these 'GUILDS', diff --git a/structure/Modmail.js b/structure/Modmail.js index ce2ae88..2d53700 100644 --- a/structure/Modmail.js +++ b/structure/Modmail.js @@ -13,6 +13,7 @@ class Modmail { this.readInactive = client._options.readInactive; this.channelSweepInterval = client._options.channelSweepInterval; this.saveInterval = client._options.saveInterval; + this.anonColor = client._options.anonColor; this.updatedThreads = []; this.mmcache = {}; @@ -29,6 +30,8 @@ class Modmail { this.bansServer = this.client.bansServer; if (!this.bansServer) this.client.logger.warn(`Missing bans server`); + + if (!this.anonColor) this.anonColor = this.mainServer.me.highestRoleColor; const { channels } = this.mainServer; this.newMail = channels.resolve(this.categories[0]); @@ -203,7 +206,7 @@ class Modmail { } ], footer: { text: `• User ID: ${user.id}` }, - color: 479397 + color: guild.me.highestRoleColor }; if (member.banned) embed.description = `**__USER IS IN BANLAND__**`; else embed.fields.push({ @@ -318,7 +321,7 @@ class Modmail { icon_url: anon ? this.mainServer.iconURL({ dynamic: true }) : author.displayAvatarURL({ dynamic: true }) }, description: content, - color: member.highestRoleColor + color: anon ? this.anonColor : member.highestRoleColor }; const sent = await targetUser.send({ embed }).catch((err) => { @@ -371,7 +374,7 @@ class Modmail { icon_url: anon ? this.mainServer.iconURL({ dynamic: true }) : author.displayAvatarURL({ dynamic: true }) }, description: content, - color: member.highestRoleColor + color: anon ? this.anonColor : member.highestRoleColor }; const sent = await target.send({ embed }).catch((err) => { diff --git a/structure/commands/Eval.js b/structure/commands/Eval.js index 7db3037..634ee2f 100644 --- a/structure/commands/Eval.js +++ b/structure/commands/Eval.js @@ -14,7 +14,7 @@ class Eval extends Command { async execute(message, { clean }) { - const { guild, author, member, client } = message; //eslint-disable-line no-unused-vars + const { guild, author, member, client, channel } = message; //eslint-disable-line no-unused-vars try { let evaled = eval(clean); //eslint-disable-line no-eval @@ -30,7 +30,7 @@ class Eval extends Command { if (evaled.length > 1850) { evaled = `${evaled.substring(0, 1850)}...`; } - await message.respond( + await channel.send( `Evaluation was successful.\`\`\`js\n${evaled}\`\`\``, { emoji: 'success' } ); @@ -42,7 +42,7 @@ class Eval extends Command { //if (args.log) guild._debugLog(`[${message.author.tag}] Evaluation Fail: ${msg}`); if (msg.length > 2000) msg = `${msg.substring(0, 1900)}...`; - await message.respond( + await channel.send( `Evaluation failed.\`\`\`js\n${msg}\`\`\``, { emoji: 'failure' } );