mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 12:55:01 +00:00
Add !invite utility command
This commit is contained in:
parent
ebdeabdc32
commit
024078ccdc
7 changed files with 187 additions and 24 deletions
27
backend/src/plugins/Utility/commands/InviteInfoCmd.ts
Normal file
27
backend/src/plugins/Utility/commands/InviteInfoCmd.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { utilityCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage } from "../../../pluginUtils";
|
||||
import { getInviteInfoEmbed } from "../functions/getInviteInfoEmbed";
|
||||
import { parseInviteCodeInput } from "../../../utils";
|
||||
|
||||
export const InviteInfoCmd = utilityCmd({
|
||||
trigger: ["invite", "inviteinfo"],
|
||||
description: "Show information about an invite",
|
||||
usage: "!invite overwatch",
|
||||
permission: "can_invite",
|
||||
|
||||
signature: {
|
||||
inviteCode: ct.string({ required: false }),
|
||||
},
|
||||
|
||||
async run({ message, args, pluginData }) {
|
||||
const inviteCode = parseInviteCodeInput(args.inviteCode);
|
||||
const embed = await getInviteInfoEmbed(pluginData, inviteCode);
|
||||
if (!embed) {
|
||||
sendErrorMessage(pluginData, message.channel, "Unknown invite");
|
||||
return;
|
||||
}
|
||||
|
||||
message.channel.createMessage({ embed });
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue