Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for voice messages #749

Merged
merged 4 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deno/payloads/common.ts
Original file line number Diff line number Diff line change
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,
Mateo-tem marked this conversation as resolved.
Show resolved Hide resolved
} as const;

/**
Expand Down
10 changes: 9 additions & 1 deletion deno/payloads/v10/channel.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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