diff options
Diffstat (limited to 'src/commands/moulberry-bush')
-rw-r--r-- | src/commands/moulberry-bush/capePerms.ts | 2 | ||||
-rw-r--r-- | src/commands/moulberry-bush/giveawayPing.ts | 2 | ||||
-rw-r--r-- | src/commands/moulberry-bush/level.ts | 6 | ||||
-rw-r--r-- | src/commands/moulberry-bush/report.ts | 12 | ||||
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 6 |
5 files changed, 15 insertions, 13 deletions
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index eb1ab89..2481e3e 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -48,7 +48,7 @@ export default class CapePermissionsCommand extends BushCommand { perms: string[]; } - let capeperms: Capeperms, uuid: string; + let capeperms: Capeperms | null, uuid: string; try { uuid = await util.findUUID(args.ign); } catch (e) { diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index 4abc6ab..4caaf0c 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -24,7 +24,7 @@ export default class GiveawayPingCommand extends BushCommand { } public override async exec(message: BushMessage): Promise<unknown> { - if (!message.member.permissions.has('MANAGE_GUILD')) + if (!message.member!.permissions.has('MANAGE_GUILD')) await message.util.reply(`${util.emojis.error} You are missing the \`manage server\` permission.`); await message.delete().catch(() => {}); diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts index c202863..02d66be 100644 --- a/src/commands/moulberry-bush/level.ts +++ b/src/commands/moulberry-bush/level.ts @@ -36,7 +36,8 @@ export default class LevelCommand extends BushCommand { required: false } ], - slash: true + slash: true, + channel: 'guild' }); } @@ -143,6 +144,7 @@ export default class LevelCommand extends BushCommand { // 'lel.png' // ) // ); - await message.reply(await this.getResponse(user || message.author, message.guild)); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + await message.reply(await this.getResponse(user || message.author, message.guild!)); } } diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index e91420b..878337b 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -59,7 +59,7 @@ export default class ReportCommand extends BushCommand { message: BushMessage, { member, evidence }: { member: GuildMember; evidence: string } ): Promise<unknown> { - if (message.guild.id != client.consts.mappings.guilds.bush) + if (message.guild!.id != client.consts.mappings.guilds.bush) return await message.util.reply(`${util.emojis.error} This command can only be run in Moulberry's bush.`); if (!member) return await message.util.reply(`${util.emojis.error} Choose someone to report`); if (member.user.id === '322862723090219008') @@ -76,14 +76,14 @@ export default class ReportCommand extends BushCommand { const reportEmbed = new MessageEmbed() .setFooter(`Reporter ID: ${message.author.id} Reported ID: ${member.user.id}`) .setTimestamp() - .setAuthor(`Report From: ${message.author.tag}`, message.author.avatarURL({ dynamic: true })) + .setAuthor(`Report From: ${message.author.tag}`, message.author.avatarURL({ dynamic: true }) ?? undefined) .setTitle('New Report') .setColor(util.colors.red) .setDescription(evidence) .addField( 'Reporter', `**Name:**${message.author.tag} <@${message.author.id}>\n**Joined:** ${moment( - message.member.joinedTimestamp + message.member!.joinedTimestamp ).fromNow()}\n**Created:** ${moment(message.author.createdTimestamp).fromNow()}\n**Sent From**: <#${ message.channel.id }> [Jump to context](${message.url})`, @@ -99,11 +99,11 @@ export default class ReportCommand extends BushCommand { //reusing code pog if (message.attachments.size > 0) { - const fileName = message.attachments.first().name.toLowerCase(); + const fileName = message.attachments.first()!.name!.toLowerCase(); if (fileName.endsWith('.png') || fileName.endsWith('.jpg') || fileName.endsWith('.gif') || fileName.endsWith('.webp')) { - reportEmbed.setImage(message.attachments.first().url); + reportEmbed.setImage(message.attachments.first()!.url); } else { - reportEmbed.addField('Attachment', message.attachments.first().url); + reportEmbed.addField('Attachment', message.attachments.first()!.url); } } const reportChannel = client.channels.cache.get('782972723654688848') as unknown as BushTextChannel; diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index eb767a8..bf44dad 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -106,10 +106,10 @@ export default class RuleCommand extends BushCommand { public override async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> { const rulesEmbed = new MessageEmbed() .setColor('#ef3929') - .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true })) + .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true }) ?? undefined) .setTimestamp(); - if (rule > 12 || rule < 1) { + if (rule !== undefined && (rule > 12 || rule < 1)) { rule = undefined; } if (rule) { @@ -131,7 +131,7 @@ export default class RuleCommand extends BushCommand { // If the original message was a reply -> imitate it message.reference?.messageId && !message.util.isSlash ? await message.channel.messages.fetch(message.reference.messageId).then(async (message) => { - await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }); + await message.util!.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }); }) : await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }) ); |