forked from Pavel_Durov/python_bot
тст
This commit is contained in:
parent
7ebca8c370
commit
0b5305c02a
8
bot.py
8
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()
|
||||
|
||||
|
||||
|
||||
|
4
sql.py
4
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()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user