fuck this shit
This commit is contained in:
parent
4adec71a3c
commit
f5afd93a75
@ -97,7 +97,8 @@ class HistoryCommand extends Command {
|
|||||||
|
|
||||||
async execute(message, { params, args }) {
|
async execute(message, { params, args }) {
|
||||||
|
|
||||||
if(args.export) return this._exportLogs(message, Boolean(args.private));
|
const priv = Boolean(args.private);
|
||||||
|
if(args.export) return this._exportLogs(message, priv);
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
guild: message.guild.id
|
guild: message.guild.id
|
||||||
@ -180,17 +181,24 @@ class HistoryCommand extends Command {
|
|||||||
for(let i = 0; i<infractions.length; i++) {
|
for(let i = 0; i<infractions.length; i++) {
|
||||||
const infraction = infractions[i];
|
const infraction = infractions[i];
|
||||||
let target = null;
|
let target = null;
|
||||||
if(infraction.targetType === 'user') {
|
if(infraction.targetType === 'USER') {
|
||||||
target = await this.client.resolver.resolveUser(infraction.target);
|
target = await this.client.resolver.resolveUser(infraction.target);
|
||||||
} else {
|
} else {
|
||||||
target = await this.client.resolver.resolveChannel(infraction.target, true, message.guild);
|
target = await this.client.resolver.resolveChannel(infraction.target, true, message.guild);
|
||||||
}
|
}
|
||||||
|
|
||||||
const executor = await this.client.resolver.resolveUser(infraction.executor);
|
const executor = await this.client.resolver.resolveUser(infraction.executor);
|
||||||
|
|
||||||
let string = stripIndents`**Target:** ${Util.escapeMarkdown(target.display)}${args.verbose ? ` (${target.id})` : ''}
|
let string = stripIndents`**Target:** ${Util.escapeMarkdown(target.display)}${args.verbose ? ` (${target.id})` : ''}
|
||||||
**Moderator:** ${executor ? `${Util.escapeMarkdown(executor.tag)}${args.verbose ? ` (${infraction.executor})` : ''}` : infraction.executor}`;
|
**Moderator:** ${executor ? `${Util.escapeMarkdown(executor.tag)}${args.verbose ? ` (${infraction.executor})` : ''}` : infraction.executor}`;
|
||||||
|
|
||||||
|
if(infraction.data.roleIds) {
|
||||||
|
string += `\n${message.guild.format('INFRACTION_DESCRIPTIONROLES', {
|
||||||
|
plural: infraction.data.roleIds.length === 1 ? '' : 's',
|
||||||
|
roles: priv ? infraction.data.roleNames.join(', ') : infraction.data.roleIds.map((r) => `<@&${r}>`).join(' ')
|
||||||
|
})}`;
|
||||||
|
}
|
||||||
|
|
||||||
if(infraction.duration) string += `\n**Duration:** ${Util.duration(infraction.duration)}`;
|
if(infraction.duration) string += `\n**Duration:** ${Util.duration(infraction.duration)}`;
|
||||||
if(infraction.points) string += `\n**Points:** ${infraction.points}`;
|
if(infraction.points) string += `\n**Points:** ${infraction.points}`;
|
||||||
|
|
||||||
@ -207,17 +215,23 @@ class HistoryCommand extends Command {
|
|||||||
if(long) embed.footer.text += ` • To see the full reason, use the ${message.guild.prefix}case command.`;
|
if(long) embed.footer.text += ` • To see the full reason, use the ${message.guild.prefix}case command.`;
|
||||||
|
|
||||||
const type = message.format('C_HISTORY_SUCCESSTYPE', { old: Boolean(args.oldest) }, true);
|
const type = message.format('C_HISTORY_SUCCESSTYPE', { old: Boolean(args.oldest) }, true);
|
||||||
message.respond(message.format('C_HISTORY_SUCCESS', {
|
try {
|
||||||
targets: parsed.length > 0 ? message.format('C_HISTORY_SUCCESSTARGETS', {
|
message.respond(message.format('C_HISTORY_SUCCESS', {
|
||||||
plural: parsed.length === 1 ? '' : 's',
|
targets: parsed.length > 0 ? message.format('C_HISTORY_SUCCESSTARGETS', {
|
||||||
targets: parsed.map((p) => `**${Util.escapeMarkdown(p.display)}**`).join(' ')
|
plural: parsed.length === 1 ? '' : 's',
|
||||||
}) : '',
|
targets: parsed.map((p) => `**${Util.escapeMarkdown(p.display)}**`).join(' ')
|
||||||
type
|
}) : '',
|
||||||
}), {
|
type
|
||||||
emoji: 'success',
|
}), {
|
||||||
embed,
|
emoji: 'success',
|
||||||
dm: Boolean(args.private)
|
embed,
|
||||||
});
|
dm: Boolean(args.private)
|
||||||
|
});
|
||||||
|
} catch(e) { //eslint-disable-line no-unused-vars
|
||||||
|
message.respond(message.format('C_HISTORY_FAILTOOLONG'), {
|
||||||
|
emoji: 'failure'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user