kopia lustrzana https://github.com/J-Rios/TLG_JoinCaptchaBot
				
				
				
			Fix code style according to flake8
							rodzic
							
								
									62acab8d8a
								
							
						
					
					
						commit
						c0d99b6be2
					
				| 
						 | 
					@ -16,15 +16,18 @@ Version:
 | 
				
			||||||
'''
 | 
					'''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
### Imported modules ###
 | 
					# Imported modules
 | 
				
			||||||
 | 
					###############################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from os import path as os_path
 | 
					from os import path as os_path
 | 
				
			||||||
from os import getenv as os_getenv
 | 
					from os import getenv as os_getenv
 | 
				
			||||||
from typing import Any
 | 
					from typing import Any
 | 
				
			||||||
from settings import SETTINGS
 | 
					from settings import SETTINGS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					###############################################################################
 | 
				
			||||||
 | 
					# Constants
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
### Constants ###
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Actual constants.py full path directory name
 | 
					# Actual constants.py full path directory name
 | 
				
			||||||
SCRIPT_PATH = os_path.dirname(os_path.realpath(__file__))
 | 
					SCRIPT_PATH = os_path.dirname(os_path.realpath(__file__))
 | 
				
			||||||
| 
						 | 
					@ -33,175 +36,175 @@ SCRIPT_PATH = os_path.dirname(os_path.realpath(__file__))
 | 
				
			||||||
