In !cases, use the username from the latest case if the user is not found
This commit is contained in:
parent
f6e487d073
commit
3700a2a4c5
1 changed files with 5 additions and 2 deletions
|
@ -1245,10 +1245,13 @@ export class ModActionsPlugin extends ZeppelinPlugin<IModActionsPluginConfig> {
|
||||||
const normalCases = cases.filter(c => !c.is_hidden);
|
const normalCases = cases.filter(c => !c.is_hidden);
|
||||||
const hiddenCases = cases.filter(c => c.is_hidden);
|
const hiddenCases = cases.filter(c => c.is_hidden);
|
||||||
|
|
||||||
const userName = `${user.username}#${user.discriminator}`;
|
const userName =
|
||||||
|
user instanceof UnknownUser && cases.length
|
||||||
|
? cases[cases.length - 1].user_name
|
||||||
|
: `${user.username}#${user.discriminator}`;
|
||||||
|
|
||||||
if (cases.length === 0) {
|
if (cases.length === 0) {
|
||||||
msg.channel.createMessage(`No cases found for ${user ? `**${userName}**` : "the specified user"}`);
|
msg.channel.createMessage(`No cases found for **${userName}**`);
|
||||||
} else {
|
} else {
|
||||||
const showHidden = args.hidden || (args.opts && args.opts.match(/\bhidden\b/));
|
const showHidden = args.hidden || (args.opts && args.opts.match(/\bhidden\b/));
|
||||||
const casesToDisplay = showHidden ? cases : normalCases;
|
const casesToDisplay = showHidden ? cases : normalCases;
|
||||||
|
|
Loading…
Add table
Reference in a new issue