From e280d900530333d9051be48faef037a9ce34832d Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sat, 18 May 2024 23:13:42 -0600 Subject: [PATCH 1/2] utility.guildinfo: fix guildID fallback not getting a guild in cases where it can --- src/modules/utility.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/utility.js b/src/modules/utility.js index 444f3ff..2850c2e 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -1981,7 +1981,11 @@ guildinfo.callback = async function (msg, line) { if (!line || line == "") { if (!msg.guildID) return "Not in a guild."; const __guild = msg.channel.guild ?? hf.bot.guilds.get(msg.guildID); - if (__guild) _guild = {source: "local", data: __guild}; + if (__guild) { + _guild = {source: "local", data: __guild}; + } else { + _guild = await getGuild(msg.guildID); + } } else { if (!SNOWFLAKE_REGEX.test(line)) return "Not a snowflake."; const snowflake = line.match(SNOWFLAKE_REGEX)[1]; From 4735cce106f542fdbf20a633a89b328e05f7aa1d Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sat, 18 May 2024 23:15:34 -0600 Subject: [PATCH 2/2] utility: add inviteinfo interaction command --- src/modules/utility.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/utility.js b/src/modules/utility.js index 2850c2e..b55a643 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -1049,6 +1049,22 @@ lookupinvite.callback = async function (msg, line) { }; hf.registerCommand(lookupinvite); +const inviteinfoInteraction = new InteractionCommand("inviteinfo"); +inviteinfoInteraction.helpText = "Get information on an invite code"; +inviteinfoInteraction.options.invite = { + name: "invite", + type: Constants.ApplicationCommandOptionTypes.STRING, + description: "Invite code to get info for", + required: true, + default: "", +}; +inviteinfoInteraction.callback = async function (interaction) { + const invite = getOption(interaction, inviteinfoInteraction, "invite"); + + return lookupinvite.callback(interaction, invite); +}; +hf.registerCommand(inviteinfoInteraction); + const snowflake = new Command("snowflake"); snowflake.category = CATEGORY; snowflake.helpText = "Converts a snowflake ID into readable time.";