utility.presence: game icon support

This commit is contained in:
Cynthia Foxwell 2023-03-25 13:40:53 -06:00
parent cb2d7db160
commit c88a7dd605
2 changed files with 42007 additions and 0 deletions

41989
data/games.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -67,6 +67,8 @@ const {
} = require("../lib/utils.js"); } = require("../lib/utils.js");
const {getNamesFromString} = require("../lib/unicode.js"); const {getNamesFromString} = require("../lib/unicode.js");
const GameData = require("../../data/games.json");
const avatar = new Command("avatar"); const avatar = new Command("avatar");
avatar.category = CATEGORY; avatar.category = CATEGORY;
avatar.helpText = "Get avatar of a user"; avatar.helpText = "Get avatar of a user";
@ -926,6 +928,22 @@ presence.callback = async function (msg, line) {
}; };
} }
} }
if (
activity.application_id &&
!activity.assets?.large_image &&
!activity.assets?.small_image
) {
const game = GameData.find(
(game) => game.id == activity.application_id
);
if (game?.icon) {
embed.thumbnail = {
url: `https://cdn.discordapp.com/applications/${game.id}/app-icons/${game.icon}.png`,
};
}
}
embeds.push(embed); embeds.push(embed);
} }
} }