This commit is contained in:
Pavel_Duron 2022-11-07 00:52:46 +10:00
parent 0f4b4caed0
commit e7d48632f4
3 changed files with 7 additions and 7 deletions

4
bot.py
View File

@ -2,10 +2,12 @@ from cgitb import text
import datetime import datetime
import logging import logging
from random import randint from random import randint
import sqlite3
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
#sql.db_start()
API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w' API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w'

Binary file not shown.

10
sql.py
View File

@ -1,19 +1,16 @@
import sqlite3 as sq import sqlite3 as sq
async def db_start(): async def db_start(): #подключение к бд
global db, cur global db, cur
db = sq.connect('dickpick.db') db = sq.connect('dickpick.db')
cur = db.cursor() cur = db.cursor()
cur.execute('CREATE TABLE IF NOT EXISTS users(users_id TEXT PRIMARY KEY, user_name TEXT, dick_size INT)') 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(): async def add_user():
user_id = message.from_user.id cur.execute('INSERT INTO users (users_id, user_name) VALUES (?, ?,)'.format(message.from_user.id, message.from_user.fullname))
cur.execute('INSERT INTO users VALUES(users_id, ?, ?)')
user_name = message.from_user.full_name
cur.execute('INSERT INTO users VALUES(?, user_name, ?)')
db.commit() db.commit()
@ -21,3 +18,4 @@ async def add_user():