Adds icons to group list and adds new playdate

This commit is contained in:
Michel Fedde 2025-05-27 19:20:10 +02:00
parent 2f826fbf36
commit 8ac59567b9
4 changed files with 55 additions and 6 deletions

View file

@ -1,4 +1,4 @@
import {Routes} from "discord.js";
import {formatEmoji, Routes, Snowflake} from "discord.js";
import {DiscordClient} from "../Discord/DiscordClient";
export class IconCache {
@ -10,7 +10,7 @@ export class IconCache {
}
public get(iconName: string): string | null {
public get(iconName: string): Snowflake | null {
if (!this.existingIcons?.has(iconName)) {
return null;
}
@ -18,6 +18,15 @@ export class IconCache {
return this.existingIcons?.get(iconName) ?? null;
}
public getEmoji(iconName: string): string {
const id = this.get(iconName);
return formatEmoji({
id: id,
name: iconName
});
}
public async set(iconName: string, pngBuffer: Buffer) {
const pngBase64 = pngBuffer.toString("base64");
const iconDataUrl = `data:image/png;base64,${pngBase64}`;