API: Add support for voice channels.

API: Add support for replies.
This commit is contained in:
Paul
2021-06-23 13:36:05 +01:00
parent 19816adfdc
commit b1d00889bc
4 changed files with 22 additions and 10 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "revolt.js",
"version": "4.3.1-alpha.0",
"version": "4.3.2",
"main": "dist/index.js",
"repository": "https://gitlab.insrt.uk/revolt/revolt.js",
"author": "Paul Makles <insrt.uk>",
+13 -5
View File
@@ -175,18 +175,25 @@ export namespace Channels {
icon?: Attachment
}
export type TextChannel = {
export type ServerChannel = {
_id: string,
channel_type: 'TextChannel',
server: string,
name: string,
description: string,
icon?: Attachment,
icon?: Attachment
}
export type TextChannel = ServerChannel & {
channel_type: 'TextChannel',
last_message: string
}
export type Channel = (SavedMessagesChannel | DirectMessageChannel | GroupChannel | TextChannel) & { nonce?: string }
export type VoiceChannel = ServerChannel & {
channel_type: 'VoiceChannel'
}
export type Channel = (SavedMessagesChannel | DirectMessageChannel | GroupChannel | TextChannel | VoiceChannel) & { nonce?: string }
export type Message = {
_id: string,
@@ -198,7 +205,8 @@ export namespace Channels {
attachments?: Attachment[],
edited?: { $date: string },
embeds?: Embed[],
mentions?: string[]
mentions?: string[],
replies?: string[]
}
export type SystemMessage =
+3 -1
View File
@@ -94,7 +94,8 @@ export class PermissionCalculator {
+ ChannelPermission.ManageChannel
+ ChannelPermission.VoiceCall
+ ChannelPermission.InviteOthers;
case 'TextChannel': {
case 'TextChannel':
case 'VoiceChannel': {
let server = this.client.servers.get(channel.server);
if (typeof server === 'undefined') return 0;
@@ -103,6 +104,7 @@ export class PermissionCalculator {
} else {
return ChannelPermission.View
+ ChannelPermission.SendMessage
+ ChannelPermission.VoiceCall
+ ChannelPermission.InviteOthers;
}
}
+5 -3
View File
@@ -369,7 +369,8 @@ type Routes =
data: {
content: string,
nonce: string,
attachments?: string[]
attachments?: string[],
replies?: { id: string, mention: boolean }[]
},
response: Channels.Message
}
@@ -524,15 +525,16 @@ type Routes =
response: Servers.Ban[]
}
| {
// Create a new text channel for a server
// Create a new server channel
method: 'POST',
route: `/servers/${Id}/channels`,
data: {
type?: 'Text' | 'Voice',
name: string,
description?: string,
nonce: string
},
response: Channels.TextChannel
response: Channels.TextChannel | Channels.VoiceChannel
}
| {
// Fetch a server's invites