Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update API constants #133

Merged
merged 7 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,17 @@ declare namespace Dysnomia {
}

interface AutoModerationTriggerMetadata {
/** valid for KEYWORD */
/** valid for KEYWORD, KEYWORD_PRESET, MEMBER_PROFILE */
allow_list: string[];
/** valid for KEYWORD */
/** valid for KEYWORD, MEMBER_PROFILE */
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 */
/** valid for KEYWORD, MEMBER_PROFILE */
regex_patterns: string[];
}
// Channel
Expand Down Expand Up @@ -1971,16 +1971,25 @@ declare namespace Dysnomia {
ROLE_PROMPT_UPDATE: 161;
ROLE_PROMPT_DELETE: 162;

GUILD_HOME_FEATURE_ITEM: 171;
GUILD_HOME_REMOVE_ITEM: 172;
ONBOARDING_PROMPT_CREATE: 163;
ONBOARDING_PROMPT_UPDATE: 164;
ONBOARDING_PROMPT_DELETE: 165;

ONBOARDING_CREATE: 166;
ONBOARDING_UPDATE: 167;

HOME_SETTINGS_CREATE: 190;
HOME_SETTINGS_UPDATE: 191;
};
AutoModerationActionTypes: {
BLOCK_MESSAGE: 1;
SEND_ALERT_MESSAGE: 2;
TIMEOUT: 3;
BLOCK_MESSAGE: 1;
SEND_ALERT_MESSAGE: 2;
TIMEOUT: 3;
BLOCK_MEMBER_INTERACTION: 4;
};
AutoModerationEventTypes: {
MESSAGE_SEND: 1;
MESSAGE_SEND: 1;
MEMBER_UPDATE: 2;
};
AutoModerationKeywordPresetTypes: {
PROFANITY: 1;
Expand All @@ -1992,6 +2001,7 @@ declare namespace Dysnomia {
SPAM: 3;
KEYWORD_PRESET: 4;
MENTION_SPAM: 5;
MEMBER_PROFILE: 6;
};
ButtonStyles: {
PRIMARY: 1;
Expand Down Expand Up @@ -2141,9 +2151,11 @@ declare namespace Dysnomia {
guildScheduledEvents: 65536;
autoModerationConfiguration: 1048576;
autoModerationExecution: 2097152;
allNonPrivileged: 3243773;
guildMessagePolls: 16777216;
directMessagePolls: 33554432;
allNonPrivileged: 53575417;
allPrivileged: 33026;
all: 3276799;
all: 53608443;
};
InteractionResponseTypes: {
PONG: 1;
Expand Down Expand Up @@ -2231,6 +2243,11 @@ declare namespace Dysnomia {
STAGE_SPEAKER: 29;
STAGE_TOPIC: 31;
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION: 32;
GUILD_INCIDENT_ALERT_MODE_ENABLED: 36;
GUILD_INCIDENT_ALERT_MODE_DISABLED: 37;
GUILD_INCIDENT_REPORT_RAID: 38;
GUILD_INCIDENT_REPORT_FALSE_ALARM: 39;
PURCHASE_NOTIFICATION: 44;
};
MembershipState: {
INVITED: 1;
Expand Down Expand Up @@ -2298,10 +2315,12 @@ declare namespace Dysnomia {
useExternalSounds: 35184372088832n;
useSoundboard: 4398046511104n;
sendVoiceMessages: 70368744177664n;
sendPolls: 562949953421312n;
useExternalApps: 1125899906842624n;
allGuild: 29697484783806n;
allText: 70904273435729n;
allText: 1759754133699665n;
allVoice: 40136803878673n;
all: 140737488355327n;
all: 1829587348619263n;
};
PremiumTiers: {
NONE: 0;
Expand Down
47 changes: 35 additions & 12 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,27 @@ module.exports.AuditLogActions = {
ROLE_PROMPT_UPDATE: 161,
ROLE_PROMPT_DELETE: 162,

GUILD_HOME_FEATURE_ITEM: 171,
GUILD_HOME_REMOVE_ITEM: 172
ONBOARDING_PROMPT_CREATE: 163,
ONBOARDING_PROMPT_UPDATE: 164,
ONBOARDING_PROMPT_DELETE: 165,

ONBOARDING_CREATE: 166,
ONBOARDING_UPDATE: 167,

HOME_SETTINGS_CREATE: 190,
HOME_SETTINGS_UPDATE: 191
};

module.exports.AutoModerationActionTypes = {
BLOCK_MESSAGE: 1,
SEND_ALERT_MESSAGE: 2,
TIMEOUT: 3
BLOCK_MESSAGE: 1,
SEND_ALERT_MESSAGE: 2,
TIMEOUT: 3,
BLOCK_MEMBER_INTERACTION: 4
};

module.exports.AutoModerationEventTypes = {
MESSAGE_SEND: 1
MESSAGE_SEND: 1,
MEMBER_UPDATE: 2
};

module.exports.AutoModerationKeywordPresetTypes = {
Expand All @@ -168,7 +177,8 @@ module.exports.AutoModerationTriggerTypes = {
KEYWORD: 1,
SPAM: 3,
KEYWORD_PRESET: 4,
MENTION_SPAM: 5
MENTION_SPAM: 5,
MEMBER_PROFILE: 6
};

module.exports.ButtonStyles = {
Expand Down Expand Up @@ -330,7 +340,9 @@ const Intents = {
messageContent: 1 << 15,
guildScheduledEvents: 1 << 16,
autoModerationConfiguration: 1 << 20,
autoModerationExecution: 1 << 21
autoModerationExecution: 1 << 21,
guildMessagePolls: 1 << 24,
directMessagePolls: 1 << 25
};

Intents.allNonPrivileged = Intents.guilds
Expand All @@ -348,7 +360,9 @@ Intents.allNonPrivileged = Intents.guilds
| Intents.directMessageTyping
| Intents.guildScheduledEvents
| Intents.autoModerationConfiguration
| Intents.autoModerationExecution;
| Intents.autoModerationExecution
| Intents.guildMessagePolls
| Intents.directMessagePolls;
Intents.allPrivileged = Intents.guildMembers
| Intents.guildPresences
| Intents.messageContent;
Expand Down Expand Up @@ -448,7 +462,12 @@ module.exports.MessageTypes = {
STAGE_END: 28,
STAGE_SPEAKER: 29,
STAGE_TOPIC: 31,
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION: 32
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION: 32,
GUILD_INCIDENT_ALERT_MODE_ENABLED: 36,
GUILD_INCIDENT_ALERT_MODE_DISABLED: 37,
GUILD_INCIDENT_REPORT_RAID: 38,
GUILD_INCIDENT_REPORT_FALSE_ALARM: 39,
PURCHASE_NOTIFICATION: 44
};

module.exports.MembershipState = {
Expand Down Expand Up @@ -518,7 +537,9 @@ const Permissions = {
createGuildExpressions: 1n << 43n,
createEvents: 1n << 44n,
useExternalSounds: 1n << 45n,
sendVoiceMessages: 1n << 46n
sendVoiceMessages: 1n << 46n,
sendPolls: 1n << 49n,
useExternalApps: 1n << 50n
};
Permissions.allGuild = Permissions.kickMembers
| Permissions.banMembers
Expand Down Expand Up @@ -557,7 +578,9 @@ Permissions.allText = Permissions.createInstantInvite
| Permissions.createPrivateThreads
| Permissions.useExternalStickers
| Permissions.sendMessagesInThreads
| Permissions.sendVoiceMessages;
| Permissions.sendVoiceMessages
| Permissions.sendPolls
| Permissions.useExternalApps;
Permissions.allVoice = Permissions.createInstantInvite
| Permissions.manageChannels
| Permissions.voicePrioritySpeaker
Expand Down
22 changes: 22 additions & 0 deletions lib/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,28 @@ class Message extends Base {
break;
}
case MessageTypes.GUILD_APPLICATION_PREMIUM_SUBSCRIPTION: {
data.content = `${this.author.mention} upgraded **${data.application?.name ?? data.application?.id ?? "a deleted application"}** to premium for this server! 🎉`;
break;
}
case MessageTypes.GUILD_INCIDENT_ALERT_MODE_ENABLED: {
data.content = `${this.author.mention} enabled security actions until **${data.content}**.`;
break;
}
case MessageTypes.GUILD_INCIDENT_ALERT_MODE_DISABLED: {
data.content = `${this.author.mention} disabled security actions.`;
break;
}
case MessageTypes.GUILD_INCIDENT_REPORT_RAID: {
data.content = `${this.author.mention} reported a raid in **${this.channel.guild?.name ?? data.guild_id}**.`;
break;
}
case MessageTypes.GUILD_INCIDENT_REPORT_FALSE_ALARM: {
data.content = `${this.author.mention} resolved an Activity Alert.`;
break;
}
case MessageTypes.PURCHASE_NOTIFICATION: {
// WARN: `purchase_notification` is documented only in the OpenAPI spec
data.content = `${this.author.mention} has purchased **${data.purchase_notification?.guild_product_purchase?.product_name ?? "an unknown product"}**!`;
break;
}
default: {
Expand Down