Answer the question
In order to leave comments, you need to log in
How to make a number randomizer in Python for a tg bot and combine it with SQLite3?
I need to make a telegram bot that will give out different numbers (from -15 to 15), and that all this would add up or subtract in a SQLite3 table. Below code:
import telebot
import sqlite3
import random
bot = telebot.TeleBot('5212199420:AAGiCqcLN*********************')
conn = sqlite3.connect('DicksVolues.db', check_same_thread=False)
cursor = conn.cursor()
def db_table_val(user_id: int, user_name: str, user_surname: str, username: str):
cursor.execute('INSERT INTO DicksVolue (user_id, user_name, user_surname, username) VALUES (?, ?, ?, ?)', (user_id, user_name, user_surname, username))
conn.commit()
@bot.message_handler(commands=["start"])
def start(message):
bot.send_message(message.chat.id, text="Привеt! Пройди 2 этапа верификации.\nДля верификации нажми на /winokey")
@bot.message_handler(commands=["winokey"])
def start(message):
bot.send_message(message.chat.id, text="Остался 2-ой этап верификации.\nДля окончания верификации нажми на /opiut")
@bot.message_handler(commands=["opiut"])
def send_message(message):
bot.reply_to(message, text="Вы прошли верификацию!")
@bot.message_handler(commands=["negr"])
def start(message):
bot.send_message(message.chat.id, "Твой жезл стал ")
us_id = message.from_user.id
us_name = message.from_user.first_name
us_surname = message.from_user.last_name
username = message.from_user.username
volue = message.
db_table_val(user_id=us_id, user_name=us_name, user_surname=us_surname, username=username)
conn.commit()
bot.polling(none_stop=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question