Skip to content

GuildShorter

Signature

export declare class GuildShorter extends BaseShorter

Properties

audit: {    fetch: (guildId: string, query?: RESTGetAPIAuditLogQuery) => Promise<APIAuditLog>;};

Provides access to audit-log functionality in a guild. https://docs.discord.com/developers/resources/audit-log#get-guild-audit-log

channels: {    list: (guildId: string, force?: boolean) => Promise<AllChannels[]>;    fetch: (_guildId: string, channelId: string, force?: boolean) => Promise<AllChannels>;    create: <T extends GuildChannelTypes = GuildChannelTypes>(guildId: string, body: RESTPostAPIGuildChannelJSONBody & {        type: T;    }) => Promise<SeyfertChannelMap[T]>;    delete: (guildId: string, channelId: string, reason?: string) => Promise<AllChannels>;    edit: (guildId: string, channelId: string, body: RESTPatchAPIChannelJSONBody, reason?: string) => Promise<AllChannels>;    editPositions: (guildId: string, body: RESTPatchAPIGuildChannelPositionsJSONBody) => Promise<undefined>;    addFollower: (channelId: string, webhook_channel_id: string, reason?: string) => Promise<RESTPostAPIChannelFollowersResult>;};

Provides access to channel-related functionality in a guild.

moderation: {    list: (guildId: string) => Promise<AutoModerationRuleStructure[]>;    create: (guildId: string, body: RESTPostAPIAutoModerationRuleJSONBody) => Promise<AutoModerationRuleStructure>;    delete: (guildId: string, ruleId: string, reason?: string) => Promise<undefined>;    fetch: (guildId: string, ruleId: string) => Promise<AutoModerationRuleStructure>;    edit: (guildId: string, ruleId: string, body: RESTPatchAPIAutoModerationRuleJSONBody, reason?: string) => Promise<AutoModerationRuleStructure>;};

Provides access to auto-moderation rule-related functionality in a guild.

events: {    list: (guildId: string, query?: RESTGetAPIGuildScheduledEventsQuery) => Promise<GuildScheduledEventStructure[]>;    create: (guildId: string, body: RESTPostAPIGuildScheduledEventJSONBody, reason?: string) => Promise<GuildScheduledEventStructure>;    fetch: (guildId: string, eventId: string, query?: RESTGetAPIGuildScheduledEventQuery) => Promise<GuildScheduledEventStructure>;    edit: (guildId: string, eventId: string, body: RESTPatchAPIGuildScheduledEventJSONBody, reason?: string) => Promise<GuildScheduledEventStructure>;    delete: (guildId: string, eventId: string, reason?: string) => Promise<undefined>;    subscribers: (guildId: string, eventId: string, query?: RESTGetAPIGuildScheduledEventUsersQuery) => Promise<GuildScheduledSubscriberStructure[]>;};

Provides access to scheduled-event functionality in a guild. https://docs.discord.com/developers/resources/guild-scheduled-event

stickers: {    list: (guildId: string) => Promise<StickerStructure[]>;    create: (guildId: string, { file, ...json }: CreateStickerBodyRequest, reason?: string) => Promise<StickerStructure>;    edit: (guildId: string, stickerId: string, body: RESTPatchAPIGuildStickerJSONBody, reason?: string) => Promise<StickerStructure>;    fetch: (guildId: string, stickerId: string, force?: boolean) => Promise<StickerStructure>;    delete: (guildId: string, stickerId: string, reason?: string) => Promise<void>;};

Provides access to sticker-related functionality in a guild.

Methods

fetch(id: string, options?: GuildFetchOptions | boolean): Promise<Guild<"api">>;

Fetches a guild by its ID.

Parameters
id
The ID of the guild to fetch.
options
The options for fetching the guild.
options.query
The query parameters for fetching the guild.
options.force
Whether to force fetching the guild from the API even if it exists in the cache.
Returns

A Promise that resolves to the fetched guild.

raw(id: string, options?: GuildFetchOptions | boolean): Promise<APIGuild>;

Fetches a guild by its ID.

Parameters
id
The ID of the guild to fetch.
options
The options for fetching the guild.
options.query
The query parameters for fetching the guild.
options.force
Whether to force fetching the guild from the API even if it exists in the cache.
Returns

A Promise that resolves to the fetched guild.

widgetURL(id: string, style?: GuildWidgetStyle): Promise<ArrayBuffer>;

Generates the widget URL for the guild.

Parameters
id
The ID of the guild.
style
The style of the widget.
Returns

The generated widget URL.

leave(id: string): Promise<void | undefined>;
searchMessages(guildId: string, query?: RESTGetAPIGuildMessagesSearchQuery, wait?: boolean): Promise<GuildSearchMessagesResult>;

Searches for messages within a guild using a variety of filters. Requires `READ_MESSAGE_HISTORY` permission.

Parameters
guildId
The ID of the guild to search in.
query
The search query parameters.
wait
Whether to automatically wait and retry when the guild index is not yet available (HTTP 202).
Returns

A Promise that resolves to the search results with flattened messages.