Skip to content

Commit

Permalink
feat: support join raid protection (#71)
Browse files Browse the repository at this point in the history
* add support for join raid protection

* add safetyAlertsChannelID editGuild() options into the typedefs
  • Loading branch information
TTtie committed May 11, 2023
1 parent cbc8839 commit cedb289
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ declare namespace Dysnomia {
keyword_filter: string[];
/** valid for MENTION_SPAM */
mention_total_limit: number;
/** valid for MENTION_SPAM */
mention_raid_protection_enabled: boolean;
/** valid for KEYWORD_PRESET */
presets: AutoModerationKeywordPresetType[];
/** valid for KEYWORD */
Expand Down Expand Up @@ -693,6 +695,7 @@ declare namespace Dysnomia {
premiumTier: PremiumTier;
publicUpdatesChannelID: string | null;
rulesChannelID: string | null;
safetyAlertsChannelID: string | null;
splash: string | null;
stickers?: Sticker[];
systemChannelFlags: SystemChannelFlags;
Expand Down Expand Up @@ -1104,6 +1107,7 @@ declare namespace Dysnomia {
premiumProgressBarEnabled?: boolean;
publicUpdatesChannelID?: string;
rulesChannelID?: string;
safetyAlertsChannelID?: string;
splash?: string;
systemChannelFlags?: number;
systemChannelID?: string;
Expand Down Expand Up @@ -2114,6 +2118,7 @@ declare namespace Dysnomia {
"NEWS",
"PARTNERED",
"PREVIEW_ENABLED",
"RAID_ALERTS_DISABLED",
"ROLE_ICONS",
"ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE",
"ROLE_SUBSCRIPTIONS_ENABLED",
Expand Down Expand Up @@ -3124,6 +3129,7 @@ declare namespace Dysnomia {
publicUpdatesChannelID: string | null;
roles: Collection<Role>;
rulesChannelID: string | null;
safetyAlertsChannelID: string | null;
shard: Shard;
splash: string | null;
splashURL: string | null;
Expand Down
2 changes: 2 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ class Client extends EventEmitter {
* @arg {Boolean} [options.premiumProgressBarEnabled] If the boost progress bar is enabled
* @arg {String} [options.publicUpdatesChannelID] The id of the channel where admins and moderators of "COMMUNITY" guilds receive notices from Discord
* @arg {String} [options.rulesChannelID] The id of the channel where "COMMUNITY" guilds display rules and/or guidelines
* @arg {String} [options.safetyAlertsChannelID] The ID of the channel where safety alerts from Discord are received
* @arg {String} [options.splash] The guild splash image as a base64 data URI (VIP only). Note: base64 strings alone are not base64 data URI strings
* @arg {Number} [options.systemChannelFlags] The flags for the system channel
* @arg {String} [options.systemChannelID] The ID of the system channel
Expand Down Expand Up @@ -1481,6 +1482,7 @@ class Client extends EventEmitter {
discovery_splash: options.discoverySplash,
features: options.features,
premium_progress_bar_enabled: options.premiumProgressBarEnabled,
safety_alerts_channel_id: options.safetyAlertsChannelID,
reason: reason
}).then((guild) => new Guild(guild, this));
}
Expand Down
1 change: 1 addition & 0 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ module.exports.GuildFeatures = [
"NEWS",
"PARTNERED",
"PREVIEW_ENABLED",
"RAID_ALERTS_DISABLED",
"ROLE_ICONS",
"ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE",
"ROLE_SUBSCRIPTIONS_ENABLED",
Expand Down
2 changes: 2 additions & 0 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@ class Shard extends EventEmitter {
premiumTier: guild.premiumTier,
publicUpdatesChannelID: guild.publicUpdatesChannelID,
rulesChannelID: guild.rulesChannelID,
safetyAlertsChannelID: guild.safetyAlertsChannelID,
splash: guild.splash,
stickers: guild.stickers,
systemChannelFlags: guild.systemChannelFlags,
Expand Down Expand Up @@ -1284,6 +1285,7 @@ class Shard extends EventEmitter {
* @prop {Number} oldGuild.premiumTier Nitro boost level of the guild
* @prop {String?} oldGuild.publicUpdatesChannelID ID of the guild's updates channel if the guild has "COMMUNITY" features
* @prop {String?} oldGuild.rulesChannelID The channel where "COMMUNITY" guilds display rules and/or guidelines
* @prop {String?} oldGuild.safetyAlertsChannelID The ID of the channel where safety alerts from Discord are received
* @prop {String?} oldGuild.splash The hash of the guild splash image, or null if no splash (VIP only)
* @prop {Array<Object>?} stickers An array of guild sticker objects
* @prop {Number} oldGuild.systemChannelFlags the flags for the system channel
Expand Down
4 changes: 4 additions & 0 deletions lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const emitDeprecation = require("../util/emitDeprecation");
* @prop {String?} publicUpdatesChannelID ID of the guild's updates channel if the guild has "COMMUNITY" features
* @prop {Collection<Role>} roles Collection of Roles in the guild
* @prop {String?} rulesChannelID The channel where "COMMUNITY" guilds display rules and/or guidelines
* @prop {String?} safetyAlertsChannelID The ID of the channel where safety alerts from Discord are received
* @prop {Shard} shard The Shard that owns the guild
* @prop {String?} splash The hash of the guild splash image, or null if no splash (VIP only)
* @prop {String?} splashURL The URL of the guild's splash image
Expand Down Expand Up @@ -296,6 +297,9 @@ class Guild extends Base {
if(data.nsfw_level !== undefined) {
this.nsfwLevel = data.nsfw_level;
}
if(data.safety_alerts_channel_id !== undefined) {
this.safetyAlertsChannelID = data.safety_alerts_channel_id;
}
}

get bannerURL() {
Expand Down

0 comments on commit cedb289

Please sign in to comment.