forked from Pavel_Durov/python_bot
тст
This commit is contained in:
parent
7ebca8c370
commit
0b5305c02a
4
bot.py
4
bot.py
@ -46,8 +46,10 @@ async def dick(message: types.Message):
|
|||||||
|
|
||||||
@dp.message_handler(commands=["id"])
|
@dp.message_handler(commands=["id"])
|
||||||
async def ident(message: types.Message):
|
async def ident(message: types.Message):
|
||||||
|
id = message.from_user.id
|
||||||
|
fullname = message.from_user.fullname
|
||||||
#await sql.add_user()
|
#await sql.add_user()
|
||||||
await bot.send_message(message.chat.id, f'{message.from_user.id}')
|
await bot.send_message(message.chat.id, f'{id} {fullname}')
|
||||||
#await sql.db.close()
|
#await sql.db.close()
|
||||||
|
|
||||||
|
|
||||||
|
4
sql.py
4
sql.py
@ -1,4 +1,5 @@
|
|||||||
import sqlite3 as sq
|
import sqlite3 as sq
|
||||||
|
import aiogram
|
||||||
|
|
||||||
async def db_start(): #подключение к бд
|
async def db_start(): #подключение к бд
|
||||||
global db, cur
|
global db, cur
|
||||||
@ -10,8 +11,7 @@ async def db_start(): #подключение к бд
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
async def add_user(id):
|
async def add_user(id):
|
||||||
cur.execute('''INSERT INTO users (users_id) VALUES (?)''',(id))
|
cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?)''',[id, fullname])
|
||||||
id = message.from_user.id
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user