tweaks, improvements

This commit is contained in:
Erik 2021-06-19 23:59:42 +03:00
parent 2ae872c2e8
commit d7b884e331
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16
3 changed files with 10 additions and 6 deletions

View File

@ -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',

View File

@ -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) => {

View File

@ -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' }
);