mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Fixed compiled version
Downgraded babel until a working solution found
This commit is contained in:
@@ -4,8 +4,6 @@ var _createClass = (function () { function defineProperties(target, props) { for
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Cache = require("../Util/Cache.js");
|
||||
@@ -17,26 +15,27 @@ var Message = (function (_Equality) {
|
||||
_inherits(Message, _Equality);
|
||||
|
||||
function Message(data, channel, client) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, Message);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Message).call(this));
|
||||
_Equality.call(this);
|
||||
this.channel = channel;
|
||||
this.client = client;
|
||||
this.nonce = data.nonce;
|
||||
this.attachments = data.attachments;
|
||||
this.tts = data.tts;
|
||||
this.embeds = data.embeds;
|
||||
this.timestamp = Date.parse(data.timestamp);
|
||||
this.everyoneMentioned = data.mention_everyone;
|
||||
this.id = data.id;
|
||||
|
||||
_this.channel = channel;
|
||||
_this.client = client;
|
||||
_this.nonce = data.nonce;
|
||||
_this.attachments = data.attachments;
|
||||
_this.tts = data.tts;
|
||||
_this.embeds = data.embeds;
|
||||
_this.timestamp = Date.parse(data.timestamp);
|
||||
_this.everyoneMentioned = data.mention_everyone;
|
||||
_this.id = data.id;
|
||||
if (data.edited_timestamp) this.editedTimestamp = Date.parse(data.edited_timestamp);
|
||||
|
||||
if (data.edited_timestamp) _this.editedTimestamp = Date.parse(data.edited_timestamp);
|
||||
if (data.author instanceof User) this.author = data.author;else this.author = client.internal.users.add(new User(data.author, client));
|
||||
|
||||
if (data.author instanceof User) _this.author = data.author;else _this.author = client.internal.users.add(new User(data.author, client));
|
||||
|
||||
_this.content = data.content;
|
||||
_this.mentions = new Cache();
|
||||
this.content = data.content;
|
||||
this.mentions = new Cache();
|
||||
|
||||
data.mentions.forEach(function (mention) {
|
||||
// this is .add and not .get because it allows the bot to cache
|
||||
@@ -44,45 +43,38 @@ var Message = (function (_Equality) {
|
||||
// not previously cached.
|
||||
if (mention instanceof User) _this.mentions.push(mention);else _this.mentions.add(client.internal.users.add(new User(mention, client)));
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
|
||||
Message.prototype.isMentioned = function isMentioned(user) {
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (user) {
|
||||
return this.mentions.has("id", user.id);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Message.prototype.toString = function toString() {
|
||||
return this.content;
|
||||
};
|
||||
|
||||
Message.prototype["delete"] = function _delete() {
|
||||
return this.client.deleteMessage.apply(this.client, reg(this, arguments));
|
||||
};
|
||||
|
||||
Message.prototype.update = function update() {
|
||||
return this.client.updateMessage.apply(this.client, reg(this, arguments));
|
||||
};
|
||||
|
||||
Message.prototype.reply = function reply() {
|
||||
return this.client.reply.apply(this.client, reg(this, arguments));
|
||||
};
|
||||
|
||||
Message.prototype.replyTTS = function replyTTS() {
|
||||
return this.client.replyTTS.apply(this.client, reg(this, arguments));
|
||||
};
|
||||
|
||||
_createClass(Message, [{
|
||||
key: "isMentioned",
|
||||
value: function isMentioned(user) {
|
||||
user = this.client.internal.resolver.resolveUser(user);
|
||||
if (user) {
|
||||
return this.mentions.has("id", user.id);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "toString",
|
||||
value: function toString() {
|
||||
return this.content;
|
||||
}
|
||||
}, {
|
||||
key: "delete",
|
||||
value: function _delete() {
|
||||
return this.client.deleteMessage.apply(this.client, reg(this, arguments));
|
||||
}
|
||||
}, {
|
||||
key: "update",
|
||||
value: function update() {
|
||||
return this.client.updateMessage.apply(this.client, reg(this, arguments));
|
||||
}
|
||||
}, {
|
||||
key: "reply",
|
||||
value: function reply() {
|
||||
return this.client.reply.apply(this.client, reg(this, arguments));
|
||||
}
|
||||
}, {
|
||||
key: "replyTTS",
|
||||
value: function replyTTS() {
|
||||
return this.client.replyTTS.apply(this.client, reg(this, arguments));
|
||||
}
|
||||
}, {
|
||||
key: "sender",
|
||||
get: function get() {
|
||||
return this.author;
|
||||
|
||||
Reference in New Issue
Block a user