feat: Safety alerts channel and mention raid protection (#9073)

* feat: safety alerts channel and mention raid protection

* feat: add raw types

* Apply suggestions from code review

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* docs: update guild features

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
Jaw0r3k
2023-05-07 14:44:44 +02:00
committed by GitHub
parent c5a42ed5ec
commit 5057f04304
5 changed files with 119 additions and 1 deletions

10
typings/index.d.ts vendored
View File

@@ -1013,6 +1013,8 @@ export class Guild extends AnonymousGuild {
public roles: RoleManager;
public readonly rulesChannel: TextChannel | null;
public rulesChannelId: Snowflake | null;
public readonly safetyAlertsChannel: TextChannel | null;
public safetyAlertsChannelId: Snowflake | null;
public scheduledEvents: GuildScheduledEventManager;
public readonly shard: WebSocketShard;
public shardId: number;
@@ -1073,6 +1075,7 @@ export class Guild extends AnonymousGuild {
/** @deprecated Use {@link RoleManager.setPositions} instead */
public setRolePositions(rolePositions: readonly RolePosition[]): Promise<Guild>;
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSafetyAlertsChannel(safetyAlertsChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>;
@@ -4227,6 +4230,10 @@ export class AutoModerationRule extends Base {
public setRegexPatterns(regexPatterns: string[], reason?: string): Promise<AutoModerationRule>;
public setPresets(presets: AutoModerationRuleKeywordPresetType[], reason?: string): Promise<AutoModerationRule>;
public setAllowList(allowList: string[], reason?: string): Promise<AutoModerationRule>;
public setMentionRaidProtectionEnabled(
mentionRaidProtectionEnabled: boolean,
reason?: string,
): Promise<AutoModerationRule>;
public setMentionTotalLimit(mentionTotalLimit: number, reason?: string): Promise<AutoModerationRule>;
public setActions(actions: AutoModerationActionOptions[], reason?: string): Promise<AutoModerationRule>;
public setEnabled(enabled?: boolean, reason?: string): Promise<AutoModerationRule>;
@@ -4315,6 +4322,7 @@ export interface AutoModerationTriggerMetadata {
regexPatterns: string[];
presets: (AutoModerationRuleKeywordPresetType | AutoModerationRuleKeywordPresetTypes)[];
allowList: string[];
mentionRaidProtectionEnabled: boolean;
mentionTotalLimit: number | null;
}
@@ -5419,6 +5427,7 @@ export interface GuildEditData {
rulesChannel?: TextChannelResolvable | null;
publicUpdatesChannel?: TextChannelResolvable | null;
preferredLocale?: string | null;
safetyAlertsChannel?: TextChannelResolvable | null;
premiumProgressBarEnabled?: boolean;
description?: string | null;
features?: GuildFeatures[];
@@ -5471,6 +5480,7 @@ export type GuildFeatures =
| 'SEVEN_DAY_THREAD_ARCHIVE'
| 'PRIVATE_THREADS'
| 'ROLE_ICONS'
| 'RAID_ALERTS_DISABLED'
| 'ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE'
| 'ROLE_SUBSCRIPTIONS_ENABLED';

View File

@@ -11,7 +11,6 @@ import {
APIChannel,
APIEmoji,
APIExtendedInvite,
APIGuild,
APIGuildIntegration,
APIGuildIntegrationApplication,
APIGuildMember,
@@ -79,6 +78,16 @@ import {
APITextInputComponent,
APIModalActionRowComponent,
APIModalSubmitInteraction,
Permissions,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildMFALevel,
GuildSystemChannelFlags,
GuildPremiumTier,
GuildNSFWLevel,
GuildHubType,
GuildVerificationLevel,
GuildFeature,
LocalizationMap
} from 'discord-api-types/v9';
import { GuildChannel, Guild, PermissionOverwrites, InteractionType } from '.';
@@ -282,6 +291,50 @@ export interface APIAutoModerationRuleTriggerMetadata {
allow_list?: string[];
regex_patterns?: string[];
mention_total_limit?: number;
mention_raid_protection_enabled?: boolean;
}
export interface APIGuild extends APIPartialGuild {
icon_hash?: string | null;
discovery_splash: string | null;
owner?: boolean;
owner_id: Snowflake;
permissions?: Permissions;
region: string;
afk_channel_id: Snowflake | null;
afk_timeout: number;
widget_enabled?: boolean;
widget_channel_id?: Snowflake | null;
verification_level: GuildVerificationLevel;
default_message_notifications: GuildDefaultMessageNotifications;
explicit_content_filter: GuildExplicitContentFilter;
roles: APIRole[];
emojis: APIEmoji[];
features: GuildFeature[];
mfa_level: GuildMFALevel;
application_id: Snowflake | null;
system_channel_id: Snowflake | null;
system_channel_flags: GuildSystemChannelFlags;
rules_channel_id: Snowflake | null;
max_presences?: number | null;
max_members?: number;
vanity_url_code: string | null;
description: string | null;
banner: string | null;
premium_tier: GuildPremiumTier;
premium_subscription_count?: number;
preferred_locale: string;
public_updates_channel_id: Snowflake | null;
max_video_channel_users?: number;
approximate_member_count?: number;
approximate_presence_count?: number;
welcome_screen?: APIGuildWelcomeScreen;
nsfw_level: GuildNSFWLevel;
stickers: APISticker[];
premium_progress_bar_enabled: boolean;
hub_type: GuildHubType | null;
safety_alerts_channel_id: Snowflake | null;
}
export interface APIApplicationRoleConnectionMetadata {