telegram: базовая регистрация

This commit is contained in:
2022-11-18 01:07:13 +03:00
parent e6f30ce953
commit a6fba9e3a0
4 changed files with 34 additions and 6 deletions

View File

@@ -2,17 +2,27 @@ import json
from aiogram import Bot, Dispatcher, executor
with open("telegram/config.json") as config_file:
from common import backend
with open("textsouls/config.json") as config_file:
config_data = json.load(config_file)
API_TOKEN = config_data["main_settings"]["BOT_TOKEN"]
API_TOKEN = config_data["main_settings"]["bot_token"]
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=["start", "help"])
async def send_welcome(message):
@dp.message_handler(commands=["start"])
async def start(message):
tg_user = message.from_user
ts_user = {
"tg_id": tg_user.id,
"first_name": tg_user.first_name,
"last_name": tg_user.last_name,
"username": tg_user.username,
}
backend.post("/registration", ts_user)
await message.reply("Nice!")