small fixes

This commit is contained in:
Erik 2022-07-28 14:52:30 +03:00
parent 0042a54f95
commit 8452f0360b
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
6 changed files with 24 additions and 10 deletions

View File

@ -339,6 +339,9 @@ Failed to display cases in one embed, try a smaller page size.
for {targets} for {targets}
//target{plural}: //target{plural}:
[COMMAND_HISTORY_SUCCESSMODERATOR]
by {moderator}
[COMMAND_HISTORY_NO_EXPORT_PERMS] [COMMAND_HISTORY_NO_EXPORT_PERMS]
Must be admin to export moderation history. Must be admin to export moderation history.

View File

@ -86,6 +86,7 @@ class Logger {
webhook(text, type) { webhook(text, type) {
if (!this._webhook) return;
const message = text.replace(new RegExp(process.env.DISCORD_TOKEN, 'gu'), '<redacted>') const message = text.replace(new RegExp(process.env.DISCORD_TOKEN, 'gu'), '<redacted>')
.replace(new RegExp(username, 'gu'), '<redacted>'); .replace(new RegExp(username, 'gu'), '<redacted>');

View File

@ -13,16 +13,20 @@ class EvalCommand extends Command {
name: 'eval', name: 'eval',
aliases: ['e', 'evaluate'], aliases: ['e', 'evaluate'],
restricted: true, restricted: true,
module: 'developer' module: 'developer',
options: [
{ name: 'code' },
{ name: 'async', flag: true, valueOptional: true, defaultValue: true }
]
}); });
} }
async execute(invoker, { parameters: params }) { async execute(invoker, { code, async }) {
const args = {}; // Temporary args until I figure out how I want to implement them const args = {}; // Temporary args until I figure out how I want to implement them
params = params.join(' '); let params = code.value;
if (args.async) params = `(async () => {${params}})()`; if (async.value) params = `(async () => {${params}})()`;
const { guild, author, member, client } = invoker; //eslint-disable-line no-unused-vars const { guild, author, member, client } = invoker; //eslint-disable-line no-unused-vars
let response = null; let response = null;

View File

@ -191,12 +191,18 @@ class HistoryCommand extends SlashCommand {
const type = invoker.format('COMMAND_HISTORY_SUCCESSTYPE', { old: oldest?.value || false }, { code: true }); const type = invoker.format('COMMAND_HISTORY_SUCCESSTYPE', { old: oldest?.value || false }, { code: true });
try { try {
return { let targets = '';
content: invoker.format('COMMAND_HISTORY_SUCCESS', { if (user || channel) targets = invoker.format('COMMAND_HISTORY_SUCCESSTARGETS', {
targets: user || channel ? invoker.format('COMMAND_HISTORY_SUCCESSTARGETS', {
//plural: parsed.length === 1 ? '' : 's', //plural: parsed.length === 1 ? '' : 's',
targets: `**${Util.escapeMarkdown(user?.value.tag || channel?.value.name)}**` //parsed.map((p) => `**${Util.escapeMarkdown(p.display)}**`).join(' ') targets: `**${Util.escapeMarkdown(user?.value.tag || channel?.value.name)}**` //parsed.map((p) => `**${Util.escapeMarkdown(p.display)}**`).join(' ')
}) : '', });
else if (moderator) targets = invoker.format('COMMAND_HISTORY_SUCCESSMODERATOR', {
moderator: `**${Util.escapeMarkdown(moderator.value.tag)}**`
});
return {
content: invoker.format('COMMAND_HISTORY_SUCCESS', {
targets,
type type
}), }),
emoji: 'success', emoji: 'success',

View File

@ -27,7 +27,7 @@ class StaffCommand extends SlashCommand {
// const role = await guild.resolveRole(staff.role); // const role = await guild.resolveRole(staff.role);
// if(!role) return invoker.editReply({ index: 'COMMAND_STAFF_ERROR', emoji: 'failure' }); // if(!role) return invoker.editReply({ index: 'COMMAND_STAFF_ERROR', emoji: 'failure' });
await channel.send({ return channel.send({
content: guild.format('COMMAND_STAFF_SUMMON', { author: author.tag, role: staff.role }), content: guild.format('COMMAND_STAFF_SUMMON', { author: author.tag, role: staff.role }),
allowedMentions: { parse: ['roles'] } // roles: [staff.role], allowedMentions: { parse: ['roles'] } // roles: [staff.role],
}); });

View File

@ -13,7 +13,7 @@ class ClientPermissions extends Inhibitor {
async execute(invoker, command) { async execute(invoker, command) {
const missing = invoker.channel.permissionsFor(invoker.guild.members.me).missing(command.clientPermissions); const missing = invoker.channel.permissionsFor(this.client.user).missing(command.clientPermissions);
if (missing.length) return super._fail({ error: true, missing: missing.join(', '), silent: true }); if (missing.length) return super._fail({ error: true, missing: missing.join(', '), silent: true });
return super._succeed(); return super._succeed();