mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
feat(Attachment): voice messages (#9392)
Co-authored-by: Tetie <tjvssr@gmail.com>
This commit is contained in:
@@ -99,6 +99,28 @@ class Attachment {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.ephemeral = data.ephemeral ?? false;
|
this.ephemeral = data.ephemeral ?? false;
|
||||||
|
|
||||||
|
if ('duration_secs' in data) {
|
||||||
|
/**
|
||||||
|
* The duration of this attachment in seconds
|
||||||
|
* <info>This will only be available if the attachment is an audio file.</info>
|
||||||
|
* @type {?number}
|
||||||
|
*/
|
||||||
|
this.duration = data.duration_secs;
|
||||||
|
} else {
|
||||||
|
this.duration ??= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('waveform' in data) {
|
||||||
|
/**
|
||||||
|
* The base64 encoded byte array representing a sampled waveform
|
||||||
|
* <info>This will only be available if the attachment is an audio file.</info>
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.waveform = data.waveform;
|
||||||
|
} else {
|
||||||
|
this.waveform ??= null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
packages/discord.js/typings/index.d.ts
vendored
2
packages/discord.js/typings/index.d.ts
vendored
@@ -2014,6 +2014,7 @@ export class Attachment {
|
|||||||
private attachment: BufferResolvable | Stream;
|
private attachment: BufferResolvable | Stream;
|
||||||
public contentType: string | null;
|
public contentType: string | null;
|
||||||
public description: string | null;
|
public description: string | null;
|
||||||
|
public duration: number | null;
|
||||||
public ephemeral: boolean;
|
public ephemeral: boolean;
|
||||||
public height: number | null;
|
public height: number | null;
|
||||||
public id: Snowflake;
|
public id: Snowflake;
|
||||||
@@ -2022,6 +2023,7 @@ export class Attachment {
|
|||||||
public size: number;
|
public size: number;
|
||||||
public get spoiler(): boolean;
|
public get spoiler(): boolean;
|
||||||
public url: string;
|
public url: string;
|
||||||
|
public waveform: string | null;
|
||||||
public width: number | null;
|
public width: number | null;
|
||||||
public toJSON(): unknown;
|
public toJSON(): unknown;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user