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