mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
fix(ApplicationCommandManager): update guild command cache on c/u/d (#6841)
This commit is contained in:
@@ -117,7 +117,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
const data = await this.commandPath({ guildId }).post({
|
const data = await this.commandPath({ guildId }).post({
|
||||||
data: this.constructor.transformCommand(command),
|
data: this.constructor.transformCommand(command),
|
||||||
});
|
});
|
||||||
return this._add(data, !guildId, guildId);
|
return this._add(data, true, guildId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,10 +146,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
const data = await this.commandPath({ guildId }).put({
|
const data = await this.commandPath({ guildId }).put({
|
||||||
data: commands.map(c => this.constructor.transformCommand(c)),
|
data: commands.map(c => this.constructor.transformCommand(c)),
|
||||||
});
|
});
|
||||||
return data.reduce(
|
return data.reduce((coll, command) => coll.set(command.id, this._add(command, true, guildId)), new Collection());
|
||||||
(coll, command) => coll.set(command.id, this._add(command, !guildId, guildId)),
|
|
||||||
new Collection(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -174,7 +171,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
const patched = await this.commandPath({ id, guildId }).patch({
|
const patched = await this.commandPath({ id, guildId }).patch({
|
||||||
data: this.constructor.transformCommand(data),
|
data: this.constructor.transformCommand(data),
|
||||||
});
|
});
|
||||||
return this._add(patched, !guildId, guildId);
|
return this._add(patched, true, guildId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -196,7 +193,7 @@ class ApplicationCommandManager extends CachedManager {
|
|||||||
await this.commandPath({ id, guildId }).delete();
|
await this.commandPath({ id, guildId }).delete();
|
||||||
|
|
||||||
const cached = this.cache.get(id);
|
const cached = this.cache.get(id);
|
||||||
if (!guildId) this.cache.delete(id);
|
this.cache.delete(id);
|
||||||
return cached ?? null;
|
return cached ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user