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

@ -1,6 +1,7 @@
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { actualInfoCmd } from "../actualInfoCmd";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed";
import { sendErrorMessage } from "../../../pluginUtils";
export const InfoCmd = utilityCmd({
trigger: "info",
@ -14,7 +15,13 @@ export const InfoCmd = utilityCmd({
compact: ct.switchOption({ shortcut: "c" }),
},
async run({ message: msg, args, pluginData }) {
actualInfoCmd(msg, args, pluginData);
async run({ message, args, pluginData }) {
const embed = await getUserInfoEmbed(pluginData, args.user.id, args.compact);
if (!embed) {
sendErrorMessage(pluginData, message.channel, "User not found");
return;
}
message.channel.createMessage({ embed });
},
});