dont double save guild related cache
This commit is contained in:
parent
950243af5c
commit
361baa39eb
1 changed files with 11 additions and 1 deletions
|
@ -30,7 +30,7 @@ export class GuildManager extends BaseManager<GuildPayload, Guild> {
|
||||||
this.client.rest
|
this.client.rest
|
||||||
.get(GUILD(id))
|
.get(GUILD(id))
|
||||||
.then(async (data: any) => {
|
.then(async (data: any) => {
|
||||||
this.set(id, data)
|
await this.set(id, data)
|
||||||
|
|
||||||
const guild = new Guild(this.client, data)
|
const guild = new Guild(this.client, data)
|
||||||
|
|
||||||
|
@ -145,6 +145,16 @@ export class GuildManager extends BaseManager<GuildPayload, Guild> {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sets a value to Cache */
|
||||||
|
async set(key: string, value: GuildPayload): Promise<any> {
|
||||||
|
if ('roles' in value) value.roles = []
|
||||||
|
if ('emojis' in value) value.emojis = []
|
||||||
|
if ('members' in value) value.members = []
|
||||||
|
if ('presences' in value) value.presences = []
|
||||||
|
if ('voice_states' in value) value.voice_states = []
|
||||||
|
return this.client.cache.set(this.cacheName, key, value)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits a guild. Returns edited guild.
|
* Edits a guild. Returns edited guild.
|
||||||
* @param guild Guild or guild id
|
* @param guild Guild or guild id
|
||||||
|
|
Loading…
Reference in a new issue