Skip to content

Commit

Permalink
Expose voice channel RTC region (abalabahaha#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsian03 authored Apr 2, 2021
1 parent 9ec347a commit f994117
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ declare namespace Eris {
icon?: string;
name?: string;
ownerID?: string;
rtcRegion?: string | null;
}
export interface GuildTextable extends Textable {
lastPinTimestamp: number | null;
Expand Down Expand Up @@ -402,6 +403,7 @@ declare namespace Eris {
permissionOverwrites: Collection<PermissionOverwrite>;
rateLimitPerUser?: number;
position: number;
rtcRegion?: string | null;
topic?: string;
type: Exclude<ChannelTypes, 1 | 3>;
userLimit?: number;
Expand Down Expand Up @@ -2420,6 +2422,7 @@ declare namespace Eris {

export class VoiceChannel extends GuildChannel implements Invitable {
bitrate: number;
rtcRegion: string | null;
type: 2;
userLimit: number;
voiceMembers: Collection<Member>;
Expand Down
2 changes: 2 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ class Client extends EventEmitter {
* @arg {String} [options.ownerID] The ID of the channel owner (group channels only)
* @arg {String?} [options.parentID] The ID of the parent channel category for this channel (guild text/voice channels only)
* @arg {Number} [options.rateLimitPerUser] The time in seconds a user has to wait before sending another message (does not affect bots or users with manageMessages/manageChannel permissions) (guild text channels only)
* @arg {String?} [options.rtcRegion] The RTC region ID of the channel (automatic if `null`) (guild voice channels only)
* @arg {String} [options.topic] The topic of the channel (guild text channels only)
* @arg {Number} [options.userLimit] The channel user limit (guild voice channels only)
* @arg {String} [reason] The reason to be displayed in audit logs
Expand All @@ -914,6 +915,7 @@ class Client extends EventEmitter {
owner_id: options.ownerID,
parent_id: options.parentID,
rate_limit_per_user: options.rateLimitPerUser,
rtc_region: options.rtcRegion,
topic: options.topic,
user_limit: options.userLimit,
reason: reason
Expand Down
2 changes: 2 additions & 0 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,7 @@ class Shard extends EventEmitter {
permissionOverwrites: channel.permissionOverwrites,
position: channel.position,
rateLimitPerUser: channel.rateLimitPerUser,
rtcRegion: channel.rtcRegion,
topic: channel.topic,
type: channel.type,
userLimit: channel.userLimit
Expand Down Expand Up @@ -1560,6 +1561,7 @@ class Shard extends EventEmitter {
* @prop {Collection} oldChannel.permissionOverwrites Collection of PermissionOverwrites in this channel
* @prop {Number} oldChannel.position The position of the channel
* @prop {Number} oldChannel.rateLimitPerUser The ratelimit of the channel, in seconds. 0 means no ratelimit is enabled (text channels only)
* @prop {String?} oldChannel.rtcRegion The RTC region ID of the channel (automatic when `null`)
* @prop {String?} oldChannel.topic The topic of the channel (text channels only)
* @prop {Number} oldChannel.type The type of the old channel
* @prop {Number} oldChannel.userLimit The max number of users that can join the channel (voice channels only)
Expand Down
1 change: 1 addition & 0 deletions lib/structures/GuildChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class GuildChannel extends Channel {
* @arg {Number} [options.bitrate] The bitrate of the channel (guild voice channels only)
* @arg {Number} [options.userLimit] The channel user limit (guild voice channels only)
* @arg {Number} [options.rateLimitPerUser] The time in seconds a user has to wait before sending another message (does not affect bots or users with manageMessages/manageChannel permissions) (guild text channels only)
* @arg {String?} [options.rtcRegion] The RTC region ID of the channel (automatic if `null`) (guild voice channels only)
* @arg {Boolean} [options.nsfw] The nsfw status of the channel
* @arg {Number?} [options.parentID] The ID of the parent channel category for this channel (guild text/voice channels only)
* @arg {String} [reason] The reason to be displayed in audit logs
Expand Down
4 changes: 4 additions & 0 deletions lib/structures/VoiceChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Member = require("./Member");
* Represents a guild voice channel. See GuildChannel for more properties and methods.
* @extends GuildChannel
* @prop {Number?} bitrate The bitrate of the channel
* @prop {String?} rtcRegion The RTC region ID of the channel (automatic when `null`)
* @prop {Number} type The type of the channel
* @prop {Number?} userLimit The max number of users that can join the channel
* @prop {Collection<Member>} voiceMembers Collection of Members in this channel
Expand All @@ -25,6 +26,9 @@ class VoiceChannel extends GuildChannel {
if(data.bitrate !== undefined) {
this.bitrate = data.bitrate;
}
if(data.rtc_region !== undefined) {
this.rtcRegion = data.rtc_region;
}
if(data.user_limit !== undefined) {
this.userLimit = data.user_limit;
}
Expand Down

0 comments on commit f994117

Please sign in to comment.