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

Executy info command if there is only one search command value

This commit is contained in:
Dark 2020-06-30 23:36:07 +02:00
parent b4e034e3d8
commit dae6ebf881

View file

@ -81,6 +81,7 @@ const ConfigSchema = t.type({
can_roles: t.boolean, can_roles: t.boolean,
can_level: t.boolean, can_level: t.boolean,
can_search: t.boolean, can_search: t.boolean,
info_on_single_result: t.boolean,
can_clean: t.boolean, can_clean: t.boolean,
can_info: t.boolean, can_info: t.boolean,
can_server: t.boolean, can_server: t.boolean,
@ -161,6 +162,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
can_roles: false, can_roles: false,
can_level: false, can_level: false,
can_search: false, can_search: false,
info_on_single_result: true,
can_clean: false, can_clean: false,
can_info: false, can_info: false,
can_server: false, can_server: false,
@ -848,6 +850,11 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
const searchMsg = await searchMsgPromise; const searchMsg = await searchMsgPromise;
searchMsg.edit(result); 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. // Set up pagination reactions if needed. The reactions are cleared after a timeout.
if (searchResult.totalResults > perPage) { if (searchResult.totalResults > perPage) {
if (!hasReactions) { if (!hasReactions) {