fix multiple issues with property, message.guild does not exist
parent
a1e8510073
commit
ec8eff224b
|
@ -15,7 +15,7 @@ export default class Ban extends Command {
|
||||||
|
|
||||||
public async run(message: Message, args: string[]) {
|
public async run(message: Message, args: string[]) {
|
||||||
try {
|
try {
|
||||||
const member = this.client.util.resolveMember(args[0], message.guild);
|
const member = this.client.util.resolveMember(args[0], this.client.guilds.get(this.client.config.guildID));
|
||||||
let user: User;
|
let user: User;
|
||||||
if (!member) {
|
if (!member) {
|
||||||
try {
|
try {
|
||||||
|
@ -25,7 +25,7 @@ export default class Ban extends Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await message.guild.getBan(args[0]);
|
await this.client.guilds.get(this.client.config.guildID).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.');
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default class Game extends Command {
|
||||||
let member: Member;
|
let member: Member;
|
||||||
if (!args[0]) member = message.member;
|
if (!args[0]) member = message.member;
|
||||||
else {
|
else {
|
||||||
member = this.client.util.resolveMember(args.join(' '), message.guild);
|
member = this.client.util.resolveMember(args.join(' '), this.client.guilds.get(this.client.config.guildID));
|
||||||
if (!member) {
|
if (!member) {
|
||||||
return this.error(message.channel, 'Member not found.');
|
return this.error(message.channel, 'Member not found.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ export default class Roleinfo extends Command {
|
||||||
try {
|
try {
|
||||||
if (!args[0]) return this.error(message.channel, 'You need to specifiy a role ID or a role name.');
|
if (!args[0]) return this.error(message.channel, 'You need to specifiy a role ID or a role name.');
|
||||||
|
|
||||||
let role: Role = message.guild.roles.find((r: Role) => r.id === args[0]);
|
let role: Role = this.client.guilds.get(this.client.config.guildID).roles.find((r: Role) => r.id === args[0]);
|
||||||
if (!role) { // if it's a role name
|
if (!role) { // if it's a role name
|
||||||
role = message.guild.roles.find((r: Role) => r.name.toLowerCase().includes(args.join(' ').toLowerCase()));
|
role = this.client.guilds.get(this.client.config.guildID).roles.find((r: Role) => r.name.toLowerCase().includes(args.join(' ').toLowerCase()));
|
||||||
}
|
}
|
||||||
if (!role) return this.error(message.channel, 'Could not find role.');
|
if (!role) return this.error(message.channel, 'Could not find role.');
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,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.client.guilds.get(this.client.config.guildID).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.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default class Whois extends Command {
|
||||||
let member: Member;
|
let member: Member;
|
||||||
if (!args[0]) member = message.member;
|
if (!args[0]) member = message.member;
|
||||||
else {
|
else {
|
||||||
member = this.client.util.resolveMember(args.join(' '), message.guild);
|
member = this.client.util.resolveMember(args.join(' '), this.client.guilds.get(this.client.config.guildID));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!member) {
|
if (!member) {
|
||||||
|
@ -42,26 +42,26 @@ export default class Whois extends Command {
|
||||||
const ackResolve = this.resolveStaffInformation(member.id);
|
const ackResolve = this.resolveStaffInformation(member.id);
|
||||||
let description = '';
|
let description = '';
|
||||||
if (ackResolve) {
|
if (ackResolve) {
|
||||||
if (ackResolve.title && ackResolve.dept) {
|
if (ackResolve?.title && ackResolve?.dept) {
|
||||||
description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`;
|
description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`;
|
||||||
}
|
}
|
||||||
if (ackResolve.emailAddress) {
|
if (ackResolve?.emailAddress) {
|
||||||
description += `${emotes.email} ${ackResolve.emailAddress}\n`;
|
description += `${emotes.email} ${ackResolve.emailAddress}\n`;
|
||||||
}
|
}
|
||||||
if (ackResolve.gitlab) {
|
if (ackResolve?.gitlab) {
|
||||||
description += `${emotes.gitlab} ${ackResolve.gitlab}\n`;
|
description += `${emotes.gitlab} ${ackResolve.gitlab}\n`;
|
||||||
}
|
}
|
||||||
if (ackResolve.github) {
|
if (ackResolve?.github) {
|
||||||
description += `${emotes.github} ${ackResolve.github}\n`;
|
description += `${emotes.github} ${ackResolve.github}\n`;
|
||||||
}
|
}
|
||||||
if (ackResolve.bio) {
|
if (ackResolve?.bio) {
|
||||||
description += `${emotes.bio} *${ackResolve.bio}*\n`;
|
description += `${emotes.bio} *${ackResolve.bio}*\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
description += `\n<@${member.id}>`;
|
description += `\n<@${member.id}>`;
|
||||||
embed.setDescription(description);
|
embed.setDescription(description);
|
||||||
|
|
||||||
const roles = member.roles.map((r) => message.guild.roles.get(r)).sort((a, b) => b.position - a.position);
|
const roles = member.roles.map((r) => this.client.guilds.get(this.client.config.guildID).roles.get(r)).sort((a, b) => b.position - a.position);
|
||||||
|
|
||||||
const { color } = roles.find((r) => r.color);
|
const { color } = roles.find((r) => r.color);
|
||||||
embed.setColor(color);
|
embed.setColor(color);
|
||||||
|
@ -72,7 +72,7 @@ export default class Whois extends Command {
|
||||||
const permissions: string[] = [];
|
const permissions: string[] = [];
|
||||||
const serverAcknowledgements: string[] = [];
|
const serverAcknowledgements: string[] = [];
|
||||||
const bit = member.permission.allow;
|
const bit = member.permission.allow;
|
||||||
if (message.guild.ownerID === member.id) serverAcknowledgements.push('Server Owner');
|
if (this.client.guilds.get(this.client.config.guildID).ownerID === member.id) serverAcknowledgements.push('Server Owner');
|
||||||
if ((bit | 8) === bit) { permissions.push('Administrator'); serverAcknowledgements.push('Server Admin'); }
|
if ((bit | 8) === bit) { permissions.push('Administrator'); serverAcknowledgements.push('Server Admin'); }
|
||||||
if ((bit | 20) === bit) { permissions.push('Manage Server'); serverAcknowledgements.push('Server Manager'); }
|
if ((bit | 20) === bit) { permissions.push('Manage Server'); serverAcknowledgements.push('Server Manager'); }
|
||||||
if ((bit | 10) === bit) permissions.push('Manage Channels');
|
if ((bit | 10) === bit) permissions.push('Manage Channels');
|
||||||
|
@ -88,7 +88,7 @@ export default class Whois extends Command {
|
||||||
if (serverAcknowledgements.length > 0) {
|
if (serverAcknowledgements.length > 0) {
|
||||||
embed.addField('Acknowledgements', serverAcknowledgements[0]);
|
embed.addField('Acknowledgements', serverAcknowledgements[0]);
|
||||||
}
|
}
|
||||||
if (ackResolve && ackResolve.acknowledgements) {
|
if (ackResolve?.acknowledgements) {
|
||||||
embed.addField('Bot Acknowledgements', ackResolve.acknowledgements.join(', '));
|
embed.addField('Bot Acknowledgements', ackResolve.acknowledgements.join(', '));
|
||||||
}
|
}
|
||||||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
|
|
Loading…
Reference in New Issue