зачал бд, удалил лишнее
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
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,11 +6,15 @@ 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()
|
||||
|
||||
|
||||
@ -19,3 +23,4 @@ async def add_user():
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user