From 0b64578413baddab5d348970f6e942bf27637631 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Fri, 13 Feb 2026 11:16:19 -0700 Subject: [PATCH 1/2] remove clan endpoint, add guild basic endpoint --- src/modules/utility/guildinfo.js | 32 ++++++------- src/util/dconstants.js | 2 +- src/util/misc.js | 81 +++++++++++++++++--------------- 3 files changed, 60 insertions(+), 55 deletions(-) diff --git a/src/modules/utility/guildinfo.js b/src/modules/utility/guildinfo.js index 8ba5856..6de373a 100644 --- a/src/modules/utility/guildinfo.js +++ b/src/modules/utility/guildinfo.js @@ -37,7 +37,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { await msg.channel.sendTyping().catch(() => {}); } - let _guild, clanEmbed, id; + let _guild, profileEmbed, id; if (!line || line == "") { if (!msg.guildID) return "Not in a guild."; const __guild = msg.channel.guild ?? hf.bot.guilds.get(msg.guildID); @@ -67,7 +67,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { "widget": ${sources.widget} "discovery": ${sources.discovery} "verification": ${sources.verification} -"clan": ${sources.clan} +"basic": ${sources.basic}${sources.local && sources.basic ? " // false positive, local = true" : ""} \`\`\``; } else { if (!SNOWFLAKE_REGEX.test(line)) return "Not a snowflake."; @@ -117,7 +117,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { const gamesLeft = games.slice(0, Math.ceil(games.length / 2)).join("\n"); const gamesRight = games.slice(Math.ceil(games.length / 2), games.length).join("\n"); - clanEmbed = { + profileEmbed = { color: profile.brand_color_primary ? parseInt(profile.brand_color_primary.replace("#", "0x")) : 0, title: _guild == null ? profile.name : null, author: { @@ -175,16 +175,16 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { if (profile.badge_hash) { const url = CDNEndpoints.CLAN_BADGE(profile.id, profile.badge_hash); images.push(`[Badge](${url})`); - clanEmbed.author.icon_url = url; + profileEmbed.author.icon_url = url; } if (profile.banner_hash) { const url = CDNEndpoints.CLAN_BANNER(profile.id, profile.banner_hash); images.push(`[Banner](${url})`); - clanEmbed.image = {url}; + profileEmbed.image = {url}; } if (images.length > 0) { - clanEmbed.fields.push({ + profileEmbed.fields.push({ name: "\u200b", value: images.join("\u3000\u3000"), inline: false, @@ -193,8 +193,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { } if (!_guild) { - if (clanEmbed != null) { - return {embeds: [clanEmbed]}; + if (profileEmbed != null) { + return {embeds: [profileEmbed]}; } else { try { await hf.bot.requestHandler.request("GET", APIEndpoints.GUILD_WIDGET(id), false); @@ -389,8 +389,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { }); } - if (clanEmbed) { - return {embeds: [embed, clanEmbed]}; + if (profileEmbed) { + return {embeds: [embed, profileEmbed]}; } else { return {embed}; } @@ -466,8 +466,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { }); } - if (clanEmbed) { - return {embeds: [embed, clanEmbed]}; + if (profileEmbed) { + return {embeds: [embed, profileEmbed]}; } else { return {embed}; } @@ -551,8 +551,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { }); } - if (clanEmbed) { - return {embeds: [embed, clanEmbed]}; + if (profileEmbed) { + return {embeds: [embed, profileEmbed]}; } else { return {embed}; } @@ -624,8 +624,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { }); } - if (clanEmbed) { - return {embeds: [embed, clanEmbed]}; + if (profileEmbed) { + return {embeds: [embed, profileEmbed]}; } else { return {embed}; } diff --git a/src/util/dconstants.js b/src/util/dconstants.js index f391808..3e3b110 100644 --- a/src/util/dconstants.js +++ b/src/util/dconstants.js @@ -40,8 +40,8 @@ delete APIEndpoints.MESSAGE_LINK; APIEndpoints.APPLICATION_ASSETS = (applicationID) => `/oauth2/applications/${applicationID}/assets`; // prettier-ignore APIEndpoints.APPLICATION_RPC = (applicationID) => `/applications/${applicationID}/rpc`; // prettier-ignore APIEndpoints.ATTACHMENT_REFRESH = "/attachments/refresh-urls"; // prettier-ignore -APIEndpoints.CLAN = (guildID) => `/discovery/${guildID}/clan`; // prettier-ignore APIEndpoints.DISCOVERY_SLUG = (guildID) => `/discovery/${guildID}`; // prettier-ignore +APIEndpoints.GUILD_BASIC = (guildID) => `/guilds/${guildID}/basic`; // prettier-ignore APIEndpoints.GUILD_MEMBER_VERIFICATION = (guildID) => `/guilds/${guildID}/member-verification`; // prettier-ignore APIEndpoints.POMELO_UNAUTHED = "/unique-username/username-attempt-unauthed"; // prettier-ignore APIEndpoints.STORE_PUBLISHED_LISTING = (skuID) => `/store/published-listings/skus/${skuID}`; // prettier-ignore diff --git a/src/util/misc.js b/src/util/misc.js index 775d610..a1c7bf3 100644 --- a/src/util/misc.js +++ b/src/util/misc.js @@ -76,15 +76,20 @@ async function getGuild(id, noLocal = false) { if (discovery) return {source: "discovery", data: discovery}; } catch { try { - const verification = await hf.bot.requestHandler.request( - "GET", - `${APIEndpoints.GUILD_MEMBER_VERIFICATION(id)}?with_guild=true`, - true - ); - if (verification?.guild) - return {source: "verification", data: {...verification.guild, profile: verification.profile}}; + const basic = await hf.bot.requestHandler.request("GET", APIEndpoints.GUILD_BASIC(id), true); + if (basic) return {source: "basic", data: basic}; } catch { - return null; + try { + const verification = await hf.bot.requestHandler.request( + "GET", + `${APIEndpoints.GUILD_MEMBER_VERIFICATION(id)}?with_guild=true`, + true + ); + if (verification?.guild) + return {source: "verification", data: {...verification.guild, profile: verification.profile}}; + } catch { + return null; + } } } } @@ -96,35 +101,35 @@ async function getGuild(id, noLocal = false) { async function getGuildProfile(id, guild = null) { if (guild == null) guild = await getGuild(id); - let profile = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(id), true).catch(() => {}); - if (!profile) { - if (guild?.data?.profile) { - profile = guild?.profile; + let profile; + if (guild?.data?.profile) { + profile = guild.data.profile; + } else if (guild?.profile) { + profile = guild.profile; + } else { + const verif = await hf.bot.requestHandler + .request("GET", `${APIEndpoints.GUILD_MEMBER_VERIFICATION(id)}?with_guild=true`, true) + .catch(() => {}); + if (verif?.profile) { + profile = verif.profile; } else { - const verif = await hf.bot.requestHandler - .request("GET", `${APIEndpoints.GUILD_MEMBER_VERIFICATION(id)}?with_guild=true`, true) - .catch(() => {}); - if (verif?.profile) { - profile = verif.profile; - } else { - let code = - guild?.data?.vanityURL ?? - guild?.data?.store_page?.guild?.invite?.code ?? - guild?.data?.store_page?.role_subscription?.purchase_page_invite?.code ?? - guild?.data?.instant_invite?.replace(/(https?:\/\/)?(canary\.|ptb\.)?discord(\.gg|(app)?.com\/invite)\//, ""); - if (!code && hf.bot.guilds.has(id)) { - const invites = await hf.bot.requestHandler - .request("GET", APIEndpoints.GUILD_INVITES(id), true) - .catch(() => {}); - if (invites?.[0]?.code) code = invites[0].code; - } + let code = + guild?.data?.vanityURL ?? + guild?.data?.store_page?.guild?.invite?.code ?? + guild?.data?.store_page?.role_subscription?.purchase_page_invite?.code ?? + guild?.data?.instant_invite?.replace(/(https?:\/\/)?(canary\.|ptb\.)?discord(\.gg|(app)?.com\/invite)\//, ""); + if (!code && hf.bot.guilds.has(id)) { + const invites = await hf.bot.requestHandler + .request("GET", APIEndpoints.GUILD_INVITES(id), true) + .catch(() => {}); + if (invites?.[0]?.code) code = invites[0].code; + } - if (code) { - const invite = await hf.bot.requestHandler - .request("GET", `${APIEndpoints.INVITE(code)}?with_counts=true&with_expiration=true`) - .catch(() => {}); - if (invite?.profile) profile = invite.profile; - } + if (code) { + const invite = await hf.bot.requestHandler + .request("GET", `${APIEndpoints.INVITE(code)}?with_counts=true&with_expiration=true`) + .catch(() => {}); + if (invite?.profile) profile = invite.profile; } } } @@ -139,7 +144,7 @@ async function tryGetGuild(id) { widget: false, discovery: false, verification: false, - clan: false, + basic: false, }; if (hf.bot.guilds.has(id)) { @@ -179,8 +184,8 @@ async function tryGetGuild(id) { } try { - const clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(id), true); - if (clan) sources.clan = true; + const basic = await hf.bot.requestHandler.request("GET", APIEndpoints.GUILD_BASIC(id), true); + if (basic) sources.basic = true; } catch { // noop } From 4cbe9e708041921fdb86a4f1da0bbce7c706d5f2 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Fri, 13 Feb 2026 11:16:32 -0700 Subject: [PATCH 2/2] vr the real --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a968fe8..5cee54e 100644 --- a/src/index.js +++ b/src/index.js @@ -246,7 +246,7 @@ instead(bot.shards, "spawn", function (args, orig) { if (shard) { before(shard.__proto__, "sendWS", function ([op, _data]) { if (op === GatewayOPCodes.IDENTIFY) { - _data.properties.browser = "Discord Embedded"; + _data.properties.browser = "Discord VR"; delete _data.properties.device; } });