CONST = {
 | 
					CONST = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Public or Private
 | 
					    # Bot Public or Private
 | 
				
			||||||
    "BOT_PRIVATE": \
 | 
					    "BOT_PRIVATE":
 | 
				
			||||||
        bool(int(os_getenv("CAPTCHABOT_PRIVATE", \
 | 
					        bool(int(os_getenv("CAPTCHABOT_PRIVATE",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_PRIVATE"]))),
 | 
					                           SETTINGS["CAPTCHABOT_PRIVATE"]))),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Token (get it from @BotFather)
 | 
					    # Bot Token (get it from @BotFather)
 | 
				
			||||||
    "TOKEN": \
 | 
					    "TOKEN":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_TOKEN", SETTINGS["CAPTCHABOT_TOKEN"]),
 | 
					        os_getenv("CAPTCHABOT_TOKEN", SETTINGS["CAPTCHABOT_TOKEN"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Owner (i.e. "@JoseTLG" or "123456789")
 | 
					    # Bot Owner (i.e. "@JoseTLG" or "123456789")
 | 
				
			||||||
    "BOT_OWNER": \
 | 
					    "BOT_OWNER":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_OWNER", SETTINGS["CAPTCHABOT_OWNER"]),
 | 
					        os_getenv("CAPTCHABOT_OWNER", SETTINGS["CAPTCHABOT_OWNER"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Host addres (keep in None for Polling or set to a
 | 
					    # Bot Webhook Host addres (keep in None for Polling or set to a
 | 
				
			||||||
    # valid address for Webhook)
 | 
					    # valid address for Webhook)
 | 
				
			||||||
    "WEBHOOK_HOST": \
 | 
					    "WEBHOOK_HOST":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_WEBHOOK_HOST", \
 | 
					        os_getenv("CAPTCHABOT_WEBHOOK_HOST",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_WEBHOOK_HOST"]),
 | 
					                  SETTINGS["CAPTCHABOT_WEBHOOK_HOST"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Host Port (this is not used if WEBHOOK_HOST is None)
 | 
					    # Bot Webhook Host Port (this is not used if WEBHOOK_HOST is None)
 | 
				
			||||||
    "WEBHOOK_PORT": \
 | 
					    "WEBHOOK_PORT":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_WEBHOOK_PORT", \
 | 
					        int(os_getenv("CAPTCHABOT_WEBHOOK_PORT",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_WEBHOOK_PORT"])),
 | 
					                      SETTINGS["CAPTCHABOT_WEBHOOK_PORT"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Certificate file path (this is not used if
 | 
					    # Bot Webhook Certificate file path (this is not used if
 | 
				
			||||||
    # WEBHOOK_HOST is None)
 | 
					    # WEBHOOK_HOST is None)
 | 
				
			||||||
    "WEBHOOK_CERT": \
 | 
					    "WEBHOOK_CERT":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_WEBHOOK_CERT", \
 | 
					        os_getenv("CAPTCHABOT_WEBHOOK_CERT",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_WEBHOOK_CERT"]),
 | 
					                  SETTINGS["CAPTCHABOT_WEBHOOK_CERT"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Certificate private key file path (this is not used
 | 
					    # Bot Webhook Certificate private key file path (this is not used
 | 
				
			||||||
    # if WEBHOOK_HOST is None)
 | 
					    # if WEBHOOK_HOST is None)
 | 
				
			||||||
    "WEBHOOK_CERT_PRIV_KEY": \
 | 
					    "WEBHOOK_CERT_PRIV_KEY":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_WEBHOOK_CERT_PRIV_KEY", \
 | 
					        os_getenv("CAPTCHABOT_WEBHOOK_CERT_PRIV_KEY",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_WEBHOOK_CERT_PRIV_KEY"]),
 | 
					                  SETTINGS["CAPTCHABOT_WEBHOOK_CERT_PRIV_KEY"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Secret Token to verify request from Telegram Server
 | 
					    # Bot Webhook Secret Token to verify request from Telegram Server
 | 
				
			||||||
    # (don't use the Bot Token, for security reason it must be other)
 | 
					    # (don't use the Bot Token, for security reason it must be other)
 | 
				
			||||||
    "WEBHOOK_SECRET_TOKEN": \
 | 
					    "WEBHOOK_SECRET_TOKEN":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_WEBHOOK_SECRET_TOKEN", \
 | 
					        os_getenv("CAPTCHABOT_WEBHOOK_SECRET_TOKEN",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_WEBHOOK_SECRET_TOKEN"]),
 | 
					                  SETTINGS["CAPTCHABOT_WEBHOOK_SECRET_TOKEN"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Chats directory path
 | 
					    # Chats directory path
 | 
				
			||||||
    "CHATS_DIR": \
 | 
					    "CHATS_DIR":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_CHATS_DIR", SETTINGS["CAPTCHABOT_CHATS_DIR"]),
 | 
					        os_getenv("CAPTCHABOT_CHATS_DIR", SETTINGS["CAPTCHABOT_CHATS_DIR"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Directory where create/generate temporary captchas
 | 
					    # Directory where create/generate temporary captchas
 | 
				
			||||||
    "CAPTCHAS_DIR": \
 | 
					    "CAPTCHAS_DIR":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_CAPTCHAS_DIR", \
 | 
					        os_getenv("CAPTCHABOT_CAPTCHAS_DIR",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_CAPTCHAS_DIR"]),
 | 
					                  SETTINGS["CAPTCHABOT_CAPTCHAS_DIR"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Global allowed users file path (i.e. to allow blind users)
 | 
					    # Global allowed users file path (i.e. to allow blind users)
 | 
				
			||||||
    "F_ALLOWED_USERS": \
 | 
					    "F_ALLOWED_USERS":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_F_ALLOWED_USERS", \
 | 
					        os_getenv("CAPTCHABOT_F_ALLOWED_USERS",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_F_ALLOWED_USERS"]),
 | 
					                  SETTINGS["CAPTCHABOT_F_ALLOWED_USERS"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Allowed groups to use the Bot when it is Private
 | 
					    # Allowed groups to use the Bot when it is Private
 | 
				
			||||||
    "F_ALLOWED_GROUPS": \
 | 
					    "F_ALLOWED_GROUPS":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_F_ALLOWED_GROUPS", \
 | 
					        os_getenv("CAPTCHABOT_F_ALLOWED_GROUPS",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_F_ALLOWED_GROUPS"]),
 | 
					                  SETTINGS["CAPTCHABOT_F_ALLOWED_GROUPS"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Blocked groups to deny Bot usage (i.e. bad groups that misuse Bot
 | 
					    # Blocked groups to deny Bot usage (i.e. bad groups that misuse Bot
 | 
				
			||||||
    # and cause overload)
 | 
					    # and cause overload)
 | 
				
			||||||
    "F_BAN_GROUPS": \
 | 
					    "F_BAN_GROUPS":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_F_BAN_GROUPS", \
 | 
					        os_getenv("CAPTCHABOT_F_BAN_GROUPS",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_F_BAN_GROUPS"]),
 | 
					                  SETTINGS["CAPTCHABOT_F_BAN_GROUPS"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial enable/disable status at Bot start
 | 
					    # Initial enable/disable status at Bot start
 | 
				
			||||||
    "INIT_ENABLE": \
 | 
					    "INIT_ENABLE":
 | 
				
			||||||
        bool(int(os_getenv("CAPTCHABOT_INIT_ENABLE", \
 | 
					        bool(int(os_getenv("CAPTCHABOT_INIT_ENABLE",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_ENABLE"]))),
 | 
					                           SETTINGS["CAPTCHABOT_INIT_ENABLE"]))),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial users send URLs enable/disable at Bot start
 | 
					    # Initial users send URLs enable/disable at Bot start
 | 
				
			||||||
    "INIT_URL_ENABLE": \
 | 
					    "INIT_URL_ENABLE":
 | 
				
			||||||
        bool(int(os_getenv("CAPTCHABOT_INIT_URL_ENABLE", \
 | 
					        bool(int(os_getenv("CAPTCHABOT_INIT_URL_ENABLE",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_URL_ENABLE"]))),
 | 
					                           SETTINGS["CAPTCHABOT_INIT_URL_ENABLE"]))),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial config regarding remove all messages sent by a user kicked
 | 
					    # Initial config regarding remove all messages sent by a user kicked
 | 
				
			||||||
    "INIT_RM_ALL_MSG": \
 | 
					    "INIT_RM_ALL_MSG":
 | 
				
			||||||
        bool(int(os_getenv("CAPTCHABOT_INIT_RM_ALL_MSG", \
 | 
					        bool(int(os_getenv("CAPTCHABOT_INIT_RM_ALL_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_RM_ALL_MSG"]))),
 | 
					                           SETTINGS["CAPTCHABOT_INIT_RM_ALL_MSG"]))),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial captcha solve time
 | 
					    # Initial captcha solve time
 | 
				
			||||||
    "INIT_CAPTCHA_TIME": \
 | 
					    "INIT_CAPTCHA_TIME":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_INIT_CAPTCHA_TIME_MIN", \
 | 
					        int(os_getenv("CAPTCHABOT_INIT_CAPTCHA_TIME_MIN",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_CAPTCHA_TIME_MIN"])) * 60,
 | 
					                      SETTINGS["CAPTCHABOT_INIT_CAPTCHA_TIME_MIN"])) * 60,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial captcha difficult level
 | 
					    # Initial captcha difficult level
 | 
				
			||||||
    "INIT_CAPTCHA_DIFFICULTY_LEVEL": \
 | 
					    "INIT_CAPTCHA_DIFFICULTY_LEVEL":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_INIT_CAPTCHA_DIFFICULTY_LEVEL", \
 | 
					        int(os_getenv("CAPTCHABOT_INIT_CAPTCHA_DIFFICULTY_LEVEL",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_CAPTCHA_DIFFICULTY_LEVEL"])),
 | 
					                      SETTINGS["CAPTCHABOT_INIT_CAPTCHA_DIFFICULTY_LEVEL"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial captcha characters mode (ascii, hex, nums, math or button)
 | 
					    # Initial captcha characters mode (ascii, hex, nums, math or button)
 | 
				
			||||||
    "INIT_CAPTCHA_CHARS_MODE": \
 | 
					    "INIT_CAPTCHA_CHARS_MODE":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_INIT_CAPTCHA_CHARS_MODE", \
 | 
					        os_getenv("CAPTCHABOT_INIT_CAPTCHA_CHARS_MODE",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_CAPTCHA_CHARS_MODE"]),
 | 
					                  SETTINGS["CAPTCHABOT_INIT_CAPTCHA_CHARS_MODE"]),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Maximum configurable captcha time
 | 
					    # Maximum configurable captcha time
 | 
				
			||||||
    "MAX_CONFIG_CAPTCHA_TIME": \
 | 
					    "MAX_CONFIG_CAPTCHA_TIME":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_MAX_CONFIG_CAPTCHA_TIME", \
 | 
					        int(os_getenv("CAPTCHABOT_MAX_CONFIG_CAPTCHA_TIME",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_MAX_CONFIG_CAPTCHA_TIME"])),
 | 
					                      SETTINGS["CAPTCHABOT_MAX_CONFIG_CAPTCHA_TIME"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Standard auto-remove messages sent by Bot timeout (in seconds)
 | 
					    # Standard auto-remove messages sent by Bot timeout (in seconds)
 | 
				
			||||||
    "T_DEL_MSG": \
 | 
					    "T_DEL_MSG":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_T_DEL_MSG", \
 | 
					        int(os_getenv("CAPTCHABOT_T_DEL_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_T_DEL_MSG"])),
 | 
					                      SETTINGS["CAPTCHABOT_T_DEL_MSG"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Fast auto-remove messages sent by Bot timeout (in seconds)
 | 
					    # Fast auto-remove messages sent by Bot timeout (in seconds)
 | 
				
			||||||
    "T_FAST_DEL_MSG": \
 | 
					    "T_FAST_DEL_MSG":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_T_FAST_DEL_MSG", \
 | 
					        int(os_getenv("CAPTCHABOT_T_FAST_DEL_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_T_FAST_DEL_MSG"])),
 | 
					                      SETTINGS["CAPTCHABOT_T_FAST_DEL_MSG"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Auto-remove custom welcome message timeout (in seconds)
 | 
					    # Auto-remove custom welcome message timeout (in seconds)
 | 
				
			||||||
    "T_DEL_WELCOME_MSG": \
 | 
					    "T_DEL_WELCOME_MSG":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_T_DEL_WELCOME_MSG", \
 | 
					        int(os_getenv("CAPTCHABOT_T_DEL_WELCOME_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_T_DEL_WELCOME_MSG"])),
 | 
					                      SETTINGS["CAPTCHABOT_T_DEL_WELCOME_MSG"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Maximum number of users allowed in each chat ignore list
 | 
					    # Maximum number of users allowed in each chat ignore list
 | 
				
			||||||
    "IGNORE_LIST_MAX": \
 | 
					    "IGNORE_LIST_MAX":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_IGNORE_LIST_MAX", \
 | 
					        int(os_getenv("CAPTCHABOT_IGNORE_LIST_MAX",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_IGNORE_LIST_MAX"])),
 | 
					                      SETTINGS["CAPTCHABOT_IGNORE_LIST_MAX"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial new users just allow to send text messages
 | 
					    # Initial new users just allow to send text messages
 | 
				
			||||||
    "INIT_RESTRICT_NON_TEXT_MSG": \
 | 
					    "INIT_RESTRICT_NON_TEXT_MSG":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_INIT_RESTRICT_NON_TEXT_MSG", \
 | 
					        int(os_getenv("CAPTCHABOT_INIT_RESTRICT_NON_TEXT_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_RESTRICT_NON_TEXT_MSG"])),
 | 
					                      SETTINGS["CAPTCHABOT_INIT_RESTRICT_NON_TEXT_MSG"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Custom Welcome message max length
 | 
					    # Custom Welcome message max length
 | 
				
			||||||
    "MAX_WELCOME_MSG_LENGTH": \
 | 
					    "MAX_WELCOME_MSG_LENGTH":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_MAX_WELCOME_MSG_LENGTH", \
 | 
					        int(os_getenv("CAPTCHABOT_MAX_WELCOME_MSG_LENGTH",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_MAX_WELCOME_MSG_LENGTH"])),
 | 
					                      SETTINGS["CAPTCHABOT_MAX_WELCOME_MSG_LENGTH"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial remove result messages cgroup onfiguration
 | 
					    # Initial remove result messages cgroup onfiguration
 | 
				
			||||||
    "INIT_RM_RESULT_MSG": \
 | 
					    "INIT_RM_RESULT_MSG":
 | 
				
			||||||
        bool(int(os_getenv("CAPTCHABOT_INIT_RM_RESULT_MSG", \
 | 
					        bool(int(os_getenv("CAPTCHABOT_INIT_RM_RESULT_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_RM_RESULT_MSG"]))),
 | 
					                           SETTINGS["CAPTCHABOT_INIT_RM_RESULT_MSG"]))),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial remove welcome message group configuration
 | 
					    # Initial remove welcome message group configuration
 | 
				
			||||||
    "INIT_RM_WELCOME_MSG": \
 | 
					    "INIT_RM_WELCOME_MSG":
 | 
				
			||||||
        bool(int(os_getenv("CAPTCHABOT_INIT_RM_WELCOME_MSG", \
 | 
					        bool(int(os_getenv("CAPTCHABOT_INIT_RM_WELCOME_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_RM_WELCOME_MSG"]))),
 | 
					                           SETTINGS["CAPTCHABOT_INIT_RM_WELCOME_MSG"]))),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Maximum number of allowed captcha Poll options
 | 
					    # Maximum number of allowed captcha Poll options
 | 
				
			||||||
    "MAX_POLL_OPTIONS": \
 | 
					    "MAX_POLL_OPTIONS":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_MAX_POLL_OPTIONS", \
 | 
					        int(os_getenv("CAPTCHABOT_MAX_POLL_OPTIONS",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_MAX_POLL_OPTIONS"])),
 | 
					                      SETTINGS["CAPTCHABOT_MAX_POLL_OPTIONS"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Poll captcha question max length
 | 
					    # Poll captcha question max length
 | 
				
			||||||
    "MAX_POLL_QUESTION_LENGTH": \
 | 
					    "MAX_POLL_QUESTION_LENGTH":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_MAX_POLL_QUESTION_LENGTH", \
 | 
					        int(os_getenv("CAPTCHABOT_MAX_POLL_QUESTION_LENGTH",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_MAX_POLL_QUESTION_LENGTH"])),
 | 
					                      SETTINGS["CAPTCHABOT_MAX_POLL_QUESTION_LENGTH"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Poll captcha question max length
 | 
					    # Poll captcha question max length
 | 
				
			||||||
    "MAX_POLL_OPTION_LENGTH": \
 | 
					    "MAX_POLL_OPTION_LENGTH":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_MAX_POLL_OPTION_LENGTH", \
 | 
					        int(os_getenv("CAPTCHABOT_MAX_POLL_OPTION_LENGTH",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_MAX_POLL_OPTION_LENGTH"])),
 | 
					                      SETTINGS["CAPTCHABOT_MAX_POLL_OPTION_LENGTH"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Maximum number of times a user joins a group and fail to solve the
 | 
					    # Maximum number of times a user joins a group and fail to solve the
 | 
				
			||||||
    # captcha. If a user don't solve the captcha after this, it will be
 | 
					    # captcha. If a user don't solve the captcha after this, it will be
 | 
				
			||||||
    # ban instead kick
 | 
					    # ban instead kick
 | 
				
			||||||
    "MAX_FAIL_BAN": \
 | 
					    "MAX_FAIL_BAN":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_MAX_FAIL_BAN", \
 | 
					        int(os_getenv("CAPTCHABOT_MAX_FAIL_BAN",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_MAX_FAIL_BAN"])),
 | 
					                      SETTINGS["CAPTCHABOT_MAX_FAIL_BAN"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Maximum number of times a user fail to solve a Poll captcha.
 | 
					    # Maximum number of times a user fail to solve a Poll captcha.
 | 
				
			||||||
    # If a user don't solve the captcha after this, it will be ban
 | 
					    # If a user don't solve the captcha after this, it will be ban
 | 
				
			||||||
    # instead kick
 | 
					    # instead kick
 | 
				
			||||||
    "MAX_FAIL_BAN_POLL": \
 | 
					    "MAX_FAIL_BAN_POLL":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_MAX_FAIL_BAN_POLL", \
 | 
					        int(os_getenv("CAPTCHABOT_MAX_FAIL_BAN_POLL",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_MAX_FAIL_BAN_POLL"])),
 | 
					                      SETTINGS["CAPTCHABOT_MAX_FAIL_BAN_POLL"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Last session restorable RAM data backup file path
 | 
					    # Last session restorable RAM data backup file path
 | 
				
			||||||
    "F_SESSION": SCRIPT_PATH + "/session.pkl",
 | 
					    "F_SESSION": SCRIPT_PATH + "/session.pkl",
 | 
				
			||||||
| 
						 | 
					@ -219,14 +222,13 @@ CONST = {
 | 
				
			||||||
    "INIT_LINK": "Unknown",
 | 
					    "INIT_LINK": "Unknown",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Initial language at Bot start
 | 
					    # Initial language at Bot start
 | 
				
			||||||
    "INIT_LANG": \
 | 
					    "INIT_LANG":
 | 
				
			||||||
        os_getenv("CAPTCHABOT_INIT_LANG", \
 | 
					        os_getenv("CAPTCHABOT_INIT_LANG", SETTINGS["CAPTCHABOT_INIT_LANG"]),
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_INIT_LANG"]),
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Time to restrict sending no-text messages
 | 
					    # Time to restrict sending no-text messages
 | 
				
			||||||
    "T_RESTRICT_NO_TEXT_MSG": \
 | 
					    "T_RESTRICT_NO_TEXT_MSG":
 | 
				
			||||||
        int(os_getenv("CAPTCHABOT_T_RESTRICT_NO_TEXT_MSG", \
 | 
					        int(os_getenv("CAPTCHABOT_T_RESTRICT_NO_TEXT_MSG",
 | 
				
			||||||
            SETTINGS["CAPTCHABOT_T_RESTRICT_NO_TEXT_MSG"])),
 | 
					                      SETTINGS["CAPTCHABOT_T_RESTRICT_NO_TEXT_MSG"])),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Number of seconds in a minute
 | 
					    # Number of seconds in a minute
 | 
				
			||||||
    "T_SECONDS_IN_MIN": 60,
 | 
					    "T_SECONDS_IN_MIN": 60,
 | 
				
			||||||
| 
						 | 
					@ -317,77 +319,77 @@ CONST = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Supported languages list
 | 
					# Supported languages list
 | 
				
			||||||
TEXT: dict = {
 | 
					TEXT: dict = {
 | 
				
			||||||
    "AR": {}, # Arabic
 | 
					    "AR": {},  # Arabic
 | 
				
			||||||
    "BE": {}, # Belarusian
 | 
					    "BE": {},  # Belarusian
 | 
				
			||||||
    "CA": {}, # Catalan
 | 
					    "CA": {},  # Catalan
 | 
				
			||||||
    "DE": {}, # German
 | 
					    "DE": {},  # German
 | 
				
			||||||
    "EL": {}, # Greek
 | 
					    "EL": {},  # Greek
 | 
				
			||||||
    "EN": {}, # English
 | 
					    "EN": {},  # English
 | 
				
			||||||
    "EO": {}, # Esperanto
 | 
					    "EO": {},  # Esperanto
 | 
				
			||||||
    "ES": {}, # Spanish
 | 
					    "ES": {},  # Spanish
 | 
				
			||||||
    "EU": {}, # Basque
 | 
					    "EU": {},  # Basque
 | 
				
			||||||
    "FA": {}, # Persian
 | 
					    "FA": {},  # Persian
 | 
				
			||||||
    "FI": {}, # Finnish
 | 
					    "FI": {},  # Finnish
 | 
				
			||||||
    "FR": {}, # French
 | 
					    "FR": {},  # French
 | 
				
			||||||
    "GL": {}, # Galician
 | 
					    "GL": {},  # Galician
 | 
				
			||||||
    "HE": {}, # Hebrew
 | 
					    "HE": {},  # Hebrew
 | 
				
			||||||
    "ID": {}, # Indonesian
 | 
					    "ID": {},  # Indonesian
 | 
				
			||||||
    "IT": {}, # Italian
 | 
					    "IT": {},  # Italian
 | 
				
			||||||
    "KN": {}, # Kannada
 | 
					    "KN": {},  # Kannada
 | 
				
			||||||
    "KO": {}, # Korean
 | 
					    "KO": {},  # Korean
 | 
				
			||||||
    "NL": {}, # Dutch
 | 
					    "NL": {},  # Dutch
 | 
				
			||||||
    "PL": {}, # Polish
 | 
					    "PL": {},  # Polish
 | 
				
			||||||
    "PT_BR": {}, # Portuguese (Brasil)
 | 
					    "PT_BR": {},  # Portuguese (Brasil)
 | 
				
			||||||
    "RU": {}, # Rusian
 | 
					    "RU": {},  # Rusian
 | 
				
			||||||
    "SK": {}, # Slovak
 | 
					    "SK": {},  # Slovak
 | 
				
			||||||
    "TR": {}, # Turkish
 | 
					    "TR": {},  # Turkish
 | 
				
			||||||
    "UK": {}, # Ukrainian
 | 
					    "UK": {},  # Ukrainian
 | 
				
			||||||
    "UZ": {}, # Uzbek
 | 
					    "UZ": {},  # Uzbek
 | 
				
			||||||
    "ZH_CN": {} # Chinese (Mainland)
 | 
					    "ZH_CN": {}  # Chinese (Mainland)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Bot Commands
 | 
					# Bot Commands
 | 
				
			||||||
CMD : dict[str, Any] = {
 | 
					CMD: dict[str, Any] = {
 | 
				
			||||||
    "START": { "KEY": "start" },
 | 
					    "START": {"KEY": "start"},
 | 
				
			||||||
    "HELP": { "KEY": "help" },
 | 
					    "HELP": {"KEY": "help"},
 | 
				
			||||||
    "COMMANDS": { "KEY": "commands" },
 | 
					    "COMMANDS": {"KEY": "commands"},
 | 
				
			||||||
    "CHECKCFG": { "KEY": "checkcfg" },
 | 
					    "CHECKCFG": {"KEY": "checkcfg"},
 | 
				
			||||||
    "CONNECT": { "KEY": "connect" },
 | 
					    "CONNECT": {"KEY": "connect"},
 | 
				
			||||||
    "DISCONNECT": { "KEY": "disconnect" },
 | 
					    "DISCONNECT": {"KEY": "disconnect"},
 | 
				
			||||||
    "LANGUAGE": { "KEY": "language" },
 | 
					    "LANGUAGE": {"KEY": "language"},
 | 
				
			||||||
    "DIFFICULTY": { "KEY": "difficulty" },
 | 
					    "DIFFICULTY": {"KEY": "difficulty"},
 | 
				
			||||||
    "WELCOME_MSG": { "KEY": "welcome_msg" },
 | 
					    "WELCOME_MSG": {"KEY": "welcome_msg"},
 | 
				
			||||||
    "WELCOME_MSG_TIME": { "KEY": "welcome_msg_time" },
 | 
					    "WELCOME_MSG_TIME": {"KEY": "welcome_msg_time"},
 | 
				
			||||||
    "CAPTCHA_POLL": { "KEY": "captcha_poll" },
 | 
					    "CAPTCHA_POLL": {"KEY": "captcha_poll"},
 | 
				
			||||||
    "RESTRICT_NON_TEXT": { "KEY": "restrict_non_text" },
 | 
					    "RESTRICT_NON_TEXT": {"KEY": "restrict_non_text"},
 | 
				
			||||||
    "ADD_IGNORE": { "KEY": "add_ignore" },
 | 
					    "ADD_IGNORE": {"KEY": "add_ignore"},
 | 
				
			||||||
    "REMOVE_IGNORE": { "KEY": "remove_ignore" },
 | 
					    "REMOVE_IGNORE": {"KEY": "remove_ignore"},
 | 
				
			||||||
    "IGNORE_LIST": { "KEY": "ignore_list" },
 | 
					    "IGNORE_LIST": {"KEY": "ignore_list"},
 | 
				
			||||||
    "REMOVE_SOLVE_KICK_MSG": { "KEY": "remove_solve_kick_msg" },
 | 
					    "REMOVE_SOLVE_KICK_MSG": {"KEY": "remove_solve_kick_msg"},
 | 
				
			||||||
    "REMOVE_WELCOME_MSG": { "KEY": "remove_welcome_msg" },
 | 
					    "REMOVE_WELCOME_MSG": {"KEY": "remove_welcome_msg"},
 | 
				
			||||||
    "REMOVE_ALL_MSG_KICK_ON": { "KEY": "remove_all_msg_kick_on" },
 | 
					    "REMOVE_ALL_MSG_KICK_ON": {"KEY": "remove_all_msg_kick_on"},
 | 
				
			||||||
    "REMOVE_ALL_MSG_KICK_OFF": { "KEY": "remove_all_msg_kick_off" },
 | 
					    "REMOVE_ALL_MSG_KICK_OFF": {"KEY": "remove_all_msg_kick_off"},
 | 
				
			||||||
    "URL_ENABLE": { "KEY": "url_enable" },
 | 
					    "URL_ENABLE": {"KEY": "url_enable"},
 | 
				
			||||||
    "URL_DISABLE": { "KEY": "url_disable" },
 | 
					    "URL_DISABLE": {"KEY": "url_disable"},
 | 
				
			||||||
    "ENABLE": { "KEY": "enable" },
 | 
					    "ENABLE": {"KEY": "enable"},
 | 
				
			||||||
    "DISABLE": { "KEY": "disable" },
 | 
					    "DISABLE": {"KEY": "disable"},
 | 
				
			||||||
    "CHATID": { "KEY": "chatid" },
 | 
					    "CHATID": {"KEY": "chatid"},
 | 
				
			||||||
    "VERSION": { "KEY": "version" },
 | 
					    "VERSION": {"KEY": "version"},
 | 
				
			||||||
    "ABOUT": { "KEY": "about" },
 | 
					    "ABOUT": {"KEY": "about"},
 | 
				
			||||||
    "CAPTCHA": { "KEY": "captcha" },
 | 
					    "CAPTCHA": {"KEY": "captcha"},
 | 
				
			||||||
    "ALLOWUSERLIST": { "KEY": "allowuserlist" },
 | 
					    "ALLOWUSERLIST": {"KEY": "allowuserlist"},
 | 
				
			||||||
    "ALLOWGROUP": { "KEY": "allowgroup" },
 | 
					    "ALLOWGROUP": {"KEY": "allowgroup"},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    "TIME": {
 | 
					    "TIME": {
 | 
				
			||||||
        "KEY": "time",
 | 
					        "KEY": "time",
 | 
				
			||||||
        "ARGV": [ "m", "min", "mins", "minutes", "s", "sec", "secs",
 | 
					        "ARGV": ["m", "min", "mins", "minutes", "s", "sec", "secs",
 | 
				
			||||||
                 "seconds" ]
 | 
					                 "seconds"]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    "CAPTCHA_MODE": {
 | 
					    "CAPTCHA_MODE": {
 | 
				
			||||||
        "KEY": "captcha_mode",
 | 
					        "KEY": "captcha_mode",
 | 
				
			||||||
        "ARGV": [ "poll", "button", "nums", "hex", "ascii", "math",
 | 
					        "ARGV": ["poll", "button", "nums", "hex", "ascii", "math",
 | 
				
			||||||
                 "random" ]
 | 
					                 "random"]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    "RESTRICTION": {
 | 
					    "RESTRICTION": {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -735,7 +735,8 @@ async def should_manage_captcha(update, bot):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def restrict_user_mute(bot, chat_id, user_id, until_date=None):
 | 
					async def restrict_user_mute(bot, chat_id, user_id, until_date=None):
 | 
				
			||||||
    '''Restrict an user in order to deny it send any kind of message.'''
 | 
					    '''Restrict an user in order to deny it send any kind of message.'''
 | 
				
			||||||
    restrict_success = await tlg_restrict_user(bot, chat_id, user_id,
 | 
					    restrict_success = await tlg_restrict_user(
 | 
				
			||||||
 | 
					        bot, chat_id, user_id,
 | 
				
			||||||
        send_msg=False,
 | 
					        send_msg=False,
 | 
				
			||||||
        send_media=False,
 | 
					        send_media=False,
 | 
				
			||||||
        send_polls=False,
 | 
					        send_polls=False,
 | 
				
			||||||
| 
						 | 
					@ -751,7 +752,8 @@ async def restrict_user_mute(bot, chat_id, user_id, until_date=None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def restrict_user_media(bot, chat_id, user_id, until_date=None):
 | 
					async def restrict_user_media(bot, chat_id, user_id, until_date=None):
 | 
				
			||||||
    '''Restrict an user in order to deny it send media messages.'''
 | 
					    '''Restrict an user in order to deny it send media messages.'''
 | 
				
			||||||
    restrict_success = await tlg_restrict_user(bot, chat_id, user_id,
 | 
					    restrict_success = await tlg_restrict_user(
 | 
				
			||||||
 | 
					        bot, chat_id, user_id,
 | 
				
			||||||
        send_msg=True,
 | 
					        send_msg=True,
 | 
				
			||||||
        send_media=False,
 | 
					        send_media=False,
 | 
				
			||||||
        send_polls=False,
 | 
					        send_polls=False,
 | 
				
			||||||
| 
						 | 
					@ -817,7 +819,7 @@ async def captcha_fail_member_kick(bot, chat_id, user_id, user_name):
 | 
				
			||||||
    # "max_join_retries"
 | 
					    # "max_join_retries"
 | 
				
			||||||
    if join_retries < max_join_retries:
 | 
					    if join_retries < max_join_retries:
 | 
				
			||||||
        logger.info("[%s] Captcha Fail - Kick - %s (%s)",
 | 
					        logger.info("[%s] Captcha Fail - Kick - %s (%s)",
 | 
				
			||||||
                chat_id, user_name, user_id)
 | 
					                    chat_id, user_name, user_id)
 | 
				
			||||||
        # Try to kick the user
 | 
					        # Try to kick the user
 | 
				
			||||||
        kick_result = await tlg_kick_user(bot, chat_id, user_id)
 | 
					        kick_result = await tlg_kick_user(bot, chat_id, user_id)
 | 
				
			||||||
        if kick_result["error"] == "":
 | 
					        if kick_result["error"] == "":
 | 
				
			||||||
| 
						 | 
					@ -849,7 +851,7 @@ async def captcha_fail_member_kick(bot, chat_id, user_id, user_name):
 | 
				
			||||||
    # the captcha
 | 
					    # the captcha
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        logger.info("[%s] Captcha Fail - Ban - %s (%s)",
 | 
					        logger.info("[%s] Captcha Fail - Ban - %s (%s)",
 | 
				
			||||||
                chat_id, user_name, user_id)
 | 
					                    chat_id, user_name, user_id)
 | 
				
			||||||
        # Try to ban the user and notify Admins
 | 
					        # Try to ban the user and notify Admins
 | 
				
			||||||
        ban_result = await tlg_ban_user(bot, chat_id, user_id)
 | 
					        ban_result = await tlg_ban_user(bot, chat_id, user_id)
 | 
				
			||||||
        if ban_result["error"] == "":
 | 
					        if ban_result["error"] == "":
 | 
				
			||||||
| 
						 | 
					@ -903,7 +905,7 @@ async def captcha_fail_member(bot, chat_id, user_id):
 | 
				
			||||||
        await captcha_fail_member_mute(bot, chat_id, user_id, user_name)
 | 
					        await captcha_fail_member_mute(bot, chat_id, user_id, user_name)
 | 
				
			||||||
    elif restriction == CMD["RESTRICTION"]["MEDIA"]:
 | 
					    elif restriction == CMD["RESTRICTION"]["MEDIA"]:
 | 
				
			||||||
        await captcha_fail_member_no_media(bot, chat_id, user_id, user_name)
 | 
					        await captcha_fail_member_no_media(bot, chat_id, user_id, user_name)
 | 
				
			||||||
    else: # restriction == CMD["RESTRICTION"]["KICK"]
 | 
					    else:  # restriction == CMD["RESTRICTION"]["KICK"]
 | 
				
			||||||
        await captcha_fail_member_kick(bot, chat_id, user_id, user_name)
 | 
					        await captcha_fail_member_kick(bot, chat_id, user_id, user_name)
 | 
				
			||||||
    # Remove join messages
 | 
					    # Remove join messages
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
| 
						 | 
					@ -1244,7 +1246,7 @@ async def chat_member_status_change(
 | 
				
			||||||
        # that requires it
 | 
					        # that requires it
 | 
				
			||||||
        if captcha_mode in ["poll", "button"]:
 | 
					        if captcha_mode in ["poll", "button"]:
 | 
				
			||||||
            await restrict_user_mute(bot, chat_id, join_user_id)
 | 
					            await restrict_user_mute(bot, chat_id, join_user_id)
 | 
				
			||||||
        else: # Restrict user to only allow send text messages
 | 
					        else:  # Restrict user to only allow send text messages
 | 
				
			||||||
            await restrict_user_media(bot, chat_id, join_user_id)
 | 
					            await restrict_user_media(bot, chat_id, join_user_id)
 | 
				
			||||||
        logger.info("[%s] Captcha send process completed.", chat_id)
 | 
					        logger.info("[%s] Captcha send process completed.", chat_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3948,11 +3950,11 @@ async def tlg_app_exit(app: Application) -> None:
 | 
				
			||||||
    Global.force_exit = True
 | 
					    Global.force_exit = True
 | 
				
			||||||
    if Global.async_captcha_timeout is not None:
 | 
					    if Global.async_captcha_timeout is not None:
 | 
				
			||||||
        if not Global.async_captcha_timeout.done():
 | 
					        if not Global.async_captcha_timeout.done():
 | 
				
			||||||
            logger.info("Waiting end of coroutine: captcha_timeout()")
 | 
					            logger.info("Waiting coroutine end: captcha_timeout()")
 | 
				
			||||||
            await Global.async_captcha_timeout
 | 
					            await Global.async_captcha_timeout
 | 
				
			||||||
    if Global.async_auto_delete_messages is not None:
 | 
					    if Global.async_auto_delete_messages is not None:
 | 
				
			||||||
        if not Global.async_auto_delete_messages.done():
 | 
					        if not Global.async_auto_delete_messages.done():
 | 
				
			||||||
            logger.info("Waiting end of coroutine: async_auto_delete_messages()")
 | 
					            logger.info("Waiting coroutine end: async_auto_delete_messages()")
 | 
				
			||||||
            await Global.async_auto_delete_messages
 | 
					            await Global.async_auto_delete_messages
 | 
				
			||||||
    # Save current session data
 | 
					    # Save current session data
 | 
				
			||||||
    save_session()
 | 
					    save_session()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,8 @@ Version:
 | 
				
			||||||
'''
 | 
					'''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
### Imported modules
 | 
					# Imported modules
 | 
				
			||||||
 | 
					###############################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# JSON Library
 | 
					# JSON Library
 | 
				
			||||||
import json
 | 
					import json
 | 
				
			||||||
| 
						 | 
					@ -33,8 +34,10 @@ from sys import exit as sys_exit
 | 
				
			||||||
# Local Constants Library
 | 
					# Local Constants Library
 | 
				
			||||||
from constants import CONST
 | 
					from constants import CONST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					###############################################################################
 | 
				
			||||||
 | 
					# Auxiliary Functions
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
### Auxiliary Functions
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
def is_valid(lang_name, lang_to_check, reference_lang):
 | 
					def is_valid(lang_name, lang_to_check, reference_lang):
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
| 
						 | 
					@ -62,8 +65,10 @@ def is_valid(lang_name, lang_to_check, reference_lang):
 | 
				
			||||||
    print(f"{lang_name} - OK")
 | 
					    print(f"{lang_name} - OK")
 | 
				
			||||||
    return True
 | 
					    return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					###############################################################################
 | 
				
			||||||
 | 
					# Main Function
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
### Main Function
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
    '''Main Function.'''
 | 
					    '''Main Function.'''
 | 
				
			||||||
| 
						 | 
					@ -92,7 +97,8 @@ def main():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
### Runnable Main Script Detection
 | 
					# Runnable Main Script Detection
 | 
				
			||||||
 | 
					###############################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
    sys_exit(main())
 | 
					    sys_exit(main())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ Version:
 | 
				
			||||||
###############################################################################
 | 
					###############################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from os import path as os_path
 | 
					from os import path as os_path
 | 
				
			||||||
from os import environ as os_environ
 | 
					# from os import environ as os_environ
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Actual settings.py full path directory name
 | 
					# Actual settings.py full path directory name
 | 
				
			||||||
SCRIPT_PATH = os_path.dirname(os_path.realpath(__file__))
 | 
					SCRIPT_PATH = os_path.dirname(os_path.realpath(__file__))
 | 
				
			||||||
| 
						 | 
					@ -51,15 +51,15 @@ SETTINGS = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Certificate file path (this is not used if
 | 
					    # Bot Webhook Certificate file path (this is not used if
 | 
				
			||||||
    # WEBHOOK_HOST is None)
 | 
					    # WEBHOOK_HOST is None)
 | 
				
			||||||
    "CAPTCHABOT_WEBHOOK_CERT" : SCRIPT_PATH + "/cert.pem",
 | 
					    "CAPTCHABOT_WEBHOOK_CERT": SCRIPT_PATH + "/cert.pem",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Certificate private key file path (this is not used
 | 
					    # Bot Webhook Certificate private key file path (this is not used
 | 
				
			||||||
    # if WEBHOOK_HOST is None)
 | 
					    # if WEBHOOK_HOST is None)
 | 
				
			||||||
    "CAPTCHABOT_WEBHOOK_CERT_PRIV_KEY" : SCRIPT_PATH + "/private.key",
 | 
					    "CAPTCHABOT_WEBHOOK_CERT_PRIV_KEY": SCRIPT_PATH + "/private.key",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bot Webhook Secret Token to verify request from Telegram Server
 | 
					    # Bot Webhook Secret Token to verify request from Telegram Server
 | 
				
			||||||
    # (don't use the Bot Token, for security reason it must be other)
 | 
					    # (don't use the Bot Token, for security reason it must be other)
 | 
				
			||||||
    "CAPTCHABOT_WEBHOOK_SECRET_TOKEN" : None,
 | 
					    "CAPTCHABOT_WEBHOOK_SECRET_TOKEN": None,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Chats directory path
 | 
					    # Chats directory path
 | 
				
			||||||
    "CAPTCHABOT_CHATS_DIR": SCRIPT_PATH + "/data/chats",
 | 
					    "CAPTCHABOT_CHATS_DIR": SCRIPT_PATH + "/data/chats",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Ładowanie…
	
		Reference in New Issue