class Config(object): LOGGER = True APP_ID = int(os.environ.get("APP_ID", 6)) LANG = os.environ.get("LANG", "en") PM_AUTO_BAN = sb(os.environ.get("PM_AUTO_BAN", "False")) CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) DB_URI = os.environ.get("DATABASE_URL", None) OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None) REM_BG_API_KEY = os.environ.get("REM_BG_API_KEY", None) CHROME_DRIVER = os.environ.get("CHROME_DRIVER", "/usr/bin/chromedriver") GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN", "/usr/bin/google-chrome") HEROKU_MEMEZ = sb(os.environ.get("HEROKU_MEMEZ", "False")) HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None) HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None) PMPERMIT_PIC = os.environ.get("PMPERMIT_PIC", None) HELP_EMOJI = os.environ.get("HELP_EMOJI", None) AUTONAME = os.environ.get("AUTONAME", None) CUSTOM_PMPERMIT = os.environ.get("CUSTOM_PMPERMIT", None) OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None) ANTI_SPAMBOT = sb(os.environ.get("ANTI_SPAMBOT", "False")) PRIVATE_GROUP_BOT_API_ID = os.environ.get("PRIVATE_GROUP_BOT_API_ID", None) ANTI_SPAMBOT_SHOUT = sb(os.environ.get("ANTI_SPAMBOT_SHOUT", "False")) #YOUTUBE_API_KEY = os.environ.get("YOUTUBE_API_KEY", None) ALIVE_NAME = os.environ.get("ALIVE_NAME", None) WOLFRAM_ID = os.environ.get("WOLFRAM_ID", None) LESS_SPAMMY = os.environ.get("LESS_SPAMMY", True) COUNTRY = str(os.environ.get("COUNTRY", "")) TZ_NUMBER = int(os.environ.get("TZ_NUMBER", 1)) CLEAN_WELCOME = sb(os.environ.get("CLEAN_WELCOME", "True")) SPAMWATCH_API = os.environ.get("SPAMWATCH_API", None) ANTISPAM_SYSTEM = os.environ.get("ANTISPAM_SYSTEM", "DISABLE") WHITE_CHAT = PRIVATE_GROUP_ID = int(os.environ.get("WHITE_CHAT", False)) BIO_PREFIX = os.environ.get("BIO_PREFIX", None) DEFAULT_BIO = os.environ.get("DEFAULT_BIO", None) LASTFM_API = os.environ.get("LASTFM_API", None) LASTFM_SECRET = os.environ.get("LASTFM_SECRET", None) LASTFM_USERNAME = os.environ.get("LASTFM_USERNAME", None) LASTFM_PASSWORD_PLAIN = os.environ.get("LASTFM_PASSWORD", None) LASTFM_PASS = pylast.md5(LASTFM_PASSWORD_PLAIN) if not LASTFM_USERNAME == "None": lastfm = pylast.LastFMNetwork( api_key=LASTFM_API, api_secret=LASTFM_SECRET, username=LASTFM_USERNAME, password_hash=LASTFM_PASS, ) else: lastfm = None G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID", None) G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET", None) G_DRIVE_AUTH_TOKEN_DATA = os.environ.get("G_DRIVE_AUTH_TOKEN_DATA", None) GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", None) TEMP_DOWNLOAD_DIRECTORY = os.environ.get("TEMP_DOWNLOAD_DIRECTORY", "./downloads") BOTLOG = sb(os.environ.get("BOTLOG", "False")) TZ = os.environ.get("TZ", "Asia/Kolkata") API_HASH = os.environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e") CLEAN_GROUPS = os.environ.get("CLEAN_GROUPS", False) ENABLE_HAREM = os.environ.get("ENABLE_HAREM", False) STRING_SESSION = os.environ.get("STRING_SESSION", None) DB_URI = os.environ.get("DATABASE_URL", None) TEMP_DOWNLOAD_DIRECTORY = os.environ.get("TEMP_DOWNLOAD_DIRECTORY", "./WhiteEyeUserBot/DOWNLOADS/") LOGGER = True GITHUB_ACCESS_TOKEN = os.environ.get("GITHUB_ACCESS_TOKEN", None) GIT_REPO_NAME = os.environ.get("GIT_REPO_NAME", None) # Here for later purposes SUDO_USERS = set(int(x) for x in os.environ.get("SUDO_USERS", "").split()) LYDIA_API_KEY = os.environ.get("LYDIA_API_KEY", None) ALIVE_NAME = os.environ.get("ALIVE_NAME", "FridayUser") LESS_SPAMMY = os.environ.get("LESS_SPAMMY", None) HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None) HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None) TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN", None) # Send .get_id in any channel to fill this value. PLUGIN_CHANNEL = int(os.environ.get("PLUGIN_CHANNEL", -100)) NO_SONGS = bool(os.environ.get("NO_SONGS", False)) PING_SERVERS = bool(os.environ.get("PING_SERVERS", False)) DOWNLOAD_PFP_URL_CLOCK = os.environ.get("DOWNLOAD_PFP_URL_CLOCK", None) G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID", None) G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET", None) GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", "root") AUTH_TOKEN_DATA = os.environ.get("AUTH_TOKEN_DATA", None) MAX_FLOOD_IN_P_M_s = int(os.environ.get("MAX_FLOOD_IN_P_M_s", 3)) if AUTH_TOKEN_DATA is not None: if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY): os.makedirs(TEMP_DOWNLOAD_DIRECTORY) t_file = open(TEMP_DOWNLOAD_DIRECTORY + "auth_token.txt", "w") t_file.write(AUTH_TOKEN_DATA) t_file.close() PRIVATE_GROUP_ID = int(os.environ.get("PRIVATE_GROUP_ID", False)) NEWS_CHANNEL_ID = int(os.environ.get("NEWS_CHANNEL_ID", -100)) SPAMWATCH_API = os.environ.get("SPAMWATCH_API", None) ANTISPAM_SYSTEM = os.environ.get("ANTISPAM_SYSTEM", "DISABLE") WHITE_CHAT = set(int(x) for x in os.environ.get("WHITE_CHAT", "").split()) # Get this value from my.telegram.org! Please do not steal LOCATION = os.environ.get("LOCATION", None) ALIVE_TEXT = os.environ.get("ALIVE_TEXT", None) OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None) STRING_SESSION_2 = os.environ.get("STRING_SESSION_2", None) STRING_SESSION_3 = os.environ.get("STRING_SESSION_3", None) VIRUSTOTAL_API_KEY = os.environ.get("VIRUSTOTAL_API_KEY", None) GPLINKS_API_KEY = os.environ.get("GPLINKS_API_KEY", None) NSFW_FILTER_PM = os.environ.get("NSFW_FILTER_PM", True) SUPERHERO_API_KEY = os.environ.get("SUPERHERO_API_KEY", None) FOOTBALL_API_KEY = os.environ.get("FOOTBALL_API_KEY", None) SUB_TO_MSG_ASSISTANT = os.environ.get("SUB_TO_MSG_ASSISTANT", False) AUTO_SPELL_FIX = os.environ.get("AUTO_SPELL_FIX", False) # Get your own ACCESS_KEY from http://api.screenshotlayer.com/api/capture SCREEN_SHOT_LAYER_ACCESS_KEY = os.environ.get( "SCREEN_SHOT_LAYER_ACCESS_KEY", None) # Send .get_id in any group to fill this value. # This is required for the modules involving the file system. TMP_DOWNLOAD_DIRECTORY = os.environ.get("TMP_DOWNLOAD_DIRECTORY", "./DOWNLOADS/") # This is required for the speech to text module. Get your USERNAME from https://console.bluemix.net/docs/services/speech-to-text/getting-started.html IBM_WATSON_CRED_URL = os.environ.get("IBM_WATSON_CRED_URL", None) IBM_WATSON_CRED_PASSWORD = os.environ.get("IBM_WATSON_CRED_PASSWORD", None) # This is required for the hash to torrent file functionality to work. TELEGRAPH_SHORT_NAME = os.environ.get("TELEGRAPH_SHORT_NAME", "WhiteEye") # Get a Free API Key from OCR.Space OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None) DEEP_API_KEY = os.environ.get("DEEP_API_KEY", None) PING_SERVER_EVERY_MINUTE_VALUE = int( os.environ.get("PING_SERVER_EVERY_MINUTE_VALUE", 30)) DEEZER_ARL_TOKEN = os.environ.get("DEEZER_ARL_TOKEN", None) NOSPAMPLUS_TOKEN = os.environ.get("NOSPAMPLUS_TOKEN", None) # Send .get_id in any group with all your administration bots (added) G_BAN_LOGGER_GROUP = int( os.environ.get("G_BAN_LOGGER_GROUP", -1001198699233)) # TG API limit. An album can have atmost 10 media! GOOGLE_SEARCH_COUNT_LIMIT = int( os.environ.get("GOOGLE_SEARCH_COUNT_LIMIT", 9)) TG_GLOBAL_ALBUM_LIMIT = int(os.environ.get("TG_GLOBAL_ALBUM_LIMIT", 9)) PRIVATE_GROUP_BOT_API_ID = int( os.environ.get("PRIVATE_GROUP_BOT_API_ID", False)) DISABLE_MARKDOWN = os.environ.get("DISABLE_MARKDOWN", False) # Load Spammy Plugins, Which can be harmful. LOAD_OTHER_PLUGINS = os.environ.get("LOAD_OTHER_PLUGINS", False) LOAD_OTHER_PLUGINS_CHNNL = os.environ.get("LOAD_OTHER_PLUGINS_CHNNL", "@WhiteEyeplugins") # # DO NOT EDIT BELOW THIS LINE IF YOU DO NOT KNOW WHAT YOU ARE DOING # TG API limit. A message can have maximum 4096 characters! MAX_MESSAGE_SIZE_LIMIT = 4095 # set blacklist_chats where you do not want fridaybot's features UB_BLACK_LIST_CHAT = set( int(x) for x in os.environ.get("UB_BLACK_LIST_CHAT", "").split()) # maximum number of messages for antiflood MAX_ANTI_FLOOD_MESSAGES = 10 # warn mode for anti flood ANTI_FLOOD_WARN_MODE = ChatBannedRights(until_date=None, view_messages=None, send_messages=True) # chat ids or usernames, it is recommended to use chat ids, # providing usernames means an additional overhead for the user CHATS_TO_MONITOR_FOR_ANTI_FLOOD = [] # Get your own API key from https://www.remove.bg/ or # feel free to use http://telegram.dog/Remove_BGBot REM_BG_API_KEY = os.environ.get("REM_BG_API_KEY", None) # Set to True if you want to block users that are spamming your PMs. SLAP_USERNAME = os.environ.get("SLAP_USERNAME", None) GITHUB_ACCESS_TOKEN = os.environ.get("GITHUB_ACCESS_TOKEN", None) GIT_REPO_NAME = os.environ.get("GIT_REPO_NAME", None) NO_P_M_SPAM = bool(os.environ.get("NO_P_M_SPAM", False)) # define "spam" in PMs NO_SONGS = bool(os.environ.get("NO_SONGS", False)) MAX_FLOOD_IN_P_M_s = int(os.environ.get("MAX_FLOOD_IN_P_M_s", 3)) # set to True if you want to log PMs to your PM_LOGGR_BOT_API_ID NC_LOG_P_M_S = bool(os.environ.get("NC_LOG_P_M_S", False)) # send .get_id in any channel to forward all your NEW PMs to this group PM_LOGGR_BOT_API_ID = os.environ.get("PM_LOGGR_BOT_API_ID", None) if PM_LOGGR_BOT_API_ID: PM_LOGGR_BOT_API_ID = int(PM_LOGGR_BOT_API_ID) # For Databases # can be None in which case modules requiring # DataBase would not work DB_URI = os.environ.get("DATABASE_URL", None) # number of rows of buttons to be displayed in .helpme command NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD = int( os.environ.get("NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD", 5)) # specify command handler that should be used for the modules # this should be a valid "regex" pattern COMMAND_HAND_LER = os.environ.get("COMMAND_HAND_LER", "\.") SUDO_COMMAND_HAND_LER = os.environ.get("SUDO_COMMAND_HAND_LER", "\.") BOT_HANDLER = os.environ.get("BOT_HANDLER", "^/") # specify list of users allowed to use bot # WARNING: be careful who you grant access to your bot. # malicious users could do ".exec rm -rf /*" SUDO_USERS = set(int(x) for x in os.environ.get("SUDO_USERS", "").split()) WHITELIST_USERS = set( int(x) for x in os.environ.get("WHITELIST_USERS", "").split()) BLACKLIST_USERS = set( int(x) for x in os.environ.get("BLACKLIST_USERS", "").split()) DEVLOPERS = set(int(x) for x in os.environ.get("DEVLOPERS", "").split()) OWNER_ID = set(int(x) for x in os.environ.get("OWNER_ID", "").split()) SUPPORT_USERS = set( int(x) for x in os.environ.get("SUPPORT_USERS", "").split()) # Very Stream VERY_STREAM_LOGIN = os.environ.get("VERY_STREAM_LOGIN", None) VERY_STREAM_KEY = os.environ.get("VERY_STREAM_KEY", None) GROUP_REG_SED_EX_BOT_S = os.environ.get( "GROUP_REG_SED_EX_BOT_S", r"(regex|moku|BananaButler_|rgx|l4mR)bot") TEMP_DIR = os.environ.get("TEMP_DIR", None) CHANNEL_ID = int(os.environ.get("CHANNEL_ID", -100)) # Google Chrome Stuff CHROME_DRIVER = os.environ.get("CHROME_DRIVER", "/usr/bin/chromedriver") GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN", "/usr/bin/google-chrome") # Google Drive () G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID", None) G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET", None) GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", None) AUTH_TOKEN_DATA = os.environ.get("AUTH_TOKEN_DATA", None) if AUTH_TOKEN_DATA != None: os.makedirs(TMP_DOWNLOAD_DIRECTORY) t_file = open(TMP_DOWNLOAD_DIRECTORY + "auth_token.txt", "w") t_file.write(AUTH_TOKEN_DATA) t_file.close() #YOUTUBE_API_KEY = os.environ.get("YOUTUBE_API_KEY", None) GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", None) # MongoDB MONGO_URI = os.environ.get("MONGO_URI", None) # Lydia API LYDIA_API = os.environ.get("LYDIA_API", None) PRIVATE_GROUP_ID = int(os.environ.get("PRIVATE_GROUP_ID", False)) PLUGIN_CHANNEL = int(os.environ.get("PLUGIN_CHANNEL", False)) NEWS_CHANNEL_ID = int(os.environ.get("NEWS_CHANNEL_ID", False)) TG_BOT_USERNAME = os.environ.get("TG_BOT_USERNAME", None) JTM_CHANNEL_ID = int(os.environ.get("JTM_CHANNEL_ID", False)) JTM_CHANNEL_USERNAME = os.environ.get("JTM_CHANNEL_USERNAME", None) FBAN_GROUP = int(os.environ.get("FBAN_GROUP", False)) PM_DATA = os.environ.get("PM_DATA", "ENABLE") ENABLE_ASSISTANTBOT = os.environ.get("ENABLE_ASSISTANTBOT", "ENABLE") TAG_FEATURE = os.environ.get("TAG_FEATURE", "DISABLE") ANTISPAM_FEATURE = os.environ.get("ANTISPAM_FEATURE", "ENABLE") ASSISTANT_LOG = int(os.environ.get("ASSISTANT_LOG", False)) UPSTREAM_REPO = os.environ.get( "UPSTREAM_REPO", "https://github.com/WhiteEyeOrg/WhiteEyeUserBot") ALIVE_IMAGE = os.environ.get( "ALIVE_IMAGE", "https://telegra.ph/file/28d9b7eb6ef941325bc64.jpg") ASSISTANT_START_PIC = os.environ.get( "ASSISTANT_START_PIC", "https://i.pinimg.com/236x/f9/93/49/f993498ace7affc1fe50262f69f1cc2e.jpg", ) TESSDATA_PREFIX = os.environ.get("TESSDATA_PREFIX", "/usr/share/tesseract-ocr/4.00/tessdata")
catversion = "2.6.0" if Var.STRING_SESSION: session_name = str(Var.STRING_SESSION) bot = TelegramClient(StringSession(session_name), Var.APP_ID, Var.API_HASH) else: session_name = "startup" bot = TelegramClient(session_name, Var.APP_ID, Var.API_HASH) # PaperPlaneExtended Support Vars ENV = os.environ.get("ENV", False) CAT_ID = ["1035034432", "551290198"] # Bot Logs setup: if bool(ENV): CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) # Check if the config was edited by using the already used variable. # Basically, its the 'virginity check' for the config file ;) CONFIG_CHECK = os.environ.get( "___________PLOX_______REMOVE_____THIS_____LINE__________", None)
session_name = "startup" bot = TelegramClient(session_name, Var.APP_ID, Var.API_HASH) CMD_LIST = {} # for later purposes CMD_HELP = {} INT_PLUG = "" LOAD_PLUG = {} # PaperPlaneExtended Support Vars ENV = os.environ.get("ENV", False) """ PPE initialization. """ # Bot Logs setup: if bool(ENV): CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) # Check if the config was edited by using the already used variable. # Basically, its the 'virginity check' for the config file ;) CONFIG_CHECK = os.environ.get(
else: bot = TelegramClient( "TG_BOT_TOKEN", api_id=Var.APP_ID, api_hash=Var.API_HASH).start(bot_token=Var.STRING_SESSION) else: session_name = "startup" bot = TelegramClient(session_name, Var.APP_ID, Var.API_HASH) # PaperPlaneExtended Support Vars ENV = os.environ.get("ENV", False) CAT_ID = ["1035034432", "551290198"] # Bot Logs setup: if bool(ENV): CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) # Check if the config was edited by using the already used variable. # Basically, its the 'virginity check' for the config file ;) CONFIG_CHECK = os.environ.get( "___________PLOX_______REMOVE_____THIS_____LINE__________", None)
class Config: LOGGER = True # Get this value from my.telegram.org! Please do not steal APP_ID = int(os.environ.get("APP_ID", 6)) API_HASH = os.environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e") # string session for running on Heroku # some people upload their session files on GitHub or other third party hosting # websites, this might prevent the un-authorized use of the # confidential session files HU_STRING_SESSION = os.environ.get("HU_STRING_SESSION", None) # Get your own APPID from https://api.openweathermap.org/data/2.5/weather OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None) # Send .get_id in any group to fill this value. PRIVATE_GROUP_BOT_API_ID = os.environ.get("PRIVATE_GROUP_BOT_API_ID", None) if PRIVATE_GROUP_BOT_API_ID: PRIVATE_GROUP_BOT_API_ID = int(PRIVATE_GROUP_BOT_API_ID) # tag channel TAG_CHANNEL = os.environ.get("TAG_CHANNEL", None) if TAG_CHANNEL: TAG_CHANNEL = int(TAG_CHANNEL) # Send .get_id in any channel to fill this value. ReQuired for @Manuel15 inspiration to work! PRIVATE_CHANNEL_BOT_API_ID = os.environ.get("PRIVATE_CHANNEL_BOT_API_ID", None) if PRIVATE_CHANNEL_BOT_API_ID: PRIVATE_CHANNEL_BOT_API_ID = int(PRIVATE_CHANNEL_BOT_API_ID) # This is required for the plugins involving the file system. TMP_DOWNLOAD_DIRECTORY = os.environ.get("TMP_DOWNLOAD_DIRECTORY", "./DOWNLOADS/") # This is required for the speech to text module. Get your USERNAME from https://console.bluemix.net/docs/services/speech-to-text/getting-started.html IBM_WATSON_CRED_URL = os.environ.get("IBM_WATSON_CRED_URL", None) IBM_WATSON_CRED_PASSWORD = os.environ.get("IBM_WATSON_CRED_PASSWORD", None) IBM_WATSON_CRED_USERNAME = os.environ.get("IBM_WATSON_CRED_USERNAME", None) # This is required for the hash to torrent file functionality to work. HASH_TO_TORRENT_API = os.environ.get("HASH_TO_TORRENT_API", "https://example.com/torrent/{}") # This is required for the @telegraph functionality. TELEGRAPH_SHORT_NAME = os.environ.get("TELEGRAPH_SHORT_NAME", "UniBorg") # Get a Free API Key from OCR.Space OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None) # Send .get_id in any group with all your administration bots (added) G_BAN_LOGGER_GROUP = os.environ.get("G_BAN_LOGGER_GROUP", None) if G_BAN_LOGGER_GROUP: G_BAN_LOGGER_GROUP = int(G_BAN_LOGGER_GROUP) # TG API limit. An album can have atmost 10 media! TG_GLOBAL_ALBUM_LIMIT = int(os.environ.get("TG_GLOBAL_ALBUM_LIMIT", 9)) # Telegram BOT Token from @BotFather TG_BOT_TOKEN_BF_HER = os.environ.get("TG_BOT_TOKEN_BF_HER", None) TG_BOT_USER_NAME_BF_HER = os.environ.get("TG_BOT_USER_NAME_BF_HER", None) # NC_LOG_P_M_S = bool(os.environ.get("NC_LOG_P_M_S", False)) # # DO NOT EDIT BELOW THIS LINE IF YOU DO NOT KNOW WHAT YOU ARE DOING # TG API limit. A message can have maximum 4096 characters! MAX_MESSAGE_SIZE_LIMIT = 4095 # set blacklist_chats where you do not want userbot's features UB_BLACK_LIST_CHAT = { int(x) for x in os.environ.get("UB_BLACK_LIST_CHAT", "").split() } # specify LOAD and NO_LOAD LOAD = [] # folowing plugins won't work on Heroku, # because of their ephemeral file system NO_LOAD = ["antispam"] # Get your own API key from https://www.remove.bg/ or # feel free to use http://telegram.dog/Remove_BGBot REM_BG_API_KEY = os.environ.get("REM_BG_API_KEY", None) # For Databases # can be None in which case plugins requiring # DataBase would not work DB_URI = os.environ.get("DATABASE_URL", None) # number of rows of buttons to be displayed in .helpme command NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD = int( os.environ.get("NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD", 5)) # specify command handler that should be used for the plugins # this should be a valid "regex" pattern COMMAND_HAND_LER = os.environ.get("COMMAND_HAND_LER", "\.") # specify list of users allowed to use bot # WARNING: be careful who you grant access to your bot. # malicious users could do ".exec rm -rf /*" SUDO_USERS = {int(x) for x in os.environ.get("SUDO_USERS", "").split()} # VeryStream only supports video formats VERY_STREAM_LOGIN = os.environ.get("VERY_STREAM_LOGIN", None) VERY_STREAM_KEY = os.environ.get("VERY_STREAM_KEY", None) # Google Drive () IS_TEAM_DRIVE = os.environ.get("IS_TEAM_DRIVE", False) G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID", None) G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET", None) GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", "root") # TELE_GRAM_2FA_CODE = os.environ.get("TELE_GRAM_2FA_CODE", None) # GROUP_REG_SED_EX_BOT_S = os.environ.get( "GROUP_REG_SED_EX_BOT_S", r"(regex|moku|BananaButler_|rgx|l4mR)bot") # rapidleech plugins OPEN_LOAD_LOGIN = os.environ.get("OPEN_LOAD_LOGIN", "0") OPEN_LOAD_KEY = os.environ.get("OPEN_LOAD_KEY", "0") # Google Chrome Selenium Stuff # taken from https://github.com/jaskaranSM/UniBorg/blob/9072e3580cc6c98d46f30e41edbe73ffc9d850d3/sample_config.py#L104-L106 GOOGLE_CHROME_DRIVER = os.environ.get("GOOGLE_CHROME_DRIVER", None) GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN", None) # spotify stuff DEFAULT_BIO = os.environ.get("DEFAULT_BIO", None) SPOTIFY_INITIAL_BIO = os.environ.get("SPOTIFY_INITIAL_BIO", None) SPOTIFY_BIO_PREFIX = os.environ.get("SPOTIFY_BIO_PREFIX", None) SPOTIFY_KEY = os.environ.get("SPOTIFY_KEY", None) SPOTIFY_DC = os.environ.get("SPOTIFY_DC", None) LYDIA_API = os.environ.get("LYDIA_API", None) DEFAULT_NAME = os.environ.get("DEFAULT_NAME", None) # # define "spam" in PMs MAX_FLOOD_IN_P_M_s = int(os.environ.get("MAX_FLOOD_IN_P_M_s", 3)) # leave this blank, should be automatically filled for Heroku.com users PM_LOGGR_BOT_API_ID = os.environ.get("PM_LOGGR_BOT_API_ID", None) if PM_LOGGR_BOT_API_ID: PM_LOGGR_BOT_API_ID = int(PM_LOGGR_BOT_API_ID) # define the "types" that should be uplaoded as streamable TL_VID_STREAM_TYPES = ("MKV", "MP4", "WEBM") TL_MUS_STREAM_TYPES = ("MP3", "WAV", "FLAC") YOUTUBE_API_KEY = os.environ.get("YOUTUBE_API_KEY", None) ANTI_SPAMBOT = os.environ.get("ANTI_SPAMBOT", None) ANTI_SPAMBOT_SHOUT = os.environ.get("ANTI_SPAMBOT_SHOUT", None) # API_TOKEN for quote plugin API_TOKEN = os.environ.get("API_TOKEN", None) # MONGO_DB_URI = os.environ.get("MONGO_DB_URI", None) BOTLOG = os.environ.get("BOTLOG", None) # MONGOCLIENT = pymongo.MongoClient(MONGO_DB_URI) # MONGO = MONGOCLIENT.userbot # MIRRORACE KEY MIRROR_ACE_API_KEY = os.environ.get("MIRROR_ACE_API_KEY", None) MIRROR_ACE_API_TOKEN = os.environ.get("MIRROR_ACE_API_TOKEN", None) # RSS_POST_MSG_GROUP_ID = map(int, os.environ.get("RSS_POST_MSG_GROUP_ID", None).split()) RSS_POST_MSG_GROUP_ID = os.environ.get("RSS_POST_MSG_GROUP_ID", None) if RSS_POST_MSG_GROUP_ID: RSS_POST_MSG_GROUP_ID = int(RSS_POST_MSG_GROUP_ID) SPAM_WATCH_API = os.environ.get("SPAM_WATCH_API", None) SPAM_WATCHAPI = os.environ.get("SPAM_WATCHAPI", None) SPAM_WATCH_LOG_CHANNEL = os.environ.get("SPAM_WATCH_LOG_CHANNEL", None) if SPAM_WATCH_LOG_CHANNEL: SPAM_WATCH_LOG_CHANNEL = int(SPAM_WATCH_LOG_CHANNEL) # Userbot logging feature switch. LOGSPAMMER = sb(os.environ.get("LOGSPAMMER", None)) MONGO_DB_URI = os.environ.get("MONGO_DB_URI", None) # Google Photos () G_PHOTOS_CLIENT_ID = os.environ.get("G_PHOTOS_CLIENT_ID", None) G_PHOTOS_CLIENT_SECRET = os.environ.get("G_PHOTOS_CLIENT_SECRET", None) G_PHOTOS_AUTH_TOKEN_ID = int( os.environ.get("G_PHOTOS_AUTH_TOKEN_ID", "-100")) # Heroku stuff HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None) HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None) # for video trimming and screenshot plugins FF_MPEG_DOWN_LOAD_MEDIA_PATH = os.environ.get( "FF_MPEG_DOWN_LOAD_MEDIA_PATH", None) INSTA_ID = os.environ.get("INSTA_ID", None) INSTA_PASS = os.environ.get("INSTA_PASS", None) # github api and update plugin UPSTREAM_REPO_URL = "https://github.com/muhammedfurkan/TelethonUserBot.git"
from sys import version_info from logging import basicConfig, getLogger, INFO, DEBUG from distutils.util import strtobool as sb from pylast import LastFMNetwork, md5 from pySmartDL import SmartDL from dotenv import load_dotenv from requests import get from telethon import TelegramClient from telethon.sessions import StringSession load_dotenv("config.env") # Bot Logs setup: CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) if version_info[0] < 3 or version_info[1] < 8: LOGS.info("You MUST have a python version of at least 3.8." "Multiple features depend on this. Bot quitting.") quit(1)
import os from sys import version_info from logging import basicConfig, getLogger, INFO, DEBUG from distutils.util import strtobool as sb from dotenv import load_dotenv from requests import get from telethon import TelegramClient from telethon.sessions import StringSession load_dotenv("config.env") # Logger setup: CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) if version_info[0] < 3 or version_info[1] < 6: LOGS.error("You MUST have a python version of at least 3.6." " Multiple features depend on this. Bot quitting.") quit(1)
import os from distutils.util import strtobool as sb from logging import basicConfig, getLogger, INFO, DEBUG from sys import version_info import pylast from dotenv import load_dotenv from requests import get from telethon import TelegramClient from telethon.sessions import StringSession load_dotenv("config.env") CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) # Bot Logs setup if CONSOLE_LOGGER_VERBOSE: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) if version_info[0] < 3 or version_info[1] < 6: LOGS.error("You MUST have a python version of at least 3.6." "Multiple features depend on this. Bot quitting.") quit(1) ENV = bool(os.environ.get('ENV', False))
from pySmartDL import SmartDL from dotenv import load_dotenv from sqlite3 import connect from requests import get from telethon.tl.functions.channels import JoinChannelRequest, LeaveChannelRequest from telethon.sync import TelegramClient, custom from telethon.sessions import StringSession from telethon.events import callbackquery, InlineQuery, NewMessage from .utils.pip_install import install_pip from .helps import timehelper as timesiri from math import ceil load_dotenv("config.env") # Bot günlükleri kurulumu: CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) ASYNC_POOL = [] if CONSOLE_LOGGER_VERBOSE: basicConfig( level=DEBUG, format="[%(asctime)s - %(levelname)s] - @SiriOT : %(message)s", datefmt='%d-%b-%y %H:%M:%S') else: basicConfig( level=INFO, format="[%(asctime)s - %(levelname)s] - @SiriOT : %(message)s", datefmt='%d-%b-%y %H:%M:%S') LOGS = getLogger(__name__)
class Config: LOGGER = True # Get this value from my.telegram.org! Please do not steal APP_ID = int(os.environ.get("APP_ID", 6)) API_HASH = os.environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e") # string session for running on Heroku # some people upload their session files on GitHub or other third party hosting # websites, this might prevent the un-authorized use of the # confidential session files HU_STRING_SESSION = os.environ.get("HU_STRING_SESSION", None) # for alive ALIVE_PIC = os.environ.get( "ALIVE_PIC", "https://telegra.ph/file/ba9acea0064aaed188195.jpg") ALIVE_NAME = os.environ.get("ALIVE_NAME", None) # Get your own APPID from https://api.openweathermap.org/data/2.5/weather OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None) # Get your own ACCESS_KEY from http://api.screenshotlayer.com/api/capture SCREEN_SHOT_LAYER_ACCESS_KEY = os.environ.get( "SCREEN_SHOT_LAYER_ACCESS_KEY", None) # Send .get_id in any group to fill this value. PRIVATE_GROUP_BOT_API_ID = os.environ.get("PRIVATE_GROUP_BOT_API_ID", None) if PRIVATE_GROUP_BOT_API_ID: PRIVATE_GROUP_BOT_API_ID = int(PRIVATE_GROUP_BOT_API_ID) # Send .g_id in any channel to fill this value. PRIVATE_CHANNEL_BOT_API_ID = os.environ.get("PRIVATE_CHANNEL_BOT_API_ID", None) if PRIVATE_CHANNEL_BOT_API_ID: PRIVATE_CHANNEL_BOT_API_ID = int(PRIVATE_CHANNEL_BOT_API_ID) # This is required for the plugins involving the file system. TMP_DOWNLOAD_DIRECTORY = os.environ.get("TMP_DOWNLOAD_DIRECTORY", "./pepe/") # This is required for the speech to text module. Get your USERNAME from # https://console.bluemix.net/docs/services/speech-to-text/getting-started.html IBM_WATSON_CRED_URL = os.environ.get("IBM_WATSON_CRED_URL", None) IBM_WATSON_CRED_PASSWORD = os.environ.get("IBM_WATSON_CRED_PASSWORD", None) # This is required for the hash to torrent file functionality to work. HASH_TO_TORRENT_API = os.environ.get("HASH_TO_TORRENT_API", "https://example.com/torrent/{}") # This is required for the @telegraph functionality. TELEGRAPH_SHORT_NAME = os.environ.get("TELEGRAPH_SHORT_NAME", "Kirito") # Get a Free API Key from OCR.Space OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None) # TG API limit. An album can have atmost 10 media! TG_GLOBAL_ALBUM_LIMIT = int(os.environ.get("TG_GLOBAL_ALBUM_LIMIT", 9)) # Telegram BOT Token from @BotFather TG_BOT_TOKEN_BF_HER = os.environ.get("TG_BOT_TOKEN_BF_HER", None) TG_BOT_USER_NAME_BF_HER = os.environ.get("TG_BOT_USER_NAME_BF_HER", None) # DO NOT EDIT BELOW THIS LINE IF YOU DO NOT KNOW WHAT YOU ARE DOING # TG API limit. A message can have maximum 4096 characters! MAX_MESSAGE_SIZE_LIMIT = 4095 # set blacklist_chats where you do not want userbot's features UB_BLACK_LIST_CHAT = { int(x) for x in os.environ.get("UB_BLACK_LIST_CHAT", "").split() } # specify LOAD and NO_LOAD LOAD = [] # Remove This To Make Them Work But Would Make Bot Unstable AF...⚡ NO_LOAD = [ "pmpermit", ] # Get your own API key from https://www.remove.bg/ or # feel free to use http://telegram.dog/Remove_BGBot REM_BG_API_KEY = os.environ.get("REM_BG_API_KEY", None) # Set to True if you want to block users that are spamming your PMs. SLAP_USERNAME = os.environ.get("SLAP_USERNAME", None) GITHUB_ACCESS_TOKEN = os.environ.get("GITHUB_ACCESS_TOKEN", None) GIT_REPO_NAME = os.environ.get("GIT_REPO_NAME", None) NO_P_M_SPAM = bool(os.environ.get("NO_P_M_SPAM", False)) # define "spam" in PMs MAX_FLOOD_IN_P_M_s = int(os.environ.get("MAX_FLOOD_IN_P_M_s", 3)) # set to True if you want to log PMs to your PM_LOGGR_BOT_API_ID NO_LOG_P_M_S = bool(os.environ.get("NO_LOG_P_M_S", True)) # send .get_id in any channel to forward all your NEW PMs to this group PM_LOGGR_BOT_API_ID = os.environ.get("PM_LOGGR_BOT_API_ID", None) if PM_LOGGR_BOT_API_ID: PM_LOGGR_BOT_API_ID = int(PM_LOGGR_BOT_API_ID) # For Databases # can be None in which case plugins requiring # DataBase would not work DB_URI = os.environ.get("DATABASE_URL", None) # number of rows of buttons to be displayed in .helpme command NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD = int( os.environ.get("NO_OF_BUTTONS_DISPLAYED_IN_H_ME_CMD", 5)) # specify command handler that should be used for the plugins # this should be a valid "regex" pattern COMMAND_HAND_LER = os.environ.get("COMMAND_HAND_LER", r"\.") # specify list of users allowed to use bot # WARNING: be careful who you grant access to your bot. # malicious users could do ".exec rm -rf /*" SUDO_USERS = set(int(x) for x in os.environ.get("SUDO_USERS", "").split()) # Temp TEMP_DIR = os.environ.get("TEMP_DIR", None) CHANNEL_ID = os.environ.get("CHANNEL_ID", None) # Google Drive () G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID", None) G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET", None) G_DRIVE_FOLDER_ID = os.environ.get("G_DRIVE_FOLDER_ID", None) G_DRIVE_AUTH_TOKEN_DATA = os.environ.get("G_DRIVE_AUTH_TOKEN_DATA", None) G_DRIVE_DATA = os.environ.get("G_DRIVE_DATA", None) G_DRIVE_INDEX_LINK = os.environ.get("G_DRIVE_INDEX_LINK", None) # Google Photos () G_PHOTOS_CLIENT_ID = os.environ.get("G_PHOTOS_CLIENT_ID", None) G_PHOTOS_CLIENT_SECRET = os.environ.get("G_PHOTOS_CLIENT_SECRET", None) G_PHOTOS_AUTH_TOKEN_ID = os.environ.get("G_PHOTOS_AUTH_TOKEN_ID", None) if G_PHOTOS_AUTH_TOKEN_ID: G_PHOTOS_AUTH_TOKEN_ID = int(G_PHOTOS_AUTH_TOKEN_ID) # TELE_GRAM_2FA_CODE = os.environ.get("TELE_GRAM_2FA_CODE", None) # GROUP_REG_SED_EX_BOT_S = os.environ.get( "GROUP_REG_SED_EX_BOT_S", r"(reg?(e)x|moku|BananaButler_|rgx|l4mR|Telethonian|pcre)bot", ) # Google Chrome Selenium Stuff # taken from # https://github.com/jaskaranSM/UniBorg/blob/9072e3580cc6c98d46f30e41edbe73ffc9d850d3/sample_config.py#L104-L106 GOOGLE_CHROME_DRIVER = os.environ.get("GOOGLE_CHROME_DRIVER", "/app/.apt/usr/bin/google-chrome") GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN", "/app/.chromedriver/bin/chromedriver") # LYDIA_API = os.environ.get("LYDIA_API", None) # Heroku Miscellaneous HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None) HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None) UPSTREAM_REPO_URL = os.environ.get("UPSTREAM_REPO_URL", "https://github.com/prono69/PepeBot") # CHROME_DRIVER = os.environ.get("CHROME_DRIVER", "/app/.chromedriver/bin/chromedriver") CHROME_BIN = os.environ.get("CHROME_BIN", "/app/.apt/usr/bin/google-chrome") # define "heroku_link" in conig_vars HEROKU_LINK = os.environ.get("HEROKU_LINK", None) # define "repo_link" in conig_vars REPO_LINK = os.environ.get("REPO_LINK", None) # define "repo_link" in conig_vars PACKS_CONTENT = os.environ.get("PACKS_CONTENT", None) # PACK_NAME = os.environ.get("PACK_NAME", None) # define "pack_name" in config_vars ANIM_PACK_NAME = os.environ.get("ANIM_PACK_NAME", None) # MIRRORACE STUFF MIRROR_ACE_API_KEY = os.environ.get("MIRROR_ACE_API_KEY", None) MIRROR_ACE_API_TOKEN = os.environ.get("MIRROR_ACE_API_TOKEN", None) # RAVANA_LEELA = os.environ.get("RAVANA_LEELA", None) # spotify stuff DEFAULT_BIO = os.environ.get("DEFAULT_BIO", None) SPOTIFY_KEY = os.environ.get("SPOTIFY_KEY", None) SPOTIFY_DC = os.environ.get("SPOTIFY_DC", None) DEFAULT_NAME = os.environ.get("DEFAULT_NAME", None) # MongoDB MONGO_URI = os.environ.get("MONGO_URI", None) # define the "types" that should be uplaoded as streamable TL_VID_STREAM_TYPES = ("MP4", "WEBM") TL_MUS_STREAM_TYPES = ("MP3", "WAV", "FLAC", "M4A") TL_FF_NOAQ_TYPES = "WEBP" # Uthob YOUTUBE_API_KEY = os.environ.get("YOUTUBE_API_KEY", None) # For Lol API_TOKEN = os.environ.get("API_TOKEN", None) THUMB_IMG = os.environ.get( "THUMB_IMG", "https://telegra.ph/file/c9377de879b53bc72b4ed.jpg") # BOTLOG BOTLOG = os.environ.get("BOTLOG", None) if BOTLOG: BOTLOG = int(BOTLOG) # For a Shitty Module KUTT_IT_API_KEY = os.environ.get("KUTT_IT_API_KEY", None) # lyrics plugin GENIUS = os.environ.get("GENIUS_API_TOKEN", None) # USER = os.environ.get("USER", None) # For watch module WATCH_COUNTRY = os.environ.get("WATCH_COUNTRY", None) # Deeer ARL Token DEEZER_ARL_TOKEN = os.environ.get("DEEZER_ARL_TOKEN", None) LOGSPAMMER = sb(os.environ.get("LOGSPAMMER", "True")) BOTLOOG = sb(os.environ.get("BOTLOOG", "True")) # SpamWatch Api SPAM_WATCH_API = os.environ.get("SPAM_WATCH_API", None) SPAM_WATCHAPI = os.environ.get("SPAM_WATCHAPI", None) # Uptobox USR_TOKEN = os.environ.get("USR_TOKEN_UPTOBOX", None) # for video trimming and screenshot plugins LT_QOAN_NOE_FF_MPEG_CTD = os.environ.get("LT_QOAN_NOE_FF_MPEG_CTD", None) LT_QOAN_NOE_FF_MPEG_URL = os.environ.get("LT_QOAN_NOE_FF_MPEG_URL", None) # Deep AI DEEP_AI = os.environ.get("DEEP_AI", None)
# """ Userbot initialization. """ import os import heroku3 from requests.exceptions import HTTPError from sys import version_info from logging import basicConfig, getLogger, INFO, DEBUG from distutils.util import strtobool as sb from telethon import TelegramClient from telethon.sessions import StringSession # Bot Logs setup: CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) if version_info < (3, 8): LOGS.info("You MUST have a python version of at least 3.8." "Multiple features depend on this. Bot quitting.") quit(1)
# Userbot Session String STRING_SESSION = os.environ.get("STRING_SESSION", None) STRING_2 = os.environ.get("STRING_2", None) STRING_3 = os.environ.get("STRING_3", None) STRING_4 = os.environ.get("STRING_4", None) STRING_5 = os.environ.get("STRING_5", None) # Logging channel/group ID configuration. BOTLOG_CHATID = int(os.environ.get("BOTLOG_CHATID") or 0) # Load or No Load modules LOAD = os.environ.get("LOAD", "").split() NO_LOAD = os.environ.get("NO_LOAD", "").split() # Bleep Blop, this is a bot ;) PM_AUTO_BAN = sb(os.environ.get("PM_AUTO_BAN", "True")) PM_LIMIT = int(os.environ.get("PM_LIMIT", 6)) # Custom Handler command CMD_HANDLER = os.environ.get("CMD_HANDLER") or "." SUDO_HANDLER = os.environ.get("SUDO_HANDLER", r"$") # Support GROUP = os.environ.get("GROUP", "SharingUserbot") CHANNEL = os.environ.get("CHANNEL", "Lunatic0de") # Heroku Credentials for updater. HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None) HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None) # JustWatch Country
from alexa.antispam import (antispam_cek_user, antispam_restrict_user, detect_user) antispam_module = True except ModuleNotFoundError: antispam_module = False def spamfilters(_text, user_id, _chat_id): if int(user_id) in SPAMMERS: print("This user is a spammer!") return True else: return False # Bot Logs setup: CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "True")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) BOTLOG = os.environ.get("BOTLOG") == "True" if STRING_SESSION: ubot = TelegramClient(StringSession(STRING_SESSION), API_KEY, API_HASH)
if version_info[0] < 3 or version_info[1] < 8: LOGS.warn(get_translation('pythonVersionError')) quit(1) HELP = {} BRAIN = [] BLACKLIST = [] VALID_PROXY_URL = [] CONVERSATION = {} PM_COUNT = {} PM_LAST_MSG = {} TEMP_SETTINGS = {} # Console verbose logging LOG_VERBOSE = sb(environ.get('LOG_VERBOSE', 'False')) basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=DEBUG if LOG_VERBOSE else INFO, ) # # Bot lang # # If missted, the default lang is English. SEDEN_LANG = environ.get('SEDEN_LANG', 'en') def set_local_env(key: str, value: str): return set_key('config.env', key, value)
else: bot = TelegramClient( "TG_BOT_TOKEN", api_id=Var.APP_ID, api_hash=Var.API_HASH).start(bot_token=Var.STRING_SESSION) else: session_name = "startup" bot = TelegramClient(session_name, Var.APP_ID, Var.API_HASH) # PaperPlaneExtended Support Vars ENV = os.environ.get("ENV", False) CAT_ID = ["1035034432", "551290198"] # Bot Logs setup: if bool(ENV): CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) # Check if the config was edited by using the already used variable. # Basically, its the 'virginity check' for the config file ;) CONFIG_CHECK = os.environ.get( "___________PLOX_______REMOVE_____THIS_____LINE__________", None)
from pylast import md5 from pySmartDL import SmartDL from github import Github from spamwatch import Client as SpamWatch from dotenv import load_dotenv from requests import get from telethon import TelegramClient from telethon.sessions import StringSession from userbot.client import UserBot load_dotenv("config.env") # Bot Logs setup: CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) if version_info < (3, 6, 0): LOGS.error("You MUST have a python version of at least 3.6." " Multiple features depend on this. Bot quitting.") quit(1)
from logging import basicConfig, getLogger, INFO, DEBUG from distutils.util import strtobool as sb from pylast import LastFMNetwork, md5 from pySmartDL import SmartDL from dotenv import load_dotenv from requests import get from telethon import TelegramClient from telethon.sessions import StringSession load_dotenv("config.env") StartTime = time.time() # Bot Logs setup: CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE") or "False") if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) if version_info[0] < 3 or version_info[1] < 8: LOGS.info("You MUST have a python version of at least 3.8." "Multiple features depend on this. Bot quitting.") quit(1)
StartTime = time.time() if Var.STRING_SESSION: session_name = str(Var.STRING_SESSION) bot = TelegramClient(StringSession(session_name), Var.APP_ID, Var.API_HASH) else: session_name = "startup" bot = TelegramClient(session_name, Var.APP_ID, Var.API_HASH) # PaperPlaneExtended Support Vars ENV = os.environ.get("ENV", False) """ PPE initialization. """ # Bot Logs setup: if bool(ENV): CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) # Check if the config was edited by using the already used variable. # Basically, its the 'virginity check' for the config file ;) CONFIG_CHECK = os.environ.get(
from distutils.util import strtobool as sb from logging import DEBUG, INFO, basicConfig, getLogger from sys import version_info import pylast import redis from dotenv import load_dotenv from pyDownload import Downloader from pymongo import MongoClient from requests import get from telethon import TelegramClient load_dotenv("config.env") # Bot Logs setup: CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) if CONSOLE_LOGGER_VERBOSE: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO) LOGS = getLogger(__name__) if version_info[0] < 3 or version_info[1] < 6: LOGS.error("You MUST have a python version of at least 3.6." " Multiple features depend on this. Bot quitting.") quit(1)
import time from userbot.utils import register, errors_handler, admin_cmd import asyncio import logging import os import sys from telethon.tl import functions, types from telethon.tl.types import Channel, Chat, User from userbot.javes_main.heroku_var import Config import os from distutils.util import strtobool as sb logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.WARN) NO_PM_LOG_USERS = [] NC_LOG_P_M_S=sb(os.environ.get("NC_LOG_P_M_S", "True")) BOTLOG = sb(os.environ.get("BOTLOG", "False")) BOTLOG_CHATID = int(os.environ.get("BOTLOG_CHATID",None)) @register(outgoing=True, pattern=r"^.save(?: |$)([\s\S]*)") async def log(log_text): """ For .log command, forwards a message or the command argument to the bot logs group """ if BOTLOG: if log_text.reply_to_msg_id: reply_msg = await log_text.get_reply_message() await reply_msg.forward_to(BOTLOG_CHATID) elif log_text.pattern_match.group(1): user = f"#LOG / Chat ID: {log_text.chat_id}\n\n" textx = user + log_text.pattern_match.group(1) await bot.send_message(BOTLOG_CHATID, textx)
class config(object): API_KEY = os.environ.get("TELEGRAM_API_KEY", None) APP_ID = os.environ.get("TELEGRAM_API_KEY", None) API_HASH = os.environ.get("TELEGRAM_API_HASH", None) STRING_SESSION = os.environ.get("TELEGRAM_STRING_SESSION", None) TAG_LOG = int(os.environ.get("TAG_LOG", None)) SCREEN_SHOT_KEY = os.environ.get("SCREEN_SHOT_KEY", None) SCREEN_SHOT_LAYER_ACCESS_KEY = SCREEN_SHOT_KEY BOTLOG_CHATID = int(os.environ.get("BOTLOG_CHATID", None)) BOTLOG = sb(os.environ.get("BOTLOG", "False")) LOGSPAMMER = sb(os.environ.get("LOGSPAMMER", "False")) GENIUS = os.environ.get("GENIUS_API_TOKEN", None) GENIUS_API_TOKEN = os.environ.get("GENIUS_API_TOKEN", None) ENV = os.environ.get("ENV", False) INLINE_MODE = os.environ.get("INLINE_MODE", False) OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None) REM_BG_API_KEY = os.environ.get("REM_BG_API_KEY", None) CHROME_DRIVER = os.environ.get("CHROME_DRIVER", None) GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN", None) OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None) WEATHER_DEFCITY = os.environ.get("WEATHER_DEFCITY", None) AFK_MESSAGE = os.environ.get("AFK_MESSAGE", None) ALIVE_S_MESSAGE = os.environ.get("ALIVE_S_MESSAGE", None) BIO_MESSAGE = os.environ.get("BIO_MESSAGE", None) ALIVE_E_MESSAGE = os.environ.get("ALIVE_E_MESSAGE", None) CLEAN_WELCOME = sb(os.environ.get("CLEAN_WELCOME", "True")) BIO_PREFIX = os.environ.get("BIO_PREFIX", None) DEFAULT_BIO = os.environ.get("DEFAULT_BIO", None) CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) PM_AUTO_BAN = sb(os.environ.get("PM_PROTECTOR", "True")) TEMP_DOWNLOAD_DIRECTORY = os.environ.get("TMP_DOWNLOAD_DIRECTORY", "./downloads") LOGGER = True GITHUB_ACCESS_TOKEN = os.environ.get("GITHUB_ACCESS_TOKEN", None) GIT_REPO_NAME = os.environ.get("GIT_REPO_NAME", None) SUDO_USERS = set(int(x) for x in os.environ.get("SUDO_USERS", "").split()) LYDIA_API_KEY = os.environ.get("LYDIA_API_KEY", None) LESS_SPAMMY = os.environ.get("LESS_SPAMMY", None) PM_MESSAGE = os.environ.get(f"PM_MESSAGE", None) JAVES_NAME = os.environ.get("JAVES_NAME", None) ANTI_SPAMBOT = sb(os.environ.get("ANTI_SPAMBOT", "False")) ANTI_SPAMBOT_SHOUT = sb(os.environ.get("ANTI_SPAMBOT_SHOUT", "False")) YOUTUBE_API_KEY = os.environ.get("YOUTUBE_API_KEY", None) ALIVE_NAME = os.environ.get("YOUR_SHORT_NAME", None) BLOCK_MESSAGE = os.environ.get("BLOCK_MESSAGE", None) HEROKU_API_KEY = os.environ.get("HEROKU_APIKEY", None) HEROKU_APP_NAME = os.environ.get("HEROKU_APPNAME", None) HEROKU_APIKEY = os.environ.get("HEROKU_APIKEY", None) HEROKU_APPNAME = os.environ.get("HEROKU_APPNAME", None) UPSTREAM_REPO_URL = os.environ.get("UPSTREAM_REPO_URL", "https://github.com/Sh1vam/javes") TELEGRAPH_SHORT_NAME = os.environ.get("TELEGRAPH_SHORT_NAME", "Javes") CONSOLE_LOGGER_VERBOSE = sb( os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) TG_BOT_TOKEN_BF_HER = os.environ.get("TG_BOT_TOKEN_BF_HER", None) COUNTRY = str(os.environ.get("COUNTRY", "")) TZ_NUMBER = int(os.environ.get("TZ_NUMBER", 1)) PLUGIN_CHANNEL = int(os.environ.get("PLUGIN_CHANNEL", -100)) TG_BOT_USER_NAME_BF_HER = os.environ.get("TG_BOT_USER_NAME_BF_HER", None) NO_SONGS = bool(os.environ.get("NO_SONGS", False)) DOWNLOAD_PFP_URL_CLOCK = os.environ.get("DOWNLOAD_PFP_URL_CLOCK", None) G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID", None) G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET", None) G_DRIVE_AUTH_TOKEN_DATA = os.environ.get("G_DRIVE_AUTH_TOKEN_DATA", None) GDRIVE_FOLDER_ID = os.environ.get("GDRIVE_FOLDER_ID", "root") AUTH_TOKEN_DATA = os.environ.get("AUTH_TOKEN_DATA", None) MAX_FLOOD_IN_P_M_s = int(os.environ.get("MAX_FLOOD_IN_P_M_s", 3)) PRIVATE_GROUP_ID = os.environ.get("BOTLOG_CHATID", None) DB_URI = os.environ.get("DATABASE_URL", None) TMP_DOWNLOAD_DIRECTORY = TEMP_DOWNLOAD_DIRECTORY
import redis from sys import version_info from sys import platform from os import environ from logging import basicConfig, getLogger, INFO, DEBUG from distutils.util import strtobool as sb from dotenv import load_dotenv from telethon import TelegramClient load_dotenv("config.env") debug = sb(environ.get("DEBUG", "False")) if debug: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=DEBUG, ) else: basicConfig( format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO ) logs = getLogger(__name__) if platform == "linux" or platform == "linux2" or platform == "darwin" or platform == "freebsd7"\ or platform == "freebsd8" or platform == "freebsdN" or platform == "openbsd6": logs.info(