mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
Fix voice channel joining
This commit is contained in:
@@ -336,7 +336,7 @@ var InternalClient = (function () {
|
|||||||
return Promise.reject(new Error("voice channel does not exist"));
|
return Promise.reject(new Error("voice channel does not exist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.type !== 'voice') {
|
if (channel.type !== 2) {
|
||||||
return Promise.reject(new Error("channel is not a voice channel!"));
|
return Promise.reject(new Error("channel is not a voice channel!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +394,7 @@ var InternalClient = (function () {
|
|||||||
return Promise.reject(new Error("voice channel does not exist"));
|
return Promise.reject(new Error("voice channel does not exist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.type !== 'voice') {
|
if (channel.type !== 2) {
|
||||||
return Promise.reject(new Error("channel is not a voice channel!"));
|
return Promise.reject(new Error("channel is not a voice channel!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1157,7 +1157,7 @@ var InternalClient = (function () {
|
|||||||
var server = channel.server;
|
var server = channel.server;
|
||||||
|
|
||||||
// Make sure `channel` is a voice channel
|
// Make sure `channel` is a voice channel
|
||||||
if (channel.type !== "voice") {
|
if (channel.type !== 2) {
|
||||||
throw new Error("Can't moveMember into a non-voice channel");
|
throw new Error("Can't moveMember into a non-voice channel");
|
||||||
} else {
|
} else {
|
||||||
return _this23.apiRequest("patch", _Constants.Endpoints.SERVER_MEMBERS(server.id) + "/" + user.id, true, { channel_id: channel.id }).then(function (res) {
|
return _this23.apiRequest("patch", _Constants.Endpoints.SERVER_MEMBERS(server.id) + "/" + user.id, true, { channel_id: channel.id }).then(function (res) {
|
||||||
@@ -2525,7 +2525,7 @@ var InternalClient = (function () {
|
|||||||
if (data.channel_id) {
|
if (data.channel_id) {
|
||||||
// in voice channel
|
// in voice channel
|
||||||
var channel = this.channels.get("id", data.channel_id);
|
var channel = this.channels.get("id", data.channel_id);
|
||||||
if (channel && channel.type === "voice") {
|
if (channel && channel.type === 2) {
|
||||||
server.eventVoiceStateUpdate(channel, user, data);
|
server.eventVoiceStateUpdate(channel, user, data);
|
||||||
} else {
|
} else {
|
||||||
client.emit("warn", "voice state channel not in cache");
|
client.emit("warn", "voice state channel not in cache");
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ var Server = (function (_Equality) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Server.prototype.eventVoiceLeave = function eventVoiceLeave(user) {
|
Server.prototype.eventVoiceLeave = function eventVoiceLeave(user) {
|
||||||
for (var _iterator4 = this.channels.getAll("type", "voice"), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
|
for (var _iterator4 = this.channels.getAll("type", 2), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
|
||||||
var _ref4;
|
var _ref4;
|
||||||
|
|
||||||
if (_isArray4) {
|
if (_isArray4) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord.js",
|
"name": "discord.js",
|
||||||
"version": "8.1.0",
|
"version": "8.2.0",
|
||||||
"description": "A way to interface with the Discord API",
|
"description": "A way to interface with the Discord API",
|
||||||
"main": "./entrypoint.js",
|
"main": "./entrypoint.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ export default class InternalClient {
|
|||||||
return Promise.reject(new Error("voice channel does not exist"));
|
return Promise.reject(new Error("voice channel does not exist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.type !== 'voice') {
|
if (channel.type !== 2) {
|
||||||
return Promise.reject(new Error("channel is not a voice channel!"));
|
return Promise.reject(new Error("channel is not a voice channel!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ export default class InternalClient {
|
|||||||
return Promise.reject(new Error("voice channel does not exist"));
|
return Promise.reject(new Error("voice channel does not exist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.type !== 'voice') {
|
if (channel.type !== 2) {
|
||||||
return Promise.reject(new Error("channel is not a voice channel!"));
|
return Promise.reject(new Error("channel is not a voice channel!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,7 +1007,7 @@ export default class InternalClient {
|
|||||||
var server = channel.server;
|
var server = channel.server;
|
||||||
|
|
||||||
// Make sure `channel` is a voice channel
|
// Make sure `channel` is a voice channel
|
||||||
if (channel.type !== "voice") {
|
if (channel.type !== 2) {
|
||||||
throw new Error("Can't moveMember into a non-voice channel");
|
throw new Error("Can't moveMember into a non-voice channel");
|
||||||
} else {
|
} else {
|
||||||
return this.apiRequest("patch", `${Endpoints.SERVER_MEMBERS(server.id)}/${user.id}`, true, { channel_id: channel.id })
|
return this.apiRequest("patch", `${Endpoints.SERVER_MEMBERS(server.id)}/${user.id}`, true, { channel_id: channel.id })
|
||||||
@@ -2262,7 +2262,7 @@ export default class InternalClient {
|
|||||||
if (data.channel_id) {
|
if (data.channel_id) {
|
||||||
// in voice channel
|
// in voice channel
|
||||||
var channel = this.channels.get("id", data.channel_id);
|
var channel = this.channels.get("id", data.channel_id);
|
||||||
if (channel && channel.type === "voice") {
|
if (channel && channel.type === 2) {
|
||||||
server.eventVoiceStateUpdate(channel, user, data);
|
server.eventVoiceStateUpdate(channel, user, data);
|
||||||
} else {
|
} else {
|
||||||
client.emit("warn", "voice state channel not in cache");
|
client.emit("warn", "voice state channel not in cache");
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ export default class Server extends Equality {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eventVoiceLeave(user) {
|
eventVoiceLeave(user) {
|
||||||
for (let chan of this.channels.getAll("type", "voice")) {
|
for (let chan of this.channels.getAll("type", 2)) {
|
||||||
if (chan.members.has("id", user.id)) {
|
if (chan.members.has("id", user.id)) {
|
||||||
chan.members.remove(user);
|
chan.members.remove(user);
|
||||||
user.voiceChannel = null;
|
user.voiceChannel = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user