From 0fd7eb78909f001cfec8fdb55ccea1055f0c1dd6 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Wed, 29 Jul 2020 00:45:31 -0400 Subject: [PATCH] fix all cmds x2 --- src/commands/ban.ts | 2 +- src/commands/kick.ts | 2 +- src/commands/page.ts | 4 ++-- src/commands/rank.ts | 2 +- src/commands/unban.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 72bfaa3..040db7d 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -28,7 +28,7 @@ export default class Ban extends Command { user = member.user; } try { - await message.guild.getBan(args[0]); + await this.mainGuild.getBan(args[0]); return this.error(message.channel, 'This user is already banned.'); } catch {} // eslint-disable-line no-empty if (member && !this.client.util.moderation.checkPermissions(member, message.member)) return this.error(message.channel, 'Permission Denied.'); diff --git a/src/commands/kick.ts b/src/commands/kick.ts index 9a5db00..9d5d9d9 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -15,7 +15,7 @@ export default class Kick extends Command { public async run(message: Message, args: string[]) { try { if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); - let user: Member = this.client.util.resolveMember(args[0], message.guild); + let user: Member = this.client.util.resolveMember(args[0], this.mainGuild); if (!user) { try { user = await this.client.getRESTGuildMember(this.mainGuild.id, args[0]); diff --git a/src/commands/page.ts b/src/commands/page.ts index dd60b54..afb0d3f 100644 --- a/src/commands/page.ts +++ b/src/commands/page.ts @@ -129,7 +129,7 @@ export default class Page extends Command { } else { this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, 'discord', code); } - chan.createMessage(`${options?.emergencyNumber ? `[SEN#${options.emergencyNumber}] ` : ''}__**Page**__\n**Recipient PN:** ${recipientNumber}\n**Sender PN:** ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})\n**Initial Command:** https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)\n\n**Pager Code:** ${code} (${this.local.codeDict.get(code)})${txt ? `\n**Message:** ${txt}` : ''}`); + chan.createMessage(`${options?.emergencyNumber ? `[SEN#${options.emergencyNumber}] ` : ''}__**Page**__\n**Recipient PN:** ${recipientNumber}\n**Sender PN:** ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})\n**Initial Command:** https://discordapp.com/channels/${this.mainGuild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)\n\n**Pager Code:** ${code} (${this.local.codeDict.get(code)})${txt ? `\n**Message:** ${txt}` : ''}`); } for (const email of recipientEntry.emailAddresses) { const recipient = this.mainGuild.members.get(recipientEntry.individualAssignID); @@ -143,7 +143,7 @@ export default class Page extends Command { from: '"LOC Paging System" ', to: email, subject: `PAGE FROM ${recipientNumber}`, - html: `

Page

${options?.emergencyNumber ? `

[SEN#${options.emergencyNumber}]` : ''}Recipient PN: ${recipientNumber}
Sender PN: ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})
Initial Command: https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)

Pager Code: ${code} (${this.local.codeDict.get(code)})${txt ? `
Message: ${txt}` : ''}`, + html: `

Page

${options?.emergencyNumber ? `

[SEN#${options.emergencyNumber}]` : ''}Recipient PN: ${recipientNumber}
Sender PN: ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})
Initial Command: https://discordapp.com/channels/${this.mainGuild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)

Pager Code: ${code} (${this.local.codeDict.get(code)})${txt ? `
Message: ${txt}` : ''}`, }); } this.client.db.Stat.updateOne({ name: 'pages' }, { $inc: { value: 1 } }).exec(); diff --git a/src/commands/rank.ts b/src/commands/rank.ts index 4409f55..3c87eea 100644 --- a/src/commands/rank.ts +++ b/src/commands/rank.ts @@ -27,7 +27,7 @@ export default class Rank extends Command { rank.permissions.forEach((r) => { rolesArray.push(this.mainGuild.roles.get(r)); }); - perms = rolesArray.map((r) => message.guild.roles.get(r.id)).sort((a, b) => b.position - a.position).map((r) => `<@&${r.id}>`).join(', '); + perms = rolesArray.map((r) => this.mainGuild.roles.get(r.id)).sort((a, b) => b.position - a.position).map((r) => `<@&${r.id}>`).join(', '); } let hasRank = false; if (message.member.roles.includes(rank.roleID)) hasRank = true; diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 0fd7777..78fbbc8 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -22,7 +22,7 @@ export default class Unban extends Command { return this.error(message.channel, 'Could find find user.'); } try { - await message.guild.getBan(args[0]); + await this.mainGuild.getBan(args[0]); } catch { return this.error(message.channel, 'This user is not banned.'); }