mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
Gateway v6 support
This commit is contained in:
@@ -802,13 +802,13 @@ var Client = (function (_EventEmitter) {
|
||||
// def createChannel
|
||||
|
||||
Client.prototype.createChannel = function createChannel(server, name) {
|
||||
var type = arguments.length <= 2 || arguments[2] === undefined ? "text" : arguments[2];
|
||||
var type = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, channel*/{} : arguments[3];
|
||||
|
||||
if (typeof type === "function") {
|
||||
// options is the callback
|
||||
callback = type;
|
||||
type = "text";
|
||||
type = 0;
|
||||
}
|
||||
|
||||
return this.internal.createChannel(server, name, type).then(dataCallback(callback), errorCallback(callback));
|
||||
|
||||
@@ -86,7 +86,7 @@ var _UtilTokenCacher = require("../Util/TokenCacher");
|
||||
|
||||
var _UtilTokenCacher2 = _interopRequireDefault(_UtilTokenCacher);
|
||||
|
||||
var GATEWAY_VERSION = 5;
|
||||
var GATEWAY_VERSION = 6;
|
||||
var zlib;
|
||||
var libVersion = require('../../package.json').version;
|
||||
|
||||
@@ -1082,7 +1082,7 @@ var InternalClient = (function () {
|
||||
InternalClient.prototype.createChannel = function createChannel(server, name) {
|
||||
var _this21 = this;
|
||||
|
||||
var type = arguments.length <= 2 || arguments[2] === undefined ? "text" : arguments[2];
|
||||
var type = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
|
||||
|
||||
server = this.resolver.resolveServer(server);
|
||||
|
||||
@@ -1091,7 +1091,7 @@ var InternalClient = (function () {
|
||||
type: type
|
||||
}).then(function (res) {
|
||||
var channel;
|
||||
if (res.type === "text") {
|
||||
if (res.type === 0) {
|
||||
channel = new _StructuresTextChannel2["default"](res, _this21.client, server);
|
||||
} else {
|
||||
channel = new _StructuresVoiceChannel2["default"](res, _this21.client, server);
|
||||
@@ -1908,7 +1908,6 @@ var InternalClient = (function () {
|
||||
_this36.identify();
|
||||
break;
|
||||
case 10:
|
||||
console.log(packet);
|
||||
if (_this36.sessionID) {
|
||||
_this36.resume();
|
||||
} else {
|
||||
@@ -2080,15 +2079,15 @@ var InternalClient = (function () {
|
||||
|
||||
if (msg) {
|
||||
// old message exists
|
||||
data.nonce = data.nonce || msg.nonce;
|
||||
data.attachments = data.attachments || msg.attachments;
|
||||
data.tts = data.tts || msg.tts;
|
||||
data.embeds = data.embeds || msg.embeds;
|
||||
data.timestamp = data.timestamp || msg.timestamp;
|
||||
data.mention_everyone = data.mention_everyone || msg.everyoneMentioned;
|
||||
data.content = data.content || msg.content;
|
||||
data.mentions = data.mentions || msg.mentions;
|
||||
data.author = data.author || msg.author;
|
||||
data.nonce = data.nonce !== undefined ? data.nonce : msg.nonce;
|
||||
data.attachments = data.attachments !== undefined ? data.attachments : msg.attachments;
|
||||
data.tts = data.tts !== undefined ? data.tts : msg.tts;
|
||||
data.embeds = data.embeds !== undefined ? data.embeds : msg.embeds;
|
||||
data.timestamp = data.timestamp !== undefined ? data.timestamp : msg.timestamp;
|
||||
data.mention_everyone = data.mention_everyone !== undefined ? data.mention_everyone : msg.everyoneMentioned;
|
||||
data.content = data.content !== undefined ? data.content : msg.content;
|
||||
data.mentions = data.mentions !== undefined ? data.mentions : msg.mentions;
|
||||
data.author = data.author !== undefined ? data.author : msg.author;
|
||||
msg = new _StructuresMessage2["default"](msg, channel, client);
|
||||
} else if (!data.author || !data.content) {
|
||||
break;
|
||||
@@ -2230,7 +2229,7 @@ var InternalClient = (function () {
|
||||
var server = this.servers.get("id", data.guild_id);
|
||||
if (server) {
|
||||
var chan = null;
|
||||
if (data.type === "text") {
|
||||
if (data.type === 0) {
|
||||
chan = this.channels.add(new _StructuresTextChannel2["default"](data, client, server));
|
||||
} else {
|
||||
chan = this.channels.add(new _StructuresVoiceChannel2["default"](data, client, server));
|
||||
@@ -2272,7 +2271,7 @@ var InternalClient = (function () {
|
||||
client.emit("channelUpdated", new _StructuresPMChannel2["default"](channel, client), this.private_channels.update(channel, new _StructuresPMChannel2["default"](data, client)));
|
||||
} else {
|
||||
if (channel.server) {
|
||||
if (channel.type === "text") {
|
||||
if (channel.type === 0) {
|
||||
//TEXT CHANNEL
|
||||
var chan = new _StructuresTextChannel2["default"](data, client, channel.server);
|
||||
chan.messages = channel.messages;
|
||||
|
||||
Reference in New Issue
Block a user