Reorganize !info abstraction

Consistent with the abstraction for !server/!serverinfo now
This commit is contained in:
Dragory 2020-08-05 17:38:47 +03:00
parent a234e18ec3
commit 1df00d8548
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 66 additions and 56 deletions

View file

@ -10,7 +10,7 @@ import { searchCmdSignature } from "./commands/SearchCmd";
import { banSearchSignature } from "./commands/BanSearchCmd";
import { UtilityPluginType } from "./types";
import { refreshMembersIfNeeded } from "./refreshMembers";
import { actualInfoCmd } from "./actualInfoCmd";
import { getUserInfoEmbed } from "./functions/getUserInfoEmbed";
const SEARCH_RESULTS_PER_PAGE = 15;
const SEARCH_ID_RESULTS_PER_PAGE = 50;
@ -113,9 +113,12 @@ export async function displaySearch(
const cfg = pluginData.config.getForUser(msg.author);
if (cfg.info_on_single_result && searchResult.totalResults === 1) {
searchMsg.edit("Only one result:");
actualInfoCmd(msg, { user: searchResult.results[0], compact: false }, pluginData);
return;
const embed = await getUserInfoEmbed(pluginData, searchResult.results[0].id, false);
if (embed) {
searchMsg.edit("Only one result:");
msg.channel.createMessage({ embed });
return;
}
}
searchMsg.edit(result);