mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
fix: do not cache webhook users (#2611)
Goal in mind is to not save the name and avatar used by webhooks because those can change between messages without any other update.
This commit is contained in:
parent
bd3d8d48c0
commit
8a3ae875bb
2 changed files with 3 additions and 3 deletions
|
|
@ -39,10 +39,10 @@ class ClientDataManager {
|
|||
return guild;
|
||||
}
|
||||
|
||||
newUser(data) {
|
||||
newUser(data, cache = true) {
|
||||
if (this.client.users.has(data.id)) return this.client.users.get(data.id);
|
||||
const user = new User(this.client, data);
|
||||
this.client.users.set(user.id, user);
|
||||
if (cache) this.client.users.set(user.id, user);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class Message {
|
|||
* The author of the message
|
||||
* @type {User}
|
||||
*/
|
||||
this.author = this.client.dataManager.newUser(data.author);
|
||||
this.author = this.client.dataManager.newUser(data.author, !data.webhook_id);
|
||||
|
||||
/**
|
||||
* Represents the author of the message as a guild member
|
||||
|
|
|
|||
Loading…
Reference in a new issue