userinfo: add interaction
This commit is contained in:
parent
acf37af87a
commit
b104dc7e3b
1 changed files with 28 additions and 0 deletions
|
@ -1,8 +1,10 @@
|
||||||
const Command = require("@lib/command.js");
|
const Command = require("@lib/command.js");
|
||||||
|
const InteractionCommand = require("@lib/interactionCommand.js");
|
||||||
|
|
||||||
const {
|
const {
|
||||||
ActivityTypeNames,
|
ActivityTypeNames,
|
||||||
APIEndpoints,
|
APIEndpoints,
|
||||||
|
ApplicationCommandOptionTypes,
|
||||||
ApplicationFlags,
|
ApplicationFlags,
|
||||||
BadgeURLs,
|
BadgeURLs,
|
||||||
CDNEndpoints,
|
CDNEndpoints,
|
||||||
|
@ -362,3 +364,29 @@ userinfo.callback = async function (msg, line) {
|
||||||
return {embeds: [embed]};
|
return {embeds: [embed]};
|
||||||
};
|
};
|
||||||
hf.registerCommand(userinfo);
|
hf.registerCommand(userinfo);
|
||||||
|
|
||||||
|
const userinfoInteraction = new InteractionCommand("userinfo");
|
||||||
|
userinfoInteraction.helpText = "Get information on an user";
|
||||||
|
userinfoInteraction.options.id = {
|
||||||
|
name: "id",
|
||||||
|
type: ApplicationCommandOptionTypes.STRING,
|
||||||
|
description: "User ID to get info for",
|
||||||
|
required: false,
|
||||||
|
default: "",
|
||||||
|
};
|
||||||
|
userinfoInteraction.options.user = {
|
||||||
|
name: "user",
|
||||||
|
type: ApplicationCommandOptionTypes.USER,
|
||||||
|
description: "User to get info for",
|
||||||
|
required: false,
|
||||||
|
default: "",
|
||||||
|
};
|
||||||
|
userinfoInteraction.callback = async function (interaction) {
|
||||||
|
const id = this.getOption(interaction, "id");
|
||||||
|
const user = interaction.resolved?.users
|
||||||
|
? Array.from(interaction.resolved.users.keys())[0]
|
||||||
|
: this.getOption(interaction, "user");
|
||||||
|
|
||||||
|
return userinfo.callback(interaction, id == "" ? user : id);
|
||||||
|
};
|
||||||
|
hf.registerCommand(userinfoInteraction);
|
||||||
|
|
Loading…
Reference in a new issue