fix member functions (PROBABLY INCOMPLETE)
This commit is contained in:
parent
ca2a00b65c
commit
4fa6571845
1 changed files with 7 additions and 7 deletions
|
@ -51,8 +51,8 @@ class Redis {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
async getMember (id) {
|
async getMember (guild, user) {
|
||||||
let result = await this.member.hgetallAsync(id);
|
let result = await this.member.hgetallAsync(guild + '-' + user);
|
||||||
let defaults = this.client.config.defaultMemberData;
|
let defaults = this.client.config.defaultMemberData;
|
||||||
|
|
||||||
if (result === null) return defaults;
|
if (result === null) return defaults;
|
||||||
|
@ -90,8 +90,8 @@ class Redis {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
async getMemberKey (id, key) {
|
async getMemberKey (guild, user, key) {
|
||||||
let result = await this.member.hgetAsync(id, key);
|
let result = await this.member.hgetAsync(guild + '-' + user, key);
|
||||||
|
|
||||||
if(result === null) result = this.client.config.defaultMemberData[key];
|
if(result === null) result = this.client.config.defaultMemberData[key];
|
||||||
|
|
||||||
|
@ -120,15 +120,15 @@ class Redis {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
async setMemberKey (id, key, newValue) {
|
async setMemberKey (guild, user, key, newValue) {
|
||||||
const def = this.client.config.defaultMemberData[key];
|
const def = this.client.config.defaultMemberData[key];
|
||||||
|
|
||||||
if (!def) return;
|
if (!def) return;
|
||||||
|
|
||||||
if(def === newValue) {
|
if(def === newValue) {
|
||||||
await this.member.hdel(id, key);
|
await this.member.hdel(guild + '-' + user, key);
|
||||||
} else {
|
} else {
|
||||||
await this.member.hsetAsync(id, key, newValue);
|
await this.member.hsetAsync(guild + '-' + user, key, newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue