forked from Pavel_Durov/python_bot
зачал бд, удалил лишнее
This commit is contained in:
parent
e7d48632f4
commit
99533b80e6
10
bot.py
10
bot.py
@ -5,9 +5,9 @@ from random import randint
|
||||
|
||||
from aiogram import Bot, Dispatcher, executor, types
|
||||
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
|
||||
#import sql
|
||||
import sql
|
||||
|
||||
#sql.db_start()
|
||||
sql.db_start()
|
||||
|
||||
API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w'
|
||||
|
||||
@ -45,6 +45,12 @@ async def dick(message: types.Message):
|
||||
numb = (f"Рандомное число : {randint(-7,10)}")
|
||||
await bot.send_message(message.chat.id, (numb))
|
||||
|
||||
@dp.message_handler(commands=["id"])
|
||||
async def id(message: types.Message):
|
||||
await sql.db_start()
|
||||
await bot.send_message(message.chat.id, f'ваш id {message.from_user.id}')
|
||||
await sql.db.close()
|
||||
|
||||
|
||||
|
||||
#####______________________ПИПИСА БОТ БУДЕТ ЗДЕСЬ__________________________________
|
||||
|
11
sql.py
11
sql.py
@ -6,14 +6,19 @@ async def db_start(): #подключение к бд
|
||||
db = sq.connect('dickpick.db')
|
||||
cur = db.cursor()
|
||||
|
||||
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()
|
||||
|
||||
async def add_user():
|
||||
cur.execute('INSERT INTO users (users_id, user_name) VALUES (?, ?,)'.format(message.from_user.id, message.from_user.fullname))
|
||||
async def add_user(id):
|
||||
cur.execute('''INSERT INTO users (users_id) VALUES (?)''',(id))
|
||||
id = message.from_user.id
|
||||
db.commit()
|
||||
|
||||
|
||||
db.commit()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user