mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 08:35:17 +00:00
Create first custom emoji
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { UserHelper } from "../helpers/UserHelper";
|
||||
import { removeHTMLNodes, checkMail, checkURL } from "../utils/StringUtils";
|
||||
import { removeHTMLNodes, checkMail, checkURL, checkEmojiCode } from "../utils/StringUtils";
|
||||
import { FriendsHelper } from "../helpers/FriendsHelper";
|
||||
import { AccountHelper } from "../helpers/AccountHelper";
|
||||
import { GroupsHelper } from "../helpers/GroupsHelper";
|
||||
@ -405,4 +405,18 @@ export abstract class BaseRequestsHandler implements AbstractUserConnectionConta
|
||||
|
||||
return convID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the shorcut of an emoji included in a POST request
|
||||
*
|
||||
* @param name The name of the POST field containing the id of the emoji
|
||||
*/
|
||||
public postEmojiShorcut(name: string) : string {
|
||||
const emojiID = this.postString(name);
|
||||
|
||||
if(!checkEmojiCode(emojiID))
|
||||
this.error(401, "Invalid emoji specified at " + name + "!")
|
||||
|
||||
return emojiID;
|
||||
}
|
||||
}
|
26
src/entities/CustomEmoji.ts
Normal file
26
src/entities/CustomEmoji.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Custom smiley
|
||||
*
|
||||
* @author Pierre Hubert
|
||||
*/
|
||||
|
||||
export interface CustomEmojiBuilder {
|
||||
id: number,
|
||||
userID: number,
|
||||
shorcut: string,
|
||||
path: string,
|
||||
}
|
||||
|
||||
export class CustomEmoji implements CustomEmojiBuilder {
|
||||
id: number;
|
||||
userID: number;
|
||||
shorcut: string;
|
||||
path: string;
|
||||
|
||||
public constructor(info: CustomEmojiBuilder) {
|
||||
for (const key in info) {
|
||||
if (info.hasOwnProperty(key))
|
||||
this[key] = info[key];
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user