diff options
Diffstat (limited to 'src/commands/moulberry-bush')
-rw-r--r-- | src/commands/moulberry-bush/capePerms.ts | 4 | ||||
-rw-r--r-- | src/commands/moulberry-bush/capes.ts | 4 | ||||
-rw-r--r-- | src/commands/moulberry-bush/moulHammer.ts | 6 | ||||
-rw-r--r-- | src/commands/moulberry-bush/report.ts | 6 | ||||
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 13 |
5 files changed, 18 insertions, 15 deletions
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index 2749430..8dd51fe 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -1,4 +1,4 @@ -import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; +import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import { MessageEmbed } from 'discord.js'; import got from 'got'; @@ -27,7 +27,7 @@ export default class CapePermissionsCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { ign: string }) { + public override async exec(message: BushMessage | BushSlashMessage, args: { ign: ArgType<'string'> }) { interface CapePerms { success: boolean; perms: User[]; diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 1734568..fe18d89 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -1,4 +1,4 @@ -import { BushCommand, ButtonPaginator, DeleteButton, type BushMessage } from '#lib'; +import { BushCommand, ButtonPaginator, DeleteButton, OptionalArgType, type BushMessage } from '#lib'; import { type MessageEmbedOptions } from 'discord.js'; import got from 'got'; @@ -28,7 +28,7 @@ export default class CapesCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { cape: string | null }) { + public override async exec(message: BushMessage, args: { cape: OptionalArgType<'string'> }) { const { tree: neuFileTree }: GithubTreeApi = await got .get('https://api.github.com/repos/Moulberry/NotEnoughUpdates/git/trees/master?recursive=1') .json(); diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 2811f80..ffb9afb 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -1,5 +1,5 @@ -import { BushCommand, BushSlashMessage, type BushMessage } from '#lib'; -import { MessageEmbed, type User } from 'discord.js'; +import { ArgType, BushCommand, BushSlashMessage, type BushMessage } from '#lib'; +import { MessageEmbed } from 'discord.js'; export default class MoulHammerCommand extends BushCommand { public constructor() { @@ -27,7 +27,7 @@ export default class MoulHammerCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, { user }: { user: User }) { + public override async exec(message: BushMessage | BushSlashMessage, { user }: { user: ArgType<'user'> }) { await message.delete(); const embed = new MessageEmbed() .setTitle('L') diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 2a0d06f..a65cfcf 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,5 +1,5 @@ -import { AllowedMentions, BushCommand, type BushMessage } from '#lib'; -import { MessageEmbed, type GuildMember } from 'discord.js'; +import { AllowedMentions, ArgType, BushCommand, type BushMessage } from '#lib'; +import { MessageEmbed } from 'discord.js'; import moment from 'moment'; export default class ReportCommand extends BushCommand { @@ -37,7 +37,7 @@ export default class ReportCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { member, evidence }: { member: GuildMember; evidence: string }) { + public override async exec(message: BushMessage, { member, evidence }: { member: ArgType<'member'>; evidence: string }) { if (!message.guild || !(await message.guild.hasFeature('reporting'))) return await message.util.reply( `${util.emojis.error} This command can only be used in servers where reporting is enabled.` diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 2404c4d..cc59db5 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,5 +1,5 @@ -import { AllowedMentions, BushCommand, type BushMessage } from '#lib'; -import { MessageEmbed, type User } from 'discord.js'; +import { AllowedMentions, BushCommand, OptionalArgType, type BushMessage } from '#lib'; +import { MessageEmbed } from 'discord.js'; const rules = [ { @@ -90,14 +90,17 @@ export default class RuleCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }) { + public override async exec( + message: BushMessage, + { rule, user }: { rule: OptionalArgType<'integer'>; user: OptionalArgType<'user'> } + ) { const rulesEmbed = new MessageEmbed() .setColor('#ef3929') .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true }) ?? undefined) .setTimestamp(); - if (rule !== undefined && (rule > 12 || rule < 1)) { - rule = undefined; + if (rule != null && (rule > 12 || rule < 1)) { + rule = null; } if (rule) { if (rules[rule - 1]?.title && rules[rule - 1]?.description) |