presence: guh
This commit is contained in:
parent
4f5eae6dcb
commit
e5fef270ad
2 changed files with 10944 additions and 32829 deletions
43733
data/games.json
43733
data/games.json
File diff suppressed because it is too large
Load diff
|
@ -318,30 +318,34 @@ presence.callback = async function (msg, line) {
|
|||
|
||||
const game = Games.find((game) => game.id == activity.application_id);
|
||||
if (game?.icon) {
|
||||
const gameIcon = `${CDNEndpoints.APP_ICON(game.id, game.icon)}?keep_aspect_ratio=false`;
|
||||
const gameIcon = `${CDNEndpoints.APP_ICON(game.id, game.icon)}&keep_aspect_ratio=false`;
|
||||
image_links.push({label: "App Icon", url: gameIcon});
|
||||
|
||||
const largeImage = await fetch(gameIcon)
|
||||
.then((res) => res.arrayBuffer())
|
||||
.then((b) => Buffer.from(b));
|
||||
const presenceImage = sharp(largeImage).resize(100, 100);
|
||||
const smallImage = await fetch(smallUrl)
|
||||
.then((res) => res.arrayBuffer())
|
||||
.then((b) => Buffer.from(b));
|
||||
const smallImageBuffer = await sharp(smallImage).resize(32, 32).toBuffer();
|
||||
try {
|
||||
const presenceImage = sharp(largeImage).resize(100, 100);
|
||||
const smallImage = await fetch(smallUrl)
|
||||
.then((res) => res.arrayBuffer())
|
||||
.then((b) => Buffer.from(b));
|
||||
const smallImageBuffer = await sharp(smallImage).resize(32, 32).toBuffer();
|
||||
|
||||
presenceImage.composite([
|
||||
{
|
||||
input: smallImageBuffer,
|
||||
gravity: "southeast",
|
||||
},
|
||||
]);
|
||||
presenceImage.composite([
|
||||
{
|
||||
input: smallImageBuffer,
|
||||
gravity: "southeast",
|
||||
},
|
||||
]);
|
||||
|
||||
files.push({
|
||||
contents: await presenceImage.toBuffer(),
|
||||
name: `${index}.png`,
|
||||
});
|
||||
thumbnail = `attachment://${index}.png`;
|
||||
files.push({
|
||||
contents: await presenceImage.toBuffer(),
|
||||
name: `${index}.png`,
|
||||
});
|
||||
thumbnail = `attachment://${index}.png`;
|
||||
} catch {
|
||||
thumbnail = fixMediaProxyURL(smallUrl);
|
||||
}
|
||||
} else {
|
||||
thumbnail = fixMediaProxyURL(smallUrl);
|
||||
}
|
||||
|
@ -352,7 +356,7 @@ presence.callback = async function (msg, line) {
|
|||
if (activity.application_id && !activity.assets?.large_image && !activity.assets?.small_image) {
|
||||
const game = Games.find((game) => game.id == activity.application_id);
|
||||
if (game?.icon) {
|
||||
thumbnail = `${CDNEndpoints.APP_ICON(game.id, game.icon)}?keep_aspect_ratio=false`;
|
||||
thumbnail = `${CDNEndpoints.APP_ICON(game.id, game.icon)}&keep_aspect_ratio=false`;
|
||||
image_links.push({label: "App Icon", url: thumbnail});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue