quick fix
This commit is contained in:
parent
04b2f862db
commit
fd2f5e687e
|
@ -496,11 +496,10 @@ class VkBot:
|
||||||
if (self._OWNER or int(user_id) in config.admins or int(user_id) == int(config.owner_id)) and self._ADMIN_MODE and int(self._CHAT_ID) > 2000000000:
|
if (self._OWNER or int(user_id) in config.admins or int(user_id) == int(config.owner_id)) and self._ADMIN_MODE and int(self._CHAT_ID) > 2000000000:
|
||||||
try:
|
try:
|
||||||
victum = re.search(r'id\d+', message[1])
|
victum = re.search(r'id\d+', message[1])
|
||||||
if int(victum[0][-2:]) != int(config.owner_id):
|
victum = victum[0][2:]
|
||||||
vk.method("messages.removeChatUser", {"chat_id": int(
|
if int(victum) != int(config.owner_id):
|
||||||
self._CHAT_ID)-2000000000, "member_id": victum[0][-2:]})
|
vk.method("messages.removeChatUser", {"chat_id": int(self._CHAT_ID)-2000000000, "member_id": victum})
|
||||||
log(False,
|
log(False, f"[BOT_{self._CHAT_ID}] user {victum} has been kicked")
|
||||||
f"[BOT_{self._CHAT_ID}] user {victum[0]} has been kicked")
|
|
||||||
else:
|
else:
|
||||||
log(False, f"[BOT_{self._CHAT_ID}] can't kick owner")
|
log(False, f"[BOT_{self._CHAT_ID}] can't kick owner")
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
@ -508,7 +507,7 @@ class VkBot:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
respond['text'] = f"Ошибка: {str(e)}"
|
respond['text'] = f"Ошибка: {str(e)}"
|
||||||
log(True,
|
log(True,
|
||||||
f"[BOT_{self._CHAT_ID}] can't kick user {victum[0]} - {str(e)}")
|
f"[BOT_{self._CHAT_ID}] can't kick user {victum} - {str(e)}")
|
||||||
else:
|
else:
|
||||||
if int(self._CHAT_ID) <= 2000000000:
|
if int(self._CHAT_ID) <= 2000000000:
|
||||||
respond['text'] = "Данный чат не является беседой"
|
respond['text'] = "Данный чат не является беседой"
|
||||||
|
@ -571,13 +570,14 @@ class VkBot:
|
||||||
if (self._OWNER or int(user_id) in config.admins or int(user_id) == int(config.owner_id)):
|
if (self._OWNER or int(user_id) in config.admins or int(user_id) == int(config.owner_id)):
|
||||||
try:
|
try:
|
||||||
victum = re.search(r'id\d+', message[1])
|
victum = re.search(r'id\d+', message[1])
|
||||||
if int(victum[0][-2:]) != int(config.owner_id):
|
victum = victum[0][2:]
|
||||||
if int(victum[0][-2:]) not in bot:
|
if int(victum) != int(config.owner_id):
|
||||||
create_new_bot_object(int(victum[0][-2:]))
|
if int(victum) not in bot:
|
||||||
if not db.get_from_users(int(victum[0][-2:])["banned"]):
|
create_new_bot_object(int(victum))
|
||||||
bot[int(victum[0][-2:])].change_flag("banned", True)
|
if not db.get_from_users(int(victum))["banned"]:
|
||||||
|
bot[int(victum)].change_flag("banned", True)
|
||||||
respond["text"] = "Теперь он не сможет воспользоваться ботом"
|
respond["text"] = "Теперь он не сможет воспользоваться ботом"
|
||||||
log(False, f"[BOT_{self._CHAT_ID}] user {victum[0]} has been resisted")
|
log(False, f"[BOT_{self._CHAT_ID}] user {victum} has been resisted")
|
||||||
else:
|
else:
|
||||||
respond["text"] = "Он и так не может пользоваться ботом, вы уже делали это"
|
respond["text"] = "Он и так не может пользоваться ботом, вы уже делали это"
|
||||||
else:
|
else:
|
||||||
|
@ -587,7 +587,7 @@ class VkBot:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
respond['text'] = f"Ошибка: {str(e)}"
|
respond['text'] = f"Ошибка: {str(e)}"
|
||||||
log(True,
|
log(True,
|
||||||
f"[BOT_{self._CHAT_ID}] can't resist user {victum[0]} - {str(e)}")
|
f"[BOT_{self._CHAT_ID}] can't resist user {victum} - {str(e)}")
|
||||||
else:
|
else:
|
||||||
respond["text"] = errors_array["access"]
|
respond["text"] = errors_array["access"]
|
||||||
|
|
||||||
|
@ -595,15 +595,16 @@ class VkBot:
|
||||||
if (self._OWNER or int(user_id) in config.admins or int(user_id) == int(config.owner_id)):
|
if (self._OWNER or int(user_id) in config.admins or int(user_id) == int(config.owner_id)):
|
||||||
try:
|
try:
|
||||||
victum = re.search(r'id\d+', message[1])
|
victum = re.search(r'id\d+', message[1])
|
||||||
if int(victum[0][-2:]) not in bot:
|
victum = victum[0][2:]
|
||||||
create_new_bot_object(int(victum[0][-2:]))
|
if int(victum) not in bot:
|
||||||
if int(victum[0][-2:]) != int(config.owner_id):
|
create_new_bot_object(int(victum))
|
||||||
if db.get_from_users(int(victum[0][-2:])["banned"]):
|
if int(victum) != int(config.owner_id):
|
||||||
bot[int(victum[0][-2:])].change_flag("banned", False)
|
if db.get_from_users(int(victum))["banned"]:
|
||||||
|
bot[int(victum)].change_flag("banned", False)
|
||||||
respond["text"] = "Теперь он снова сможет воспользоваться ботом"
|
respond["text"] = "Теперь он снова сможет воспользоваться ботом"
|
||||||
log(False, f"[BOT_{self._CHAT_ID}] user {victum[0]} has been resisted")
|
log(False, f"[BOT_{self._CHAT_ID}] user {victum} has been restored")
|
||||||
else:
|
else:
|
||||||
respond["text"] = "Он и так не может пользоваться ботом, вы уже делали это"
|
respond["text"] = "Он и так может пользоваться ботом"
|
||||||
else:
|
else:
|
||||||
log(False, f"[BOT_{self._CHAT_ID}] can't restore owner")
|
log(False, f"[BOT_{self._CHAT_ID}] can't restore owner")
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
@ -611,7 +612,7 @@ class VkBot:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
respond['text'] = f"Ошибка: {str(e)}"
|
respond['text'] = f"Ошибка: {str(e)}"
|
||||||
log(True,
|
log(True,
|
||||||
f"[BOT_{self._CHAT_ID}] can't restore user {victum[0]} - {str(e)}")
|
f"[BOT_{self._CHAT_ID}] can't restore user {victum} - {str(e)}")
|
||||||
else:
|
else:
|
||||||
respond["text"] = errors_array["access"]
|
respond["text"] = errors_array["access"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue