Compare commits

...

17 Commits

Author SHA1 Message Date
github-actions[bot]
9978b77ef2 chore(release): 0.37.13 🎉 (#606)
Build ran for 3696ce7805

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-14 22:01:14 +03:00
Jiralite
3696ce7805 refactor(APIAuditLogOptions): Use AuditLogRuleTriggerType for auto_moderation_rule_trigger_type (#605) 2022-10-14 17:32:49 +00:00
Vitor
b216f7a8be feat(APIAutoModeration): add support for auto moderation (#418) 2022-10-14 19:56:21 +03:00
dependabot[bot]
05cfe1bf96 chore(deps): bump vm2 from 3.9.9 to 3.9.11 (#593)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-13 22:29:18 +03:00
github-actions[bot]
5ffb2d3586 chore(release): 0.37.12 🎉 (#598)
Build ran for f62f2506b0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-06 15:30:56 +03:00
Almeida
f62f2506b0 refactor(FormattingPatterns): update SlashCommand pattern (#597) 2022-10-06 12:18:06 +00:00
github-actions[bot]
2876125975 chore(release): 0.37.11 🎉 (#591)
Build ran for 143b003fbe

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-26 22:46:32 +03:00
Almeida
143b003fbe feat(APIGuildForumChannel): add default_sort_order (#589) 2022-09-25 20:42:38 +03:00
MateoDeveloper
0f118d382f feat(APIGuildForumChannel): update and add missing features (#575) 2022-09-25 20:21:49 +03:00
github-actions[bot]
2dc3fd0a15 chore(release): 0.37.10 🎉 (#587)
Build ran for d452f6346b

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-15 16:42:15 +04:00
Vitor
d452f6346b feat(APIConnection): add two_way_link (#546) 2022-09-15 01:29:48 +03:00
MateoDeveloper
32f5a7b981 feat(APIGuild): document afk timeout values (#570) 2022-09-15 00:14:27 +03:00
Almeida
f4d3f4d5b1 feat: add RESTRateLimit (#585) 2022-09-14 21:13:32 +03:00
github-actions[bot]
5c7e58284e chore(release): 0.37.9 🎉 (#586)
Build ran for afd3b55c08

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-12 15:37:13 +03:00
Vitor
afd3b55c08 feat(ConnectionService): add new connections (#548) 2022-09-09 21:36:17 +03:00
github-actions[bot]
4fbe1180fc chore(release): 0.37.8 🎉 (#584)
Build ran for 2708cb9dca

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-08 15:44:24 +03:00
advaith
2708cb9dca feat(GuildFeature): add InvitesDisabled (#549) 2022-09-08 01:12:49 +03:00
69 changed files with 2789 additions and 61 deletions

View File

@@ -1,3 +1,38 @@
## [0.37.13](https://github.com/discordjs/discord-api-types/compare/0.37.12...0.37.13) (2022-10-14)
### Features
- **APIAutoModeration:** add support for auto moderation ([#418](https://github.com/discordjs/discord-api-types/issues/418)) ([b216f7a](https://github.com/discordjs/discord-api-types/commit/b216f7a8bee2c02fe0e75189fe31f95973bfbe2e))
## [0.37.12](https://github.com/discordjs/discord-api-types/compare/0.37.11...0.37.12) (2022-10-06)
## [0.37.11](https://github.com/discordjs/discord-api-types/compare/0.37.10...0.37.11) (2022-09-26)
### Features
- **APIGuildForumChannel:** add `default_sort_order` ([#589](https://github.com/discordjs/discord-api-types/issues/589)) ([143b003](https://github.com/discordjs/discord-api-types/commit/143b003fbe5a86eda225e9da1d0914d6e48cddfd))
- **APIGuildForumChannel:** update and add missing features ([#575](https://github.com/discordjs/discord-api-types/issues/575)) ([0f118d3](https://github.com/discordjs/discord-api-types/commit/0f118d382f94151b1c9be42620520c91b20a05f6))
## [0.37.10](https://github.com/discordjs/discord-api-types/compare/0.37.9...0.37.10) (2022-09-15)
### Features
- add `RESTRateLimit` ([#585](https://github.com/discordjs/discord-api-types/issues/585)) ([f4d3f4d](https://github.com/discordjs/discord-api-types/commit/f4d3f4d5b1c1b6e42c2a8f8184f43d67b586c8c1))
- **APIConnection:** add `two_way_link` ([#546](https://github.com/discordjs/discord-api-types/issues/546)) ([d452f63](https://github.com/discordjs/discord-api-types/commit/d452f6346bd4953a8d777f3818797c4285b1b842))
- **APIGuild:** document afk timeout values ([#570](https://github.com/discordjs/discord-api-types/issues/570)) ([32f5a7b](https://github.com/discordjs/discord-api-types/commit/32f5a7b9814b69da7fc3772ec1f0307d39cda087))
## [0.37.9](https://github.com/discordjs/discord-api-types/compare/0.37.8...0.37.9) (2022-09-12)
### Features
- **ConnectionService:** add new connections ([#548](https://github.com/discordjs/discord-api-types/issues/548)) ([afd3b55](https://github.com/discordjs/discord-api-types/commit/afd3b55c08b0cf75cc4f5a06d3574b6cf532cb6c))
## [0.37.8](https://github.com/discordjs/discord-api-types/compare/0.37.7...0.37.8) (2022-09-08)
### Features
- **GuildFeature:** add `InvitesDisabled` ([#549](https://github.com/discordjs/discord-api-types/issues/549)) ([2708cb9](https://github.com/discordjs/discord-api-types/commit/2708cb9dcaa07d19ca71e9ca211e78939b9d1ff4))
## [0.37.7](https://github.com/discordjs/discord-api-types/compare/0.37.6...0.37.7) (2022-09-05)
### Bug Fixes

View File

@@ -1,3 +1,38 @@
## [0.37.13](https://github.com/discordjs/discord-api-types/compare/0.37.12...0.37.13) (2022-10-14)
### Features
- **APIAutoModeration:** add support for auto moderation ([#418](https://github.com/discordjs/discord-api-types/issues/418)) ([b216f7a](https://github.com/discordjs/discord-api-types/commit/b216f7a8bee2c02fe0e75189fe31f95973bfbe2e))
## [0.37.12](https://github.com/discordjs/discord-api-types/compare/0.37.11...0.37.12) (2022-10-06)
## [0.37.11](https://github.com/discordjs/discord-api-types/compare/0.37.10...0.37.11) (2022-09-26)
### Features
- **APIGuildForumChannel:** add `default_sort_order` ([#589](https://github.com/discordjs/discord-api-types/issues/589)) ([143b003](https://github.com/discordjs/discord-api-types/commit/143b003fbe5a86eda225e9da1d0914d6e48cddfd))
- **APIGuildForumChannel:** update and add missing features ([#575](https://github.com/discordjs/discord-api-types/issues/575)) ([0f118d3](https://github.com/discordjs/discord-api-types/commit/0f118d382f94151b1c9be42620520c91b20a05f6))
## [0.37.10](https://github.com/discordjs/discord-api-types/compare/0.37.9...0.37.10) (2022-09-15)
### Features
- add `RESTRateLimit` ([#585](https://github.com/discordjs/discord-api-types/issues/585)) ([f4d3f4d](https://github.com/discordjs/discord-api-types/commit/f4d3f4d5b1c1b6e42c2a8f8184f43d67b586c8c1))
- **APIConnection:** add `two_way_link` ([#546](https://github.com/discordjs/discord-api-types/issues/546)) ([d452f63](https://github.com/discordjs/discord-api-types/commit/d452f6346bd4953a8d777f3818797c4285b1b842))
- **APIGuild:** document afk timeout values ([#570](https://github.com/discordjs/discord-api-types/issues/570)) ([32f5a7b](https://github.com/discordjs/discord-api-types/commit/32f5a7b9814b69da7fc3772ec1f0307d39cda087))
## [0.37.9](https://github.com/discordjs/discord-api-types/compare/0.37.8...0.37.9) (2022-09-12)
### Features
- **ConnectionService:** add new connections ([#548](https://github.com/discordjs/discord-api-types/issues/548)) ([afd3b55](https://github.com/discordjs/discord-api-types/commit/afd3b55c08b0cf75cc4f5a06d3574b6cf532cb6c))
## [0.37.8](https://github.com/discordjs/discord-api-types/compare/0.37.7...0.37.8) (2022-09-08)
### Features
- **GuildFeature:** add `InvitesDisabled` ([#549](https://github.com/discordjs/discord-api-types/issues/549)) ([2708cb9](https://github.com/discordjs/discord-api-types/commit/2708cb9dcaa07d19ca71e9ca211e78939b9d1ff4))
## [0.37.7](https://github.com/discordjs/discord-api-types/compare/0.37.6...0.37.7) (2022-09-05)
### Bug Fixes

View File

@@ -6,6 +6,8 @@ import type { Snowflake } from '../globals.ts';
import type { GatewayPresenceUpdate } from '../payloads/v10/gateway.ts';
import type {
APIApplication,
APIAutoModerationRule,
APIAutoModerationAction,
APIChannel,
APIEmoji,
APIGuild,
@@ -28,6 +30,7 @@ import type {
GatewayVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
} from '../payloads/v10/mod.ts';
import type { Nullable } from '../utils/internals.ts';
@@ -190,6 +193,8 @@ export enum GatewayIntentBits {
DirectMessageTyping = 1 << 14,
MessageContent = 1 << 15,
GuildScheduledEvents = 1 << 16,
AutoModerationConfiguration = 1 << 20,
AutoModerationExecution = 1 << 21,
}
/**
@@ -252,6 +257,10 @@ export enum GatewayDispatchEvents {
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
AutoModerationRuleCreate = 'AUTO_MODERATION_RULE_CREATE',
AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE',
AutoModerationRuleDelete = 'AUTO_MODERATION_RULE_DELETE',
AutoModerationActionExecution = 'AUTO_MODERATION_ACTION_EXECUTION',
}
export type GatewaySendPayload =
@@ -432,6 +441,121 @@ export interface GatewayReadyDispatchData {
*/
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatch = DataPayload<
| GatewayDispatchEvents.AutoModerationRuleCreate
| GatewayDispatchEvents.AutoModerationRuleUpdate
| GatewayDispatchEvents.AutoModerationRuleDelete,
GatewayAutoModerationRuleModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatchData = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-action-execution
*/
export type GatewayAutoModerationActionExecutionDispatch = DataPayload<
GatewayDispatchEvents.AutoModerationActionExecution,
GatewayAutoModerationActionExecutionDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution
*/
export interface GatewayAutoModerationActionExecutionDispatchData {
/**
* The id of the guild in which action was executed
*/
guild_id: Snowflake;
/**
* The action which was executed
*/
action: APIAutoModerationAction;
/**
* The id of the rule which action belongs to
*/
rule_id: Snowflake;
/**
* The trigger type of rule which was triggered
*/
rule_trigger_type: AutoModerationRuleTriggerType;
/**
* The id of the user which generated the content which triggered the rule
*/
user_id: Snowflake;
/**
* The id of the channel in which user content was posted
*/
channel_id?: Snowflake;
/**
* The id of any user message which content belongs to
*
* This field will not be present if message was blocked by AutoMod or content was not part of any message
*/
message_id?: Snowflake;
/**
* The id of any system auto moderation messages posted as a result of this action
*
* This field will not be present if this event does not correspond to an action with type {@link AutoModerationActionType.SendAlertMessage}
*/
alert_system_message_id?: Snowflake;
/**
* The user generated text content
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
content: string;
/**
* The word or phrase configured in the rule that triggered the rule
*/
matched_keyword: string | null;
/**
* The substring in content that triggered the rule
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
matched_content: string | null;
}
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update

View File

@@ -6,6 +6,8 @@ import type { Snowflake } from '../globals.ts';
import type { GatewayPresenceUpdate } from '../payloads/v9/gateway.ts';
import type {
APIApplication,
APIAutoModerationRule,
APIAutoModerationAction,
APIChannel,
APIEmoji,
APIGuild,
@@ -28,6 +30,7 @@ import type {
GatewayVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
} from '../payloads/v9/mod.ts';
import type { Nullable } from '../utils/internals.ts';
@@ -189,6 +192,8 @@ export enum GatewayIntentBits {
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
AutoModerationConfiguration = 1 << 20,
AutoModerationExecution = 1 << 21,
}
/**
@@ -251,6 +256,10 @@ export enum GatewayDispatchEvents {
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
AutoModerationRuleCreate = 'AUTO_MODERATION_RULE_CREATE',
AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE',
AutoModerationRuleDelete = 'AUTO_MODERATION_RULE_DELETE',
AutoModerationActionExecution = 'AUTO_MODERATION_ACTION_EXECUTION',
}
export type GatewaySendPayload =
@@ -431,6 +440,121 @@ export interface GatewayReadyDispatchData {
*/
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatch = DataPayload<
| GatewayDispatchEvents.AutoModerationRuleCreate
| GatewayDispatchEvents.AutoModerationRuleUpdate
| GatewayDispatchEvents.AutoModerationRuleDelete,
GatewayAutoModerationRuleModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatchData = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-action-execution
*/
export type GatewayAutoModerationActionExecutionDispatch = DataPayload<
GatewayDispatchEvents.AutoModerationActionExecution,
GatewayAutoModerationActionExecutionDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution
*/
export interface GatewayAutoModerationActionExecutionDispatchData {
/**
* The id of the guild in which action was executed
*/
guild_id: Snowflake;
/**
* The action which was executed
*/
action: APIAutoModerationAction;
/**
* The id of the rule which action belongs to
*/
rule_id: Snowflake;
/**
* The trigger type of rule which was triggered
*/
rule_trigger_type: AutoModerationRuleTriggerType;
/**
* The id of the user which generated the content which triggered the rule
*/
user_id: Snowflake;
/**
* The id of the channel in which user content was posted
*/
channel_id?: Snowflake;
/**
* The id of any user message which content belongs to
*
* This field will not be present if message was blocked by AutoMod or content was not part of any message
*/
message_id?: Snowflake;
/**
* The id of any system auto moderation messages posted as a result of this action
*
* This field will not be present if this event does not correspond to an action with type {@link AutoModerationActionType.SendAlertMessage}
*/
alert_system_message_id?: Snowflake;
/**
* The user generated text content
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
content: string;
/**
* The word or phrase configured in the rule that triggered the rule
*/
matched_keyword: string | null;
/**
* The substring in content that triggered the rule
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
matched_content: string | null;
}
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update

View File

@@ -51,7 +51,7 @@ export const FormattingPatterns = {
* The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression
*/
SlashCommand:
/<\/(?<fullName>(?<name>[\w-]{1,32})(?: (?<subcommandOrGroup>[\w-]{1,32}))?(?: (?<subcommand>[\w-]{1,32}))?):(?<id>\d{17,20})>/,
/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
/**
* Regular expression for matching a custom emoji, either static or animated
*

View File

@@ -78,3 +78,21 @@ export interface RESTErrorGroupWrapper {
}
export type RESTErrorData = RESTErrorGroupWrapper | RESTErrorFieldInformation | { [k: string]: RESTErrorData } | string;
/**
* https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-rate-limit-response-structure
*/
export interface RESTRateLimit {
/**
* A value indicating if you are being globally rate limited or not
*/
global: boolean;
/**
* A message saying you are being rate limited.
*/
message: string;
/**
* The number of seconds to wait before submitting another request.
*/
retry_after: number;
}

View File

@@ -2,6 +2,13 @@
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type {
APIAutoModerationAction,
APIAutoModerationRule,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleEventType,
AutoModerationRuleTriggerType,
} from './autoModeration.ts';
import type { APIChannel, APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
@@ -52,6 +59,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
*/
audit_log_entries: APIAuditLogEntry[];
/**
* List of auto moderation rules referenced in the audit log
*
* See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
*/
auto_moderation_rules: APIAutoModerationRule[];
/**
* Partial integration objects
*
@@ -180,12 +193,37 @@ export enum AuditLogEvent {
ThreadDelete,
ApplicationCommandPermissionUpdate = 121,
AutoModerationRuleCreate = 140,
AutoModerationRuleUpdate,
AutoModerationRuleDelete,
AutoModerationBlockMessage,
AutoModerationFlagToChannel,
AutoModerationUserCommunicationDisabled,
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
export interface APIAuditLogOptions {
/**
* Name of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_name?: string;
/**
* Trigger type of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_trigger_type?: AuditLogRuleTriggerType;
/**
* Number of days after which inactive members were kicked
*
@@ -212,6 +250,9 @@ export interface APIAuditLogOptions {
* - STAGE_INSTANCE_CREATE
* - STAGE_INSTANCE_UPDATE
* - STAGE_INSTANCE_DELETE
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
channel_id?: Snowflake;
@@ -275,6 +316,8 @@ export enum AuditLogOptionsType {
Member = '1',
}
export type AuditLogRuleTriggerType = `${AutoModerationRuleTriggerType}`;
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
*/
@@ -347,7 +390,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation
| APIAuditLogChangeKeyCommunicationDisabledUntil;
| APIAuditLogChangeKeyCommunicationDisabledUntil
| APIAuditLogChangeKeyTriggerType
| APIAuditLogChangeKeyEventType
| APIAuditLogChangeKeyTriggerMetadata
| APIAuditLogChangeKeyActions
| APIAuditLogChangeKeyEnabled
| APIAuditLogChangeKeyExemptRoles
| APIAuditLogChangeKeyExemptChannels;
/**
* Returned when an entity's name is changed
@@ -710,6 +760,44 @@ export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string
*/
export type APIAuditLogChangeKeyCommunicationDisabledUntil = AuditLogChangeData<'communication_disabled_until', string>;
/**
* Returned when an auto moderation rule's trigger type is changed (only in rule creation or deletion)
*/
export type APIAuditLogChangeKeyTriggerType = AuditLogChangeData<'trigger_type', AutoModerationRuleTriggerType>;
/**
* Returned when an auto moderation rule's event type is changed
*/
export type APIAuditLogChangeKeyEventType = AuditLogChangeData<'event_type', AutoModerationRuleEventType>;
/**
* Returned when an auto moderation rule's trigger metadata is changed
*/
export type APIAuditLogChangeKeyTriggerMetadata = AuditLogChangeData<
'trigger_metadata',
APIAutoModerationRuleTriggerMetadata
>;
/**
* Returned when an auto moderation rule's actions is changed
*/
export type APIAuditLogChangeKeyActions = AuditLogChangeData<'actions', APIAutoModerationAction[]>;
/**
* Returned when an auto moderation rule's enabled status is changed
*/
export type APIAuditLogChangeKeyEnabled = AuditLogChangeData<'enabled', boolean>;
/**
* Returned when an auto moderation rule's exempt roles is changed
*/
export type APIAuditLogChangeKeyExemptRoles = AuditLogChangeData<'exempt_roles', Snowflake[]>;
/**
* Returned when an auto moderation rule's exempt channels is changed
*/
export type APIAuditLogChangeKeyExemptChannels = AuditLogChangeData<'exempt_channels', Snowflake[]>;
interface AuditLogChangeData<K extends string, D> {
key: K;
/**

View File

@@ -0,0 +1,195 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/auto-moderation
*/
import type { Snowflake } from '../../globals.ts';
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure
*/
export interface APIAutoModerationRule {
/**
* The id of this rule
*/
id: Snowflake;
/**
* The guild which this rule belongs to
*/
guild_id: Snowflake;
/**
* The rule name
*/
name: string;
/**
* The user id who created this rule
*/
creator_id: Snowflake;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*/
trigger_metadata: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*/
enabled: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels: Snowflake[];
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types
*/
export enum AutoModerationRuleTriggerType {
/**
* Check if content contains words from a user defined list of keywords (Maximum of 3 per guild)
*/
Keyword = 1,
/**
* Check if content represents generic spam (Maximum of 1 per guild)
*/
Spam = 3,
/**
* Check if content contains words from internal pre-defined wordsets (Maximum of 1 per guild)
*/
KeywordPreset,
/**
* Check if content contains more mentions than allowed (Maximum of 1 per guild)
*/
MentionSpam,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata
*/
export interface APIAutoModerationRuleTriggerMetadata {
/**
* Substrings which will be searched for in content (Maximum of 1000)
*
* A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.Keyword}
*/
keyword_filter?: string[];
/**
* The internally pre-defined wordsets which will be searched for in content
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
presets?: AutoModerationRuleKeywordPresetType[];
/**
* Substrings which will be exempt from triggering the preset trigger type (Maximum of 1000)
*
* A allowed-word can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
allow_list?: string[];
/**
* Total number of mentions (role & user) allowed per message (Maximum of 50)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.MentionSpam}
*/
mention_total_limit?: number;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types
*/
export enum AutoModerationRuleKeywordPresetType {
/**
* Words that may be considered forms of swearing or cursing
*/
Profanity = 1,
/**
* Words that refer to sexually explicit behavior or activity
*/
SexualContent,
/**
* Personal insults or words that may be considered hate speech
*/
Slurs,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
*/
export enum AutoModerationRuleEventType {
/**
* When a member sends or edits a message in the guild
*/
MessageSend = 1,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure
*/
export interface APIAutoModerationAction {
/**
* The action type
*/
type: AutoModerationActionType;
/**
* Additional metadata needed during execution for this specific action type
*
* Will only be omitted if the action type is {@link AutoModerationActionType.BlockMessage}
*/
metadata?: APIAutoModerationActionMetadata;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types
*/
export enum AutoModerationActionType {
/**
* Blocks the content of a message according to the rule
*/
BlockMessage = 1,
/**
* Logs user content to a specified channel
*/
SendAlertMessage,
/**
* Timeout user for specified duration, this action type can be set if the bot has `MODERATE_MEMBERS` permission
*/
Timeout,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata
*/
export interface APIAutoModerationActionMetadata {
/**
* Channel to which user content should be logged
*
* Associated action type: {@link AutoModerationActionType.SendAlertMessage}
*/
channel_id?: Snowflake;
/**
* Timeout duration in seconds (Maximum of 4 weeks - 2419200 seconds)
*
* Only available if using {@link AutoModerationRuleTriggerType.Keyword}
*
* Associated action type: {@link AutoModerationActionType.Timeout}
*/
duration_seconds?: number;
}

View File

@@ -108,7 +108,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
*/
default_auto_archive_duration?: ThreadAutoArchiveDuration;
/**
* The channel topic (0-1024 characters)
* The channel topic (0-4096 characters for forum channels, 0-1024 characters for all others)
*/
topic?: string | null;
/**
@@ -230,9 +230,85 @@ export interface APIThreadChannel
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
*/
total_message_sent?: number;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags: Snowflake[];
}
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
/**
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
*/
export interface APIGuildForumTag {
/**
* The id of the tag
*/
id: Snowflake;
/**
* The name of the tag (0-20 characters)
*/
name: string;
/**
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
*/
moderated: boolean;
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
*/
export interface APIGuildForumDefaultReactionEmoji {
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
*/
export enum SortOrderType {
/**
* Sort forum posts by activity
*/
LatestActivity,
/**
* Sort forum posts by creation time (from most recent to oldest)
*/
CreationDate,
}
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
/**
* The set of tags that can be used in a forum channel
*/
available_tags: APIGuildForumTag[];
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*/
default_thread_rate_limit_per_user?: number;
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*/
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
/**
* The default sort order type used to order posts in forum channels
*/
default_sort_order: SortOrderType | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
@@ -591,6 +667,7 @@ export enum MessageType {
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,
}
/**
@@ -943,6 +1020,12 @@ export enum EmbedType {
* Link embed
*/
Link = 'link',
/**
* Auto moderation alert embed
*
* @unstable This embed type is currently not documented by Discord, but it is returned in the auto moderation system messages.
*/
AutoModerationMessage = 'auto_moderation_message',
}
/**
@@ -1429,7 +1512,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
export enum ChannelFlags {
/**
* This thread is pinned to the top of its parent forum channel
*/
Pinned = 1 << 1,
/**
* Whether a tag is required to be specified when creating a thread in a forum channel.
* Tags are specified in the `applied_tags` field
*/
RequireTag = 1 << 4,
}
/**

View File

@@ -118,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
*/
afk_channel_id: Snowflake | null;
/**
* afk timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout: number;
/**
@@ -382,6 +382,10 @@ export enum GuildFeature {
* Guild has access to set an animated guild icon
*/
AnimatedIcon = 'ANIMATED_ICON',
/**
* Guild has set up auto moderation rules
*/
AutoModeration = 'AUTO_MODERATION',
/**
* Guild has access to set a guild banner image
*/
@@ -410,6 +414,10 @@ export enum GuildFeature {
* @unstable This feature is currently not documented by Discord, but has known value
*/
Hub = 'HUB',
/**
* Guild has disabled invite usage, preventing users from joining
*/
InvitesDisabled = 'INVITES_DISABLED',
/**
* Guild has access to set an invite splash background
*/

View File

@@ -1,6 +1,7 @@
export * from '../common.ts';
export * from './application.ts';
export * from './auditLog.ts';
export * from './autoModeration.ts';
export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';

View File

@@ -204,6 +204,10 @@ export interface APIConnection {
* Whether activities related to this connection will be shown in presence updates
*/
show_activity: boolean;
/**
* Whether this connection supports console voice transfer
*/
two_way_link: boolean;
/**
* Visibility of this connection
*
@@ -214,13 +218,15 @@ export interface APIConnection {
export enum ConnectionService {
BattleNet = 'battlenet',
eBay = 'ebay',
EpicGames = 'epicgames',
Facebook = 'facebook',
GitHub = 'github',
LeagueOfLegends = 'leagueoflegends',
PayPal = 'paypal',
PlayStationNetwork = 'playstation',
Reddit = 'reddit',
SamsungGalaxy = 'samsunggalaxy',
RiotGames = 'riotgames',
Spotify = 'spotify',
Skype = 'skype',
Steam = 'steam',

View File

@@ -2,6 +2,13 @@
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type {
APIAutoModerationAction,
APIAutoModerationRule,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleEventType,
AutoModerationRuleTriggerType,
} from './autoModeration.ts';
import type { APIChannel, APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
@@ -52,6 +59,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
*/
audit_log_entries: APIAuditLogEntry[];
/**
* List of auto moderation rules referenced in the audit log
*
* See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
*/
auto_moderation_rules: APIAutoModerationRule[];
/**
* Partial integration objects
*
@@ -180,12 +193,37 @@ export enum AuditLogEvent {
ThreadDelete,
ApplicationCommandPermissionUpdate = 121,
AutoModerationRuleCreate = 140,
AutoModerationRuleUpdate,
AutoModerationRuleDelete,
AutoModerationBlockMessage,
AutoModerationFlagToChannel,
AutoModerationUserCommunicationDisabled,
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
export interface APIAuditLogOptions {
/**
* Name of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_name?: string;
/**
* Trigger type of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_trigger_type?: AuditLogRuleTriggerType;
/**
* Number of days after which inactive members were kicked
*
@@ -212,6 +250,9 @@ export interface APIAuditLogOptions {
* - STAGE_INSTANCE_CREATE
* - STAGE_INSTANCE_UPDATE
* - STAGE_INSTANCE_DELETE
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
channel_id?: Snowflake;
@@ -275,6 +316,8 @@ export enum AuditLogOptionsType {
Member = '1',
}
export type AuditLogRuleTriggerType = `${AutoModerationRuleTriggerType}`;
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
*/
@@ -347,7 +390,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation
| APIAuditLogChangeKeyCommunicationDisabledUntil;
| APIAuditLogChangeKeyCommunicationDisabledUntil
| APIAuditLogChangeKeyTriggerType
| APIAuditLogChangeKeyEventType
| APIAuditLogChangeKeyTriggerMetadata
| APIAuditLogChangeKeyActions
| APIAuditLogChangeKeyEnabled
| APIAuditLogChangeKeyExemptRoles
| APIAuditLogChangeKeyExemptChannels;
/**
* Returned when an entity's name is changed
@@ -710,6 +760,44 @@ export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string
*/
export type APIAuditLogChangeKeyCommunicationDisabledUntil = AuditLogChangeData<'communication_disabled_until', string>;
/**
* Returned when an auto moderation rule's trigger type is changed (only in rule creation or deletion)
*/
export type APIAuditLogChangeKeyTriggerType = AuditLogChangeData<'trigger_type', AutoModerationRuleTriggerType>;
/**
* Returned when an auto moderation rule's event type is changed
*/
export type APIAuditLogChangeKeyEventType = AuditLogChangeData<'event_type', AutoModerationRuleEventType>;
/**
* Returned when an auto moderation rule's trigger metadata is changed
*/
export type APIAuditLogChangeKeyTriggerMetadata = AuditLogChangeData<
'trigger_metadata',
APIAutoModerationRuleTriggerMetadata
>;
/**
* Returned when an auto moderation rule's actions is changed
*/
export type APIAuditLogChangeKeyActions = AuditLogChangeData<'actions', APIAutoModerationAction[]>;
/**
* Returned when an auto moderation rule's enabled status is changed
*/
export type APIAuditLogChangeKeyEnabled = AuditLogChangeData<'enabled', boolean>;
/**
* Returned when an auto moderation rule's exempt roles is changed
*/
export type APIAuditLogChangeKeyExemptRoles = AuditLogChangeData<'exempt_roles', Snowflake[]>;
/**
* Returned when an auto moderation rule's exempt channels is changed
*/
export type APIAuditLogChangeKeyExemptChannels = AuditLogChangeData<'exempt_channels', Snowflake[]>;
interface AuditLogChangeData<K extends string, D> {
key: K;
/**

View File

@@ -0,0 +1,195 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/auto-moderation
*/
import type { Snowflake } from '../../globals.ts';
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure
*/
export interface APIAutoModerationRule {
/**
* The id of this rule
*/
id: Snowflake;
/**
* The guild which this rule belongs to
*/
guild_id: Snowflake;
/**
* The rule name
*/
name: string;
/**
* The user id who created this rule
*/
creator_id: Snowflake;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*/
trigger_metadata: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*/
enabled: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels: Snowflake[];
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types
*/
export enum AutoModerationRuleTriggerType {
/**
* Check if content contains words from a user defined list of keywords (Maximum of 3 per guild)
*/
Keyword = 1,
/**
* Check if content represents generic spam (Maximum of 1 per guild)
*/
Spam = 3,
/**
* Check if content contains words from internal pre-defined wordsets (Maximum of 1 per guild)
*/
KeywordPreset,
/**
* Check if content contains more mentions than allowed (Maximum of 1 per guild)
*/
MentionSpam,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata
*/
export interface APIAutoModerationRuleTriggerMetadata {
/**
* Substrings which will be searched for in content (Maximum of 1000)
*
* A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.Keyword}
*/
keyword_filter?: string[];
/**
* The internally pre-defined wordsets which will be searched for in content
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
presets?: AutoModerationRuleKeywordPresetType[];
/**
* Substrings which will be exempt from triggering the preset trigger type (Maximum of 1000)
*
* A allowed-word can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
allow_list?: string[];
/**
* Total number of mentions (role & user) allowed per message (Maximum of 50)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.MentionSpam}
*/
mention_total_limit?: number;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types
*/
export enum AutoModerationRuleKeywordPresetType {
/**
* Words that may be considered forms of swearing or cursing
*/
Profanity = 1,
/**
* Words that refer to sexually explicit behavior or activity
*/
SexualContent,
/**
* Personal insults or words that may be considered hate speech
*/
Slurs,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
*/
export enum AutoModerationRuleEventType {
/**
* When a member sends or edits a message in the guild
*/
MessageSend = 1,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure
*/
export interface APIAutoModerationAction {
/**
* The action type
*/
type: AutoModerationActionType;
/**
* Additional metadata needed during execution for this specific action type
*
* Will only be omitted if the action type is {@link AutoModerationActionType.BlockMessage}
*/
metadata?: APIAutoModerationActionMetadata;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types
*/
export enum AutoModerationActionType {
/**
* Blocks the content of a message according to the rule
*/
BlockMessage = 1,
/**
* Logs user content to a specified channel
*/
SendAlertMessage,
/**
* Timeout user for specified duration, this action type can be set if the bot has `MODERATE_MEMBERS` permission
*/
Timeout,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata
*/
export interface APIAutoModerationActionMetadata {
/**
* Channel to which user content should be logged
*
* Associated action type: {@link AutoModerationActionType.SendAlertMessage}
*/
channel_id?: Snowflake;
/**
* Timeout duration in seconds (Maximum of 4 weeks - 2419200 seconds)
*
* Only available if using {@link AutoModerationRuleTriggerType.Keyword}
*
* Associated action type: {@link AutoModerationActionType.Timeout}
*/
duration_seconds?: number;
}

View File

@@ -230,9 +230,85 @@ export interface APIThreadChannel
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
*/
total_message_sent?: number;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags: Snowflake[];
}
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
/**
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
*/
export interface APIGuildForumTag {
/**
* The id of the tag
*/
id: Snowflake;
/**
* The name of the tag (0-20 characters)
*/
name: string;
/**
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
*/
moderated: boolean;
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
*/
export interface APIGuildForumDefaultReactionEmoji {
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
*/
export enum SortOrderType {
/**
* Sort forum posts by activity
*/
LatestActivity,
/**
* Sort forum posts by creation time (from most recent to oldest)
*/
CreationDate,
}
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
/**
* The set of tags that can be used in a forum channel
*/
available_tags: APIGuildForumTag[];
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*/
default_thread_rate_limit_per_user?: number;
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*/
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
/**
* The default sort order type used to order posts in forum channels
*/
default_sort_order: SortOrderType | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
@@ -586,6 +662,7 @@ export enum MessageType {
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,
}
/**
@@ -942,6 +1019,12 @@ export enum EmbedType {
* Link embed
*/
Link = 'link',
/**
* Auto moderation alert embed
*
* @unstable This embed type is currently not documented by Discord, but it is returned in the auto moderation system messages.
*/
AutoModerationMessage = 'auto_moderation_message',
}
/**
@@ -1428,7 +1511,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
export enum ChannelFlags {
/**
* This thread is pinned to the top of its parent forum channel
*/
Pinned = 1 << 1,
/**
* Whether a tag is required to be specified when creating a thread in a forum channel.
* Tags are specified in the `applied_tags` field
*/
RequireTag = 1 << 4,
}
/**

View File

@@ -118,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
*/
afk_channel_id: Snowflake | null;
/**
* afk timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout: number;
/**
@@ -382,6 +382,10 @@ export enum GuildFeature {
* Guild has access to set an animated guild icon
*/
AnimatedIcon = 'ANIMATED_ICON',
/**
* Guild has set up auto moderation rules
*/
AutoModeration = 'AUTO_MODERATION',
/**
* Guild has access to set a guild banner image
*/
@@ -410,6 +414,10 @@ export enum GuildFeature {
* @unstable This feature is currently not documented by Discord, but has known value
*/
Hub = 'HUB',
/**
* Guild has disabled invite usage, preventing users from joining
*/
InvitesDisabled = 'INVITES_DISABLED',
/**
* Guild has access to set an invite splash background
*/

View File

@@ -1,6 +1,7 @@
export * from '../common.ts';
export * from './application.ts';
export * from './auditLog.ts';
export * from './autoModeration.ts';
export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';

View File

@@ -204,6 +204,10 @@ export interface APIConnection {
* Whether activities related to this connection will be shown in presence updates
*/
show_activity: boolean;
/**
* Whether this connection supports console voice transfer
*/
two_way_link: boolean;
/**
* Visibility of this connection
*
@@ -214,13 +218,15 @@ export interface APIConnection {
export enum ConnectionService {
BattleNet = 'battlenet',
eBay = 'ebay',
EpicGames = 'epicgames',
Facebook = 'facebook',
GitHub = 'github',
LeagueOfLegends = 'leagueoflegends',
PlayStationNetwork = 'playstation',
Reddit = 'reddit',
SamsungGalaxy = 'samsunggalaxy',
RiotGames = 'riotgames',
PayPal = 'paypal',
Spotify = 'spotify',
Skype = 'skype',
Steam = 'steam',

View File

@@ -137,9 +137,14 @@ export enum RESTJSONErrorCodes {
ApplicationInteractionFailedToSend = 40043,
CannotSendAMessageInAForumChannel = 40058,
InteractionHasAlreadyBeenAcknowledged = 40060,
TagNamesMustBeUnique,
ThereAreNoTagsAvailableThatCanBeSetByNonModerators = 40066,
TagRequiredToCreateAForumPostInThisChannel,
MissingAccess = 50001,
InvalidAccountType,
CannotExecuteActionOnDMChannel,
@@ -246,7 +251,10 @@ export enum RESTJSONErrorCodes {
MessageWasBlockedByAutomaticModeration = 200000,
TitleWasBlockedByAutomaticModeration,
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId = 220001,
WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId,
WebhooksCanOnlyCreateThreadsInForumChannels,
WebhookServicesCannotBeUsedInForumChannels,
MessageBlockedByHarmfulLinksFilter = 240000,
}

View File

@@ -0,0 +1,84 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIAutoModerationAction,
APIAutoModerationRule,
AutoModerationRuleEventType,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleTriggerType,
} from '../../payloads/v10/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild
*/
export type RESTGetAPIAutoModerationRulesResult = APIAutoModerationRule[];
/**
* https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule
*/
export type RESTGetAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The rule name
*/
name: string;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*
* Can be omitted if the trigger type is {@link AutoModerationRuleTriggerType.HarmfulLink} or {@link AutoModerationRuleTriggerType.Spam}
*/
trigger_metadata?: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*
* @default false
*/
enabled?: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles?: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels?: Snowflake[];
}>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleJSONBody = Omit<
Partial<RESTPostAPIAutoModerationRuleJSONBody>,
'trigger_type'
>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule
*/
export type RESTDeleteAPIAutoModerationRuleResult = never;

View File

@@ -19,6 +19,9 @@ import type {
OverwriteType,
ThreadAutoArchiveDuration,
VideoQualityMode,
APIGuildForumTag,
APIGuildForumDefaultReactionEmoji,
SortOrderType,
} from '../../payloads/v10/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*/
position?: number | null;
/**
* 0-1024 character channel topic
* 0-1024 character channel topic (0-4096 characters for forum channels)
*
* Channel types: text, news
* Channel types: text, news, forum
*/
topic?: string | null;
/**
* Whether the channel is nsfw
*
* Channel types: text, voice, news
* Channel types: text, voice, news, forum
*/
nsfw?: boolean | null;
/**
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
* are unaffected
*
* Channel types: text, newsThread, publicThread, privateThread
* Channel types: text, newsThread, publicThread, privateThread, forum
*/
rate_limit_per_user?: number | null;
/**
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* Channel types: privateThread
*/
invitable?: boolean;
/**
* The set of tags that can be used in a forum channel
*
* Channel types: forum
*/
available_tags?: APIGuildForumTag[];
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*
* Channel types: forum
*/
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*
* Channel types: text, forum
*/
default_thread_rate_limit_per_user?: number | null;
/**
* The default sort order type used to order posts in forum channels
*
* Channel types: forum
*/
default_sort_order?: SortOrderType | null;
}>;
/**
@@ -589,6 +617,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
* First message in the forum thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags?: Snowflake[];
};
/**

View File

@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
| 'rtc_region'
| 'video_quality_mode'
| 'flags'
| 'default_reaction_emoji'
| 'available_tags'
| 'default_sort_order'
>
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: number | Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**

View File

@@ -20,6 +20,25 @@ export * from './webhook.ts';
export const APIVersion = '10';
export const Routes = {
/**
* Route for:
* - GET `/guilds/{guild.id}/auto-moderation/rules`
* - POST `/guilds/{guild.id}/auto-moderation/rules`
*/
guildAutoModerationRules(guildId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules`;
},
/**
* Routes for:
* - GET `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - PATCH `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - DELETE `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
*/
guildAutoModerationRule(guildId: Snowflake, ruleId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules/${ruleId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`

View File

@@ -0,0 +1,84 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIAutoModerationAction,
APIAutoModerationRule,
AutoModerationRuleEventType,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleTriggerType,
} from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild
*/
export type RESTGetAPIAutoModerationRulesResult = APIAutoModerationRule[];
/**
* https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule
*/
export type RESTGetAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The rule name
*/
name: string;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*
* Can be omitted if the trigger type is {@link AutoModerationRuleTriggerType.HarmfulLink} or {@link AutoModerationRuleTriggerType.Spam}
*/
trigger_metadata?: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*
* @default false
*/
enabled?: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles?: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels?: Snowflake[];
}>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleJSONBody = Omit<
Partial<RESTPostAPIAutoModerationRuleJSONBody>,
'trigger_type'
>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule
*/
export type RESTDeleteAPIAutoModerationRuleResult = never;

View File

@@ -19,6 +19,9 @@ import type {
OverwriteType,
ThreadAutoArchiveDuration,
VideoQualityMode,
APIGuildForumTag,
APIGuildForumDefaultReactionEmoji,
SortOrderType,
} from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*/
position?: number | null;
/**
* 0-1024 character channel topic
* 0-1024 character channel topic (0-4096 characters for forum channels)
*
* Channel types: text, news
* Channel types: text, news, forum
*/
topic?: string | null;
/**
* Whether the channel is nsfw
*
* Channel types: text, voice, news
* Channel types: text, voice, news, forum
*/
nsfw?: boolean | null;
/**
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
* are unaffected
*
* Channel types: text, newsThread, publicThread, privateThread
* Channel types: text, newsThread, publicThread, privateThread, forum
*/
rate_limit_per_user?: number | null;
/**
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* Channel types: privateThread
*/
invitable?: boolean;
/**
* The set of tags that can be used in a forum channel
*
* Channel types: forum
*/
available_tags?: APIGuildForumTag[];
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*
* Channel types: forum
*/
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*
* Channel types: text, forum
*/
default_thread_rate_limit_per_user?: number | null;
/**
* The default sort order type used to order posts in forum channels
*
* Channel types: forum
*/
default_sort_order?: SortOrderType | null;
}>;
/**
@@ -603,6 +631,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
* First message in the forum thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags?: Snowflake[];
};
/**

View File

@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
| 'rtc_region'
| 'video_quality_mode'
| 'flags'
| 'default_reaction_emoji'
| 'available_tags'
| 'default_sort_order'
>
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: number | Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**

View File

@@ -2,6 +2,7 @@ import type { Snowflake } from '../../globals.ts';
export * from '../common.ts';
export * from './auditLog.ts';
export * from './autoModeration.ts';
export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
@@ -20,6 +21,25 @@ export * from './webhook.ts';
export const APIVersion = '9';
export const Routes = {
/**
* Route for:
* - GET `/guilds/{guild.id}/auto-moderation/rules`
* - POST `/guilds/{guild.id}/auto-moderation/rules`
*/
guildAutoModerationRules(guildId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules`;
},
/**
* Routes for:
* - GET `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - PATCH `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - DELETE `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
*/
guildAutoModerationRule(guildId: Snowflake, ruleId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules/${ruleId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`

View File

@@ -6,6 +6,8 @@ import type { Snowflake } from '../globals';
import type { GatewayPresenceUpdate } from '../payloads/v10/gateway';
import type {
APIApplication,
APIAutoModerationRule,
APIAutoModerationAction,
APIChannel,
APIEmoji,
APIGuild,
@@ -28,6 +30,7 @@ import type {
GatewayVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
} from '../payloads/v10/index';
import type { Nullable } from '../utils/internals';
@@ -190,6 +193,8 @@ export enum GatewayIntentBits {
DirectMessageTyping = 1 << 14,
MessageContent = 1 << 15,
GuildScheduledEvents = 1 << 16,
AutoModerationConfiguration = 1 << 20,
AutoModerationExecution = 1 << 21,
}
/**
@@ -252,6 +257,10 @@ export enum GatewayDispatchEvents {
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
AutoModerationRuleCreate = 'AUTO_MODERATION_RULE_CREATE',
AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE',
AutoModerationRuleDelete = 'AUTO_MODERATION_RULE_DELETE',
AutoModerationActionExecution = 'AUTO_MODERATION_ACTION_EXECUTION',
}
export type GatewaySendPayload =
@@ -432,6 +441,121 @@ export interface GatewayReadyDispatchData {
*/
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatch = DataPayload<
| GatewayDispatchEvents.AutoModerationRuleCreate
| GatewayDispatchEvents.AutoModerationRuleUpdate
| GatewayDispatchEvents.AutoModerationRuleDelete,
GatewayAutoModerationRuleModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatchData = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-action-execution
*/
export type GatewayAutoModerationActionExecutionDispatch = DataPayload<
GatewayDispatchEvents.AutoModerationActionExecution,
GatewayAutoModerationActionExecutionDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution
*/
export interface GatewayAutoModerationActionExecutionDispatchData {
/**
* The id of the guild in which action was executed
*/
guild_id: Snowflake;
/**
* The action which was executed
*/
action: APIAutoModerationAction;
/**
* The id of the rule which action belongs to
*/
rule_id: Snowflake;
/**
* The trigger type of rule which was triggered
*/
rule_trigger_type: AutoModerationRuleTriggerType;
/**
* The id of the user which generated the content which triggered the rule
*/
user_id: Snowflake;
/**
* The id of the channel in which user content was posted
*/
channel_id?: Snowflake;
/**
* The id of any user message which content belongs to
*
* This field will not be present if message was blocked by AutoMod or content was not part of any message
*/
message_id?: Snowflake;
/**
* The id of any system auto moderation messages posted as a result of this action
*
* This field will not be present if this event does not correspond to an action with type {@link AutoModerationActionType.SendAlertMessage}
*/
alert_system_message_id?: Snowflake;
/**
* The user generated text content
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
content: string;
/**
* The word or phrase configured in the rule that triggered the rule
*/
matched_keyword: string | null;
/**
* The substring in content that triggered the rule
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
matched_content: string | null;
}
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update

View File

@@ -6,6 +6,8 @@ import type { Snowflake } from '../globals';
import type { GatewayPresenceUpdate } from '../payloads/v9/gateway';
import type {
APIApplication,
APIAutoModerationRule,
APIAutoModerationAction,
APIChannel,
APIEmoji,
APIGuild,
@@ -28,6 +30,7 @@ import type {
GatewayVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
} from '../payloads/v9/index';
import type { Nullable } from '../utils/internals';
@@ -189,6 +192,8 @@ export enum GatewayIntentBits {
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
AutoModerationConfiguration = 1 << 20,
AutoModerationExecution = 1 << 21,
}
/**
@@ -251,6 +256,10 @@ export enum GatewayDispatchEvents {
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
AutoModerationRuleCreate = 'AUTO_MODERATION_RULE_CREATE',
AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE',
AutoModerationRuleDelete = 'AUTO_MODERATION_RULE_DELETE',
AutoModerationActionExecution = 'AUTO_MODERATION_ACTION_EXECUTION',
}
export type GatewaySendPayload =
@@ -431,6 +440,121 @@ export interface GatewayReadyDispatchData {
*/
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatch = DataPayload<
| GatewayDispatchEvents.AutoModerationRuleCreate
| GatewayDispatchEvents.AutoModerationRuleUpdate
| GatewayDispatchEvents.AutoModerationRuleDelete,
GatewayAutoModerationRuleModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleModifyDispatchData = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-create
*/
export type GatewayAutoModerationRuleCreateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-update
*/
export type GatewayAutoModerationRuleUpdateDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatch = GatewayAutoModerationRuleModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-rule-delete
*/
export type GatewayAutoModerationRuleDeleteDispatchData = GatewayAutoModerationRuleModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#auto-moderation-action-execution
*/
export type GatewayAutoModerationActionExecutionDispatch = DataPayload<
GatewayDispatchEvents.AutoModerationActionExecution,
GatewayAutoModerationActionExecutionDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution
*/
export interface GatewayAutoModerationActionExecutionDispatchData {
/**
* The id of the guild in which action was executed
*/
guild_id: Snowflake;
/**
* The action which was executed
*/
action: APIAutoModerationAction;
/**
* The id of the rule which action belongs to
*/
rule_id: Snowflake;
/**
* The trigger type of rule which was triggered
*/
rule_trigger_type: AutoModerationRuleTriggerType;
/**
* The id of the user which generated the content which triggered the rule
*/
user_id: Snowflake;
/**
* The id of the channel in which user content was posted
*/
channel_id?: Snowflake;
/**
* The id of any user message which content belongs to
*
* This field will not be present if message was blocked by AutoMod or content was not part of any message
*/
message_id?: Snowflake;
/**
* The id of any system auto moderation messages posted as a result of this action
*
* This field will not be present if this event does not correspond to an action with type {@link AutoModerationActionType.SendAlertMessage}
*/
alert_system_message_id?: Snowflake;
/**
* The user generated text content
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
content: string;
/**
* The word or phrase configured in the rule that triggered the rule
*/
matched_keyword: string | null;
/**
* The substring in content that triggered the rule
*
* `MESSAGE_CONTENT` (`1 << 15`) gateway intent is required to receive non-empty values from this field
*/
matched_content: string | null;
}
/**
* https://discord.com/developers/docs/topics/gateway#channel-create
* https://discord.com/developers/docs/topics/gateway#channel-update

View File

@@ -51,7 +51,7 @@ export const FormattingPatterns = {
* The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression
*/
SlashCommand:
/<\/(?<fullName>(?<name>[\w-]{1,32})(?: (?<subcommandOrGroup>[\w-]{1,32}))?(?: (?<subcommand>[\w-]{1,32}))?):(?<id>\d{17,20})>/,
/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
/**
* Regular expression for matching a custom emoji, either static or animated
*

16
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "discord-api-types",
"version": "0.37.7",
"version": "0.37.13",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "discord-api-types",
"version": "0.37.7",
"version": "0.37.13",
"license": "MIT",
"devDependencies": {
"@babel/runtime-corejs3": "^7.18.0",
@@ -7611,9 +7611,9 @@
}
},
"node_modules/vm2": {
"version": "3.9.9",
"resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.9.tgz",
"integrity": "sha512-xwTm7NLh/uOjARRBs8/95H0e8fT3Ukw5D/JJWhxMbhKzNh1Nu981jQKvkep9iKYNxzlVrdzD0mlBGkDKZWprlw==",
"version": "3.9.11",
"resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz",
"integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==",
"dev": true,
"dependencies": {
"acorn": "^8.7.0",
@@ -13609,9 +13609,9 @@
}
},
"vm2": {
"version": "3.9.9",
"resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.9.tgz",
"integrity": "sha512-xwTm7NLh/uOjARRBs8/95H0e8fT3Ukw5D/JJWhxMbhKzNh1Nu981jQKvkep9iKYNxzlVrdzD0mlBGkDKZWprlw==",
"version": "3.9.11",
"resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz",
"integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==",
"dev": true,
"requires": {
"acorn": "^8.7.0",

View File

@@ -1,6 +1,6 @@
{
"name": "discord-api-types",
"version": "0.37.7",
"version": "0.37.13",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"homepage": "https://discord-api-types.dev",
"exports": {

View File

@@ -78,3 +78,21 @@ export interface RESTErrorGroupWrapper {
}
export type RESTErrorData = RESTErrorGroupWrapper | RESTErrorFieldInformation | { [k: string]: RESTErrorData } | string;
/**
* https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-rate-limit-response-structure
*/
export interface RESTRateLimit {
/**
* A value indicating if you are being globally rate limited or not
*/
global: boolean;
/**
* A message saying you are being rate limited.
*/
message: string;
/**
* The number of seconds to wait before submitting another request.
*/
retry_after: number;
}

View File

@@ -2,6 +2,13 @@
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type {
APIAutoModerationAction,
APIAutoModerationRule,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleEventType,
AutoModerationRuleTriggerType,
} from './autoModeration';
import type { APIChannel, APIOverwrite } from './channel';
import type {
APIGuildIntegration,
@@ -52,6 +59,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
*/
audit_log_entries: APIAuditLogEntry[];
/**
* List of auto moderation rules referenced in the audit log
*
* See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
*/
auto_moderation_rules: APIAutoModerationRule[];
/**
* Partial integration objects
*
@@ -180,12 +193,37 @@ export enum AuditLogEvent {
ThreadDelete,
ApplicationCommandPermissionUpdate = 121,
AutoModerationRuleCreate = 140,
AutoModerationRuleUpdate,
AutoModerationRuleDelete,
AutoModerationBlockMessage,
AutoModerationFlagToChannel,
AutoModerationUserCommunicationDisabled,
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
export interface APIAuditLogOptions {
/**
* Name of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_name?: string;
/**
* Trigger type of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_trigger_type?: AuditLogRuleTriggerType;
/**
* Number of days after which inactive members were kicked
*
@@ -212,6 +250,9 @@ export interface APIAuditLogOptions {
* - STAGE_INSTANCE_CREATE
* - STAGE_INSTANCE_UPDATE
* - STAGE_INSTANCE_DELETE
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
channel_id?: Snowflake;
@@ -275,6 +316,8 @@ export enum AuditLogOptionsType {
Member = '1',
}
export type AuditLogRuleTriggerType = `${AutoModerationRuleTriggerType}`;
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
*/
@@ -347,7 +390,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation
| APIAuditLogChangeKeyCommunicationDisabledUntil;
| APIAuditLogChangeKeyCommunicationDisabledUntil
| APIAuditLogChangeKeyTriggerType
| APIAuditLogChangeKeyEventType
| APIAuditLogChangeKeyTriggerMetadata
| APIAuditLogChangeKeyActions
| APIAuditLogChangeKeyEnabled
| APIAuditLogChangeKeyExemptRoles
| APIAuditLogChangeKeyExemptChannels;
/**
* Returned when an entity's name is changed
@@ -710,6 +760,44 @@ export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string
*/
export type APIAuditLogChangeKeyCommunicationDisabledUntil = AuditLogChangeData<'communication_disabled_until', string>;
/**
* Returned when an auto moderation rule's trigger type is changed (only in rule creation or deletion)
*/
export type APIAuditLogChangeKeyTriggerType = AuditLogChangeData<'trigger_type', AutoModerationRuleTriggerType>;
/**
* Returned when an auto moderation rule's event type is changed
*/
export type APIAuditLogChangeKeyEventType = AuditLogChangeData<'event_type', AutoModerationRuleEventType>;
/**
* Returned when an auto moderation rule's trigger metadata is changed
*/
export type APIAuditLogChangeKeyTriggerMetadata = AuditLogChangeData<
'trigger_metadata',
APIAutoModerationRuleTriggerMetadata
>;
/**
* Returned when an auto moderation rule's actions is changed
*/
export type APIAuditLogChangeKeyActions = AuditLogChangeData<'actions', APIAutoModerationAction[]>;
/**
* Returned when an auto moderation rule's enabled status is changed
*/
export type APIAuditLogChangeKeyEnabled = AuditLogChangeData<'enabled', boolean>;
/**
* Returned when an auto moderation rule's exempt roles is changed
*/
export type APIAuditLogChangeKeyExemptRoles = AuditLogChangeData<'exempt_roles', Snowflake[]>;
/**
* Returned when an auto moderation rule's exempt channels is changed
*/
export type APIAuditLogChangeKeyExemptChannels = AuditLogChangeData<'exempt_channels', Snowflake[]>;
interface AuditLogChangeData<K extends string, D> {
key: K;
/**

View File

@@ -0,0 +1,195 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/auto-moderation
*/
import type { Snowflake } from '../../globals';
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure
*/
export interface APIAutoModerationRule {
/**
* The id of this rule
*/
id: Snowflake;
/**
* The guild which this rule belongs to
*/
guild_id: Snowflake;
/**
* The rule name
*/
name: string;
/**
* The user id who created this rule
*/
creator_id: Snowflake;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*/
trigger_metadata: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*/
enabled: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels: Snowflake[];
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types
*/
export enum AutoModerationRuleTriggerType {
/**
* Check if content contains words from a user defined list of keywords (Maximum of 3 per guild)
*/
Keyword = 1,
/**
* Check if content represents generic spam (Maximum of 1 per guild)
*/
Spam = 3,
/**
* Check if content contains words from internal pre-defined wordsets (Maximum of 1 per guild)
*/
KeywordPreset,
/**
* Check if content contains more mentions than allowed (Maximum of 1 per guild)
*/
MentionSpam,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata
*/
export interface APIAutoModerationRuleTriggerMetadata {
/**
* Substrings which will be searched for in content (Maximum of 1000)
*
* A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.Keyword}
*/
keyword_filter?: string[];
/**
* The internally pre-defined wordsets which will be searched for in content
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
presets?: AutoModerationRuleKeywordPresetType[];
/**
* Substrings which will be exempt from triggering the preset trigger type (Maximum of 1000)
*
* A allowed-word can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
allow_list?: string[];
/**
* Total number of mentions (role & user) allowed per message (Maximum of 50)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.MentionSpam}
*/
mention_total_limit?: number;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types
*/
export enum AutoModerationRuleKeywordPresetType {
/**
* Words that may be considered forms of swearing or cursing
*/
Profanity = 1,
/**
* Words that refer to sexually explicit behavior or activity
*/
SexualContent,
/**
* Personal insults or words that may be considered hate speech
*/
Slurs,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
*/
export enum AutoModerationRuleEventType {
/**
* When a member sends or edits a message in the guild
*/
MessageSend = 1,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure
*/
export interface APIAutoModerationAction {
/**
* The action type
*/
type: AutoModerationActionType;
/**
* Additional metadata needed during execution for this specific action type
*
* Will only be omitted if the action type is {@link AutoModerationActionType.BlockMessage}
*/
metadata?: APIAutoModerationActionMetadata;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types
*/
export enum AutoModerationActionType {
/**
* Blocks the content of a message according to the rule
*/
BlockMessage = 1,
/**
* Logs user content to a specified channel
*/
SendAlertMessage,
/**
* Timeout user for specified duration, this action type can be set if the bot has `MODERATE_MEMBERS` permission
*/
Timeout,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata
*/
export interface APIAutoModerationActionMetadata {
/**
* Channel to which user content should be logged
*
* Associated action type: {@link AutoModerationActionType.SendAlertMessage}
*/
channel_id?: Snowflake;
/**
* Timeout duration in seconds (Maximum of 4 weeks - 2419200 seconds)
*
* Only available if using {@link AutoModerationRuleTriggerType.Keyword}
*
* Associated action type: {@link AutoModerationActionType.Timeout}
*/
duration_seconds?: number;
}

View File

@@ -108,7 +108,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
*/
default_auto_archive_duration?: ThreadAutoArchiveDuration;
/**
* The channel topic (0-1024 characters)
* The channel topic (0-4096 characters for forum channels, 0-1024 characters for all others)
*/
topic?: string | null;
/**
@@ -230,9 +230,85 @@ export interface APIThreadChannel
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
*/
total_message_sent?: number;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags: Snowflake[];
}
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
/**
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
*/
export interface APIGuildForumTag {
/**
* The id of the tag
*/
id: Snowflake;
/**
* The name of the tag (0-20 characters)
*/
name: string;
/**
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
*/
moderated: boolean;
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
*/
export interface APIGuildForumDefaultReactionEmoji {
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
*/
export enum SortOrderType {
/**
* Sort forum posts by activity
*/
LatestActivity,
/**
* Sort forum posts by creation time (from most recent to oldest)
*/
CreationDate,
}
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
/**
* The set of tags that can be used in a forum channel
*/
available_tags: APIGuildForumTag[];
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*/
default_thread_rate_limit_per_user?: number;
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*/
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
/**
* The default sort order type used to order posts in forum channels
*/
default_sort_order: SortOrderType | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
@@ -591,6 +667,7 @@ export enum MessageType {
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,
}
/**
@@ -943,6 +1020,12 @@ export enum EmbedType {
* Link embed
*/
Link = 'link',
/**
* Auto moderation alert embed
*
* @unstable This embed type is currently not documented by Discord, but it is returned in the auto moderation system messages.
*/
AutoModerationMessage = 'auto_moderation_message',
}
/**
@@ -1429,7 +1512,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
export enum ChannelFlags {
/**
* This thread is pinned to the top of its parent forum channel
*/
Pinned = 1 << 1,
/**
* Whether a tag is required to be specified when creating a thread in a forum channel.
* Tags are specified in the `applied_tags` field
*/
RequireTag = 1 << 4,
}
/**

View File

@@ -118,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
*/
afk_channel_id: Snowflake | null;
/**
* afk timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout: number;
/**
@@ -382,6 +382,10 @@ export enum GuildFeature {
* Guild has access to set an animated guild icon
*/
AnimatedIcon = 'ANIMATED_ICON',
/**
* Guild has set up auto moderation rules
*/
AutoModeration = 'AUTO_MODERATION',
/**
* Guild has access to set a guild banner image
*/
@@ -410,6 +414,10 @@ export enum GuildFeature {
* @unstable This feature is currently not documented by Discord, but has known value
*/
Hub = 'HUB',
/**
* Guild has disabled invite usage, preventing users from joining
*/
InvitesDisabled = 'INVITES_DISABLED',
/**
* Guild has access to set an invite splash background
*/

View File

@@ -1,6 +1,7 @@
export * from '../common';
export * from './application';
export * from './auditLog';
export * from './autoModeration';
export * from './channel';
export * from './emoji';
export * from './gateway';

View File

@@ -204,6 +204,10 @@ export interface APIConnection {
* Whether activities related to this connection will be shown in presence updates
*/
show_activity: boolean;
/**
* Whether this connection supports console voice transfer
*/
two_way_link: boolean;
/**
* Visibility of this connection
*
@@ -214,13 +218,15 @@ export interface APIConnection {
export enum ConnectionService {
BattleNet = 'battlenet',
eBay = 'ebay',
EpicGames = 'epicgames',
Facebook = 'facebook',
GitHub = 'github',
LeagueOfLegends = 'leagueoflegends',
PayPal = 'paypal',
PlayStationNetwork = 'playstation',
Reddit = 'reddit',
SamsungGalaxy = 'samsunggalaxy',
RiotGames = 'riotgames',
Spotify = 'spotify',
Skype = 'skype',
Steam = 'steam',

View File

@@ -2,6 +2,13 @@
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type {
APIAutoModerationAction,
APIAutoModerationRule,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleEventType,
AutoModerationRuleTriggerType,
} from './autoModeration';
import type { APIChannel, APIOverwrite } from './channel';
import type {
APIGuildIntegration,
@@ -52,6 +59,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
*/
audit_log_entries: APIAuditLogEntry[];
/**
* List of auto moderation rules referenced in the audit log
*
* See https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object
*/
auto_moderation_rules: APIAutoModerationRule[];
/**
* Partial integration objects
*
@@ -180,12 +193,37 @@ export enum AuditLogEvent {
ThreadDelete,
ApplicationCommandPermissionUpdate = 121,
AutoModerationRuleCreate = 140,
AutoModerationRuleUpdate,
AutoModerationRuleDelete,
AutoModerationBlockMessage,
AutoModerationFlagToChannel,
AutoModerationUserCommunicationDisabled,
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
export interface APIAuditLogOptions {
/**
* Name of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_name?: string;
/**
* Trigger type of the Auto Moderation rule that was triggered
*
* Present from:
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
auto_moderation_rule_trigger_type?: AuditLogRuleTriggerType;
/**
* Number of days after which inactive members were kicked
*
@@ -212,6 +250,9 @@ export interface APIAuditLogOptions {
* - STAGE_INSTANCE_CREATE
* - STAGE_INSTANCE_UPDATE
* - STAGE_INSTANCE_DELETE
* - AUTO_MODERATION_BLOCK_MESSAGE
* - AUTO_MODERATION_FLAG_TO_CHANNEL
* - AUTO_MODERATION_USER_COMMUNICATION_DISABLED
*/
channel_id?: Snowflake;
@@ -275,6 +316,8 @@ export enum AuditLogOptionsType {
Member = '1',
}
export type AuditLogRuleTriggerType = `${AutoModerationRuleTriggerType}`;
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
*/
@@ -347,7 +390,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation
| APIAuditLogChangeKeyCommunicationDisabledUntil;
| APIAuditLogChangeKeyCommunicationDisabledUntil
| APIAuditLogChangeKeyTriggerType
| APIAuditLogChangeKeyEventType
| APIAuditLogChangeKeyTriggerMetadata
| APIAuditLogChangeKeyActions
| APIAuditLogChangeKeyEnabled
| APIAuditLogChangeKeyExemptRoles
| APIAuditLogChangeKeyExemptChannels;
/**
* Returned when an entity's name is changed
@@ -710,6 +760,44 @@ export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string
*/
export type APIAuditLogChangeKeyCommunicationDisabledUntil = AuditLogChangeData<'communication_disabled_until', string>;
/**
* Returned when an auto moderation rule's trigger type is changed (only in rule creation or deletion)
*/
export type APIAuditLogChangeKeyTriggerType = AuditLogChangeData<'trigger_type', AutoModerationRuleTriggerType>;
/**
* Returned when an auto moderation rule's event type is changed
*/
export type APIAuditLogChangeKeyEventType = AuditLogChangeData<'event_type', AutoModerationRuleEventType>;
/**
* Returned when an auto moderation rule's trigger metadata is changed
*/
export type APIAuditLogChangeKeyTriggerMetadata = AuditLogChangeData<
'trigger_metadata',
APIAutoModerationRuleTriggerMetadata
>;
/**
* Returned when an auto moderation rule's actions is changed
*/
export type APIAuditLogChangeKeyActions = AuditLogChangeData<'actions', APIAutoModerationAction[]>;
/**
* Returned when an auto moderation rule's enabled status is changed
*/
export type APIAuditLogChangeKeyEnabled = AuditLogChangeData<'enabled', boolean>;
/**
* Returned when an auto moderation rule's exempt roles is changed
*/
export type APIAuditLogChangeKeyExemptRoles = AuditLogChangeData<'exempt_roles', Snowflake[]>;
/**
* Returned when an auto moderation rule's exempt channels is changed
*/
export type APIAuditLogChangeKeyExemptChannels = AuditLogChangeData<'exempt_channels', Snowflake[]>;
interface AuditLogChangeData<K extends string, D> {
key: K;
/**

View File

@@ -0,0 +1,195 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/auto-moderation
*/
import type { Snowflake } from '../../globals';
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-auto-moderation-rule-structure
*/
export interface APIAutoModerationRule {
/**
* The id of this rule
*/
id: Snowflake;
/**
* The guild which this rule belongs to
*/
guild_id: Snowflake;
/**
* The rule name
*/
name: string;
/**
* The user id who created this rule
*/
creator_id: Snowflake;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*/
trigger_metadata: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*/
enabled: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels: Snowflake[];
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types
*/
export enum AutoModerationRuleTriggerType {
/**
* Check if content contains words from a user defined list of keywords (Maximum of 3 per guild)
*/
Keyword = 1,
/**
* Check if content represents generic spam (Maximum of 1 per guild)
*/
Spam = 3,
/**
* Check if content contains words from internal pre-defined wordsets (Maximum of 1 per guild)
*/
KeywordPreset,
/**
* Check if content contains more mentions than allowed (Maximum of 1 per guild)
*/
MentionSpam,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata
*/
export interface APIAutoModerationRuleTriggerMetadata {
/**
* Substrings which will be searched for in content (Maximum of 1000)
*
* A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.Keyword}
*/
keyword_filter?: string[];
/**
* The internally pre-defined wordsets which will be searched for in content
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
presets?: AutoModerationRuleKeywordPresetType[];
/**
* Substrings which will be exempt from triggering the preset trigger type (Maximum of 1000)
*
* A allowed-word can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each string will be matched. Each keyword must be 30 characters or less
* See [keyword matching strategies](https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.KeywordPreset}
*/
allow_list?: string[];
/**
* Total number of mentions (role & user) allowed per message (Maximum of 50)
*
* Associated trigger type: {@link AutoModerationRuleTriggerType.MentionSpam}
*/
mention_total_limit?: number;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types
*/
export enum AutoModerationRuleKeywordPresetType {
/**
* Words that may be considered forms of swearing or cursing
*/
Profanity = 1,
/**
* Words that refer to sexually explicit behavior or activity
*/
SexualContent,
/**
* Personal insults or words that may be considered hate speech
*/
Slurs,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types
*/
export enum AutoModerationRuleEventType {
/**
* When a member sends or edits a message in the guild
*/
MessageSend = 1,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-auto-moderation-action-structure
*/
export interface APIAutoModerationAction {
/**
* The action type
*/
type: AutoModerationActionType;
/**
* Additional metadata needed during execution for this specific action type
*
* Will only be omitted if the action type is {@link AutoModerationActionType.BlockMessage}
*/
metadata?: APIAutoModerationActionMetadata;
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types
*/
export enum AutoModerationActionType {
/**
* Blocks the content of a message according to the rule
*/
BlockMessage = 1,
/**
* Logs user content to a specified channel
*/
SendAlertMessage,
/**
* Timeout user for specified duration, this action type can be set if the bot has `MODERATE_MEMBERS` permission
*/
Timeout,
}
/**
* https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata
*/
export interface APIAutoModerationActionMetadata {
/**
* Channel to which user content should be logged
*
* Associated action type: {@link AutoModerationActionType.SendAlertMessage}
*/
channel_id?: Snowflake;
/**
* Timeout duration in seconds (Maximum of 4 weeks - 2419200 seconds)
*
* Only available if using {@link AutoModerationRuleTriggerType.Keyword}
*
* Associated action type: {@link AutoModerationActionType.Timeout}
*/
duration_seconds?: number;
}

View File

@@ -230,9 +230,85 @@ export interface APIThreadChannel
* Similar to `message_count` on message creation, but won't decrement when a message is deleted
*/
total_message_sent?: number;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags: Snowflake[];
}
export type APIGuildForumChannel = APIGuildTextChannel<ChannelType.GuildForum>;
/**
* https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure
*/
export interface APIGuildForumTag {
/**
* The id of the tag
*/
id: Snowflake;
/**
* The name of the tag (0-20 characters)
*/
name: string;
/**
* Whether this tag can only be added to or removed from threads by a member with the `MANAGE_THREADS` permission
*/
moderated: boolean;
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel#default-reaction-object-default-reaction-structure
*/
export interface APIGuildForumDefaultReactionEmoji {
/**
* The id of a guild's custom emoji
*/
emoji_id: Snowflake | null;
/**
* The unicode character of the emoji
*/
emoji_name: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel/#channel-object-sort-order-types
*/
export enum SortOrderType {
/**
* Sort forum posts by activity
*/
LatestActivity,
/**
* Sort forum posts by creation time (from most recent to oldest)
*/
CreationDate,
}
export interface APIGuildForumChannel extends APIGuildTextChannel<ChannelType.GuildForum> {
/**
* The set of tags that can be used in a forum channel
*/
available_tags: APIGuildForumTag[];
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*/
default_thread_rate_limit_per_user?: number;
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*/
default_reaction_emoji: APIGuildForumDefaultReactionEmoji | null;
/**
* The default sort order type used to order posts in forum channels
*/
default_sort_order: SortOrderType | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
@@ -586,6 +662,7 @@ export enum MessageType {
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,
}
/**
@@ -942,6 +1019,12 @@ export enum EmbedType {
* Link embed
*/
Link = 'link',
/**
* Auto moderation alert embed
*
* @unstable This embed type is currently not documented by Discord, but it is returned in the auto moderation system messages.
*/
AutoModerationMessage = 'auto_moderation_message',
}
/**
@@ -1428,7 +1511,15 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
export enum ChannelFlags {
/**
* This thread is pinned to the top of its parent forum channel
*/
Pinned = 1 << 1,
/**
* Whether a tag is required to be specified when creating a thread in a forum channel.
* Tags are specified in the `applied_tags` field
*/
RequireTag = 1 << 4,
}
/**

View File

@@ -118,7 +118,7 @@ export interface APIGuild extends APIPartialGuild {
*/
afk_channel_id: Snowflake | null;
/**
* afk timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout: number;
/**
@@ -382,6 +382,10 @@ export enum GuildFeature {
* Guild has access to set an animated guild icon
*/
AnimatedIcon = 'ANIMATED_ICON',
/**
* Guild has set up auto moderation rules
*/
AutoModeration = 'AUTO_MODERATION',
/**
* Guild has access to set a guild banner image
*/
@@ -410,6 +414,10 @@ export enum GuildFeature {
* @unstable This feature is currently not documented by Discord, but has known value
*/
Hub = 'HUB',
/**
* Guild has disabled invite usage, preventing users from joining
*/
InvitesDisabled = 'INVITES_DISABLED',
/**
* Guild has access to set an invite splash background
*/

View File

@@ -1,6 +1,7 @@
export * from '../common';
export * from './application';
export * from './auditLog';
export * from './autoModeration';
export * from './channel';
export * from './emoji';
export * from './gateway';

View File

@@ -204,6 +204,10 @@ export interface APIConnection {
* Whether activities related to this connection will be shown in presence updates
*/
show_activity: boolean;
/**
* Whether this connection supports console voice transfer
*/
two_way_link: boolean;
/**
* Visibility of this connection
*
@@ -214,13 +218,15 @@ export interface APIConnection {
export enum ConnectionService {
BattleNet = 'battlenet',
eBay = 'ebay',
EpicGames = 'epicgames',
Facebook = 'facebook',
GitHub = 'github',
LeagueOfLegends = 'leagueoflegends',
PlayStationNetwork = 'playstation',
Reddit = 'reddit',
SamsungGalaxy = 'samsunggalaxy',
RiotGames = 'riotgames',
PayPal = 'paypal',
Spotify = 'spotify',
Skype = 'skype',
Steam = 'steam',

View File

@@ -137,9 +137,14 @@ export enum RESTJSONErrorCodes {
ApplicationInteractionFailedToSend = 40043,
CannotSendAMessageInAForumChannel = 40058,
InteractionHasAlreadyBeenAcknowledged = 40060,
TagNamesMustBeUnique,
ThereAreNoTagsAvailableThatCanBeSetByNonModerators = 40066,
TagRequiredToCreateAForumPostInThisChannel,
MissingAccess = 50001,
InvalidAccountType,
CannotExecuteActionOnDMChannel,
@@ -246,7 +251,10 @@ export enum RESTJSONErrorCodes {
MessageWasBlockedByAutomaticModeration = 200000,
TitleWasBlockedByAutomaticModeration,
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId = 220001,
WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId,
WebhooksCanOnlyCreateThreadsInForumChannels,
WebhookServicesCannotBeUsedInForumChannels,
MessageBlockedByHarmfulLinksFilter = 240000,
}

View File

@@ -0,0 +1,84 @@
import type { Snowflake } from '../../globals';
import type {
APIAutoModerationAction,
APIAutoModerationRule,
AutoModerationRuleEventType,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleTriggerType,
} from '../../payloads/v10/index';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals';
/**
* https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild
*/
export type RESTGetAPIAutoModerationRulesResult = APIAutoModerationRule[];
/**
* https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule
*/
export type RESTGetAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The rule name
*/
name: string;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*
* Can be omitted if the trigger type is {@link AutoModerationRuleTriggerType.HarmfulLink} or {@link AutoModerationRuleTriggerType.Spam}
*/
trigger_metadata?: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*
* @default false
*/
enabled?: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles?: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels?: Snowflake[];
}>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleJSONBody = Omit<
Partial<RESTPostAPIAutoModerationRuleJSONBody>,
'trigger_type'
>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule
*/
export type RESTDeleteAPIAutoModerationRuleResult = never;

View File

@@ -19,6 +19,9 @@ import type {
OverwriteType,
ThreadAutoArchiveDuration,
VideoQualityMode,
APIGuildForumTag,
APIGuildForumDefaultReactionEmoji,
SortOrderType,
} from '../../payloads/v10/index';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*/
position?: number | null;
/**
* 0-1024 character channel topic
* 0-1024 character channel topic (0-4096 characters for forum channels)
*
* Channel types: text, news
* Channel types: text, news, forum
*/
topic?: string | null;
/**
* Whether the channel is nsfw
*
* Channel types: text, voice, news
* Channel types: text, voice, news, forum
*/
nsfw?: boolean | null;
/**
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
* are unaffected
*
* Channel types: text, newsThread, publicThread, privateThread
* Channel types: text, newsThread, publicThread, privateThread, forum
*/
rate_limit_per_user?: number | null;
/**
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* Channel types: privateThread
*/
invitable?: boolean;
/**
* The set of tags that can be used in a forum channel
*
* Channel types: forum
*/
available_tags?: APIGuildForumTag[];
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*
* Channel types: forum
*/
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*
* Channel types: text, forum
*/
default_thread_rate_limit_per_user?: number | null;
/**
* The default sort order type used to order posts in forum channels
*
* Channel types: forum
*/
default_sort_order?: SortOrderType | null;
}>;
/**
@@ -589,6 +617,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
* First message in the forum thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags?: Snowflake[];
};
/**

View File

@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
| 'rtc_region'
| 'video_quality_mode'
| 'flags'
| 'default_reaction_emoji'
| 'available_tags'
| 'default_sort_order'
>
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: number | Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**

View File

@@ -20,6 +20,25 @@ export * from './webhook';
export const APIVersion = '10';
export const Routes = {
/**
* Route for:
* - GET `/guilds/{guild.id}/auto-moderation/rules`
* - POST `/guilds/{guild.id}/auto-moderation/rules`
*/
guildAutoModerationRules(guildId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules`;
},
/**
* Routes for:
* - GET `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - PATCH `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - DELETE `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
*/
guildAutoModerationRule(guildId: Snowflake, ruleId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules/${ruleId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`

84
rest/v9/autoModeration.ts Normal file
View File

@@ -0,0 +1,84 @@
import type { Snowflake } from '../../globals';
import type {
APIAutoModerationAction,
APIAutoModerationRule,
AutoModerationRuleEventType,
APIAutoModerationRuleTriggerMetadata,
AutoModerationRuleTriggerType,
} from '../../payloads/v9/index';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals';
/**
* https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild
*/
export type RESTGetAPIAutoModerationRulesResult = APIAutoModerationRule[];
/**
* https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule
*/
export type RESTGetAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The rule name
*/
name: string;
/**
* The rule event type
*/
event_type: AutoModerationRuleEventType;
/**
* The rule trigger type
*/
trigger_type: AutoModerationRuleTriggerType;
/**
* The rule trigger metadata
*
* Can be omitted if the trigger type is {@link AutoModerationRuleTriggerType.HarmfulLink} or {@link AutoModerationRuleTriggerType.Spam}
*/
trigger_metadata?: APIAutoModerationRuleTriggerMetadata;
/**
* The actions which will execute when this rule is triggered
*/
actions: APIAutoModerationAction[];
/**
* Whether this rule is enabled
*
* @default false
*/
enabled?: boolean;
/**
* The role ids that shouldn't be affected by this rule (Maximum of 20)
*/
exempt_roles?: Snowflake[];
/**
* The channel ids that shouldn't be affected by this rule (Maximum of 50)
*/
exempt_channels?: Snowflake[];
}>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule
*/
export type RESTPostAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleJSONBody = Omit<
Partial<RESTPostAPIAutoModerationRuleJSONBody>,
'trigger_type'
>;
/**
* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule
*/
export type RESTPatchAPIAutoModerationRuleResult = APIAutoModerationRule;
/**
* https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule
*/
export type RESTDeleteAPIAutoModerationRuleResult = never;

View File

@@ -19,6 +19,9 @@ import type {
OverwriteType,
ThreadAutoArchiveDuration,
VideoQualityMode,
APIGuildForumTag,
APIGuildForumDefaultReactionEmoji,
SortOrderType,
} from '../../payloads/v9/index';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';
@@ -56,15 +59,15 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*/
position?: number | null;
/**
* 0-1024 character channel topic
* 0-1024 character channel topic (0-4096 characters for forum channels)
*
* Channel types: text, news
* Channel types: text, news, forum
*/
topic?: string | null;
/**
* Whether the channel is nsfw
*
* Channel types: text, voice, news
* Channel types: text, voice, news, forum
*/
nsfw?: boolean | null;
/**
@@ -72,7 +75,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`,
* are unaffected
*
* Channel types: text, newsThread, publicThread, privateThread
* Channel types: text, newsThread, publicThread, privateThread, forum
*/
rate_limit_per_user?: number | null;
/**
@@ -141,6 +144,31 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
* Channel types: privateThread
*/
invitable?: boolean;
/**
* The set of tags that can be used in a forum channel
*
* Channel types: forum
*/
available_tags?: APIGuildForumTag[];
/**
* The emoji to show in the add reaction button on a thread in a forum channel
*
* Channel types: forum
*/
default_reaction_emoji?: APIGuildForumDefaultReactionEmoji;
/**
* The initial `rate_limit_per_user` to set on newly created threads in a channel.
* This field is copied to the thread at creation time and does not live update
*
* Channel types: text, forum
*/
default_thread_rate_limit_per_user?: number | null;
/**
* The default sort order type used to order posts in forum channels
*
* Channel types: forum
*/
default_sort_order?: SortOrderType | null;
}>;
/**
@@ -603,6 +631,10 @@ export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThr
* First message in the forum thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags that have been applied to a thread in a forum channel
*/
applied_tags?: Snowflake[];
};
/**

View File

@@ -53,6 +53,9 @@ export type APIGuildCreatePartialChannel = StrictPartial<
| 'rtc_region'
| 'video_quality_mode'
| 'flags'
| 'default_reaction_emoji'
| 'available_tags'
| 'default_sort_order'
>
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
@@ -135,7 +138,7 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: number | Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**
@@ -235,7 +238,7 @@ export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
afk_channel_id?: Snowflake | null;
/**
* AFK timeout in seconds
* afk timeout in seconds, can be set to: `60`, `300`, `900`, `1800`, `3600`
*/
afk_timeout?: number;
/**

View File

@@ -2,6 +2,7 @@ import type { Snowflake } from '../../globals';
export * from '../common';
export * from './auditLog';
export * from './autoModeration';
export * from './channel';
export * from './emoji';
export * from './gateway';
@@ -20,6 +21,25 @@ export * from './webhook';
export const APIVersion = '9';
export const Routes = {
/**
* Route for:
* - GET `/guilds/{guild.id}/auto-moderation/rules`
* - POST `/guilds/{guild.id}/auto-moderation/rules`
*/
guildAutoModerationRules(guildId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules`;
},
/**
* Routes for:
* - GET `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - PATCH `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - DELETE `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
*/
guildAutoModerationRule(guildId: Snowflake, ruleId: Snowflake) {
return `/guilds/${guildId}/auto-moderation/rules/${ruleId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`

View File

@@ -1 +1 @@
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.6"}]
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.12"}]

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.7"}]
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.13"}]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
[
"0.37.7",
"0.37.6"
"0.37.13",
"0.37.12"
]