diff --git a/Dockerfile b/Dockerfile index ae4caef84..4d5e004ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,8 @@ RUN sed -e 's;^#http\(.*\)/edge/community;http\1/edge/community;g' -i /etc/apk/r # # Installing Packages # -RUN apk add --no-cache --update \ - bash \ +RUN apk add --no-cache=true --update \ + bash \ build-base \ bzip2-dev \ curl \ @@ -22,8 +22,6 @@ RUN apk add --no-cache --update \ aria2 \ util-linux \ libevent \ - chromium \ - chromium-chromedriver \ jpeg-dev \ libffi-dev \ libpq \ @@ -43,6 +41,7 @@ RUN apk add --no-cache --update \ jq \ wget \ python \ + python-dev \ python3 \ python3-dev \ readline-dev \ @@ -50,9 +49,12 @@ RUN apk add --no-cache --update \ ffmpeg \ sqlite-dev \ sudo \ + chromium \ + chromium-chromedriver \ zlib-dev \ - jpeg-dev \ - python-dev + jpeg + + RUN python3 -m ensurepip \ @@ -65,7 +67,7 @@ RUN python3 -m ensurepip \ # # Clone repo and prepare working directory # -RUN git clone https://github.com/Spyderzz/Userbot/root/userbot +RUN git clone -b master https://github.com/MuhamadFajarGaray/UserBug /root/userbot RUN mkdir /root/userbot/bin/ WORKDIR /root/userbot/ diff --git a/Procfile b/Procfile index 0dae77512..32ef5a9dd 100644 --- a/Procfile +++ b/Procfile @@ -1 +1,5 @@ -worker: python3 -m userbot +build: + docker: + worker: Dockerfile +run: + worker: python3 -m userbot diff --git a/app.json b/app.json index 37c07fcad..fd621fea9 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { - "name": "Telegram User Bot", - "description": "[Paperplane Extended] A modular Telegram userbot running on Python 3.6+ with an sqlalchemy database.", - "logo": "https://i.imgur.com/ATSG4w3.png", + "name": "Telegram Open User Bot", + "description": "[OpenUserBot] A modular Telegram userbot running on Python 3.7+ with an sqlalchemy database.", + "logo": "https://telegra.ph/file/d04a1724c6dd8a957bd0e.png", "keywords": [ "telegram", "userbot", @@ -9,9 +9,10 @@ "modular", "productivity" ], - "repository": "https://github.com/AvinashReddy3108/PaperplaneExtended", - "website": "https://telegra.ph/How-to-host-a-Telegram-Userbot-07-24", - "success_url": "https://t.me/PaperplaneExtended", + "repository": "https://github.com/mkaraniya/OpenUserBot", + "website": "https://telegra.ph/How-to-host-a-Telegram-Userbot-11-02", + "success_url": "https://t.me/PPE_Support", + "stack": "container", "env": { "API_KEY": { "description": "Get this value from my.telegram.org.", @@ -26,14 +27,10 @@ "required": true }, "HEROKU_MEMEZ": { - "description": "This should be True if the userbor is running on a Heroku Dyno.", + "description": "This should be True if the userbot is running on a Heroku Dyno.", "value": "True", "required": true }, - "UPSTREAM_REPO_URL": { - "description": "In case you maintain a fork, add your repo URL here.", - "required": false - }, "HEROKU_API_KEY": { "description": "Your Heroku API key, get it from 'https://dashboard.heroku.com/account'", "value": "" @@ -42,6 +39,10 @@ "description": "Add the Heroku app name here. It helps with userbot updates.", "required": false }, + "UPSTREAM_REPO_URL": { + "description": "In case you maintain a fork, add your repo URL here.", + "required": false + }, "COUNTRY": { "description": "Set your Country to be used in the .time and .date commands.", "required": false @@ -53,12 +54,12 @@ }, "CHROME_DRIVER": { "description": "ChromeDriver location for selenium based modules.", - "value": "/app/.chromedriver/bin/chromedriver", + "value": "/usr/bin/chromedriver", "required": false }, "GOOGLE_CHROME_BIN": { "description": "Google Chrome (or) Chromium binary location for selenium based modules.", - "value": "/app/.apt/usr/bin/google-chrome", + "value": "/usr/bin/chromium-browser", "required": false }, "OPEN_WEATHER_MAP_APPID": { @@ -135,7 +136,7 @@ }, "DEFAULT_BIO": { "description": "Default profile bio.", - "value": "[PM = Report Spam] Beware of my userbot.", + "value": "[PM = Report Spam] I ❤ ️@OpenUserBot", "required": false }, "ALIVE_NAME": { @@ -150,6 +151,10 @@ "description": "Enter the Google Drive authentication data, as a JSON structure.", "required": false }, + "LYDIA_API_KEY": { + "description": "This Module Needs CoffeeHouse API to work. so Join https://telegram.dog/IntellivoidDev and send #activateapi and follow instructions.", + "required": false + }, "WEATHER_DEFCITY": { "description": "Set the default city for the userbot's weather module.", "required": false @@ -166,25 +171,5 @@ "version": "9.5" } } - ], - "buildpacks": [ - { - "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest" - }, - { - "url": "https://github.com/opendoor-labs/heroku-buildpack-p7zip" - }, - { - "url": "https://github.com/amivin/aria2-heroku" - }, - { - "url": "https://github.com/heroku/heroku-buildpack-google-chrome" - }, - { - "url": "https://github.com/heroku/heroku-buildpack-chromedriver" - }, - { - "url": "heroku/python" - } ] } diff --git a/init/init_script.sh b/init/init_script.sh index 5a69e8231..d78a8df93 100644 --- a/init/init_script.sh +++ b/init/init_script.sh @@ -26,7 +26,7 @@ echo "$1=y" >> $prog_f # Welcome Message welcome() { - echo "*****Welcome to AvinashReddy3108's userbot setup***** + echo "*****Welcome to mkaraniya's userbot setup***** This Guided Setup shall help you get your own userbot up and running. You might be asked for sudo password several number of times." } @@ -40,7 +40,7 @@ packageinstall() { sudo apt --yes --force-yes install build-essential checkinstall git \ libreadline-gplv2-dev libncursesw5-dev libssl-dev wget \ libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev - sudo apt --yes --force-yes install python3.7 docker + sudo apt --yes --force-yes install python3.8 docker } # Clone the required repo @@ -48,7 +48,7 @@ botclone() { cd ~ echo "Cloning bot sources..." if [ -z "$bot_clone" ]; then - git clone https://github.com/AvinashReddy3108/Telegram-UserBot -b master + git clone https://github.com/MuhamadFajarGaray/UserBug -b master save_prog "bot_clone" fi echo "DONE!!" @@ -59,7 +59,7 @@ botclone() { reqinstall() { echo "***Installing Requirements***" if [ -z "$req" ]; then - sudo python3.7 -m pip install -r requirements.txt + sudo python3.8 -m pip install -r requirements.txt clear save_prog "req" fi @@ -136,7 +136,7 @@ session() { echo "Generating session..." if [ -z "$sess" ]; then python3 windows_startup_script.py - python3.7 -m userbot test + python3.8 -m userbot test save_prog "sess" fi echo "DONE!!" diff --git a/init/telegram b/init/telegram index 35323417f..67f8daabb 100644 --- a/init/telegram +++ b/init/telegram @@ -91,7 +91,7 @@ kickstart_pub() { "Branch ${PARSE_BRANCH}" \ "Commit Point ${COMMIT_POINT}" \ " " \ - "Github Link: https://github.com/AvinashReddy3108/telegram-userbot/commit/${COMMIT_HASH}" \ + "Github Link: https://github.com/MuhamadFajarGaray/UserBug/commit/${COMMIT_HASH}" \ " " \ "CI Link: https://semaphoreci.com/baalajimaestro/telegram-userbot" } diff --git a/init/telegramapi b/init/telegramapi index 2d9f568dd..a8081d22c 100644 --- a/init/telegramapi +++ b/init/telegramapi @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="0.2" +VERSION="0.3" TOKEN="" CHATS=() DEBUG=false diff --git a/requirements.txt b/requirements.txt index 3d1a8ae35..b5c883247 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,8 @@ aria2p async_generator bs4 cowpy -cryptg +# cryptg +cffi>=1.0.0 dnspython emoji gitpython @@ -14,7 +15,6 @@ google_images_download>=2.7.1 gTTS>=2.0.1 gTTS-token>=1.1.3 hachoir -heroku3 httplib2 humanize lxml @@ -34,7 +34,9 @@ requests>=2.18.4 search-engine-parser>=0.4.2 speedtest-cli>=2.0.2 sqlalchemy>=1.2 -telethon>=1.10.6 +telethon>=1.10.10 telethon-session-sqlalchemy>=0.2.6 urbandict>=0.5 wikipedia>=1.4.0 +coffeehouse +telegraph diff --git a/runtime.txt b/runtime.txt index aefcfbece..c5d7ce328 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.7.5 +python-3.8.1 diff --git a/sample_config.env b/sample_config.env index 78c16fae1..515269df8 100644 --- a/sample_config.env +++ b/sample_config.env @@ -86,6 +86,11 @@ BIO_PREFIX = "" # default bio message DEFAULT_BIO = "" +# FOR Lydia Access +LYDIA_API_KEY = "" +LYDIA_ANTI-PM = "" + + # Report or kick some known spammer bots after # they joins ANTI_SPAMBOT = False diff --git a/termux_install.sh b/termux_install.sh index 1e11df931..23033f596 100644 --- a/termux_install.sh +++ b/termux_install.sh @@ -1,24 +1,41 @@ clear -echo -E " ____ __ " -echo -E " / __ \____ _____ ___ _________ / /___ _____ ___ " -echo -E " / /_/ / __ `/ __ \/ _ \/ ___/ __ \/ / __ `/ __ \/ _ \ " -echo -E " / ____/ /_/ / /_/ / __/ / / /_/ / / /_/ / / / / __/ " -echo -E "/_/ \__,_/ .___/\___/_/ / .___/_/\__,_/_/ /_/\___/ " -echo -E " /_/ /_/ " -echo -E " ______ __ __ __ " -echo -E " / ____/ __/ /____ ____ ____/ /__ ____/ / " -echo -E " / __/ | |/_/ __/ _ \/ __ \/ __ / _ \/ __ / " -echo -E " / /____> startbot.sh -echo "cd PaperplaneExtended" >> startbot.sh +echo "cd OpenUserBot" >> startbot.sh echo "python3 -m userbot" >> startbot.sh chmod 755 startbot.sh diff --git a/userbot/__init__.py b/userbot/__init__.py index 51adea507..a96f544bb 100644 --- a/userbot/__init__.py +++ b/userbot/__init__.py @@ -41,7 +41,7 @@ # 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) + "", None) if CONFIG_CHECK: LOGS.info( @@ -53,6 +53,7 @@ API_KEY = os.environ.get("API_KEY", None) API_HASH = os.environ.get("API_HASH", None) + # Userbot Session String STRING_SESSION = os.environ.get("STRING_SESSION", None) @@ -67,13 +68,14 @@ PM_AUTO_BAN = sb(os.environ.get("PM_AUTO_BAN", "False")) # Heroku Credentials for updater. +HEROKU_MEMEZ = sb(os.environ.get("HEROKU_MEMEZ", "False")) HEROKU_APPNAME = os.environ.get("HEROKU_APPNAME", None) HEROKU_APIKEY = os.environ.get("HEROKU_APIKEY", None) # Custom (forked) repo URL for updater. UPSTREAM_REPO_URL = os.environ.get( "UPSTREAM_REPO_URL", - "https://github.com/AvinashReddy3108/PaperplaneExtended.git") + "https://github.com/mkaraniya/OpenUserBot.git") # Console verbose logging CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False")) @@ -84,6 +86,9 @@ # OCR API key OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None) +# Telegrap.h +TELEGRAPH_SHORT_NAME = os.environ.get("TELEGRAPH_SHORT_NAME", None) + # remove.bg API key REM_BG_API_KEY = os.environ.get("REM_BG_API_KEY", None) @@ -95,6 +100,9 @@ OPEN_WEATHER_MAP_APPID = os.environ.get("OPEN_WEATHER_MAP_APPID", None) WEATHER_DEFCITY = os.environ.get("WEATHER_DEFCITY", None) +# Lydia API +LYDIA_API_KEY = os.environ.get("LYDIA_API_KEY", None) + # Anti Spambot Config ANTI_SPAMBOT = sb(os.environ.get("ANTI_SPAMBOT", "False")) ANTI_SPAMBOT_SHOUT = sb(os.environ.get("ANTI_SPAMBOT_SHOUT", "False")) @@ -157,20 +165,10 @@ # 'bot' variable if STRING_SESSION: # pylint: disable=invalid-name - bot = TelegramClient(StringSession(STRING_SESSION), - API_KEY, - API_HASH, - connection_retries=None, - auto_reconnect=False, - lang_code='en') + bot = TelegramClient(StringSession(STRING_SESSION), API_KEY, API_HASH) else: # pylint: disable=invalid-name - bot = TelegramClient("userbot", - API_KEY, - API_HASH, - connection_retries=None, - auto_reconnect=False, - lang_code='en') + bot = TelegramClient("userbot", API_KEY, API_HASH) async def check_botlog_chatid(): @@ -213,4 +211,4 @@ async def check_botlog_chatid(): LASTMSG = {} CMD_HELP = {} ISAFK = False -AFKREASON = None \ No newline at end of file +AFKREASON = None diff --git a/userbot/__main__.py b/userbot/__main__.py index 7910102f1..e3bf042c5 100644 --- a/userbot/__main__.py +++ b/userbot/__main__.py @@ -7,7 +7,6 @@ from importlib import import_module from sys import argv -from os import execle from telethon.errors.rpcerrorlist import PhoneNumberInvalidError from userbot import LOGS, bot @@ -27,12 +26,13 @@ for module_name in ALL_MODULES: imported_module = import_module("userbot.modules." + module_name) -LOGS.info("You are running Paperplane Extended [v5.0]") +LOGS.info("You are running UserBug [v1.0]") -LOGS.info("Congratulations, your userbot is now running !!" - "Test it by typing .alive in any chat.") +LOGS.info( + "Congrats, your userbug is now running!! Type .alive for sure." + "If you need something, ask on https://t.me/UserBotIndo") if len(argv) not in (1, 3, 4): bot.disconnect() else: - bot.run_until_disconnected() \ No newline at end of file + bot.run_until_disconnected() diff --git a/userbot/events.py b/userbot/events.py index fde6770c1..7d4bfc403 100644 --- a/userbot/events.py +++ b/userbot/events.py @@ -23,7 +23,7 @@ def register(**args): pattern = args.get('pattern', None) disable_edited = args.get('disable_edited', False) ignore_unsafe = args.get('ignore_unsafe', False) - unsafe_pattern = r"^[^/!#@\$A-Za-z0-9]" + unsafe_pattern = r'^[^/!#@\$A-Za-z]' groups_only = args.get('groups_only', False) trigger_on_fwd = args.get('trigger_on_fwd', False) disable_errors = args.get('disable_errors', False) @@ -86,6 +86,9 @@ async def wrapper(check): date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT ERROR REPORT**\n" + link = "[UserBot Heroku 🇲🇨](https://t.me/UserBotIndo)" + text += "If you want to, you can report it" + text += f"- just forward this message to {link}.\n" text += "Nothing is logged except the fact of error and date\n" ftext = "========== DISCLAIMER ==========" @@ -125,9 +128,10 @@ async def wrapper(check): file.close() if LOGSPAMMER: - await check.respond("`Sorry, my userbot has crashed.\ + await check.client.respond( + "`Sorry, my userbot has crashed.\ \nThe error logs are stored in the userbot's log chat.`" - ) + ) await check.client.send_file(send_to, "error.log", @@ -141,4 +145,4 @@ async def wrapper(check): bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper - return decorator \ No newline at end of file + return decorator