darkcord
Version:
A NodeJS Package to interact with Discord API
506 lines • 18.8 kB
TypeScript
import { GuildChannelDataManager } from "../manager/ChannelDataManager";
import { GuildEmojiDataManager } from "../manager/EmojiDataManager";
import { MemberDataManager } from "../manager/MemberDataManager";
import { RoleDataManager } from "../manager/RoleDataManager";
import { GuildStickerDataManager } from "../manager/StickerDataManager";
import { APIGuildWithShard, CreateChannelOptions, CreateEmojiOptions, DataWithClient, KeysToCamelCase } from "../types/index";
import { APIAutoModerationRuleTriggerMetadata, APIGuild, APIGuildScheduledEvent, APIGuildScheduledEventEntityMetadata, APIGuildWelcomeScreen, APIInviteGuild, APIPartialGuild, APIStageInstance, APIUser, GatewayPresenceUpdate, GuildBannerFormat, GuildDefaultMessageNotifications, GuildExplicitContentFilter, GuildFeature, GuildHubType, GuildIconFormat, GuildMFALevel, GuildNSFWLevel, GuildPremiumTier, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, GuildSystemChannelFlags, GuildVerificationLevel, RESTGetAPIGuildBansQuery, RESTPatchAPIApplicationCommandJSONBody, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPICurrentGuildMemberJSONBody, RESTPatchAPIGuildEmojiJSONBody, RESTPatchAPIGuildJSONBody, RESTPatchAPIGuildMemberJSONBody, RESTPatchAPIGuildRoleJSONBody, RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIGuildPruneJSONBody, RESTPostAPIGuildRoleJSONBody, RESTPostAPIGuildScheduledEventJSONBody, RESTPutAPIApplicationCommandsJSONBody, RESTPutAPIGuildBanJSONBody } from "discord-api-types/v10";
import { Base } from "./Base";
import { Channel, WelcomeChannel } from "./Channel";
import { Invite } from "./Invite";
import { Member } from "./Member";
import { Permissions } from "./Permission";
import { User } from "./User";
import { VoiceState } from "./VoiceState";
import { AuditLog } from "./AuditLog";
import { Integration } from "./Integration";
export declare class BaseGuild extends Base {
/**
* Banner hash
*/
banner: string | null;
/**
* Icon hash
*/
icon: string | null;
/**
* Enabled guild features
*/
features: GuildFeature[];
/**
* Splash hash
*/
splash: string | null;
/**
* The description of a guild
*/
description: string | null;
/**
* Verification level required for the guild
*/
verificationLevel: GuildVerificationLevel | null;
/**
* The vanity url code for the guild
*/
vanityUrlCode: string | null;
/**
* Guild name (2-100 characters, excluding trailing and leading whitespace)
*/
name: string;
/**
* The guild id
*/
id: string;
constructor(data: DataWithClient<APIPartialGuild>);
iconURL(format?: GuildIconFormat): string | null;
bannerURL(format?: GuildBannerFormat): string | null;
_update(data: APIPartialGuild): this;
}
export declare class WelcomeScreen {
/**
* The guild for this welcome screen
*/
guild: BaseGuild;
/**
* The welcome screen short message
*/
description: string | null;
/**
* Suggested channels
*/
welcomeChannels: Map<string, WelcomeChannel>;
constructor(data: APIGuildWelcomeScreen, guild: BaseGuild);
}
export declare class InviteGuild extends BaseGuild {
/**
* Guild NSFW level
*/
nsfwLevel: GuildNSFWLevel;
/**
* The number of boosts this guild currently has
*/
premiumSubscriptionCount: number | null;
/**
* The welcome screen of a Community guild, shown to new members
*/
welcomeScreen: WelcomeScreen | null;
constructor(data: DataWithClient<APIInviteGuild & Pick<APIGuild, "welcome_screen">>);
}
export declare class Guild extends BaseGuild {
/**
* Cache of channels
*/
channels: GuildChannelDataManager;
/**
* Icon hash, returned when in the template object
*/
iconHash: string | null;
/**
* Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
*/
discoverySplash: string | null;
/**
* Id of owner
*/
ownerId: string;
/**
* Total permissions for the user in the guild (excludes overwrites)
*/
permissions: Permissions;
/**
* Id of afk channel
*/
afkChannelId: string | null;
/**
* Afk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600
*/
afkTimeout: 60 | 300 | 900 | 1800 | 3600;
/**
* True if the server widget is enabled
*/
widgetEnabled?: boolean | undefined;
/**
* The channel id that the widget will generate an invite to, or null if set to no invite
*/
widgetChannelId?: string | null | undefined;
/**
* Default message notifications level
*/
defaultMessageNotifications: GuildDefaultMessageNotifications;
/**
* Explicit content filter level
*/
explicitContentFilter: GuildExplicitContentFilter;
/**
* Roles in the guild
*/
roles: RoleDataManager;
/**
* Custom guild emojis
*/
emojis: GuildEmojiDataManager;
/**
* Required MFA level for the guild
*/
mfaLevel: GuildMFALevel;
/**
* Application id of the guild creator if it is bot-created
*/
applicationId: string | null;
/**
* The id of the channel where guild notices such as welcome messages and boost events are posted
*/
systemChannelId: string | null;
/**
* System channel flags
*/
systemChannelFlags: GuildSystemChannelFlags;
/**
* The id of the channel where Community guilds can display rules and/or guidelines
*/
rulesChannelId: string | null;
/**
* The maximum number of presences for the guild (null is always returned, apart from the largest of guilds)
*/
maxPresences?: number | null | undefined;
/**
* The maximum number of members for the guild
*/
maxMembers?: number | undefined;
/**
* Premium tier (Server Boost level)
*/
premiumTier: GuildPremiumTier;
/**
* The preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
*/
preferredLocale: string;
/**
* The id of the channel where admins and moderators of Community guilds receive notices from Discord
*/
publicUpdatesChannelId: string | null;
/**
* The maximum amount of users in a video channel
*/
maxVideoChannelUsers?: number;
/**
* Approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
*/
approximateMemberCount?: number;
/**
* Approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
*/
approximatePresenceCount?: number;
/**
* The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
*/
welcomeScreen?: APIGuildWelcomeScreen;
/**
* Custom guild stickers
*/
stickers: GuildStickerDataManager;
/**
* Whether the guild has the boost progress bar enabled
*/
premiumProgressBarEnabled: boolean;
/**
* The type of Student Hub the guild is
*/
hubType: GuildHubType | null;
rawData: APIGuild;
/**
* Members of guild
*/
members: MemberDataManager;
/**
* Guild NSFW level
*/
nsfwLevel: GuildNSFWLevel;
/**
* The number of boosts this guild currently has
*/
premiumSubscriptionCount: number;
/**
* Guild presences
*/
presences: GatewayPresenceUpdate[];
/**
* Guild shard id
*/
shardId: string;
/**
* Stage Instances in this guild
*/
stageInstances: Map<string, APIStageInstance>;
/**
* Voice states in this guild
*/
voiceStates: Map<string, VoiceState>;
/**
* This guild scheduled events
*/
scheduledEvents: Map<string, ScheduledEvent>;
/**
* Guild invites
*/
invites: Map<string, Invite>;
constructor(data: DataWithClient<APIGuild | APIGuildWithShard>);
/**
* Returns the client member object
*/
get clientMember(): Member;
/**
* Returns a ban object for the given user
* @param userId
* @returns
*/
getMemberBan(userId: string): Promise<import("discord-api-types/v10").APIBan>;
getBanList(options?: RESTGetAPIGuildBansQuery): Promise<import("discord-api-types/v10").APIBan[]>;
/**
* Create a guild ban, and optionally delete previous messages sent by the banned user.
* @param userId
* @param reason
* @returns
*/
createMemberBan(userId: string, options?: KeysToCamelCase<RESTPutAPIGuildBanJSONBody>, reason?: string): Promise<void>;
/**
* Remove the ban for a user
* @param userId User id to remove ban
* @param reason Reason to remove ban
* @returns
*/
removeMemberBan(userId: string, reason?: string): Promise<void>;
/**
* Modify the position of a role in the guild
* @param roleId Role id to be modified
* @param newPosition The new position of role
* @param reason Reason to modify the position
* @returns
*/
setRolePosition(roleId: string, newPosition: number, reason?: string): Promise<import("./Role").Role>;
/**
* Edit a guild role
* @param roleId The id of role to be edited
* @param options The options to edit role
* @param reason Reason to edit role
* @returns
*/
editRole(roleId: string, options: KeysToCamelCase<RESTPatchAPIGuildRoleJSONBody>, reason?: string): Promise<import("./Role").Role>;
/**
* Create a new role for the guild
* @param options The options to create role
* @param reason The reason to create role
* @returns
*/
createRole(options: Omit<KeysToCamelCase<RESTPostAPIGuildRoleJSONBody>, "permissions"> & {
permissions: Permissions | bigint;
}, reason?: string): Promise<import("./Role").Role>;
/**
* Delete a guild role
* @param id The id of role to be deleted
* @param reason Reason to delete role
* @returns
*/
deleteRole(id: string, reason?: string): Promise<void>;
/**
* Begin a prune operation
* @param options Options to prune members
* @param reason Reason to prune members
* @returns
*/
pruneMembers(options: KeysToCamelCase<RESTPostAPIGuildPruneJSONBody>, reason?: string): Promise<import("discord-api-types/v10").RESTPostAPIGuildPruneResult>;
/**
* Remove a member from a guild
* @param userId The id of the member to be removed
* @param reason Reason to remove member
* @returns
*/
removeMember(userId: string, reason?: string): Promise<void>;
/**
* Adds a role to a member
* @param userId Id of the member who will receive the role
* @param roleId The role to be added to member
* @param reason Reason to add role
* @returns
*/
addMemberRole(userId: string, roleId: string, reason?: string): Promise<void>;
/**
* Removes a role from a member
* @param userId The id of user to remove role
* @param roleId The id of role to be removed from member
* @param reason The reason to remove role
* @returns
*/
removeMemberRole(userId: string, roleId: string, reason?: string): Promise<void>;
/**
* Edit the current member
* @param options Options to edit member
* @param reason Reason to edit member
*/
editMember(userId: "@me", options: RESTPatchAPICurrentGuildMemberJSONBody, reason?: string): Promise<Member>;
/**
* Edit a member of the guild
* @param userId The id of member to be edited
* @param options Options to edit member
* @param reason Reason to edit member
*/
editMember(userId: string, options: KeysToCamelCase<RESTPatchAPIGuildMemberJSONBody>, reason?: string): Promise<Member>;
getAuditLogs(): Promise<AuditLog>;
getInvites(): Promise<import("discord-api-types/v10").APIExtendedInvite[]>;
getIntegrations(): Promise<Integration[]>;
deleteIntegration(id: string): Promise<void>;
createScheduledEvent(options: KeysToCamelCase<RESTPostAPIGuildScheduledEventJSONBody>, reason?: string): Promise<import("discord-api-types/v10").APIGuildScheduledEvent>;
createAutoModerationRule(options: Omit<KeysToCamelCase<RESTPostAPIAutoModerationRuleJSONBody>, "triggerMetadata"> & {
triggerMetadata?: KeysToCamelCase<APIAutoModerationRuleTriggerMetadata>;
}, reason?: string): Promise<import("discord-api-types/v10").APIAutoModerationRule>;
deleteAutoModerationRule(autoModerationRuleId: string, reason?: string): Promise<void>;
editAutoModerationRule(autoModerationRuleId: string, options: Omit<KeysToCamelCase<RESTPatchAPIAutoModerationRuleJSONBody>, "triggerMetadata"> & {
triggerMetadata?: KeysToCamelCase<APIAutoModerationRuleTriggerMetadata>;
}, reason?: string): Promise<import("discord-api-types/v10").APIAutoModerationRule>;
/**
* Create a channel in this guild
* @param options The options to create channel
* @param reason Reason to create channel
* @returns
*/
createChannel(options: CreateChannelOptions, reason?: string): Promise<import("./Channel").DMChannel | Channel | import("./Channel").TextBasedChannel | import("./Channel").GuildChannel | import("./Channel").GuildTextChannel | import("./Channel").CategoryChannel | import("./Channel").StageChannel | import("./Channel").VoiceChannel>;
/**
* Delete a channel in this guild
* @param id The id of channel to be deleted
* @param reason Reason to delete channel
* @returns
*/
deleteChannel(id: string, reason?: string): Promise<void>;
/**
* Get permissions of user
* @param userId user id to get permissions
* @returns
*/
permissionsOf(userId: string | Member): Permissions;
/**
* Create a new guild command
* @param options Options to create command
* @returns
*/
createApplicationCommand(options: RESTPostAPIApplicationCommandsJSONBody): Promise<import("discord-api-types/v10").APIApplicationCommand>;
/**
* Edit a guild command
* @param commandId The id of command to be edited
* @param options Options to edit command
* @returns
*/
editApplicationCommand(commandId: string, options: RESTPatchAPIApplicationCommandJSONBody): Promise<import("discord-api-types/v10").APIApplication>;
/**
* Delete a guild command
* @param commandId The id of command to be deleted
* @returns
*/
deleteApplicationCommand(commandId: string): Promise<void>;
/**
* Takes a list of application commands, overwriting the existing command list for this application for the targeted guild
* @param commands The array of commands
* @returns
*/
bulkOverwriteApplicationCommands(commands: RESTPutAPIApplicationCommandsJSONBody): Promise<import("discord-api-types/v10").APIApplication[]>;
/**
* Create a new emoji for the guild. Requires the `CreateGuildExpressions` permission.
*
* Returns the new emoji object on success. Fires a `guildEmojisUpdate` Gateway event.
* @param options The options to create emoji
* @param reason Reason to create emoji
*/
createEmoji(options: CreateEmojiOptions, reason?: string): Promise<import("./Emoji").Emoji>;
/**
* Modify the given emoji.
*
* For emojis created by the current user, requires either the `createGuildExpressions` or `manageGuildExpressions` permission.
*
* For other emojis, requires the `manageGuildExpressions` permission.
*
* Returns the updated emoji object on success. Fires a `guildEmojisUpdate` Gateway event.
* @param emojiId The id of emoji to be edited
* @param options The options to edit emoji
* @param reason Reason to edit emoji
* @returns
*/
editEmoji(emojiId: string, options: RESTPatchAPIGuildEmojiJSONBody, reason?: string): Promise<import("./Emoji").Emoji>;
/**
* Delete the given emoji.
*
* For emojis created by the current user, requires either the `createGuildExpressions` or `manageGuildExpressions`S permission.
*
* For other emojis, requires the `manageGuildExpressions` permission.
* @param emojiId The id of emoji to be deleted
* @param reason Reason to delete emoji
* @returns
*/
deleteEmoji(emojiId: string, reason?: string): Promise<void>;
/**
* The acronym that shows up in place of a guild icon
* @returns
*/
get nameAcronym(): string;
/**
* Edit the guild
* @param options Options to edit guild
* @param reason Reason to edit
* @returns
*/
edit(options: KeysToCamelCase<RESTPatchAPIGuildJSONBody>, reason?: string): Promise<this>;
_update(data: APIGuild): this;
/**
* Update information of this guild
*
* Util if this is forged
* @returns
*/
fetchInformation(): Promise<this>;
}
export declare class ScheduledEvent extends Base {
/**
* The channel id in which the scheduled event will be hosted, or null if entity type is EXTERNAL The channel id in which the scheduled event will be hosted, or null if entity type is EXTERNAL The channel id in which the scheduled event will be hosted, or null if entity type is EXTERNAL
*/
channelId: string | null;
/**
* The user that created the scheduled event
*/
creator: User | APIUser | null;
/**
* The id of the user that created the scheduled event
*/
creatorId?: string | null;
/**
* The description of the scheduled event
*/
description?: string | null;
/**
* The id of the hosting entity associated with the scheduled event
*/
entityId: string | null;
/**
* The type of hosting entity associated with the scheduled event
*/
entityType: GuildScheduledEventEntityType;
/**
* The entity metadata for the scheduled event The entity metadata for the scheduled event The entity metadata for the scheduled event
*/
entityMetadata: APIGuildScheduledEventEntityMetadata | null;
/**
* The privacy level of the scheduled event
*/
privacyLevel: GuildScheduledEventPrivacyLevel;
/**
* The number of users subscribed to the scheduled event
*/
userCount?: number | null;
/**
* The status of the scheduled event
*/
status: GuildScheduledEventStatus;
/**
* The guild of scheduled event
*/
guild: BaseGuild;
constructor(data: APIGuildScheduledEvent, guild: BaseGuild);
}
//# sourceMappingURL=Guild.d.ts.map