fix: telegram bot/miniapp bugs (#259)

This commit is contained in:
Dream Hunter
2024-05-21 13:32:47 +08:00
committed by GitHub
parent 96ea81e055
commit 2533257b68
+1 -3
View File
@@ -46,11 +46,9 @@ export function newTelegramBot(c: Context<HonoCustomType>, token: string): Teleg
const bot = new Telegraf(token); const bot = new Telegraf(token);
bot.use(async (ctx, next) => { bot.use(async (ctx, next) => {
// skip non-message
if (ctx.updateType != "message") return;
// check if in private chat // check if in private chat
if (ctx.chat?.type !== "private") { if (ctx.chat?.type !== "private") {
return await ctx.reply("请在私聊中使用"); return;
} }
const userId = ctx?.message?.from?.id || ctx.callbackQuery?.message?.chat?.id; const userId = ctx?.message?.from?.id || ctx.callbackQuery?.message?.chat?.id;