mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 19:20:42 +00:00
fixed references to update items
This commit is contained in:
parent
21be3d3c77
commit
2000b62b36
6 changed files with 19 additions and 2 deletions
|
|
@ -20,6 +20,8 @@ The Client_ that created the user.
|
||||||
username
|
username
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
|
_Alias_ : ``name``
|
||||||
|
|
||||||
`String`, username of the User.
|
`String`, username of the User.
|
||||||
|
|
||||||
discriminator
|
discriminator
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,11 @@ var User = (function (_Equality) {
|
||||||
return _Constants.Endpoints.AVATAR(this.id, this.avatar);
|
return _Constants.Endpoints.AVATAR(this.id, this.avatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: "name",
|
||||||
|
get: function get() {
|
||||||
|
return this.username;
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
return User;
|
return User;
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,10 @@ var Cache = (function (_Array) {
|
||||||
|
|
||||||
Cache.prototype.update = function update(old, data) {
|
Cache.prototype.update = function update(old, data) {
|
||||||
var item = this.get(this[discrimS], old[this[discrimS]]);
|
var item = this.get(this[discrimS], old[this[discrimS]]);
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
var index = this.indexOf(item);
|
var index = this.indexOf(item);
|
||||||
this[index] = data;
|
Object.assign(this[index], data);
|
||||||
this[discrimCacheS][data[this[discrimS]]] = this[index];
|
this[discrimCacheS][data[this[discrimS]]] = this[index];
|
||||||
return this[index];
|
return this[index];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ export default class User extends Equality{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get name() {
|
||||||
|
return this.username;
|
||||||
|
}
|
||||||
|
|
||||||
mention(){
|
mention(){
|
||||||
return `<@${this.id}>`;
|
return `<@${this.id}>`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,10 @@ export default class Cache extends Array {
|
||||||
|
|
||||||
update(old, data) {
|
update(old, data) {
|
||||||
var item = this.get(this[discrimS], old[this[discrimS]]);
|
var item = this.get(this[discrimS], old[this[discrimS]]);
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
var index = this.indexOf(item);
|
var index = this.indexOf(item);
|
||||||
this[index] = data;
|
Object.assign(this[index], data);
|
||||||
this[discrimCacheS][data[this[discrimS]]] = this[index];
|
this[discrimCacheS][data[this[discrimS]]] = this[index];
|
||||||
return this[index];
|
return this[index];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,10 @@ client.on("message", msg => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg.content === "what is my name") {
|
||||||
|
msg.reply(msg.channel.server.members.get("id", msg.sender.id));
|
||||||
|
}
|
||||||
|
|
||||||
if(msg.content === "replyme"){
|
if(msg.content === "replyme"){
|
||||||
msg.reply("hi");
|
msg.reply("hi");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue