|
|
@ -97,23 +97,34 @@ def is_anon(message):
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
def get_target(message):
|
|
|
|
def get_target(message):
|
|
|
|
try:
|
|
|
|
# try:
|
|
|
|
|
|
|
|
if True:
|
|
|
|
|
|
|
|
global users
|
|
|
|
if len(message.text.split()) > 1 and message.text.split()[1][0] == "@":
|
|
|
|
if len(message.text.split()) > 1 and message.text.split()[1][0] == "@":
|
|
|
|
username = message.text.split()[1][1:]
|
|
|
|
username = message.text.split()[1][1:]
|
|
|
|
global users
|
|
|
|
|
|
|
|
read_users()
|
|
|
|
read_users()
|
|
|
|
if sha(username) in users:
|
|
|
|
if sha(username) in users:
|
|
|
|
return users[sha(username)]
|
|
|
|
return users[sha(username)]
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
print(1)
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
elif len(message.text.split()) > 1 and message.text.split()[2][0] == "@":
|
|
|
|
|
|
|
|
username = message.text.split()[2][1:]
|
|
|
|
|
|
|
|
read_users()
|
|
|
|
|
|
|
|
if sha(username) in users:
|
|
|
|
|
|
|
|
return users[sha(username)]
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print(2)
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
target = message.reply_to_message.from_user.id
|
|
|
|
target = message.reply_to_message.from_user.id
|
|
|
|
if target not in get_admins(message):
|
|
|
|
if target not in get_admins(message):
|
|
|
|
return target
|
|
|
|
return target
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
print(3)
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
except:
|
|
|
|
# except:
|
|
|
|
return None
|
|
|
|
# return None
|
|
|
|
|
|
|
|
|
|
|
|
def get_name(message):
|
|
|
|
def get_name(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -122,6 +133,8 @@ def get_name(message):
|
|
|
|
# If message with @username
|
|
|
|
# If message with @username
|
|
|
|
if len(text) > 1 and text[1][0] == '@':
|
|
|
|
if len(text) > 1 and text[1][0] == '@':
|
|
|
|
return text[1]
|
|
|
|
return text[1]
|
|
|
|
|
|
|
|
if len(text) > 1 and text[2][0] == '@':
|
|
|
|
|
|
|
|
return text[2]
|
|
|
|
# Reply to message
|
|
|
|
# Reply to message
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return telebot.util.user_link(message.reply_to_message.from_user)
|
|
|
|
return telebot.util.user_link(message.reply_to_message.from_user)
|
|
|
@ -207,6 +220,7 @@ def mute(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if have_rights(message):
|
|
|
|
if have_rights(message):
|
|
|
|
target = get_target(message)
|
|
|
|
target = get_target(message)
|
|
|
|
|
|
|
|
print(target)
|
|
|
|
if target:
|
|
|
|
if target:
|
|
|
|
if len(message.text.split()) == 1:
|
|
|
|
if len(message.text.split()) == 1:
|
|
|
|
bot.restrict_chat_member(message.chat.id, target, until_date = message.date)
|
|
|
|
bot.restrict_chat_member(message.chat.id, target, until_date = message.date)
|
|
|
@ -351,7 +365,7 @@ def getid(message):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['del'])
|
|
|
|
@bot.message_handler(commands=['del'])
|
|
|
|
def secret(message):
|
|
|
|
def delete(message):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if have_rights(message):
|
|
|
|
if have_rights(message):
|
|
|
|
bot.delete_message(message.chat.id, message.reply_to_message.id)
|
|
|
|
bot.delete_message(message.chat.id, message.reply_to_message.id)
|
|
|
|