1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-19 16:15:16 +00:00

Can get information about an emoji included in a POST request

This commit is contained in:
2020-04-03 18:51:00 +02:00
parent f70d01d8bb
commit 8693c1e556
2 changed files with 40 additions and 3 deletions

View File

@ -42,6 +42,25 @@ export class CustomEmojisHelper {
})).map((e) => this.DbToCustomEmoji(e));
}
/**
* Get information about a single emoji
*
* @param emojiID The ID of the emoji to get
* @throws An error if the emoji was not found
*/
public static async GetSingle(emojiID: number) : Promise<CustomEmoji> {
const row = await DatabaseHelper.QueryRow({
table: EMOJIS_TABLE,
where: {
id: emojiID
}
});
if(row == null)
throw new Error("Requested emoji was not found ! (emoji id " + emojiID + ")")
return this.DbToCustomEmoji(row);
}
/**
* Turn a database entry into a custom emoji