mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-20 21:24:46 +12:00
feat(Attachment): add flags (#9686)
Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
parent
a222e537c1
commit
2ac8be09a1
2 changed files with 46 additions and 0 deletions
37
src/util/AttachmentFlags.js
Normal file
37
src/util/AttachmentFlags.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
const BitField = require('./BitField');
|
||||
|
||||
/**
|
||||
* Data structure that makes it easy to interact with an {@link GuildMember#flags} bitfield.
|
||||
* @extends {BitField}
|
||||
*/
|
||||
class AttachmentFlags extends BitField {}
|
||||
|
||||
/**
|
||||
* @name AttachmentFlags
|
||||
* @kind constructor
|
||||
* @memberof AttachmentFlags
|
||||
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
||||
*/
|
||||
|
||||
/**
|
||||
* Numeric guild member flags. All available properties:
|
||||
* * `IS_REMIX`
|
||||
* @type {Object}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure-attachment-flags}
|
||||
*/
|
||||
AttachmentFlags.FLAGS = {
|
||||
IS_REMIX: 1 << 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* Data that can be resolved to give a guild attachment bitfield. This can be:
|
||||
* * A string (see {@link AttachmentFlags.FLAGS})
|
||||
* * A attachment flag
|
||||
* * An instance of AttachmentFlags
|
||||
* * An Array of AttachmentFlagsResolvable
|
||||
* @typedef {string|number|AttachmentFlags|AttachmentFlagsResolvable[]} AttachmentFlagsResolvable
|
||||
*/
|
||||
|
||||
module.exports = AttachmentFlags;
|
9
typings/index.d.ts
vendored
9
typings/index.d.ts
vendored
|
@ -1715,6 +1715,7 @@ export class MessageAttachment {
|
|||
public description: string | null;
|
||||
public duration: number | null;
|
||||
public ephemeral: boolean;
|
||||
public flags: Readonly<AttachmentFlags>;
|
||||
public height: number | null;
|
||||
public id: Snowflake;
|
||||
public name: string | null;
|
||||
|
@ -1731,6 +1732,14 @@ export class MessageAttachment {
|
|||
public toJSON(): unknown;
|
||||
}
|
||||
|
||||
export class AttachmentFlags extends BitField<AttachmentFlagsString> {
|
||||
public static FLAGS: Record<AttachmentFlagsString, number>;
|
||||
public static resolve(bit?: BitFieldResolvable<AttachmentFlagsString, number>): number;
|
||||
}
|
||||
|
||||
export type AttachmentFlagsString =
|
||||
| 'IS_REMIX';
|
||||
|
||||
export class MessageButton extends BaseMessageComponent {
|
||||
public constructor(data?: MessageButton | MessageButtonOptions | APIButtonComponent);
|
||||
public customId: string | null;
|
||||
|
|
Loading…
Reference in a new issue