From dae6ebf8812066e6df4256d4e7ef15e2f002643f Mon Sep 17 00:00:00 2001 From: Dark <7890309+DarkView@users.noreply.github.com> Date: Tue, 30 Jun 2020 23:36:07 +0200 Subject: [PATCH] Executy info command if there is only one search command value --- backend/src/plugins/Utility.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/src/plugins/Utility.ts b/backend/src/plugins/Utility.ts index f40f1551..f2304d1c 100644 --- a/backend/src/plugins/Utility.ts +++ b/backend/src/plugins/Utility.ts @@ -81,6 +81,7 @@ const ConfigSchema = t.type({ can_roles: t.boolean, can_level: t.boolean, can_search: t.boolean, + info_on_single_result: t.boolean, can_clean: t.boolean, can_info: t.boolean, can_server: t.boolean, @@ -161,6 +162,7 @@ export class UtilityPlugin extends ZeppelinPlugin { can_roles: false, can_level: false, can_search: false, + info_on_single_result: true, can_clean: false, can_info: false, can_server: false, @@ -848,6 +850,11 @@ export class UtilityPlugin extends ZeppelinPlugin { const searchMsg = await searchMsgPromise; searchMsg.edit(result); + const cfg = this.getConfigForUser(msg.author); + if (cfg.info_on_single_result && searchResult.totalResults === 1) { + this.infoCmd(msg, { user: searchResult.results[0], compact: false }); + } + // Set up pagination reactions if needed. The reactions are cleared after a timeout. if (searchResult.totalResults > perPage) { if (!hasReactions) {