zappyzep/backend/src/plugins/Utility/commands/InfoCmd.ts

29 lines
867 B
TypeScript
Raw Normal View History

2020-07-06 00:53:28 +03:00
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed";
import { sendErrorMessage } from "../../../pluginUtils";
2020-07-06 00:53:28 +03:00
export const InfoCmd = utilityCmd({
trigger: "info",
description: "Show basic information about a user",
usage: "!info 106391128718245888",
permission: "can_info",
signature: {
user: ct.resolvedUserLoose({ required: false }),
compact: ct.switchOption({ shortcut: "c" }),
2020-07-06 00:53:28 +03:00
},
async run({ message, args, pluginData }) {
const userId = args.user?.id || message.author.id;
const embed = await getUserInfoEmbed(pluginData, userId, args.compact);
if (!embed) {
sendErrorMessage(pluginData, message.channel, "User not found");
return;
}
message.channel.createMessage({ embed });
2020-07-06 00:53:28 +03:00
},
});