mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Added queue as a setup option
This commit is contained in:
@@ -19,7 +19,7 @@ var WebSocket = require("ws");
|
||||
var fs = require("fs");
|
||||
|
||||
var defaultOptions = {
|
||||
cache_tokens: false
|
||||
queue: false
|
||||
};
|
||||
|
||||
var Client = (function () {
|
||||
@@ -35,6 +35,7 @@ var Client = (function () {
|
||||
further efforts will be made to connect.
|
||||
*/
|
||||
this.options = options;
|
||||
this.options.queue = this.options.queue || false;
|
||||
this.token = token;
|
||||
this.state = 0;
|
||||
this.websocket = null;
|
||||
@@ -60,6 +61,7 @@ var Client = (function () {
|
||||
this.serverCache = [];
|
||||
this.pmChannelCache = [];
|
||||
this.readyTime = null;
|
||||
this.optionsQueue = {};
|
||||
}
|
||||
|
||||
_createClass(Client, [{
|
||||
@@ -603,6 +605,9 @@ var Client = (function () {
|
||||
|
||||
function send(destination) {
|
||||
|
||||
if (self.options.queue) {
|
||||
//we're QUEUEING messages, so sending them sequentially based on servers.
|
||||
}
|
||||
request.post(Endpoints.CHANNELS + "/" + destination + "/messages").set("authorization", self.token).send({
|
||||
content: message,
|
||||
mentions: mentions
|
||||
|
||||
@@ -13,7 +13,7 @@ var WebSocket = require("ws");
|
||||
var fs = require("fs");
|
||||
|
||||
var defaultOptions = {
|
||||
cache_tokens: false
|
||||
queue: false
|
||||
}
|
||||
|
||||
class Client {
|
||||
@@ -25,6 +25,7 @@ class Client {
|
||||
further efforts will be made to connect.
|
||||
*/
|
||||
this.options = options;
|
||||
this.options.queue = this.options.queue || false;
|
||||
this.token = token;
|
||||
this.state = 0;
|
||||
this.websocket = null;
|
||||
@@ -50,6 +51,7 @@ class Client {
|
||||
this.serverCache = [];
|
||||
this.pmChannelCache = [];
|
||||
this.readyTime = null;
|
||||
this.optionsQueue = {};
|
||||
}
|
||||
|
||||
get uptime() {
|
||||
@@ -620,7 +622,10 @@ class Client {
|
||||
}
|
||||
|
||||
function send(destination) {
|
||||
|
||||
|
||||
if(self.options.queue){
|
||||
//we're QUEUEING messages, so sending them sequentially based on servers.
|
||||
}
|
||||
request
|
||||
.post(`${Endpoints.CHANNELS}/${destination}/messages`)
|
||||
.set("authorization", self.token)
|
||||
|
||||
Reference in New Issue
Block a user