Fix channel-based infractions not logging among some other issues.
This commit is contained in:
parent
26fbc12af3
commit
9e5508781a
@ -56,6 +56,8 @@ class RemoveroleCommand extends Command {
|
||||
.handleInfraction(RemoveRole, message, {
|
||||
targets: members,
|
||||
data: {
|
||||
roleIds: roles.map((r) => r.id),
|
||||
roleNames: roles.map((r) => r.display),
|
||||
roles
|
||||
},
|
||||
reason: parameters.join(' ')
|
||||
|
@ -36,8 +36,6 @@ class AddroleInfraction extends Infraction {
|
||||
return this._fail('INFRACTION_ERROR');
|
||||
}
|
||||
|
||||
delete this.data.roles; //before it saves to db.
|
||||
|
||||
await this.handle();
|
||||
return this._succeed();
|
||||
|
||||
@ -67,6 +65,7 @@ class AddroleInfraction extends Infraction {
|
||||
}
|
||||
|
||||
description(dm) {
|
||||
console.log(this.data);
|
||||
return `\n${this.guild.format('INFRACTION_DESCRIPTIONROLES', {
|
||||
plural: this.data.roleIds.length === 1 ? '' : 's',
|
||||
roles: dm ? this.data.roleNames.join(', ') : this.data.roleIds.map((r) => `<@&${r}>`).join(' ')
|
||||
|
@ -10,7 +10,7 @@ class RemoveroleInfraction extends Infraction {
|
||||
targetType: 'USER',
|
||||
message: opts.message,
|
||||
executor: opts.executor.user,
|
||||
target: opts.target,
|
||||
target: opts.target.user,
|
||||
reason: opts.reason,
|
||||
guild: opts.guild,
|
||||
channel: opts.channel,
|
||||
@ -31,7 +31,7 @@ class RemoveroleInfraction extends Infraction {
|
||||
async execute() {
|
||||
|
||||
try {
|
||||
await this.member.roles.remove(this.data.roles, this._reason);
|
||||
await this.member.roles.remove(this.data.roleIds, this._reason);
|
||||
} catch(error) {
|
||||
return this._fail('INFRACTION_ERROR');
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ class SlowmodeInfraction extends Infraction {
|
||||
rateLimitPerUser: this.data.seconds
|
||||
}, this._reason);
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
return this._fail('INFRACTION_ERROR');
|
||||
}
|
||||
|
||||
|
@ -122,9 +122,7 @@ class Infraction {
|
||||
}
|
||||
|
||||
/* LMAOOOO PLEASE DONT JUDGE ME */
|
||||
if(this.data.roles && this.data.roles.length > 0) {
|
||||
this.data.roleIds = this.data.roles.map((r) => r.id);
|
||||
this.data.roleNames = this.data.roles.map((r) => r.name);
|
||||
if(this.data.roles) {
|
||||
delete this.data.roles;
|
||||
}
|
||||
|
||||
@ -170,12 +168,11 @@ class Infraction {
|
||||
&& (dm && !Constants.RemovedInfractions.includes(this.type))) {
|
||||
description += `\n${this.guild.format('INFRACTION_DESCRIPTIONJUMPTO', { name: this.hyperlink ? 'Case' : 'Message', link: this.hyperlink ? this.hyperlink : `https://discord.com/channels/${this.guildId}/${this.channelId}/${this.messageId}` })}`;
|
||||
}
|
||||
|
||||
|
||||
const blah = {
|
||||
author: {
|
||||
name: `${this.target.display} (${this.targetId})`,
|
||||
icon_url: this.target.displayAvatarURL() //eslint-disable-line camelcase
|
||||
icon_url: this.targetIcon //eslint-disable-line camelcase
|
||||
},
|
||||
timestamp: this.timestamp,
|
||||
color: this.color,
|
||||
|
Loading…
Reference in New Issue
Block a user