This commit is contained in:
parent
171cdfc5fe
commit
1069a20093
5
bot.py
5
bot.py
@ -5,6 +5,7 @@ from random import randint
|
|||||||
|
|
||||||
from aiogram import Bot, Dispatcher, executor, types
|
from aiogram import Bot, Dispatcher, executor, types
|
||||||
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
|
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
|
||||||
|
import sql
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -48,8 +49,10 @@ async def dick(message: types.Message):
|
|||||||
async def ident(message: types.Message):
|
async def ident(message: types.Message):
|
||||||
id1 = message.from_user.id
|
id1 = message.from_user.id
|
||||||
fullname1 = message.from_user.full_name
|
fullname1 = message.from_user.full_name
|
||||||
#await sql.add_user()
|
sql.db_start
|
||||||
await bot.send_message(message.chat.id, f'{id1} + {fullname1}')
|
await bot.send_message(message.chat.id, f'{id1} + {fullname1}')
|
||||||
|
sql.add_user
|
||||||
|
sql.close
|
||||||
#await sql.db.close()
|
#await sql.db.close()
|
||||||
|
|
||||||
|
|
||||||
|
10
sql.py
10
sql.py
@ -1,5 +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,12 +10,12 @@ async def db_start(): #подключение к бд
|
|||||||
cur.execute(''''CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, users_id INTEGER, user_name TEXT, dick_size INTEGER)''')
|
cur.execute(''''CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, users_id INTEGER, user_name TEXT, dick_size INTEGER)''')
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
async def add_user(id):
|
async def add_user():
|
||||||
cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?)''',[id, fullname])
|
cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?)''',[id1, fullname1])
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
async def close():
|
||||||
db.commit()
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user