fix all cmds x3

merge-requests/15/head
Matthew 2020-07-29 00:46:52 -04:00
parent bdef73b646
commit fcd8e5b983
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
5 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@ export default class Ban extends Command {
user = member.user; user = member.user;
} }
try { try {
await message.guild.getBan(args[0]); await this.mainGuild.getBan(args[0]);
return this.error(message.channel, 'This user is already banned.'); return this.error(message.channel, 'This user is already banned.');
} catch {} // eslint-disable-line no-empty } catch {} // eslint-disable-line no-empty
if (member && !this.client.util.moderation.checkPermissions(member, message.member)) return this.error(message.channel, 'Permission Denied.'); if (member && !this.client.util.moderation.checkPermissions(member, message.member)) return this.error(message.channel, 'Permission Denied.');

View File

@ -15,7 +15,7 @@ export default class Kick extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); 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) { if (!user) {
try { try {
user = await this.client.getRESTGuildMember(this.mainGuild.id, args[0]); user = await this.client.getRESTGuildMember(this.mainGuild.id, args[0]);

View File

@ -129,7 +129,7 @@ export default class Page extends Command {
} else { } else {
this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, 'discord', code); 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) { for (const email of recipientEntry.emailAddresses) {
const recipient = this.mainGuild.members.get(recipientEntry.individualAssignID); const recipient = this.mainGuild.members.get(recipientEntry.individualAssignID);
@ -143,7 +143,7 @@ export default class Page extends Command {
from: '"LOC Paging System" <internal@libraryofcode.org>', from: '"LOC Paging System" <internal@libraryofcode.org>',
to: email, to: email,
subject: `PAGE FROM ${recipientNumber}`, subject: `PAGE FROM ${recipientNumber}`,
html: `<h1>Page</h1>${options?.emergencyNumber ? `<h2>[SEN#${options.emergencyNumber}]` : ''}<strong>Recipient PN:</strong> ${recipientNumber}<br><strong>Sender PN:</strong> ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})<br><strong>Initial Command:</strong> https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)<br><br><strong>Pager Code:</strong> ${code} (${this.local.codeDict.get(code)})${txt ? `<br><strong>Message:</strong> ${txt}` : ''}`, html: `<h1>Page</h1>${options?.emergencyNumber ? `<h2>[SEN#${options.emergencyNumber}]` : ''}<strong>Recipient PN:</strong> ${recipientNumber}<br><strong>Sender PN:</strong> ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})<br><strong>Initial Command:</strong> https://discordapp.com/channels/${this.mainGuild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)<br><br><strong>Pager Code:</strong> ${code} (${this.local.codeDict.get(code)})${txt ? `<br><strong>Message:</strong> ${txt}` : ''}`,
}); });
} }
this.client.db.Stat.updateOne({ name: 'pages' }, { $inc: { value: 1 } }).exec(); this.client.db.Stat.updateOne({ name: 'pages' }, { $inc: { value: 1 } }).exec();

View File

@ -27,7 +27,7 @@ export default class Rank extends Command {
rank.permissions.forEach((r) => { rank.permissions.forEach((r) => {
rolesArray.push(this.mainGuild.roles.get(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; let hasRank = false;
if (message.member.roles.includes(rank.roleID)) hasRank = true; if (message.member.roles.includes(rank.roleID)) hasRank = true;

View File

@ -22,7 +22,7 @@ export default class Unban extends Command {
return this.error(message.channel, 'Could find find user.'); return this.error(message.channel, 'Could find find user.');
} }
try { try {
await message.guild.getBan(args[0]); await this.mainGuild.getBan(args[0]);
} catch { } catch {
return this.error(message.channel, 'This user is not banned.'); return this.error(message.channel, 'This user is not banned.');
} }