guildinfo: resolve clan game ids

This commit is contained in:
Cynthia Foxwell 2024-08-12 16:06:06 -06:00
parent f0d36959c9
commit 50d36a650f

View file

@ -9,6 +9,7 @@ const {
CDNEndpoints,
ClanPlaystyle,
ExplicitContentFilterStrings,
Games,
Permissions,
VerificationLevelStrings,
} = require("../../util/dconstants.js");
@ -76,6 +77,17 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
if (clan) {
const images = [];
const games = await Promise.all(
clan.game_ids.map(async (id) => {
let game = Games.find((x) => x.id == id);
if (!game) {
game = await hf.bot.requestHandler.request("GET", APIEndpoints.APPLICATION_RPC(snowflake), false);
}
return `${game.name} (\`${id}\`)`;
})
);
clanEmbed = {
title: _guild != null ? "Clan data" : clan.name,
description: clan.description ?? "*No description*",
@ -106,8 +118,8 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
inline: false,
},
{
name: "Associated Game IDs",
value: `\`${clan.game_ids.map((x) => `"${x}"`).join(", ")}\``,
name: "Associated Games",
value: `- ${games.join("\n- ")}`,
inline: false,
},
{