kopia lustrzana https://github.com/J-Rios/TLG_JoinCaptchaBot
Custom ENV restrict send no-text msg
rodzic
6db6a84325
commit
a1823ce83f
|
@ -32,18 +32,18 @@ FROM base AS builder-deps
|
|||
# Install build dependencies
|
||||
RUN apt-get ${APT_OPTS} update && \
|
||||
apt-get ${APT_OPTS} install \
|
||||
build-essential \
|
||||
git \
|
||||
procps \
|
||||
libtiff5-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
zlib1g-dev \
|
||||
libfreetype6-dev \
|
||||
liblcms2-dev \
|
||||
libwebp-dev \
|
||||
tcl8.6-dev \
|
||||
tk8.6-dev \
|
||||
python3-tk
|
||||
build-essential \
|
||||
git \
|
||||
procps \
|
||||
libtiff5-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
zlib1g-dev \
|
||||
libfreetype6-dev \
|
||||
liblcms2-dev \
|
||||
libwebp-dev \
|
||||
tcl8.6-dev \
|
||||
tk8.6-dev \
|
||||
python3-tk
|
||||
|
||||
################################################################################
|
||||
|
||||
|
|
|
@ -180,6 +180,11 @@ CONST = {
|
|||
os_getenv("CAPTCHABOT_INIT_LANG", \
|
||||
SETTINGS["CAPTCHABOT_INIT_LANG"]),
|
||||
|
||||
# Time to restrict sending no-text messages
|
||||
"T_RESTRICT_NO_TEXT_MSG": \
|
||||
int(os_getenv("CAPTCHABOT_T_RESTRICT_NO_TEXT_MSG", \
|
||||
SETTINGS["CAPTCHABOT_T_RESTRICT_NO_TEXT_MSG"])),
|
||||
|
||||
# Number of seconds in a day (60s x 60m x 24h)
|
||||
"T_SECONDS_IN_A_DAY": 86400,
|
||||
|
||||
|
|
|
@ -968,7 +968,7 @@ def msg_nocmd(update: Update, context: CallbackContext):
|
|||
restrict_non_text_msgs = get_chat_config(chat_id, "Restrict_Non_Text")
|
||||
# Restrict for 1 day
|
||||
if restrict_non_text_msgs == 1:
|
||||
tomorrow_epoch = get_unix_epoch() + CONST["T_SECONDS_IN_A_DAY"]
|
||||
tomorrow_epoch = get_unix_epoch() + CONST["T_RESTRICT_NO_TEXT_MSG"]
|
||||
tlg_restrict_user(bot, chat_id, user_id, send_msg=True, send_media=False,
|
||||
send_stickers_gifs=False, insert_links=False, send_polls=False,
|
||||
invite_members=False, pin_messages=False, change_group_info=False,
|
||||
|
@ -1055,7 +1055,7 @@ def receive_poll_answer(update: Update, context: CallbackContext):
|
|||
printts("[{}] Error: Can't send the welcome message.".format(chat_id))
|
||||
# Check for send just text message option and apply user restrictions
|
||||
if restrict_non_text_msgs == 1: # Restrict for 1 day
|
||||
tomorrow_epoch = get_unix_epoch() + CONST["T_SECONDS_IN_A_DAY"]
|
||||
tomorrow_epoch = get_unix_epoch() + CONST["T_RESTRICT_NO_TEXT_MSG"]
|
||||
tlg_restrict_user(bot, chat_id, user_id, send_msg=True, send_media=False,
|
||||
send_stickers_gifs=False, insert_links=False, send_polls=False,
|
||||
invite_members=False, pin_messages=False, change_group_info=False,
|
||||
|
@ -1242,7 +1242,7 @@ def button_request_pass(bot, query):
|
|||
restrict_non_text_msgs = get_chat_config(chat_id, "Restrict_Non_Text")
|
||||
# Restrict for 1 day
|
||||
if restrict_non_text_msgs == 1:
|
||||
tomorrow_epoch = get_unix_epoch() + CONST["T_SECONDS_IN_A_DAY"]
|
||||
tomorrow_epoch = get_unix_epoch() + CONST["T_RESTRICT_NO_TEXT_MSG"]
|
||||
tlg_restrict_user(bot, chat_id, user_id, send_msg=True, send_media=False,
|
||||
send_stickers_gifs=False, insert_links=False, send_polls=False,
|
||||
invite_members=False, pin_messages=False, change_group_info=False,
|
||||
|
|
|
@ -93,6 +93,9 @@ SETTINGS = {
|
|||
# Auto-remove custom welcome message timeout
|
||||
"CAPTCHABOT_T_DEL_WELCOME_MSG": 5,
|
||||
|
||||
# Time to restrict sending no-text messages (in seconds, default 24h)
|
||||
"CAPTCHABOT_T_RESTRICT_NO_TEXT_MSG": 86400,
|
||||
|
||||
# Maximum number of users allowed in each chat ignore list
|
||||
"CAPTCHABOT_IGNORE_LIST_MAX": 100,
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue