Appearance
Guild
Package: @erinjs/core
Represents a erin.js guild (server).
Constructor
| Name | Type | Optional | Description |
|---|---|---|---|
client | Client | No | |
data | any | No | API guild from GET /guilds/{id} or gateway GUILD_CREATE |
Properties
| Name | Type | Readonly | Optional | Description |
|---|---|---|---|---|
afkChannelId | string | null | No | No | AFK voice channel ID. Null if none. |
afkTimeout | number | No | No | AFK timeout in seconds. |
banner | string | null | No | No | |
bannerHeight | number | null | No | Yes | Banner image height. Optional. |
bannerWidth | number | null | No | Yes | Banner image width. Optional. |
channels | any | No | No | |
client | Client | Yes | No | |
defaultMessageNotifications | DefaultMessageNotifications | No | No | |
emojis | any | No | No | |
explicitContentFilter | GuildExplicitContentFilter | No | No | |
features | GuildFeature[] | No | No | Enabled guild features. |
icon | string | null | No | No | |
id | string | Yes | No | |
members | GuildMemberManager | No | No | |
mfaLevel | GuildMFALevel | No | No | |
name | string | No | No | |
nsfwLevel | number | No | No | |
ownerId | string | Yes | No | |
roles | any | No | No | |
rulesChannelId | string | null | No | No | Rules/guidelines channel ID. Null if none. |
splash | string | null | No | No | Invite splash image hash. Null if none. |
splashHeight | number | null | No | Yes | Splash image height. Optional. |
splashWidth | number | null | No | Yes | Splash image width. Optional. |
systemChannelId | string | null | No | No | System messages channel ID. Null if none. |
vanityURLCode | string | null | No | No | Custom vanity URL code (e.g. fluxer.gg/code). Null if none. |
verificationLevel | GuildVerificationLevel | No | No |
Methods
addRoleToMember() async
Add a role to a member by user ID. Does not require fetching the member first.
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
userId | string | No | The user ID of the member |
roleId | string | No | The role ID to add (or use guild.resolveRoleId for mention/name resolution) |
| Requires Manage Roles permission. |
ban() async
Ban a user from this guild.
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
userId | string | No | The user ID to ban |
options | { reason?: string; delete_message_days?: number; ban_duration_seconds?: number; } | Yes | Optional reason, delete_message_days (0–7), and ban_duration_seconds (temporary ban). |
| ban_duration_seconds: 0 = permanent, or use 3600, 43200, 86400, 259200, 432000, 604800, 1209600, 2592000. | |||
| Requires Ban Members permission. |
bannerURL()
Get the guild banner URL, or null if no banner.
Returns: string | null
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { size?: number; } | Yes |
createChannel() async
Create a channel in this guild.
Returns: Promise<GuildChannel>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
data | { type: 0 | 2 | 4 | 5; name: string; parent_id?: string | null; topic?: string | null; bitrate?: number | null; user_limit?: number | null; nsfw?: boolean; permission_overwrites?: Array<{ id: string; type: number; allow: string; deny: string; }>; } | No | Channel data: type (0=text, 2=voice, 4=category, 5=link), name, and optional parent_id, topic, bitrate, user_limit, nsfw, permission_overwrites |
| Requires Manage Channels permission. |
createEmojisBulk() async
Bulk create emojis. POST /guilds/{id}/emojis/bulk.
Returns: Promise<GuildEmoji[]>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
emojis | { name: string; image: string; }[] | No | Array of { name, image } (base64), 1-50 emojis |
createRole() async
Create a role in this guild. Requires Manage Roles permission.
Returns: Promise<Role>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | any | No | Role data (permissions accepts PermissionResolvable for convenience) |
createStickersBulk() async
Bulk create stickers. POST /guilds/{id}/stickers/bulk.
Returns: Promise<GuildSticker[]>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
stickers | { name: string; image: string; description?: string; tags?: string[]; }[] | No | Array of { name, image, description?, tags? }, 1-50 stickers |
delete() async
Delete this guild. POST /guilds/{id}/delete. Must be the guild owner.
Returns: Promise<void>
Parameters:
None
edit() async
Edit this guild. PATCH /guilds/{id}. Requires guild owner or Administrator.
Returns: Promise<this>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { name?: string; icon?: string | null; system_channel_id?: string | null; system_channel_flags?: number; afk_channel_id?: string | null; afk_timeout?: number; default_message_notifications?: DefaultMessageNotifications; ... 7 more ...; features?: GuildFeature[]; } | No |
fetchAuditLogs() async
Fetch guild audit logs. Requires View Audit Log permission.
Returns: Promise<APIGuildAuditLog>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { limit?: number; before?: string; after?: string; userId?: string; actionType?: number; } | Yes | Optional limit, before, after, user_id, action_type for filtering |
fetchBans() async
Fetch guild bans. Requires Ban Members permission.
Returns: Promise<GuildBan[]>
Parameters:
None
fetchChannels() async
Fetch all channels in this guild.
Returns: Promise<GuildChannel[]>
Parameters:
None
fetchEmoji() async
Fetch a single emoji by ID.
Returns: Promise<GuildEmoji>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
emojiId | string | No | The emoji ID to fetch |
fetchEmojis() async
Fetch all emojis in this guild.
Returns: Promise<GuildEmoji[]>
Parameters:
None
fetchMember() async
Fetch a guild member by user ID.
Returns: Promise<GuildMember>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
userId | string | No | The user ID of the member to fetch |
fetchRole() async
Fetch a role by ID.
Returns: Promise<Role>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
roleId | string | No | The role ID to fetch |
fetchRoles() async
Fetch all roles in this guild.
Returns: Promise<Role[]>
Parameters:
None
fetchVanityURL() async
Fetch vanity URL for this guild. GET /guilds/{id}/vanity-url. Requires Manage Guild permission.
Returns: Promise<APIVanityURL>
Parameters:
None
fetchWebhooks() async
Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send).
Returns: Promise<Webhook[]>
Parameters:
None
iconURL()
Get the guild icon URL, or null if no icon.
Returns: string | null
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { size?: number; } | Yes |
kick() async
Kick a member from this guild.
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
userId | string | No | The user ID to kick |
| Requires Kick Members permission. |
removeRoleFromMember() async
Remove a role from a member by user ID. Does not require fetching the member first.
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
userId | string | No | The user ID of the member |
roleId | string | No | The role ID to remove |
| Requires Manage Roles permission. |
resetRoleHoistPositions() async
Reset role hoist positions. DELETE /guilds/{id}/roles/hoist-positions.
Returns: Promise<APIRole[]>
Parameters:
None
resolveRoleId() async
Resolve a role ID from an argument (role mention, raw ID, or name). Fetches guild roles if name is provided.
Returns: Promise<string | null>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
arg | string | No | Role mention (@role), role ID, or role name |
setChannelPositions() async
Update channel positions.
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
updates | { id: string; position?: number; parent_id?: string | null; lock_permissions?: boolean; }[] | No | Array of |
| Requires Manage Channels permission. |
setDetachedBanner()
Set detached banner feature. PATCH /guilds/{id}/detached-banner.
Returns: Promise<this>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
enabled | boolean | No |
setDisallowUnclaimedAccounts()
Set disallow unclaimed accounts. PATCH /guilds/{id}/disallow-unclaimed-accounts.
Returns: Promise<this>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
enabled | boolean | No |
setRoleHoistPositions() async
Update role hoist positions. PATCH /guilds/{id}/roles/hoist-positions.
Returns: Promise<APIRole[]>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
updates | { id: string; hoist_position?: number; }[] | No |
setRolePositions() async
Update role positions. PATCH /guilds/{id}/roles.
Returns: Promise<APIRole[]>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
updates | { id: string; position?: number; }[] | No | Array of |
setTextChannelFlexibleNames()
Set text channel flexible names feature. PATCH /guilds/{id}/text-channel-flexible-names.
Returns: Promise<this>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
enabled | boolean | No |
splashURL()
Get the guild splash (invite background) URL, or null if no splash.
Returns: string | null
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { size?: number; } | Yes |
transferOwnership() async
Transfer guild ownership to another user. POST /guilds/{id}/transfer-ownership. Must be the guild owner.
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
newOwnerId | string | No | |
password | string | Yes |
unban() async
Remove a ban (unban a user).
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
userId | string | No | The user ID to unban |
| Requires Ban Members permission. |