emoji_add
Upload an image as a new custom emoji. Once added, members can use it, for example as a reaction.
Request
Section titled “Request”{ "cmd": "emoji_add", "name": "party_parrot", "image": "data:image/gif;base64,R0lGODlhEAAQAPIAAP..."}| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | 1 to 64 letters, digits, or underscores. Surrounding spaces are trimmed. Must not match an existing emoji name, ignoring case. |
image |
string | Yes | A base64 data URI in the form data:image/<type>;base64,<data>. A plain URL or bare base64 is rejected. |
The image type must be in the server’s uploads.emoji_allowed_file_types list, which the handshake sends in uploads. By default that is gif, jpg, jpeg, png, webp, bmp, avif, and tiff.
For PNG, JPEG, GIF, WebP, BMP, and TIFF, the server checks the file signature. The data must really be the type the URI declares.
Response
Section titled “Response”{ "cmd": "emoji_add", "id": "4", "name": "party_parrot", "fileName": "4.gif", "added": true}idis a string of digits. IDs start at"0", and each new emoji gets one more than the highest existing ID.fileNameis<id>.<extension>. Load the image fromGET /emojis/{fileName}.GET /emojis/{id}also works.
The server doesn’t broadcast new emoji. Other clients see it the next time they call emoji_list.
Permissions
Section titled “Permissions”Requires manage_emojis. A user in timeout gets a rate_limit frame instead.
Errors
Section titled “Errors”val |
When |
|---|---|
name: Required |
name is missing. The same pattern applies to image. |
name: Expected string, received number |
name or image isn’t a string. |
Failed to add emoji 'party_parrot'. It may already exist or there was a storage error. |
Any other failure: the name is invalid or taken, the image is not a valid data URI, the type isn’t allowed, the data doesn’t match the type, or the save failed. The quoted text is the name you sent. |
