fix: cannot delete addres when not bind KV (#284)

This commit is contained in:
Dream Hunter
2024-05-29 12:08:56 +08:00
committed by GitHub
parent 1f8edbc295
commit 00abf79417
4 changed files with 5 additions and 3 deletions

View File

@@ -102,6 +102,7 @@ export const unbindTelegramAddress = async (
export const unbindTelegramByAddress = async (
c: Context<HonoCustomType>, address: string
): Promise<boolean> => {
if (!c.env.KV) return true;
const userId = await c.env.KV.get<string>(`${CONSTANTS.TG_KV_PREFIX}:${address}`)
if (userId) {
return await unbindTelegramAddress(c, userId, address);