Fixed databasenot properly caching disabled channels

This commit is contained in:
Essem 2021-07-01 08:01:00 -05:00
parent b24e99d8e8
commit 714e4a451c
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C

View file

@ -38,14 +38,14 @@ exports.toggleTags = async (guild) => {
exports.disableChannel = async (channel) => {
const guildDB = await this.getGuild(channel.guild.id);
await connection.query("UPDATE guilds SET disabled = $1 WHERE guild_id = $2", [[...guildDB.disabled, channel.id], channel.guild.id]);
collections.disabledCache.set(channel.guild.id, guildDB.disabled);
collections.disabledCache.set(channel.guild.id, [...guildDB.disabled, channel.id]);
};
exports.enableChannel = async (channel) => {
const guildDB = await this.getGuild(channel.guild.id);
const newDisabled = guildDB.disabled.filter(item => item !== channel.id);
await connection.query("UPDATE guilds SET disabled = $1 WHERE guild_id = $2", [newDisabled, channel.guild.id]);
collections.disabledCache.set(channel.guild.id, guildDB.disabled);
collections.disabledCache.set(channel.guild.id, newDisabled);
};
exports.getCounts = async () => {