mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 00:25:17 +00:00
Check if an emoji with the same shorcut is defined
This commit is contained in:
@ -29,6 +29,24 @@ export class CustomEmojisHelper {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a given user has already a custom emoji with
|
||||
* the same shorcut
|
||||
*
|
||||
* @param userID Target user ID
|
||||
* @param shorcut The name of the shorcut to check
|
||||
*/
|
||||
public static async HasUserSimilarShorcut(userID: number, shorcut: string) : Promise<boolean> {
|
||||
return await DatabaseHelper.Count({
|
||||
table: EMOJIS_TABLE,
|
||||
where: {
|
||||
user_id: userID,
|
||||
shorcut: shorcut
|
||||
}
|
||||
}) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of emojies of a given user
|
||||
*
|
||||
|
Reference in New Issue
Block a user