kopia lustrzana https://github.com/J-Rios/TLG_JoinCaptchaBot
Fix ignore URL protection for channel post discussion group messages
rodzic
2a1b10050b
commit
6ee780542f
|
|
@ -71,7 +71,8 @@ from tlgbotutils import (
|
|||
tlg_answer_callback_query, tlg_delete_msg, tlg_edit_msg_media,
|
||||
tlg_ban_user, tlg_kick_user, tlg_user_is_admin, tlg_leave_chat,
|
||||
tlg_restrict_user, tlg_is_valid_user_id_or_alias, tlg_is_valid_group,
|
||||
tlg_alias_in_string, tlg_extract_members_status_change
|
||||
tlg_alias_in_string, tlg_extract_members_status_change,
|
||||
tlg_is_a_channel_msg_on_discussion_group
|
||||
)
|
||||
|
||||
from constants import (
|
||||
|
|
@ -985,6 +986,10 @@ def msg_notext(update: Update, context: CallbackContext):
|
|||
# Ignore if message comes from a channel
|
||||
if chat.type == "channel":
|
||||
return
|
||||
# Ignore if message is a channel post automatically forwarded to the
|
||||
# connected discussion group
|
||||
if tlg_is_a_channel_msg_on_discussion_group(update_msg):
|
||||
return
|
||||
# Ignore if captcha protection is not enable in this chat
|
||||
captcha_enable = get_chat_config(chat_id, "Enabled")
|
||||
if not captcha_enable:
|
||||
|
|
@ -1041,6 +1046,10 @@ def msg_nocmd(update: Update, context: CallbackContext):
|
|||
# Ignore if message comes from a channel
|
||||
if chat.type == "channel":
|
||||
return
|
||||
# Ignore if message is a channel post automatically forwarded to the
|
||||
# connected discussion group
|
||||
if tlg_is_a_channel_msg_on_discussion_group(update_msg):
|
||||
return
|
||||
# Ignore if captcha protection is not enable in this chat
|
||||
captcha_enable = get_chat_config(chat_id, "Enabled")
|
||||
if not captcha_enable:
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ Author:
|
|||
Creation date:
|
||||
02/11/2020
|
||||
Last modified date:
|
||||
06/06/2022
|
||||
13/06/2022
|
||||
Version:
|
||||
1.1.3
|
||||
1.1.4
|
||||
'''
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -307,6 +307,13 @@ def tlg_user_is_admin(bot, user_id, chat_id, timeout=None):
|
|||
return False
|
||||
|
||||
|
||||
def tlg_is_a_channel_msg_on_discussion_group(msg):
|
||||
'''Check if a Telegram message is a channel publish send to linked
|
||||
discussion group of that group.'''
|
||||
is_automatic_forward = getattr(msg, "is_automatic_forward", None)
|
||||
return is_automatic_forward
|
||||
|
||||
|
||||
def tlg_get_chat_type(bot, chat_id_or_alias, timeout=None):
|
||||
'''Telegram check if a chat exists and what type it is (user, group, '''
|
||||
'''channel).'''
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue