From 76cb99287f24392a70766e81fc1b521616502db1 Mon Sep 17 00:00:00 2001 From: Superchupu Date: Tue, 12 Oct 2021 18:25:03 +0100 Subject: [PATCH] fix(logs): don't set to 2 when the count is not set --- detector/counter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detector/counter.js b/detector/counter.js index 10c74d6..f341288 100644 --- a/detector/counter.js +++ b/detector/counter.js @@ -6,10 +6,10 @@ module.exports = async (client, guildId, userId) => { // Update user count const userData = client.db.prepare('SELECT count FROM users WHERE id = ?').get(userId); const userStatement = userData ? 'UPDATE users SET count = @count WHERE id = @id' : 'INSERT INTO users (id, count) VALUES (@id, @count)'; - client.db.prepare(userStatement).run({ id: userId, count: (userData?.count ?? 1) + 1 }); + client.db.prepare(userStatement).run({ id: userId, count: (userData?.count ?? 0) + 1 }); // Update guild count const guildData = client.db.prepare('SELECT count FROM guilds WHERE id = ?').get(guildId); const guildStatement = guildData ? 'UPDATE guilds SET count = @count WHERE id = @id' : 'INSERT INTO guilds (id, count) VALUES (@id, @count)'; - client.db.prepare(guildStatement).run({ id: guildId, count: (guildData?.count ?? 1) + 1 }); + client.db.prepare(guildStatement).run({ id: guildId, count: (guildData?.count ?? 0) + 1 }); };