feat: update Discord developer documentation links and add new flags (#9473)

- Update developer documentation links in WebSocketShard.js, ActivityFlags.js, Constants.js, and MessageFlags.js
- Add new flags in ApplicationFlags.js, MessageFlags.js, Permissions.js, and SystemChannelFlags.js
- Update typings in index.d.ts for the added flags
This commit is contained in:
Hampus Kraft 2023-04-29 03:15:19 +02:00 committed by GitHub
parent 3386bab2c0
commit d867936fce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 22 deletions

View file

@ -735,7 +735,7 @@ class WebSocketShard extends EventEmitter {
/**
* Adds a packet to the queue to be sent to the gateway.
* <warn>If you use this method, make sure you understand that you need to provide
* a full [Payload](https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-commands).
* a full [Payload](https://discord.com/developers/docs/topics/gateway-events#payload-structure).
* Do not use this method if you don't know what you're doing.</warn>
* @param {Object} data The full packet to send
* @param {boolean} [important=false] If this packet should be added first in queue

View file

@ -27,7 +27,7 @@ class ActivityFlags extends BitField {}
* * `PARTY_PRIVACY_VOICE_CHANNEL`
* * `EMBEDDED`
* @type {Object}
* @see {@link https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags}
* @see {@link https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-flags}
*/
ActivityFlags.FLAGS = {
INSTANCE: 1 << 0,

View file

@ -23,6 +23,7 @@ class ApplicationFlags extends BitField {}
/**
* Numeric application flags. All available properties:
* * `APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE`
* * `GATEWAY_PRESENCE`
* * `GATEWAY_PRESENCE_LIMITED`
* * `GATEWAY_GUILD_MEMBERS`
@ -31,10 +32,12 @@ class ApplicationFlags extends BitField {}
* * `EMBEDDED`
* * `GATEWAY_MESSAGE_CONTENT`
* * `GATEWAY_MESSAGE_CONTENT_LIMITED`
* * `APPLICATION_COMMAND_BADGE`
* @type {Object}
* @see {@link https://discord.com/developers/docs/resources/application#application-object-application-flags}
*/
ApplicationFlags.FLAGS = {
APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE: 1 << 6,
GATEWAY_PRESENCE: 1 << 12,
GATEWAY_PRESENCE_LIMITED: 1 << 13,
GATEWAY_GUILD_MEMBERS: 1 << 14,
@ -43,6 +46,7 @@ ApplicationFlags.FLAGS = {
EMBEDDED: 1 << 17,
GATEWAY_MESSAGE_CONTENT: 1 << 18,
GATEWAY_MESSAGE_CONTENT_LIMITED: 1 << 19,
APPLICATION_COMMAND_BADGE: 1 << 23,
};
module.exports = ApplicationFlags;

View file

@ -432,7 +432,7 @@ exports.PartialTypes = keyMirror(['USER', 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE',
* * GUILD_SCHEDULED_EVENT_USER_REMOVE
* * GUILD_AUDIT_LOG_ENTRY_CREATE
* @typedef {string} WSEventType
* @see {@link https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events}
* @see {@link https://discord.com/developers/docs/topics/gateway-events#receive-events}
*/
exports.WSEvents = keyMirror([
'READY',

View file

@ -31,7 +31,9 @@ class MessageFlags extends BitField {}
* * `HAS_THREAD`
* * `EPHEMERAL`
* * `LOADING`
* * `FAILED_TO_MENTION_SOME_ROLES_IN_THREAD`
* * `SUPPRESS_NOTIFICATIONS`
* * `IS_VOICE_MESSAGE`
* @type {Object}
* @see {@link https://discord.com/developers/docs/resources/channel#message-object-message-flags}
*/
@ -44,6 +46,7 @@ MessageFlags.FLAGS = {
HAS_THREAD: 1 << 5,
EPHEMERAL: 1 << 6,
LOADING: 1 << 7,
FAILED_TO_MENTION_SOME_ROLES_IN_THREAD: 1 << 8,
SUPPRESS_NOTIFICATIONS: 1 << 12,
IS_VOICE_MESSAGE: 1 << 13,
};

View file

@ -110,6 +110,7 @@ class Permissions extends BitField {
* * `MODERATE_MEMBERS`
* * `VIEW_CREATOR_MONETIZATION_ANALYTICS`
* * `USE_SOUNDBOARD`
* * `SEND_VOICE_MESSAGES`
* @type {Object<string, bigint>}
* @see {@link https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags}
*/

View file

@ -38,6 +38,8 @@ class SystemChannelFlags extends BitField {}
* * `SUPPRESS_PREMIUM_SUBSCRIPTIONS` (Suppress server boost notifications)
* * `SUPPRESS_GUILD_REMINDER_NOTIFICATIONS` (Suppress server setup tips)
* * `SUPPRESS_JOIN_NOTIFICATION_REPLIES` (Hide member join sticker reply buttons)
* * `SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATIONS` (Suppress role subscription purchase and renewal notifications)
* * `SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATION_REPLIES` (HHide role subscription sticker reply buttons)
* @type {Object}
* @see {@link https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags}
*/
@ -46,6 +48,8 @@ SystemChannelFlags.FLAGS = {
SUPPRESS_PREMIUM_SUBSCRIPTIONS: 1 << 1,
SUPPRESS_GUILD_REMINDER_NOTIFICATIONS: 1 << 2,
SUPPRESS_JOIN_NOTIFICATION_REPLIES: 1 << 3,
SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATIONS: 1 << 4,
SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATION_REPLIES: 1 << 5,
};
module.exports = SystemChannelFlags;

65
typings/index.d.ts vendored
View file

@ -2787,10 +2787,21 @@ export class Formatters extends null {
public static blockQuote: typeof blockQuote;
public static bold: typeof bold;
public static channelMention: typeof channelMention;
public static chatInputApplicationCommandMention
<N extends string, G extends string, S extends string, I extends Snowflake>(commandName: N, subcommandGroupName: G, subcommandName: S, commandId: I): `</${N} ${G} ${S}:${I}>`;
public static chatInputApplicationCommandMention<N extends string, S extends string, I extends Snowflake>(commandName: N, subcommandName: S, commandId: I): `</${N} ${S}:${I}>`;
public static chatInputApplicationCommandMention<N extends string, I extends Snowflake>(commandName: N, commandId: I): `</${N}:${I}>`;
public static chatInputApplicationCommandMention<
N extends string,
G extends string,
S extends string,
I extends Snowflake,
>(commandName: N, subcommandGroupName: G, subcommandName: S, commandId: I): `</${N} ${G} ${S}:${I}>`;
public static chatInputApplicationCommandMention<N extends string, S extends string, I extends Snowflake>(
commandName: N,
subcommandName: S,
commandId: I,
): `</${N} ${S}:${I}>`;
public static chatInputApplicationCommandMention<N extends string, I extends Snowflake>(
commandName: N,
commandId: I,
): `</${N}:${I}>`;
public static codeBlock: typeof codeBlock;
public static formatEmoji: typeof formatEmoji;
public static hideLinkEmbed: typeof hideLinkEmbed;
@ -3436,7 +3447,7 @@ export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, Gu
options: AddGuildMemberOptions & { fetchWhenExisting: false },
): Promise<GuildMember | null>;
public add(user: UserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>;
public addRole(user: UserResolvable, role: RoleResolvable, reason?: string): Promise<GuildMember|User|Snowflake>;
public addRole(user: UserResolvable, role: RoleResolvable, reason?: string): Promise<GuildMember | User | Snowflake>;
public ban(user: UserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>;
public edit(user: UserResolvable, data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
public fetch(
@ -3448,7 +3459,11 @@ export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, Gu
public list(options?: GuildListMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
public prune(options: GuildPruneMembersOptions & { dry?: false; count: false }): Promise<null>;
public prune(options?: GuildPruneMembersOptions): Promise<number>;
public removeRole(user: UserResolvable, role: RoleResolvable, reason?: string): Promise<GuildMember|User|Snowflake>;
public removeRole(
user: UserResolvable,
role: RoleResolvable,
reason?: string,
): Promise<GuildMember | User | Snowflake>;
public search(options: GuildSearchMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
public unban(user: UserResolvable, reason?: string): Promise<User | null>;
}
@ -3645,24 +3660,27 @@ export class ThreadMemberManager extends CachedManager<Snowflake, ThreadMember,
public get me(): ThreadMember | null;
public add(member: UserResolvable | '@me', reason?: string): Promise<Snowflake>;
public fetch(options?: FetchThreadMembersWithoutGuildMemberDataOptions): Promise<Collection<Snowflake, ThreadMember>>;
public fetch(
member: ThreadMember<true>,
options?: FetchMemberOptions
): Promise<ThreadMember<true>>;
public fetch(member: ThreadMember<true>, options?: FetchMemberOptions): Promise<ThreadMember<true>>;
public fetch(
member: Snowflake,
options: (FetchThreadMemberOptions & { withMember: true }),
options: FetchThreadMemberOptions & { withMember: true },
): Promise<ThreadMember<true>>;
public fetch(
options: FetchThreadMembersWithGuildMemberDataOptions,
): Promise<Collection<Snowflake, ThreadMember<true>>>;
): Promise<Collection<Snowflake, ThreadMember<true>>>;
public fetch(member: UserResolvable, options?: FetchThreadMemberOptions): Promise<ThreadMember>;
/** @deprecated Use `fetch(options)` instead. */
public fetch(cache: boolean, options?: FetchThreadMembersOptions): Promise<Collection<Snowflake, ThreadMember>>;
public fetch(x: undefined, options: FetchThreadMembersWithGuildMemberDataOptions): Promise<Collection<Snowflake, ThreadMember<true>>>;
public fetch(x: undefined, options?: FetchThreadMembersWithoutGuildMemberDataOptions): Promise<Collection<Snowflake, ThreadMember>>;
public fetch(
x: undefined,
options: FetchThreadMembersWithGuildMemberDataOptions,
): Promise<Collection<Snowflake, ThreadMember<true>>>;
public fetch(
x: undefined,
options?: FetchThreadMembersWithoutGuildMemberDataOptions,
): Promise<Collection<Snowflake, ThreadMember>>;
public fetchMe(options?: BaseFetchOptions): Promise<ThreadMember>;
public remove(id: Snowflake | '@me', reason?: string): Promise<Snowflake>;
@ -4266,6 +4284,7 @@ export type ApplicationCommandPermissionType = keyof typeof ApplicationCommandPe
export type ApplicationCommandResolvable = ApplicationCommand | Snowflake;
export type ApplicationFlagsString =
| 'APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE'
| 'GATEWAY_PRESENCE'
| 'GATEWAY_PRESENCE_LIMITED'
| 'GATEWAY_GUILD_MEMBERS'
@ -4273,7 +4292,8 @@ export type ApplicationFlagsString =
| 'VERIFICATION_PENDING_GUILD_LIMIT'
| 'EMBEDDED'
| 'GATEWAY_MESSAGE_CONTENT'
| 'GATEWAY_MESSAGE_CONTENT_LIMITED';
| 'GATEWAY_MESSAGE_CONTENT_LIMITED'
| 'APPLICATION_COMMAND_BADGE';
export interface ApplicationRoleConnectionMetadataEditOptions {
name: string;
@ -4427,8 +4447,8 @@ export type CacheConstructors = {
// Narrowing the type of `manager.name` doesn't propagate type information to `holds` and the return type.
export type CacheFactory = (
manager: CacheConstructors[keyof Caches],
holds: Caches[typeof manager['name']][1],
) => typeof manager['prototype'] extends DataManager<infer K, infer V, any> ? Collection<K, V> : never;
holds: Caches[(typeof manager)['name']][1],
) => (typeof manager)['prototype'] extends DataManager<infer K, infer V, any> ? Collection<K, V> : never;
export type CacheWithLimitsOptions = {
[K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer K, infer V, any>
@ -5466,7 +5486,11 @@ export interface GuildMemberEditData {
flags?: GuildMemberFlagsResolvable;
}
export type GuildMemberFlagsString = 'DID_REJOIN' | 'COMPLETED_ONBOARDING' | 'BYPASSES_VERIFICATION' | 'STARTED_ONBOARDING';
export type GuildMemberFlagsString =
| 'DID_REJOIN'
| 'COMPLETED_ONBOARDING'
| 'BYPASSES_VERIFICATION'
| 'STARTED_ONBOARDING';
export type GuildMemberFlagsResolvable = BitFieldResolvable<GuildMemberFlagsString, number>;
@ -5871,6 +5895,7 @@ export type MessageFlagsString =
| 'HAS_THREAD'
| 'EPHEMERAL'
| 'LOADING'
| 'FAILED_TO_MENTION_SOME_ROLES_IN_THREAD'
| 'SUPPRESS_NOTIFICATIONS'
| 'IS_VOICE_MESSAGE';
@ -6285,7 +6310,9 @@ export type SystemChannelFlagsString =
| 'SUPPRESS_JOIN_NOTIFICATIONS'
| 'SUPPRESS_PREMIUM_SUBSCRIPTIONS'
| 'SUPPRESS_GUILD_REMINDER_NOTIFICATIONS'
| 'SUPPRESS_JOIN_NOTIFICATION_REPLIES';
| 'SUPPRESS_JOIN_NOTIFICATION_REPLIES'
| 'SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATIONS'
| 'SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATION_REPLIES';
export type SystemChannelFlagsResolvable = BitFieldResolvable<SystemChannelFlagsString, number>;