> ## Documentation Index
> Fetch the complete documentation index at: https://www.chapterjs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# GuildEmoji

> Read, show, rename and delete the custom emojis of a server

A `GuildEmoji` is a custom emoji of a server. You get one from `guild.emojis`, `guild.fetchEmojis()` or `guild.createEmoji()`. Putting one in a text shows it.

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
import type { Guild } from 'chapterjs';

async function welcome(guild: Guild) {
  const emoji = [...guild.emojis.values()].find(emoji => emoji.name === 'party');
  const channel = guild.channels.get(guild.systemChannelId ?? '');
  if (!emoji || !channel?.isTextBased()) return;
  await channel.send(`Welcome! ${emoji}`);
}
```

> [!NOTE]
>
> How to put an emoji in a message or react with one is in [Messages](https://www.chapterjs.org/messages.md). A standard emoji (🎉) is a text, not a `GuildEmoji`.

## Properties

**id** `Snowflake`

The unique id Discord gave it.

**createdAt** `Date`

When it was created: a Discord id contains its creation date.

**guildId** `Snowflake`

The id of the server of the emoji.

**name** `string`

The name of the emoji, without the colons.

**animated** `boolean`

Whether the emoji moves.

**available** `boolean`

`false` when the server lost the boosts that gave it this emoji.

**managed** `boolean`

Whether the emoji belongs to an integration.

**roleIds** `readonly Snowflake[]`

The ids of the roles allowed to use the emoji; empty for everyone.

## Helpers

These read what the bot remembers: they never send a request.

### url()

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
url(options?: ImageOptions): string
```

The URL of the image of the emoji. See [ImageOptions](https://www.chapterjs.org/reference/helpers.md#imageoptions).

### toString()

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
toString(): string
```

`<:name:id>`: shows the emoji when put in a message.

### toJSON()

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
toJSON(): object
```

The data of Discord as a plain object, with camelCase names.

## Actions

### edit()

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
edit(
  options: { name?: string; roles?: (Snowflake | { id: Snowflake })[] | null },
  reason?: string
): Promise<GuildEmoji>
```

Renames the emoji, or changes which roles can use it.

[Discord documentation](https://docs.discord.com/developers/resources/emoji#modify-guild-emoji)

### delete()

```ts theme={"theme":{"light":"github-light","dark":"vesper"}}
delete(reason?: string): Promise<void>
```

Deletes the emoji.

[Discord documentation](https://docs.discord.com/developers/resources/emoji#delete-guild-emoji)

## Types

`ImageOptions` is in [Helpers](https://www.chapterjs.org/reference/helpers.md#imageoptions). To add an emoji to a server, see [`guild.createEmoji()`](https://www.chapterjs.org/reference/guild#createemoji).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.