Compare commits

..

No commits in common. "4cbe9e708041921fdb86a4f1da0bbce7c706d5f2" and "852d9f6812802dd0696d5a7e2d0a58e570b5a27f" have entirely different histories.

4 changed files with 56 additions and 61 deletions

View file

@ -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 VR";
_data.properties.browser = "Discord Embedded";
delete _data.properties.device;
}
});

View file

@ -37,7 +37,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
await msg.channel.sendTyping().catch(() => {});
}
let _guild, profileEmbed, id;
let _guild, clanEmbed, 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}
"basic": ${sources.basic}${sources.local && sources.basic ? " // false positive, local = true" : ""}
"clan": ${sources.clan}
\`\`\``;
} 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");
profileEmbed = {
clanEmbed = {
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})`);
profileEmbed.author.icon_url = url;
clanEmbed.author.icon_url = url;
}
if (profile.banner_hash) {
const url = CDNEndpoints.CLAN_BANNER(profile.id, profile.banner_hash);
images.push(`[Banner](${url})`);
profileEmbed.image = {url};
clanEmbed.image = {url};
}
if (images.length > 0) {
profileEmbed.fields.push({
clanEmbed.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 (profileEmbed != null) {
return {embeds: [profileEmbed]};
if (clanEmbed != null) {
return {embeds: [clanEmbed]};
} 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 (profileEmbed) {
return {embeds: [embed, profileEmbed]};
if (clanEmbed) {
return {embeds: [embed, clanEmbed]};
} else {
return {embed};
}
@ -466,8 +466,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
});
}
if (profileEmbed) {
return {embeds: [embed, profileEmbed]};
if (clanEmbed) {
return {embeds: [embed, clanEmbed]};
} else {
return {embed};
}
@ -551,8 +551,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
});
}
if (profileEmbed) {
return {embeds: [embed, profileEmbed]};
if (clanEmbed) {
return {embeds: [embed, clanEmbed]};
} else {
return {embed};
}
@ -624,8 +624,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
});
}
if (profileEmbed) {
return {embeds: [embed, profileEmbed]};
if (clanEmbed) {
return {embeds: [embed, clanEmbed]};
} else {
return {embed};
}

View file

@ -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

View file

@ -74,10 +74,6 @@ async function getGuild(id, noLocal = false) {
try {
const discovery = await hf.bot.requestHandler.request("GET", APIEndpoints.DISCOVERY_SLUG(id), false);
if (discovery) return {source: "discovery", data: discovery};
} catch {
try {
const basic = await hf.bot.requestHandler.request("GET", APIEndpoints.GUILD_BASIC(id), true);
if (basic) return {source: "basic", data: basic};
} catch {
try {
const verification = await hf.bot.requestHandler.request(
@ -93,7 +89,6 @@ async function getGuild(id, noLocal = false) {
}
}
}
}
return null;
}
@ -101,11 +96,10 @@ async function getGuild(id, noLocal = false) {
async function getGuildProfile(id, guild = null) {
if (guild == null) guild = await getGuild(id);
let profile;
let profile = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(id), true).catch(() => {});
if (!profile) {
if (guild?.data?.profile) {
profile = guild.data.profile;
} else if (guild?.profile) {
profile = guild.profile;
profile = guild?.profile;
} else {
const verif = await hf.bot.requestHandler
.request("GET", `${APIEndpoints.GUILD_MEMBER_VERIFICATION(id)}?with_guild=true`, true)
@ -133,6 +127,7 @@ async function getGuildProfile(id, guild = null) {
}
}
}
}
return profile;
}
@ -144,7 +139,7 @@ async function tryGetGuild(id) {
widget: false,
discovery: false,
verification: false,
basic: false,
clan: false,
};
if (hf.bot.guilds.has(id)) {
@ -184,8 +179,8 @@ async function tryGetGuild(id) {
}
try {
const basic = await hf.bot.requestHandler.request("GET", APIEndpoints.GUILD_BASIC(id), true);
if (basic) sources.basic = true;
const clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(id), true);
if (clan) sources.clan = true;
} catch {
// noop
}