forked from Galactic/galactic-bot
cleanup n fixes
This commit is contained in:
parent
55ba970bb4
commit
c762182e2a
@ -1,4 +1,4 @@
|
||||
const { Client, Collection, Options } = require('discord.js');
|
||||
const { Client, Collection } = require('discord.js');
|
||||
const chalk = require('chalk');
|
||||
const { inspect } = require('util');
|
||||
|
||||
|
@ -43,7 +43,7 @@ class PollCommand extends SlashCommand {
|
||||
required: true
|
||||
}]
|
||||
}],
|
||||
guildOnly: true
|
||||
guildOnly: true,
|
||||
});
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ class PollCommand extends SlashCommand {
|
||||
time: 90, editReply: true
|
||||
});
|
||||
if (!response || !response.content) return invoker.editReply({ index: 'COMMAND_POLL_TIMEOUT' });
|
||||
await response.delete();
|
||||
if(invoker.channel.permissionsFor(guild.me).has('MANAGE_MESSAGES')) await response.delete();
|
||||
const { content } = response;
|
||||
if (content.toLowerCase() === 'stop') break;
|
||||
if (content.toLowerCase() === 'cancel') return invoker.editReply({ index: 'GENERAL_CANCELLED' });
|
||||
|
@ -44,7 +44,8 @@ class DmInfraction extends Setting {
|
||||
],
|
||||
messages: {
|
||||
default: 'You were **{infraction}** {from|on} the server `{server}`, your infraction details are below.'
|
||||
}
|
||||
},
|
||||
anonymous: false
|
||||
},
|
||||
definitions: {
|
||||
enabled: 'BOOLEAN',
|
||||
@ -86,16 +87,22 @@ class DmInfraction extends Setting {
|
||||
name: 'enabled',
|
||||
description: 'Enable or disable the sending of infractions in DMs',
|
||||
type: 'BOOLEAN'
|
||||
})
|
||||
}),
|
||||
{
|
||||
name: 'anonymous',
|
||||
type: 'BOOLEAN',
|
||||
description: 'Whether who issued the infraction is shown in moderation logs'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async execute(interaction, opts, setting) {
|
||||
|
||||
const { enabled, infractions, infraction, message } = opts;
|
||||
const { enabled, infractions, infraction, message, anonymous } = opts;
|
||||
|
||||
if (enabled) setting.enabled = enabled.value;
|
||||
if (anonymous) setting.anonymous = anonymous.value;
|
||||
|
||||
if (infractions) {
|
||||
const response = await this._prompt(interaction, {
|
||||
|
@ -34,7 +34,8 @@ class ModerationLog extends Setting {
|
||||
module: 'logging',
|
||||
default: {
|
||||
channel: null,
|
||||
infractions: Infractions
|
||||
infractions: Infractions,
|
||||
anonymous: false
|
||||
},
|
||||
definitions: {
|
||||
channel: 'GUILD_TEXT',
|
||||
@ -58,15 +59,21 @@ class ModerationLog extends Setting {
|
||||
{ name: 'set', value: 'set' },
|
||||
{ name: 'reset', value: 'reset' },
|
||||
]
|
||||
})
|
||||
}),
|
||||
{
|
||||
name: 'anonymous',
|
||||
type: 'BOOLEAN',
|
||||
description: 'Whether who issued the infraction is shown in moderation logs'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async execute(interaction, opts, setting) {
|
||||
|
||||
const { channel, infractions } = opts;
|
||||
const { channel, infractions, anonymous } = opts;
|
||||
|
||||
if (anonymous) setting.anonymous = anonymous.value;
|
||||
if (channel) setting.channel = channel.value.id;
|
||||
|
||||
if (infractions) {
|
||||
|
@ -153,7 +153,7 @@ class Infraction {
|
||||
return `https://discord.com/channels/${this.guildId}/${this.channelId}/${this.messageId}`;
|
||||
}
|
||||
|
||||
_embed(dm) {
|
||||
_embed(dm = false) {
|
||||
|
||||
const embed = {
|
||||
author: {
|
||||
@ -169,9 +169,10 @@ class Infraction {
|
||||
};
|
||||
let description = "";
|
||||
|
||||
const anonymous = dm ? this.guild._settings.dminfraction.anonymous : this.guild._settings.moderation.anonymous || false;
|
||||
description += `${this.guild.format('INFRACTION_DESCRIPTION', {
|
||||
type: this.dictionary.past.toUpperCase(),
|
||||
moderator: `${Util.escapeMarkdown(this.executor.tag)}`,
|
||||
moderator: `${Util.escapeMarkdown(anonymous ? this.client.user.tag : this.executor.tag)}`,
|
||||
reason: Util.escapeMarkdown(this.reason.length > Constants.MaxCharacters ?
|
||||
`${this.reason.substring(0, Constants.MaxCharacters - 3)}...` :
|
||||
this.reason, { italic: false, underline: false, strikethrough: false }),
|
||||
|
@ -185,7 +185,7 @@ class SettingsMigrator {
|
||||
wordfilter: result.wordFilter,
|
||||
linkfilter: result.linkFilter ? { ...result.linkFilter, greylist: [], mode: undefined } : undefined,
|
||||
messages: result.messageLog ? { ...result.messageLog, enabled: Boolean(result.messageLog.channel) } : undefined,
|
||||
wordwatcher: result.wordWatcher,
|
||||
wordwatcher: result.wordwatcher ? { ...result.wordWatcher, regex: [] } : undefined,
|
||||
invitefilter: result.inviteFilter,
|
||||
permissions: { type: result.permissionType || 'discord' },
|
||||
premium: result.premium,
|
||||
|
Loading…
Reference in New Issue
Block a user