Skip to content

Commit

Permalink
feat: add support for voice messages (#749)
Browse files Browse the repository at this point in the history
Co-authored-by: advaith <advaithj1@gmail.com>
  • Loading branch information
Mateo-tem and advaith1 committed Apr 21, 2023
1 parent 0f76026 commit 3dac5b9
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 6 deletions.
1 change: 1 addition & 0 deletions deno/payloads/common.ts
Expand Up @@ -59,6 +59,7 @@ export const PermissionFlagsBits = {
* @unstable This permission flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
UseExternalSounds: 1n << 45n,
SendVoiceMessages: 1n << 46n,
} as const;

/**
Expand Down
10 changes: 9 additions & 1 deletion deno/payloads/v10/channel.ts
Expand Up @@ -807,7 +807,7 @@ export enum MessageFlags {
*/
SuppressNotifications = 1 << 12,
/**
* @unstable This message flag is currently not documented by Discord but has a known value which we will try to keep up to date.
* This message is a voice message
*/
IsVoiceMessage = 1 << 13,
}
Expand Down Expand Up @@ -1321,6 +1321,14 @@ export interface APIAttachment {
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
*/
duration_secs?: number;
/**
* Base64 encoded bytearray representing a sampled waveform (currently for voice messages)
*/
waveform?: string;
}

/**
Expand Down
10 changes: 9 additions & 1 deletion deno/payloads/v9/channel.ts
Expand Up @@ -793,7 +793,7 @@ export enum MessageFlags {
*/
SuppressNotifications = 1 << 12,
/**
* @unstable This message flag is currently not documented by Discord but has a known value which we will try to keep up to date.
* This message is a voice message
*/
IsVoiceMessage = 1 << 13,
}
Expand Down Expand Up @@ -1289,6 +1289,14 @@ export interface APIAttachment {
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
*/
duration_secs?: number;
/**
* Base64 encoded bytearray representing a sampled waveform (currently for voice messages)
*/
waveform?: string;
}

/**
Expand Down
8 changes: 7 additions & 1 deletion deno/rest/common.ts
Expand Up @@ -232,7 +232,13 @@ export enum RESTJSONErrorCodes {
CannotConvertBetweenPremiumEmojiAndNormalEmoji,
UploadedFileNotFound,

CannotDeleteGuildSubscriptionIntegration = 50163,
VoiceMessagesDoNotSupportAdditionalContent = 50159,
VoiceMessagesMustHaveASingleAudioAttachment,
VoiceMessagesMustHaveSupportingMetadata,
VoiceMessagesCannotBeEdited,
CannotDeleteGuildSubscriptionIntegration,

YouCannotSendVoiceMessagesInThisChannel = 50173,

YouDoNotHavePermissionToSendThisSticker = 50600,

Expand Down
1 change: 1 addition & 0 deletions payloads/common.ts
Expand Up @@ -59,6 +59,7 @@ export const PermissionFlagsBits = {
* @unstable This permission flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
UseExternalSounds: 1n << 45n,
SendVoiceMessages: 1n << 46n,
} as const;

/**
Expand Down
10 changes: 9 additions & 1 deletion payloads/v10/channel.ts
Expand Up @@ -807,7 +807,7 @@ export enum MessageFlags {
*/
SuppressNotifications = 1 << 12,
/**
* @unstable This message flag is currently not documented by Discord but has a known value which we will try to keep up to date.
* This message is a voice message
*/
IsVoiceMessage = 1 << 13,
}
Expand Down Expand Up @@ -1321,6 +1321,14 @@ export interface APIAttachment {
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
*/
duration_secs?: number;
/**
* Base64 encoded bytearray representing a sampled waveform (currently for voice messages)
*/
waveform?: string;
}

/**
Expand Down
10 changes: 9 additions & 1 deletion payloads/v9/channel.ts
Expand Up @@ -793,7 +793,7 @@ export enum MessageFlags {
*/
SuppressNotifications = 1 << 12,
/**
* @unstable This message flag is currently not documented by Discord but has a known value which we will try to keep up to date.
* This message is a voice message
*/
IsVoiceMessage = 1 << 13,
}
Expand Down Expand Up @@ -1289,6 +1289,14 @@ export interface APIAttachment {
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
*/
duration_secs?: number;
/**
* Base64 encoded bytearray representing a sampled waveform (currently for voice messages)
*/
waveform?: string;
}

/**
Expand Down
8 changes: 7 additions & 1 deletion rest/common.ts
Expand Up @@ -232,7 +232,13 @@ export enum RESTJSONErrorCodes {
CannotConvertBetweenPremiumEmojiAndNormalEmoji,
UploadedFileNotFound,

CannotDeleteGuildSubscriptionIntegration = 50163,
VoiceMessagesDoNotSupportAdditionalContent = 50159,
VoiceMessagesMustHaveASingleAudioAttachment,
VoiceMessagesMustHaveSupportingMetadata,
VoiceMessagesCannotBeEdited,
CannotDeleteGuildSubscriptionIntegration,

YouCannotSendVoiceMessagesInThisChannel = 50173,

YouDoNotHavePermissionToSendThisSticker = 50600,

Expand Down

1 comment on commit 3dac5b9

@vercel
Copy link

@vercel vercel bot commented on 3dac5b9 Apr 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.