user_id = 123
get_id_from_db = 6
user_data = {user_id: {'city':'', 'fio':'', 'phone':'', 'inn':'', 'address':'', 'napravlenie':'', 'id': get_id_from_db}}
print(user_data)
user_data[user_id]['city'] = 'Павлодар'
print(user_data)
user_data[user_id]['fio'] = 'Иванов а м'
print(user_data)
user_data[user_id]['phone'] = '77777777'
print(user_data)
user_data[user_id]['inn'] = '4679085467'
print(user_data)
user_data[user_id]['address'] = 'Петрова 65 кв 98'
print(user_data)
user_data[user_id]['napravlenie'] = 'сайт-визитка'
print(user_data)
from time import sleep
def check_email():
while True:
mails = loop()
if mails:
for mail in mails:
bot.send_message(admin_id, mail)
sleep(60)
from threading import Thread
Thread(target=check_email, args=()).start()
colour
The colour code of the embed. Aliased to color as well. This can be set during initialisation.
Type
Union[Colour, int]
embed=discord.Embed(description="Показывает информацию об игроке", color=int(tsvet, 16))
with sqlite3.connect('my.db') as connection:
cursor = connection.cursor()
cursor.execute(cmd)
def is_user_warned(user_id: int) -> bool:
if not is_user_warned(event.obj.reply_message['from_id']):
def post_sql_query(sql_query):
with sqlite3.connect('my.db') as connection:
cursor = connection.cursor()
try:
cursor.execute(sql_query)
except Error:
pass
result = cursor.fetchall()
return result
def is_user_warned(user_id: int):
cmd = "select count(user_id) from warnlist where user_id = %d" % (user_id)
result = post_sql_query(cmd)
return result
if not is_user_warned(event.obj.reply_message['from_id']):
print('добавить')
else:
print('+ 1/3 варн')
def post_sql_query(sql_query):
with sqlite3.connect(database) as connection:
cursor = connection.cursor()
try:
cursor.execute(sql_query)
except Error:
print(Error)
result = cursor.fetchall()
return result
def delete_user(user_id):
del_user_query = f'DELETE FROM users WHERE user_id = {user_id};'
post_sql_query(del_user_query)
try:
bot.send_message(user_id, text)
except telebot.apihelper.ApiException:
delete_user(user_id)