mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Always fire messageUpdated, reset on login (#294,#295)
This commit is contained in:
@@ -213,8 +213,10 @@ var InternalClient = (function () {
|
||||
this.messageAwaits = {};
|
||||
this.retryAfters = {};
|
||||
|
||||
this.tokenCacher = new _UtilTokenCacher2["default"](this.client);
|
||||
this.tokenCacher.init(0);
|
||||
if (!this.tokenCacher) {
|
||||
this.tokenCacher = new _UtilTokenCacher2["default"](this.client);
|
||||
this.tokenCacher.init(0);
|
||||
}
|
||||
};
|
||||
|
||||
InternalClient.prototype.cleanIntervals = function cleanIntervals() {
|
||||
@@ -255,7 +257,6 @@ var InternalClient = (function () {
|
||||
if (!_this2.email && !_this2.token) {
|
||||
return;
|
||||
}
|
||||
_this2.setup();
|
||||
|
||||
// Check whether the email is set (if not, only a token has been used for login)
|
||||
_this2.loginWithToken(_this2.token, _this2.email, _this2.password)["catch"](function () {
|
||||
@@ -588,6 +589,8 @@ var InternalClient = (function () {
|
||||
InternalClient.prototype.loginWithToken = function loginWithToken(token, email, password) {
|
||||
var _this10 = this;
|
||||
|
||||
this.setup();
|
||||
|
||||
this.state = _ConnectionState2["default"].LOGGED_IN;
|
||||
this.token = token;
|
||||
this.email = email;
|
||||
@@ -1819,8 +1822,11 @@ var InternalClient = (function () {
|
||||
data.content = data.content || msg.content;
|
||||
data.mentions = data.mentions || msg.mentions;
|
||||
data.author = data.author || msg.author;
|
||||
var nmsg = new _StructuresMessage2["default"](data, channel, client);
|
||||
client.emit("messageUpdated", new _StructuresMessage2["default"](msg, channel, client), nmsg);
|
||||
msg = new _StructuresMessage2["default"](msg, channel, client);
|
||||
}
|
||||
var nmsg = new _StructuresMessage2["default"](data, channel, client);
|
||||
client.emit("messageUpdated", msg, nmsg);
|
||||
if (msg) {
|
||||
channel.messages.update(msg, nmsg);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -133,10 +133,8 @@ var Server = (function (_Equality) {
|
||||
var presence = _ref;
|
||||
|
||||
var user = client.internal.users.get("id", presence.user.id);
|
||||
if (user) {
|
||||
user.status = presence.status;
|
||||
user.game = presence.game;
|
||||
}
|
||||
user.status = presence.status;
|
||||
user.game = presence.game;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user