feat: voice messages (#9444)

* feat: voice messages

* fix: delete unnesseary error
This commit is contained in:
Jaw0r3k
2023-04-23 21:03:29 +02:00
committed by GitHub
parent 420f379933
commit 3386bab2c0
6 changed files with 54 additions and 4 deletions

View File

@@ -147,6 +147,28 @@ class MessageAttachment {
* @type {boolean}
*/
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;
}
}
/**

View File

@@ -1141,6 +1141,11 @@ exports.APIErrors = {
INVALID_JSON: 50109,
CANNOT_MIX_SUBSCRIPTION_AND_NON_SUBSCRIPTION_ROLES_FOR_EMOJI: 50144,
CANNOT_CONVERT_PREMIUM_EMOJI_TO_NORMAL_EMOJI: 50145,
VOICE_MESSAGES_DO_NOT_SUPPORT_ADDITIONAL_CONTENT: 50159,
VOICE_MESSAGES_MUST_HAVE_A_SINGLE_AUDIO_ATTACHMENT: 50160,
VOICE_MESSAGES_MUST_HAVE_SUPPORTING_METADATA: 50161,
VOICE_MESSAGES_CANNOT_BE_EDITED: 50162,
YOU_CANNOT_SEND_VOICE_MESSAGES_IN_THIS_CHANNEL: 50173,
TWO_FACTOR_REQUIRED: 60003,
NO_USERS_WITH_DISCORDTAG_EXIST: 80004,
REACTION_BLOCKED: 90001,

View File

@@ -45,6 +45,7 @@ MessageFlags.FLAGS = {
EPHEMERAL: 1 << 6,
LOADING: 1 << 7,
SUPPRESS_NOTIFICATIONS: 1 << 12,
IS_VOICE_MESSAGE: 1 << 13,
};
module.exports = MessageFlags;

View File

@@ -160,6 +160,7 @@ Permissions.FLAGS = {
MODERATE_MEMBERS: 1n << 40n,
VIEW_CREATOR_MONETIZATION_ANALYTICS: 1n << 41n,
USE_SOUNDBOARD: 1n << 42n,
SEND_VOICE_MESSAGES: 1n << 46n,
};
/**