Skip to content

SupEmoji

The SupEmoji object represents a custom emoji in Sup, which can have both an image and an audio component.

Example Emoji
{
"id": "clim8yjtr0007k10fx3pt6gip",
"name": "a",
"image": {
"url": "https://user-uploads.cdn.overworld.xyz/tobpzjemg76w36f94kd1jyh9.webp",
"width": 128,
"height": 128
},
"audio": {
"url": "https://user-uploads.cdn.overworld.xyz/k49lv3f90remnuqln1i8xt9p.mp3",
"name": "k49lv3f90remnuqln1i8xt9p.mp3"
},
"creator": {
"id": "user123",
"username": "exampleuser",
"displayName": "Example User"
}
}

Properties

id

type: string

The unique identifier for the emoji.

name

type: string

The display name of the emoji. Note: This does not include the username of the creator.

image

type: SupImage| undefined

The image for the emoji.

audio

type: SupAudio | undefined

The sound that plays when the emoji is used, if available.

creator

type: SupUser | undefined

The user who created this emoji. System emojis will have undefined for this field.

Usage

function main() {
const matches =
(sup.input.text || "").match(/(:[a-z0-9]+:|:\w+\/\w+:)/g) || [];
const emojis = matches.map((match) => sup.emoji(match)).filter(Boolean);
return emojis.map((emoji) => emoji.image);
}

This example extracts emoji names from user input and displays the corresponding images.