diff --git a/lib/Client/Client.js b/lib/Client/Client.js index e575920c4..5c3365dad 100644 --- a/lib/Client/Client.js +++ b/lib/Client/Client.js @@ -417,10 +417,10 @@ var Client = (function (_EventEmitter) { // def setTopic - Client.prototype.setTopic = function setTopic(channel, topic) { + Client.prototype.setChannelTopic = function setChannelTopic(channel, topic) { var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2]; - return this.internal.setTopic(channel, topic).then(callback, errCB(callback)); + return this.internal.setChannelTopic(channel, topic).then(callback, errCB(callback)); }; //def setChannelName @@ -439,6 +439,14 @@ var Client = (function (_EventEmitter) { return this.internal.setChannelNameAndTopic(channel, name, topic).then(callback, errCB(callback)); }; + //def setChannelPosition + + Client.prototype.setChannelPosition = function setChannelPosition(channel, position) { + var callback = arguments.length <= 2 || arguments[2] === undefined ? function () /*err*/{} : arguments[2]; + + return this.internal.setChannelPosition(channel, position).then(callback, errCB(callback)); + }; + //def updateChannel Client.prototype.updateChannel = function updateChannel(channel, data) { diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index 6dd35d5ea..938e2b083 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -894,7 +894,7 @@ var InternalClient = (function () { //def setTopic - InternalClient.prototype.setTopic = function setTopic(chann) { + InternalClient.prototype.setChannelTopic = function setChannelTopic(chann) { var _this25 = this; var topic = arguments.length <= 1 || arguments[1] === undefined ? "" : arguments[1]; @@ -948,6 +948,24 @@ var InternalClient = (function () { }); }; + //def setTopic + + InternalClient.prototype.setChannelPosition = function setChannelPosition(chann) { + var _this28 = this; + + var position = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1]; + + return this.resolver.resolveChannel(chann).then(function (channel) { + return _superagent2["default"].patch(_Constants.Endpoints.CHANNEL(channel.id)).set("authorization", _this28.token).send({ + name: channel.name, + position: position, + topic: channel.topic + }).end().then(function (res) { + return channel.position = res.body.position; + }); + }); + }; + //def updateChannel InternalClient.prototype.updateChannel = function updateChannel(chann, data) { diff --git a/lib/Structures/Invite.js b/lib/Structures/Invite.js index 27d470b9c..3f67f2d48 100644 --- a/lib/Structures/Invite.js +++ b/lib/Structures/Invite.js @@ -5,27 +5,35 @@ exports.__esModule = true; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Invite = (function () { - function Invite(data, chan, client) { - _classCallCheck(this, Invite); + function Invite(data, chan, client) { + _classCallCheck(this, Invite); - this.maxAge = data.max_age; - this.code = data.code; - this.server = chan.server; - this.channel = chan; - this.revoked = data.revoked; - this.createdAt = Date.parse(data.created_at); - this.temporary = data.temporary; - this.uses = data.uses; - this.maxUses = data.uses; - this.inviter = client.internal.users.get("id", data.inviter.id); - this.xkcd = data.xkcdpass; - } + this.maxAge = data.max_age; + this.code = data.code; + this.server = chan.server; + this.channel = chan; + this.revoked = data.revoked; + this.createdAt = Date.parse(data.created_at); + this.temporary = data.temporary; + this.uses = data.uses; + this.maxUses = data.uses; + this.inviter = client.internal.users.get("id", data.inviter.id); + this.xkcd = data.xkcdpass; + } - Invite.prototype.toString = function toString() { - return "https://discord.gg/" + this.code; - }; + Invite.prototype.toString = function toString() { + return "https://discord.gg/" + this.code; + }; - return Invite; + Invite.prototype["delete"] = function _delete() { + return this.client.deleteInvite.apply(this.client, reg(this, arguments)); + }; + + Invite.prototype.join = function join() { + return this.client.joinServer.apply(this.client, reg(this, arguments)); + }; + + return Invite; })(); exports["default"] = Invite; diff --git a/lib/Structures/PMChannel.js b/lib/Structures/PMChannel.js index 59eb39685..71129a266 100644 --- a/lib/Structures/PMChannel.js +++ b/lib/Structures/PMChannel.js @@ -60,6 +60,22 @@ var PMChannel = (function (_Channel) { return this.client.sendTTSMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); }; + PMChannel.prototype.sendFile = function sendFile() { + return this.client.sendFile.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + PMChannel.prototype.startTyping = function startTyping() { + return this.client.startTyping.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + PMChannel.prototype.stopTyping = function stopTyping() { + return this.client.stopTyping.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + PMChannel.prototype.getLogs = function getLogs() { + return this.client.getChannelLogs.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + _createClass(PMChannel, [{ key: "lastMessage", get: function get() { diff --git a/lib/Structures/Role.js b/lib/Structures/Role.js index 942eda733..f32eb0e4e 100644 --- a/lib/Structures/Role.js +++ b/lib/Structures/Role.js @@ -154,7 +154,7 @@ var Role = (function () { }; Role.prototype.addUser = function addUser(member, callback) { - return this.client.addMemberToRole.apply(this.client, [member, this, callback]); + return this.client.addUserToRole.apply(this.client, [member, this, callback]); }; Role.prototype.removeMember = function removeMember(member, callback) { @@ -162,7 +162,7 @@ var Role = (function () { }; Role.prototype.removeUser = function removeUser(member, callback) { - return this.client.removeMemberFromRole.apply(this.client, [member, this, callback]); + return this.client.removeUserFromRole.apply(this.client, [member, this, callback]); }; return Role; diff --git a/lib/Structures/Server.js b/lib/Structures/Server.js index 9570a5111..1332da1ba 100644 --- a/lib/Structures/Server.js +++ b/lib/Structures/Server.js @@ -118,7 +118,7 @@ var Server = (function (_Equality) { } } - Server.prototype.details = function details(user) { + Server.prototype.detailsOf = function detailsOf(user) { user = this.client.internal.resolver.resolveUser(user); if (user) { return this.memberMap[user.id]; @@ -127,7 +127,7 @@ var Server = (function (_Equality) { } }; - Server.prototype.detailsOf = function detailsOf(user) { + Server.prototype.detailsOfUser = function detailsOfUser(user) { return this.details(user); }; @@ -190,6 +190,50 @@ var Server = (function (_Equality) { return this.client.createRole.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); }; + Server.prototype.banMember = function banMember(user, tlength, callback) { + return this.client.banMember.apply(this.client, [user, this, tlength, callback]); + }; + + Server.prototype.banUser = function banUser(user, tlength, callback) { + return this.client.banMember.apply(this.client, [user, this, tlength, callback]); + }; + + Server.prototype.ban = function ban(user, tlength, callback) { + return this.client.banMember.apply(this.client, [user, this, tlength, callback]); + }; + + Server.prototype.unbanMember = function unbanMember(user, callback) { + return this.client.unbanMember.apply(this.client, [user, this, callback]); + }; + + Server.prototype.unbanUser = function unbanUser(user, callback) { + return this.client.unbanMember.apply(this.client, [user, this, callback]); + }; + + Server.prototype.unban = function unban(user, callback) { + return this.client.unbanMember.apply(this.client, [user, this, callback]); + }; + + Server.prototype.kickMember = function kickMember(user, callback) { + return this.client.kickMember.apply(this.client, [user, this, callback]); + }; + + Server.prototype.kickUser = function kickUser(user, callback) { + return this.client.kickMember.apply(this.client, [user, this, callback]); + }; + + Server.prototype.kick = function kick(user, callback) { + return this.client.kickMember.apply(this.client, [user, this, callback]); + }; + + Server.prototype.getBans = function getBans() { + return this.client.getBans.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + Server.prototype.createChannel = function createChannel() { + return this.client.createChannel.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + _createClass(Server, [{ key: "iconURL", get: function get() { @@ -209,6 +253,16 @@ var Server = (function (_Equality) { get: function get() { return this.channels.get("id", this.id); } + }, { + key: "generalChannel", + get: function get() { + return this.defaultChannel; + } + }, { + key: "general", + get: function get() { + return this.defaultChannel; + } }, { key: "owner", get: function get() { diff --git a/lib/Structures/ServerChannel.js b/lib/Structures/ServerChannel.js index 57ad3f21f..3ee2cad34 100644 --- a/lib/Structures/ServerChannel.js +++ b/lib/Structures/ServerChannel.js @@ -127,6 +127,10 @@ var ServerChannel = (function (_Channel) { return this.client.setChannelName.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); }; + ServerChannel.prototype.setPosition = function setPosition() { + return this.client.setChannelPosition.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + return ServerChannel; })(_Channel3["default"]); diff --git a/lib/Structures/TextChannel.js b/lib/Structures/TextChannel.js index 6833c417f..e7dd40ef0 100644 --- a/lib/Structures/TextChannel.js +++ b/lib/Structures/TextChannel.js @@ -36,7 +36,7 @@ var TextChannel = (function (_ServerChannel) { /* warning! may return null */ TextChannel.prototype.setTopic = function setTopic() { - return this.client.setTopic.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + return this.client.setChannelTopic.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); }; TextChannel.prototype.setNameAndTopic = function setNameAndTopic() { @@ -63,6 +63,22 @@ var TextChannel = (function (_ServerChannel) { return this.client.sendTTSMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); }; + TextChannel.prototype.sendFile = function sendFile() { + return this.client.sendFile.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + TextChannel.prototype.getLogs = function getLogs() { + return this.client.getChannelLogs.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + TextChannel.prototype.startTyping = function startTyping() { + return this.client.startTyping.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + TextChannel.prototype.stopTyping = function stopTyping() { + return this.client.stopTyping.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + _createClass(TextChannel, [{ key: "lastMessage", get: function get() { diff --git a/lib/Structures/User.js b/lib/Structures/User.js index b3117524d..73bf10cd6 100644 --- a/lib/Structures/User.js +++ b/lib/Structures/User.js @@ -70,6 +70,18 @@ var User = (function (_Equality) { return this.client.sendTTSMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); }; + User.prototype.sendFile = function sendFile() { + return this.client.sendFile.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + User.prototype.startTyping = function startTyping() { + return this.client.startTyping.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + + User.prototype.stopTyping = function stopTyping() { + return this.client.stopTyping.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + User.prototype.addTo = function addTo(role, callback) { return this.client.addMemberToRole.apply(this.client, [this, role, callback]); }; @@ -78,6 +90,10 @@ var User = (function (_Equality) { return this.client.removeMemberFromRole.apply(this.client, [this, role, callback]); }; + User.prototype.getLogs = function getLogs() { + return this.client.getChannelLogs.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments)); + }; + _createClass(User, [{ key: "avatarURL", get: function get() {