You are reading the documentation for the next version of discord.js. Documentation for v13/v14+ has been moved to old.discordjs.dev

GuildsAPI

export declare class GuildsAPI
export declare class GuildsAPI

No summary provided.

constructor(rest)
Constructs a new instance of the GuildsAPI class
NameTypeOptionalDescription
restRESTNoNone
addRoleToMember(guildId, userId, roleId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
userIdSnowflakeNoThe id of the user
roleIdSnowflakeNoThe id of the role
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for adding a role to a guild member
banUser(guildId, userId, body?, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to ban the member in
userIdSnowflakeNoThe id of the user to ban
bodyRESTPutAPIGuildBanJSONBodyYesThe payload for banning the user
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for banning the user
beginPrune(guildId, body?, options?):Promise<RESTPostAPIGuildPruneResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to prune members in
bodyRESTPostAPIGuildPruneJSONBodyYesThe options for pruning members
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for initiating the prune
create(body, options?):Promise<APIGuild>
NameTypeOptionalDescription
bodyRESTPostAPIGuildsJSONBodyNoThe guild to create
optionsPick<RequestData, 'signal'>YesThe options for creating the guild
createAutoModerationRule(guildId, body, options?):Promise<APIAutoModerationRule>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to create the auto moderation rule from
bodyRESTPostAPIAutoModerationRuleJSONBodyNoThe data for creating the auto moderation rule
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the auto moderation rule
createChannel(guildId, body, options?):Promise<APIChannel>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to create the channel in
bodyRESTPostAPIGuildChannelJSONBodyNoThe data to create the new channel
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the guild channel
createEmoji(guildId, body, options?):Promise<APIEmoji>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to create the emoji from
bodyRESTPostAPIGuildEmojiJSONBodyNoThe data for creating the emoji
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the emoji
createRole(guildId, body, options?):Promise<APIRole>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to create the role in
bodyRESTPostAPIGuildRoleJSONBodyNoThe data to create the role with
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the guild role
createScheduledEvent(guildId, body, options?):Promise<APIGuildScheduledEvent>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to create the scheduled event from
bodyRESTPostAPIGuildScheduledEventJSONBodyNoThe data to create the event with
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the scheduled event
createSticker(guildId, body, options?):Promise<APISticker>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to create the sticker for
bodyOmit<RESTPostAPIGuildStickerFormDataBody, 'file'> & { file: RawFile; }NoThe data for creating the sticker
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the sticker
createTemplate(templateCode, body, options?):Promise<APITemplate>
NameTypeOptionalDescription
templateCodestringNoThe code of the template
bodyRESTPostAPIGuildTemplatesJSONBodyNoThe data for creating the template
optionsPick<RequestData, 'signal'>YesThe options for creating the template
delete(guildId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting this guild
deleteAutoModerationRule(guildId, ruleId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete the auto moderation rule from
ruleIdSnowflakeNoThe id of the auto moderation rule to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the auto moderation rule
deleteEmoji(guildId, emojiId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete the emoji from
emojiIdSnowflakeNoThe id of the emoji to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the emoji
deleteIntegration(guildId, integrationId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete the integration from
integrationIdSnowflakeNoThe id of the integration to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the integration
deleteRole(guildId, roleId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete the role in
roleIdSnowflakeNoThe id of the role to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the guild role
deleteScheduledEvent(guildId, eventId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete the scheduled event from
eventIdSnowflakeNoThe id of the scheduled event to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the scheduled event
deleteSticker(guildId, stickerId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete the sticker from
stickerIdSnowflakeNoThe id of the sticker to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the sticker
deleteTemplate(guildId, templateCode, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to delete the template from
templateCodestringNoThe code of the template to delete
optionsPick<RequestData, 'signal'>YesThe options for deleting the template
edit(guildId, body, options?):Promise<APIGuild>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit
bodyRESTPatchAPIGuildJSONBodyNoThe new guild data
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the guild
editAutoModerationRule(guildId, ruleId, body, options?):Promise<APIAutoModerationRule>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the auto moderation rule from
ruleIdSnowflakeNoThe id of the auto moderation rule to edit
bodyRESTPatchAPIAutoModerationRuleJSONBodyNoThe data for editing the auto moderation rule
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the auto moderation rule
editEmoji(guildId, emojiId, body, options?):Promise<APIEmoji>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the emoji from
emojiIdSnowflakeNoThe id of the emoji to edit
bodyRESTPatchAPIGuildEmojiJSONBodyNoThe data for editing the emoji
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the emoji
editMember(guildId, userId, body?, options?):Promise<APIGuildMember>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
userIdSnowflakeNoThe id of the user
bodyRESTPatchAPIGuildMemberJSONBodyYesThe data for editing the guild member
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the guild member
editMFALevel(guildId, level, options?):Promise<RESTPostAPIGuildsMFAJSONBody>
Edits the multi-factor-authentication (MFA) level of a guild
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the MFA level for
levelGuildMFALevelNoThe new MFA level
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the MFA level
editRole(guildId, roleId, body, options?):Promise<APIRole>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the role in
roleIdSnowflakeNoThe id of the role to edit
bodyRESTPatchAPIGuildRoleJSONBodyNodata for editing the role
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the guild role
editScheduledEvent(guildId, eventId, body, options?):Promise<APIGuildScheduledEvent>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the scheduled event from
eventIdSnowflakeNoThe id of the scheduled event to edit
bodyRESTPatchAPIGuildScheduledEventJSONBodyNoThe new event data
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the scheduled event
editSticker(guildId, stickerId, body, options?):Promise<APISticker>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the sticker from
stickerIdSnowflakeNoThe id of the sticker to edit
bodyRESTPatchAPIGuildStickerJSONBodyNoThe data for editing the sticker
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the sticker
editTemplate(guildId, templateCode, body, options?):Promise<APITemplate>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the template from
templateCodestringNoThe code of the template to edit
bodyRESTPatchAPIGuildTemplateJSONBodyNoThe data for editing the template
optionsPick<RequestData, 'signal'>YesThe options for editing the template
editUserVoiceState(guildId, userId, body, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the current user's voice state in
userIdSnowflakeNoThe id of the user to edit the voice state for
bodyRESTPatchAPIGuildVoiceStateUserJSONBodyNoThe data for editing the voice state
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the voice state
editWelcomeScreen(guildId, body?, options?):Promise<APIGuildWelcomeScreen>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the welcome screen for
bodyRESTPatchAPIGuildWelcomeScreenJSONBodyYesThe new welcome screen data
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the welcome screen
editWidgetSettings(guildId, body, options?):Promise<APIGuildWidgetSettings>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the widget settings from
bodyRESTPatchAPIGuildWidgetSettingsJSONBodyNoThe new widget settings data
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the widget settings
get(guildId, options?):Promise<APIGuild>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild
getActiveThreads(guildId, options?):Promise<APIThreadList>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the active threads from
optionsPick<RequestData, 'signal'>YesThe options for fetching the active threads
getAuditLogs(guildId, query?, options?):Promise<APIAuditLog>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the audit logs from
queryRESTGetAPIAuditLogQueryYesThe query options for fetching the audit logs
optionsPick<RequestData, 'signal'>YesThe options for fetching the audit logs
getAutoModerationRule(guildId, ruleId, options?):Promise<APIAutoModerationRule>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the auto moderation rule from
ruleIdSnowflakeNoThe id of the auto moderation rule to fetch
optionsPick<RequestData, 'signal'>YesThe options for fetching the auto moderation rule
getAutoModerationRules(guildId, options?):Promise<RESTGetAPIAutoModerationRulesResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the auto moderation rules from
optionsPick<RequestData, 'signal'>YesThe options for fetching the auto moderation rules
getChannels(guildId, options?):Promise<RESTGetAPIGuildChannelsResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the channels from
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild channels
getEmoji(guildId, emojiId, options?):Promise<APIEmoji>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the emoji from
emojiIdSnowflakeNoThe id of the emoji to fetch
optionsPick<RequestData, 'signal'>YesThe options for fetching the emoji
getEmojis(guildId, options?):Promise<RESTGetAPIGuildEmojisResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the emojis from
optionsPick<RequestData, 'signal'>YesThe options for fetching the emojis
getIntegrations(guildId, options?):Promise<RESTGetAPIGuildIntegrationsResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the integrations from
optionsPick<RequestData, 'signal'>YesThe options for fetching the integrations
getInvites(guildId, options?):Promise<RESTGetAPIGuildInvitesResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the invites from
optionsPick<RequestData, 'signal'>YesThe options for fetching the invites
getMember(guildId, userId, options?):Promise<APIGuildMember>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
userIdSnowflakeNoThe id of the user
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild member
getMemberBan(guildId, userId, options?):Promise<APIBan>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the ban from
userIdSnowflakeNoThe id of the user to fetch the ban
optionsPick<RequestData, 'signal'>YesThe options for fetching the ban
getMemberBans(guildId, query?, options?):Promise<RESTGetAPIGuildBansResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the bans from
queryRESTGetAPIGuildBansQueryYesThe query options for fetching the bans
optionsPick<RequestData, 'signal'>YesThe options for fetching the bans
getMembers(guildId, query?, options?):Promise<RESTGetAPIGuildMembersResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
queryRESTGetAPIGuildMembersQueryYesThe query for fetching the guild members
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild members
getOnboarding(guildId, options?):Promise<APIGuildOnboarding>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild onboarding
getPreview(guildId, options?):Promise<APIGuildPreview>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the preview from
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild preview
getPruneCount(guildId, query?, options?):Promise<RESTGetAPIGuildPruneCountResult>
Fetch the number of members that can be pruned from a guild
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the number of pruned members from
queryRESTGetAPIGuildPruneCountQueryYesThe query options for fetching the number of pruned members
optionsPick<RequestData, 'signal'>YesThe options for fetching the number of pruned members
getRoles(guildId, options?):Promise<RESTGetAPIGuildRolesResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the roles from
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild roles
getScheduledEvent(guildId, eventId, query?, options?):Promise<APIGuildScheduledEvent>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the scheduled event from
eventIdSnowflakeNoThe id of the scheduled event to fetch
queryRESTGetAPIGuildScheduledEventQueryYesThe options for fetching the scheduled event
optionsPick<RequestData, 'signal'>YesThe options for fetching the scheduled event
getScheduledEvents(guildId, query?, options?):Promise<RESTGetAPIGuildScheduledEventsResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the scheduled events from
queryRESTGetAPIGuildScheduledEventsQueryYesThe query options for fetching the scheduled events
optionsPick<RequestData, 'signal'>YesThe options for fetching the scheduled events
getScheduledEventUsers(guildId, eventId, query?, options?):Promise<RESTGetAPIGuildScheduledEventUsersResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the scheduled event users from
eventIdSnowflakeNoThe id of the scheduled event to fetch the users for
queryRESTGetAPIGuildScheduledEventUsersQueryYesThe options for fetching the scheduled event users
optionsPick<RequestData, 'signal'>YesThe options for fetching the scheduled event users
getSticker(guildId, stickerId, options?):Promise<APISticker>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the sticker from
stickerIdSnowflakeNoThe id of the sticker to fetch
optionsPick<RequestData, 'signal'>YesThe options for fetching the sticker
getStickers(guildId, options?):Promise<RESTGetAPIGuildStickersResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the stickers from
optionsPick<RequestData, 'signal'>YesThe options for fetching the stickers
getTemplate(templateCode, options?):Promise<APITemplate>
NameTypeOptionalDescription
templateCodestringNoThe code of the template
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild template
getTemplates(guildId, options?):Promise<RESTGetAPIGuildTemplatesResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the templates from
optionsPick<RequestData, 'signal'>YesThe options for fetching the templates
getVanityURL(guildId, options?):Promise<RESTGetAPIGuildVanityUrlResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the vanity url from
optionsPick<RequestData, 'signal'>YesThe options for fetching the vanity url
getVoiceRegions(guildId, options?):Promise<RESTGetAPIGuildVoiceRegionsResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the voice regions from
optionsPick<RequestData, 'signal'>YesThe options for fetching the voice regions
getWebhooks(id):Promise<RESTGetAPIGuildWebhooksResult>
NameTypeOptionalDescription
idSnowflakeNoThe id of the guild
getWelcomeScreen(guildId, options?):Promise<APIGuildWelcomeScreen>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the welcome screen from
optionsPick<RequestData, 'signal'>YesThe options for fetching the welcome screen
getWidget(guildId, options?):Promise<APIGuildWidget>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the widget from
optionsPick<RequestData, 'signal'>YesThe options for fetching the widget
getWidgetImage(guildId, style?, options?):Promise<ArrayBuffer>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the widget image from
styleGuildWidgetStyleYesThe style of the widget image
optionsPick<RequestData, 'signal'>YesThe options for fetching the widget image
getWidgetSettings(guildId, options?):Promise<APIGuildWidgetSettings>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to fetch the widget settings from
optionsPick<RequestData, 'signal'>YesThe options for fetching the widget settings
removeMember(guildId, userId, options?):Promise<unknown>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
userIdSnowflakeNoThe id of the user
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for removing the guild member
removeRoleFromMember(guildId, userId, roleId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
userIdSnowflakeNoThe id of the user
roleIdSnowflakeNoThe id of the role
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for removing a role from a guild member
searchForMembers(guildId, query, options?):Promise<RESTGetAPIGuildMembersSearchResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to search in
queryRESTGetAPIGuildMembersSearchQueryNoThe query to search for
optionsPick<RequestData, 'signal'>YesThe options for searching for guild members
setChannelPositions(guildId, body, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to edit the channel positions from
bodyRESTPatchAPIGuildChannelPositionsJSONBodyNoThe data to edit the channel positions with
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the guild channel positions
setRolePositions(guildId, body, options?):Promise<RESTPatchAPIGuildRolePositionsResult>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to set role positions for
bodyRESTPatchAPIGuildRolePositionsJSONBodyNoThe data for setting a role position
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for setting role positions
setVoiceState(guildId, body?):Promise<never>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
bodyRESTPatchAPIGuildVoiceStateCurrentMemberJSONBodyYesThe options for setting the voice state
syncTemplate(guildId, templateCode, options?):Promise<APITemplate>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to sync the template from
templateCodestringNoThe code of the template to sync
optionsPick<RequestData, 'signal'>YesThe options for syncing the template
unbanUser(guildId, userId, options?):Promise<void>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild to unban the member in
userIdSnowflakeNoThe id of the user to unban
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for unbanning the user