feat: 텔레그램 미니앱 연동

- sendMessageWithKeyboard 함수 추가
- /start 명령어에 미니앱 버튼 추가
- 메뉴 버튼으로 서비스 페이지 열기 지원

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-14 13:57:21 +09:00
parent 4477551ae2
commit 72b0ae0133
2 changed files with 58 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
import { Env, TelegramUpdate } from './types';
import { validateWebhookRequest, checkRateLimit } from './security';
import { sendMessage, setWebhook, getWebhookInfo, sendChatAction } from './telegram';
import { sendMessage, sendMessageWithKeyboard, setWebhook, getWebhookInfo, sendChatAction } from './telegram';
import {
addToBuffer,
processAndSummarize,
@@ -76,6 +76,15 @@ async function handleMessage(
const [command, ...argParts] = text.split(' ');
const args = argParts.join(' ');
responseText = await handleCommand(env, userId, chatIdStr, command, args);
// /start 명령어는 미니앱 버튼과 함께 전송
if (command === '/start') {
await sendMessageWithKeyboard(env.BOT_TOKEN, chatId, responseText, [
[{ text: '🌐 서비스 보기', web_app: { url: 'https://anvil-hosting.pages.dev' } }],
[{ text: '💬 문의하기', url: 'https://t.me/AnvilForgeBot' }],
]);
return;
}
} else {
// 타이핑 표시
await sendChatAction(env.BOT_TOKEN, chatId, 'typing');