From 3700a2a4c56c1c04207813fe0a7d562ae9f1d46c Mon Sep 17 00:00:00 2001 From: Dragory Date: Sat, 20 Apr 2019 19:32:20 +0300 Subject: [PATCH] In !cases, use the username from the latest case if the user is not found --- src/plugins/ModActions.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/ModActions.ts b/src/plugins/ModActions.ts index 8b43305d..7714a2ef 100644 --- a/src/plugins/ModActions.ts +++ b/src/plugins/ModActions.ts @@ -1245,10 +1245,13 @@ export class ModActionsPlugin extends ZeppelinPlugin { 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;