forked from Galactic/galactic-bot
small fixes
This commit is contained in:
parent
5dd4750f54
commit
0cf2c9d88c
@ -12,7 +12,8 @@ class EvalCommand extends Command {
|
||||
super(client, {
|
||||
name: 'eval',
|
||||
aliases: ['e', 'evaluate'],
|
||||
restricted: true
|
||||
restricted: true,
|
||||
module: 'developer'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,8 @@ class GuildCommand extends SlashCommand {
|
||||
super(client, {
|
||||
name: 'server',
|
||||
description: 'Display server related information',
|
||||
guildOnly: true
|
||||
guildOnly: true,
|
||||
module: 'information'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ class Disabled extends Inhibitor {
|
||||
if (!invoker.guild) return super._succeed();
|
||||
|
||||
const settings = await invoker.guild.settings();
|
||||
if (settings.disabledCommands?.includes(command.resolveable)) return super._fail({
|
||||
if (settings.commands.disabled?.includes(command.resolveable)) return super._fail({
|
||||
modifier: invoker.format('INHIBITOR_DISABLED', { globally: false }, { code: true })
|
||||
});
|
||||
|
||||
|
@ -8,7 +8,8 @@ class IgnoreSetting extends Setting {
|
||||
super(client, {
|
||||
name: 'ignore',
|
||||
module: 'administration',
|
||||
display: 'Have the bot ignore commands in given channels',
|
||||
description: 'Have the bot ignore commands in given channels',
|
||||
display: 'Ignore channels',
|
||||
default: {
|
||||
channels: [],
|
||||
bypass: []
|
||||
|
@ -8,6 +8,7 @@ class ModerationPoints extends Setting {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'modpoints',
|
||||
display: 'Moderation Points',
|
||||
description: 'Configure severity values for infractions, used by automod',
|
||||
module: 'moderation',
|
||||
default: {
|
||||
|
@ -6,6 +6,7 @@ class WordWatcher extends FilterSetting {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'wordwatcher',
|
||||
display: 'Word Watcher',
|
||||
description: 'Flag messages for potentially offensive content instead of deleting automatically',
|
||||
module: 'moderation',
|
||||
default: {
|
||||
|
@ -25,6 +25,7 @@ class Command extends Component {
|
||||
|
||||
this.name = options.name;
|
||||
this.module = options.module;
|
||||
if(!options.module) this.client.logger.warn(`Command ${this.name} is missing module information.`);
|
||||
|
||||
this.description = options.description || "";
|
||||
this.tags = options.tags || [];
|
||||
|
@ -49,7 +49,7 @@ class SettingsCommand extends SlashCommand {
|
||||
const subCommand = new CommandOption({
|
||||
name: setting.name,
|
||||
description: setting.description,
|
||||
type: 'SUB_COMMAND',
|
||||
type: setting.commandType, //'SUB_COMMAND',
|
||||
options: setting.commandOptions
|
||||
});
|
||||
this.options.push(subCommand);
|
||||
@ -80,8 +80,8 @@ class SettingsCommand extends SlashCommand {
|
||||
|
||||
async execute(invoker, opts) {
|
||||
|
||||
const { guild } = invoker;
|
||||
const settingName = invoker.subcommand.name;
|
||||
const { guild, subcommand, subcommandGroup } = invoker;
|
||||
const settingName = subcommandGroup?.name || subcommand.name;
|
||||
|
||||
if (settingName === 'list') return this._listSettings(invoker);
|
||||
|
||||
@ -92,14 +92,14 @@ class SettingsCommand extends SlashCommand {
|
||||
const missing = guild.me.permissions.missing(setting.clientPermissions);
|
||||
if (missing.length) return invoker.reply({
|
||||
emoji: 'failure',
|
||||
index: 'SETTING_MISSINGCLIENTPERMISSIONS',
|
||||
index: 'SETTING_MISSING_CLIENTPERMISSIONS',
|
||||
params: { permissions: missing.map((m) => `\`${PermissionNames[m]}\``).join(', ') }
|
||||
});
|
||||
}
|
||||
|
||||
await invoker.deferReply();
|
||||
const settings = await guild.settings();
|
||||
if (!Object.keys(opts).length) return this._showSetting(invoker, setting);
|
||||
if (!Object.keys(opts).length && this.subcommand(subcommand.name).options.length) return this._showSetting(invoker, setting);
|
||||
|
||||
try {
|
||||
// Pass setting values copy so the changes don't persist unless successful and actually saved
|
||||
@ -167,8 +167,8 @@ class SettingsCommand extends SlashCommand {
|
||||
|
||||
async _showSetting(invoker, setting) {
|
||||
|
||||
const { guild } = invoker;
|
||||
const embed = setting.usageEmbed(guild);
|
||||
const { guild, subcommand } = invoker;
|
||||
const embed = setting.usageEmbed(guild, null, this.subcommand(subcommand.name));
|
||||
const dataFields = await setting.fields(guild);
|
||||
// eslint-disable-next-line no-return-assign
|
||||
dataFields.forEach((field) => {
|
||||
|
@ -200,7 +200,7 @@ class SettingsMigrator {
|
||||
autorole: result.autorole,
|
||||
stickyrole: result.stickyrole ? { ...result.stickyrole, enabled: Boolean(result.stickyrole.roles.length) } : undefined,
|
||||
welcomer: result.welcomer,
|
||||
disabledCommands: result.disabledCommands,
|
||||
commands: { disabled: result.disabledCommands, custom: {} },
|
||||
prefix: result.prefix
|
||||
};
|
||||
return settings;
|
||||
@ -322,7 +322,8 @@ class SettingsMigrator {
|
||||
for(const cmd of cmds) if(!resolved.includes(cmd)) resolved.push(cmd);
|
||||
}
|
||||
}
|
||||
settings.disabledCommands = resolved;
|
||||
// TODO Add custom command imports
|
||||
settings.commands = { disabled: resolved, custom: {} };
|
||||
}
|
||||
|
||||
if (modpoints) {
|
||||
|
Loading…
Reference in New Issue
Block a user