Перевести проект на Telegram Business (без хранения сессии)
Смена архитектуры с MTProto-юзербота (GramJS + строка сессии) на официальное бизнес-подключение Telegram (Bot API). Проект больше НЕ хранит сессию — работает только через бота с включённым Business Mode, подключённого в Настройках → Telegram для бизнеса → Чат-боты. Это соответствует ToS. Изменения: - удалено: scripts/login.js, src/userbot/client.js, модуль onetime - src/userbot/ → src/business/: events.js подписывает business_message / edited / deleted / connection и нормализует сообщение; context.js даёт ctx.api = bot.api - core/media.js: скачивание через getFile + fetch вместо GramJS - core/db.js: составной ключ PRIMARY KEY (chat_id, msg_id) — в Bot API message_id уникален только внутри чата - bot/panel.js: барьер владельца пропускает бизнес-апдейты (у них ctx.from это собеседник); убран UI одноразовых - index.js: сборка только на grammY, явный allowed_updates с бизнес-типами - config.js: убраны API_ID/API_HASH/SESSION, проверки на старте почищены - package.json: убраны зависимости telegram и input, скрипт login - README и .env.example переписаны под бизнес-подключение Границы: onetime невозможен через Business API (сервер отбрасывает self-destruct до доставки боту), медиа >~20 МБ не выгружаются (лимит getFile), перехват — только личные 1-на-1 чаты. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,26 @@
|
||||
"Bash(gh api *)",
|
||||
"Bash(cd /tmp)",
|
||||
"Bash(curl -sL \"https://raw.githubusercontent.com/tdlib/telegram-bot-api/master/telegram-bot-api/Client.cpp\" -o client.cpp)",
|
||||
"Bash(awk 'NR<=18629 && /^[a-zA-Z].*Client::.*\\\\\\(/ {line=NR; text=$0} END{print line\": \"text}' client.cpp)"
|
||||
"Bash(awk 'NR<=18629 && /^[a-zA-Z].*Client::.*\\\\\\(/ {line=NR; text=$0} END{print line\": \"text}' client.cpp)",
|
||||
"Bash(awk 'NR<=19167 && /^\\(void|bool|td|const|int|auto\\).*Client::.*\\\\\\(/ {line=NR; text=$0} END{print line\": \"text}' client.cpp)",
|
||||
"Bash(awk 'NR<=19212 && /^\\(void|bool|td|const|int|auto\\).*Client::.*\\\\\\(/ {line=NR; text=$0} END{print line\": \"text}' client.cpp)",
|
||||
"Bash(git add *)",
|
||||
"WebFetch(domain:docs.python-telegram-bot.org)",
|
||||
"Bash(curl -s \"https://core.telegram.org/bots/api-changelog\" -o /tmp/changelog.html)",
|
||||
"Read(//tmp/**)",
|
||||
"Bash(curl -s \"https://core.telegram.org/bots/api\" -o /tmp/api.html)",
|
||||
"Bash(python -c ' *)",
|
||||
"Bash(curl -s \"https://core.telegram.org/bots/api\" -o api.html)",
|
||||
"Bash(curl -s \"https://core.telegram.org/bots/api-changelog\" -o changelog.html)",
|
||||
"Bash(git rm *)",
|
||||
"Bash(git mv *)",
|
||||
"Bash(mkdir -p src/business)",
|
||||
"Bash(rm -f api.html changelog.html)",
|
||||
"Bash(rmdir src/userbot)",
|
||||
"Bash(npm install *)",
|
||||
"Bash(node _offline_test.mjs)",
|
||||
"Bash(rm -f _offline_test.mjs)",
|
||||
"Bash(rm -rf data)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user