From 98aa7646b615e929cd582e1e5621c6202fc0ff89 Mon Sep 17 00:00:00 2001 From: skinmaker1345 Date: Wed, 29 Jan 2025 23:22:28 +0700 Subject: [PATCH] fix: do not set state deleted if api is unreachable --- utils/Query.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/Query.ts b/utils/Query.ts index eda62b3..83b3bf2 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -76,7 +76,10 @@ async function getBot(id: string, topLevel = true): Promise { if (res) { const discordBot = await get.discord.user.load(res.id) - if (!discordBot || Number(discordBot.discriminator) === 0) { + if(!discordBot) { + return null + } + if (Number(discordBot.discriminator) === 0) { knex('bots') .update({ state: 'deleted' }) .where({ id })