3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

In !cases, use the username from the latest case if the user is not found

This commit is contained in:
Dragory 2019-04-20 19:32:20 +03:00
parent f6e487d073
commit 3700a2a4c5

View file

@ -1245,10 +1245,13 @@ export class ModActionsPlugin extends ZeppelinPlugin<IModActionsPluginConfig> {
const normalCases = 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) {
msg.channel.createMessage(`No cases found for ${user ? `**${userName}**` : "the specified user"}`);
msg.channel.createMessage(`No cases found for **${userName}**`);
} else {
const showHidden = args.hidden || (args.opts && args.opts.match(/\bhidden\b/));
const casesToDisplay = showHidden ? cases : normalCases;