kopia lustrzana https://github.com/J-Rios/TLG_JoinCaptchaBot
Deny and remove forwarded msgs from doing captcha users
rodzic
3d0ebaec32
commit
2219fa8979
|
@ -10,9 +10,9 @@ Author:
|
|||
Creation date:
|
||||
09/09/2018
|
||||
Last modified date:
|
||||
07/06/2022
|
||||
30/06/2022
|
||||
Version:
|
||||
1.26.3
|
||||
1.26.4
|
||||
'''
|
||||
|
||||
###############################################################################
|
||||
|
@ -290,7 +290,7 @@ CONST = {
|
|||
"DEV_DONATION_ADDR": "https://www.buymeacoffee.com/joincaptchabot",
|
||||
|
||||
# Bot version
|
||||
"VERSION": "1.26.3 (07/06/2022)"
|
||||
"VERSION": "1.26.4 (30/06/2022)"
|
||||
}
|
||||
|
||||
# Supported languages list
|
||||
|
|
|
@ -12,9 +12,9 @@ Author:
|
|||
Creation date:
|
||||
09/09/2018
|
||||
Last modified date:
|
||||
07/06/2022
|
||||
30/06/2022
|
||||
Version:
|
||||
1.26.3
|
||||
1.26.4
|
||||
'''
|
||||
|
||||
###############################################################################
|
||||
|
@ -1117,6 +1117,20 @@ def msg_nocmd(update: Update, context: CallbackContext):
|
|||
lang = get_chat_config(chat_id, "Language")
|
||||
rm_result_msg = get_chat_config(chat_id, "Rm_Result_Msg")
|
||||
captcha_mode = new_users[chat_id][user_id]["join_data"]["captcha_mode"]
|
||||
# Check for forwarded messages and delete it
|
||||
forward_from = getattr(update_msg, "forward_from", None)
|
||||
forward_from_chat = getattr(update_msg, "forward_from_chat", None)
|
||||
if (forward_from is not None) or (forward_from_chat is not None):
|
||||
printts("[{}] Spammer detected: {}.".format(chat_id, user_name))
|
||||
printts("[{}] Removing forwarded msg: {}.".format(chat_id, msg_text))
|
||||
delete_result = tlg_delete_msg(bot, chat_id, msg_id)
|
||||
if delete_result["error"] == "":
|
||||
printts("Message removed.")
|
||||
elif delete_result["error"] == "Message can't be deleted":
|
||||
printts("No rights to remove msg.")
|
||||
else:
|
||||
printts("Message can't be deleted.")
|
||||
return
|
||||
# Check for Spam (check if the message contains any URL or alias)
|
||||
has_url = re.findall(CONST["REGEX_URLS"], msg_text)
|
||||
has_alias = tlg_alias_in_string(msg_text)
|
||||
|
|
Ładowanie…
Reference in New Issue