From 0b5305c02a168ff8cd6e7f00827b383676f7e9f7 Mon Sep 17 00:00:00 2001 From: Pavel_Duron Date: Mon, 7 Nov 2022 19:43:54 +1000 Subject: [PATCH] =?UTF-8?q?=D1=82=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 8 +++++--- sql.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index be0328a..ef58f05 100644 --- a/bot.py +++ b/bot.py @@ -46,9 +46,11 @@ async def dick(message: types.Message): @dp.message_handler(commands=["id"]) async def ident(message: types.Message): - #await sql.add_user() - await bot.send_message(message.chat.id, f'{message.from_user.id}') - #await sql.db.close() + id = message.from_user.id + fullname = message.from_user.fullname + #await sql.add_user() + await bot.send_message(message.chat.id, f'{id} {fullname}') + #await sql.db.close() diff --git a/sql.py b/sql.py index 07cf8ce..35d59dd 100644 --- a/sql.py +++ b/sql.py @@ -1,4 +1,5 @@ import sqlite3 as sq +import aiogram async def db_start(): #подключение к бд global db, cur @@ -10,8 +11,7 @@ async def db_start(): #подключение к бд db.commit() async def add_user(id): - cur.execute('''INSERT INTO users (users_id) VALUES (?)''',(id)) - id = message.from_user.id + cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?)''',[id, fullname]) db.commit()