|
|
@ -50,7 +50,8 @@ def start(message):
|
|
|
|
def reg(message):
|
|
|
|
def reg(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
if len(message.text.split()) == 2:
|
|
|
|
if not ok_args(bot, message, 2, '```\n/reg никнейм```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
nick = message.text.split()[1]
|
|
|
|
nick = message.text.split()[1]
|
|
|
|
# Проверка ника
|
|
|
|
# Проверка ника
|
|
|
|
if not nick_ok(bot, message, nick):
|
|
|
|
if not nick_ok(bot, message, nick):
|
|
|
@ -66,15 +67,14 @@ def reg(message):
|
|
|
|
|
|
|
|
|
|
|
|
save(db)
|
|
|
|
save(db)
|
|
|
|
bot.reply_to(message, "Вы зарегистрировались!\nПриятного использования.")
|
|
|
|
bot.reply_to(message, "Вы зарегистрировались!\nПриятного использования.")
|
|
|
|
else:
|
|
|
|
|
|
|
|
bot.reply_to(message, "Вы ввели не 2 аргумента, нужно: /reg ЛюбойНикнейм")
|
|
|
|
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
catch_error(bot, message)
|
|
|
|
catch_error(bot, message)
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['b'])
|
|
|
|
@bot.message_handler(commands=['b'])
|
|
|
|
def b(message):
|
|
|
|
def b(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if is_auth(bot, message):
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 2, '```\n/b :ник``` или ```\n/b ник```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
nick = db[str(message.chat.id)]
|
|
|
|
nick = db[str(message.chat.id)]
|
|
|
|
user = db[nick]
|
|
|
|
user = db[nick]
|
|
|
@ -97,7 +97,8 @@ def b(message):
|
|
|
|
@bot.message_handler(commands=['u'])
|
|
|
|
@bot.message_handler(commands=['u'])
|
|
|
|
def u(message):
|
|
|
|
def u(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if is_auth(bot, message):
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 2, '```\n/u :ник``` или ```\n/u ник```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
nick = db[str(message.chat.id)]
|
|
|
|
nick = db[str(message.chat.id)]
|
|
|
|
user = db[nick]
|
|
|
|
user = db[nick]
|
|
|
@ -107,21 +108,24 @@ def u(message):
|
|
|
|
if block[0] == ":":
|
|
|
|
if block[0] == ":":
|
|
|
|
block = block[1:]
|
|
|
|
block = block[1:]
|
|
|
|
|
|
|
|
|
|
|
|
if db[block].id in user.blocks:
|
|
|
|
if block in db and db[block].id in user.blocks:
|
|
|
|
user.blocks.remove(db[block].id)
|
|
|
|
user.blocks.remove(db[block].id)
|
|
|
|
save(db)
|
|
|
|
save(db)
|
|
|
|
bot.reply_to(message, f"Была снята блокировка с пользователя {telebot.formatting.hcode(block)}",parse_mode="HTML")
|
|
|
|
bot.reply_to(message, f"Была снята блокировка с пользователя {telebot.formatting.hcode(block)}",parse_mode="HTML")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
bot.reply_to(message, "Данного пользователя не существует.")
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
catch_error(bot, message)
|
|
|
|
catch_error(bot, message)
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['nick'])
|
|
|
|
@bot.message_handler(commands=['nick'])
|
|
|
|
def nick(message):
|
|
|
|
def nick(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if is_auth(bot, message):
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 2, '```\n/nick ник```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
new_nick = message.text.split()[1]
|
|
|
|
new_nick = message.text.split()[1]
|
|
|
|
# Проверка ника
|
|
|
|
# Проверка ника
|
|
|
|
if not nick_ok(message, new_nick):
|
|
|
|
if not nick_ok(bot, message, new_nick):
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
old_nick = db[str(message.chat.id)]
|
|
|
|
old_nick = db[str(message.chat.id)]
|
|
|
|
|
|
|
|
|
|
|
@ -142,7 +146,8 @@ def nick(message):
|
|
|
|
@bot.message_handler(commands=['av'])
|
|
|
|
@bot.message_handler(commands=['av'])
|
|
|
|
def av(message):
|
|
|
|
def av(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if is_auth(bot, message):
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 2, '```\n/av ❄️```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
if not len(message.text.split()) > 1:
|
|
|
|
if not len(message.text.split()) > 1:
|
|
|
|
bot.reply_to(message,"Укажите аватарку")
|
|
|
|
bot.reply_to(message,"Укажите аватарку")
|
|
|
@ -163,22 +168,22 @@ def av(message):
|
|
|
|
@bot.message_handler(commands=['key'])
|
|
|
|
@bot.message_handler(commands=['key'])
|
|
|
|
def key(message):
|
|
|
|
def key(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if len(message.text.split()) == 2:
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 2, '```\n/key ник``` или ```\n/key :ник```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
nick = message.text.split()[1]
|
|
|
|
nick = message.text.split()[1]
|
|
|
|
if nick[0] == ':':
|
|
|
|
if nick[0] == ':':
|
|
|
|
nick = nick[1:]
|
|
|
|
nick = nick[1:]
|
|
|
|
key = db[nick].pkey
|
|
|
|
key = db[nick].pkey
|
|
|
|
bot.reply_to(message,f"Ключ пользователя: {telebot.formatting.hcode(key)}", parse_mode="HTML")
|
|
|
|
bot.reply_to(message,f"Ключ пользователя: {telebot.formatting.hcode(key)}", parse_mode="HTML")
|
|
|
|
else:
|
|
|
|
|
|
|
|
bot.reply_to(message,"/key ник")
|
|
|
|
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
catch_error(bot, message)
|
|
|
|
catch_error(bot, message)
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['ver'])
|
|
|
|
@bot.message_handler(commands=['ver'])
|
|
|
|
def ver(message):
|
|
|
|
def ver(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if len(message.text.split()) == 3:
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 3, '```\n/ver ник ключ``` или ```\n/ver :ник ключ```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
nick = message.text.split()[1]
|
|
|
|
nick = message.text.split()[1]
|
|
|
|
if nick[0] == ':':
|
|
|
|
if nick[0] == ':':
|
|
|
@ -192,15 +197,14 @@ def ver(message):
|
|
|
|
bot.reply_to(message,"✅ Ключи совпадают")
|
|
|
|
bot.reply_to(message,"✅ Ключи совпадают")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
bot.reply_to(message,"❌ Ключи не совпадают")
|
|
|
|
bot.reply_to(message,"❌ Ключи не совпадают")
|
|
|
|
else:
|
|
|
|
|
|
|
|
bot.reply_to(message,"/ver ник ключ")
|
|
|
|
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
catch_error(bot, message)
|
|
|
|
catch_error(bot, message)
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['key_res'])
|
|
|
|
@bot.message_handler(commands=['key_res'])
|
|
|
|
def key_res(message):
|
|
|
|
def key_res(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if is_auth(bot, message):
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 1, '```\n/key_res```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
|
|
|
|
|
|
|
|
key = hash(randint(74287, 5747962))
|
|
|
|
key = hash(randint(74287, 5747962))
|
|
|
@ -223,7 +227,8 @@ def key_res(message):
|
|
|
|
@bot.message_handler(commands=['me'])
|
|
|
|
@bot.message_handler(commands=['me'])
|
|
|
|
def me(message):
|
|
|
|
def me(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if is_auth(bot, message):
|
|
|
|
if not is_auth(bot, message) or not ok_args(bot, message, 1, '```\n/me```'):
|
|
|
|
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
db = load()
|
|
|
|
nick = db[str(message.chat.id)]
|
|
|
|
nick = db[str(message.chat.id)]
|
|
|
|
user = db[nick]
|
|
|
|
user = db[nick]
|
|
|
@ -263,10 +268,14 @@ def catch_all_messages(message):
|
|
|
|
bot.reply_to(message, "Не существует данного пользователя.")
|
|
|
|
bot.reply_to(message, "Не существует данного пользователя.")
|
|
|
|
elif user.channel != None:
|
|
|
|
elif user.channel != None:
|
|
|
|
channel = user.channel
|
|
|
|
channel = user.channel
|
|
|
|
|
|
|
|
db = load()
|
|
|
|
|
|
|
|
# Проверяем существование пользователя
|
|
|
|
|
|
|
|
if channel not in db:
|
|
|
|
|
|
|
|
bot.reply_to(message, "Не существует данного пользователя.")
|
|
|
|
|
|
|
|
return 0
|
|
|
|
# Проверяем ключи
|
|
|
|
# Проверяем ключи
|
|
|
|
if not key_valid(bot, message, channel):
|
|
|
|
if not key_valid(bot, message, channel):
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
db = load()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if message.chat.id not in db[channel].blocks:
|
|
|
|
if message.chat.id not in db[channel].blocks:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -299,7 +308,10 @@ def catch_all_messages(message):
|
|
|
|
caption = ""
|
|
|
|
caption = ""
|
|
|
|
bot.send_video(db[channel].id, vid_id, caption = f"{telebot.formatting.hcode(':'+nick) + avatar}", parse_mode="HTML")
|
|
|
|
bot.send_video(db[channel].id, vid_id, caption = f"{telebot.formatting.hcode(':'+nick) + avatar}", parse_mode="HTML")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
try:
|
|
|
|
bot.send_message(db[channel].id, f"{telebot.formatting.hcode(':'+nick) + avatar}\n" + message.text, parse_mode="HTML")
|
|
|
|
bot.send_message(db[channel].id, f"{telebot.formatting.hcode(':'+nick) + avatar}\n" + message.text, parse_mode="HTML")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
catch_error(bot, message, 'spec_symb')
|
|
|
|
|
|
|
|
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
catch_error(bot, message)
|
|
|
|
catch_error(bot, message)
|
|
|
|