i=1
for row in cursor.execute("SELECT * FROM users"):
if row['id']==ctx.author.id:
print('Ваш код')
return
else:
i=i+1
commands={
'find':('найди мне', 'поищи', 'покажи'),
'opbrowser':('открой браузер', 'браузер', 'найди в браузере')
}
user_key=input('Введите команду: ')
for command in commands['find']:
if user_key.lower() == command.lower():
print('Ищу!')
for command in commands['opbrowser']:
if user_key.lower() == command.lower():
print('Открываю браузер!')
@bot.message_handler(content_types=['text'])
def chatting(message):
adding_onevsone()
bot.send_message(message.chat.id, text=message.text, reply_markup=throwing_reply)
time.sleep(2)
bot.send_message(message.chat.id, text=message.text, parse_mode='html', reply_markup=types.ReplyKeyboardRemove())
def adding_onevsone():
global throwing_reply
throwing_reply=types.ReplyKeyboardMarkup(resize_keyboard=True)
throwing_reply.add(types.KeyboardButton('message'))
sql.execute("SELECT * FROM table_name ORDER BY index DESC LIMIT 5")
rows = sql.fetchall()
for row in rows:
bot.send_message(id, row)
async def kill(ctx, *member: discord.Member = None):
#Часть кода...
for user in member:
load1=discord.Embed(title="Тебя убили", description = f"{ctx.author.mention} заебашил {user.mention}", color=2358184)
load1.set_author(name = pybot.user.name, icon_url = cap.avatar_url)
load1.set_image(url = "gif")
await ctx.channel.send(embed = load1)
def password_generator(message):
global chars_all
global chars_number
global chars_letters
chars_all = '1234567890qwertyuiopasdfghjklzxcvbnm!@#$%^&*()_+=-/?.,|<>/'
chars_number = '1234567890'
chars_letters = 'qwertyuiopasdfghjklzxcvbnm'
mes='1 - all chars\n2 - only numbers\n3 - only letters'
bot.send_message(message.from_user.id, text=mes)
type_of_choice=bot.send_message(message.from_user.id, "Type:")
bot.register_next_step_handler(type_of_choice, choosing_type)
def choosing_type(message):
#Получаем Type пароля
global type_of_choice
type_of_choice=int(message.text)
num=bot.send_message(message.from_user.id, "Quantity of passwords:")
bot.register_next_step_handler(num, choosing_num)
def choosing_num(message):
#Получаем количество паролей
global num
num = int(message.text)
length=bot.send_message(message.from_user.id, "Length of password:")
bot.register_next_step_handler(length, choosing_length)
def choosing_length(message):
#Получаем длину пароля
global length
length=int(message.text)
password = ''
for i in range (num):
if type_of_choice == 1:
for j in range(length):
password += random.choice(chars_all)
if type_of_choice == 2:
for j in range(length):
password += random.choice(chars_number)
if type_of_choice == 3:
for j in range(length):
password += random.choice(chars_letters)
password=password+'\n'
#Получаем все пароли
return bot.send_message(message.from_user.id, password)
@bot.message_handler(commands = ['start', 'help', 'info', 'time', 'password'])
def get_text_messages(message):
if message.text == "/password":
#Вызываем начало функции, где спрашивается Type
password_generator(message)
@bot.message_handler(content_types=['text'])
def chatting(message):
bot.delete_message(message.chat.id, message.message_id)
@bot.message_handler(content_types=['text'])
def chatting(message):
if message.text=='запрещённое слово':
bot.delete_message(message.chat.id, message.message_id)
db = sqlite3.connect('base.db') # подключаю бд
cur = db.cursor()
def add():
for row in cur.execute('SELECT * FROM users'):
Name = row['Name']
Balance = row['Balance']
WeekSalary = row['WeekSalary']
summa = Balance+WeekSalary
cur.execute("UPDATE users SET Balance = {} WHERE Name = {}".format(summa, Name))
db.commit()