mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Added createServer
This commit is contained in:
@@ -235,6 +235,22 @@ var Client = (function (_EventEmitter) {
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.createServer = function createServer(name) {
|
||||
var region = arguments.length <= 1 || arguments[1] === undefined ? "london" : arguments[1];
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err, srv) {} : arguments[2];
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
self.internal.createServer(name, region).then(function (srv) {
|
||||
callback(null, srv);
|
||||
resolve(srv);
|
||||
})["catch"](function (e) {
|
||||
callback(e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return Client;
|
||||
})(EventEmitter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user