diff --git a/config.env.sample b/config.env.sample index afae42f92..345a15138 100644 --- a/config.env.sample +++ b/config.env.sample @@ -1,10 +1,10 @@ - - # Remove this line first before doing anything else + _____REMOVE_____THIS_____LINE_____=true -# >----------- REQUIRED ----------< # + +# ---------------「 REQUIRED 」--------------- # # Get them from https://my.telegram.org/ @@ -12,21 +12,25 @@ API_ID="" API_HASH="" -# Mongodb url from https://cloud.mongodb.com/, guide: https://del.dog/mongodb_guide +# Mongodb url from https://cloud.mongodb.com/ +# guide: https://del.dog/mongodb_guide DATABASE_URL="" -# [ Private Telegram Log Channel ID ], Note: Also add your Bot to LOG CHANNEL (for BOT or DUAL) +# [ Private Telegram Log Channel ID ] +# Note: Also add your Bot to LOG CHANNEL (for BOT or DUAL) LOG_CHANNEL_ID="" -# [------- USERGE-X MODES -------] # +# ════════════「 USERGE-X MODES 」════════════ # + # Fill Vars for the mode you want [ USER ], [ BOT ] # or [ DUAL MODE ] (Both) # 1. USER MODE -# get this using [ https://repl.it/@Leorio/stringsessiongen or bash genStr ] +# get this using +# [ https://repl.it/@Leorio/stringsessiongen or bash genStr ] HU_STRING_SESSION="" @@ -38,13 +42,11 @@ OWNER_ID="" # your user_id(s) # 3. DUAL MODE # Both BOT and USER Sessions are Required for DUAL MODE -# [------------------------------] # -# >------------------------------< # -# ----------- OPTIONAL ----------- # +# -----------「 OPTIONAL 」----------- # # Set false if your don't like to use extra plugins @@ -175,6 +177,4 @@ HEROKU_API_KEY="" # given app name to the heroku app -HEROKU_APP_NAME="" - - +HEROKU_APP_NAME="" \ No newline at end of file diff --git a/init/checks.sh b/init/checks.sh index 86f503a57..df7434e10 100644 --- a/init/checks.sh +++ b/init/checks.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -70,8 +70,9 @@ _checkDefaultVars() { WORKERS=32 fi export MOTOR_MAX_WORKERS=$WORKERS + export HEROKU_ENV=$(test $DYNO && echo 1 || echo 0) DOWN_PATH=${DOWN_PATH%/}/ - if [[ -n $HEROKU_API_KEY && -n $HEROKU_APP_NAME ]]; then + if [[ $HEROKU_ENV == 1 && -n $HEROKU_API_KEY && -n $HEROKU_APP_NAME ]]; then local herokuErr=$(runPythonCode ' import heroku3 try: diff --git a/init/init.sh b/init/init.sh index 41e3ec859..f44a7ffcb 100644 --- a/init/init.sh +++ b/init/init.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -14,6 +14,7 @@ trap handleSigTerm TERM trap handleSigInt INT +trap 'echo hi' USR1 initUserge() { printLogo @@ -32,7 +33,6 @@ startUserge() { stopUserge() { sendMessage "Exiting USERGE-X ..." endLogBotPolling - exit 0 } handleSigTerm() { @@ -50,5 +50,7 @@ handleSigInt() { runUserge() { initUserge startUserge "$@" + local code=$? stopUserge + return $code } diff --git a/init/logbot/core/api.sh b/init/logbot/core/api.sh index 4474c7bcf..bac9c5b32 100644 --- a/init/logbot/core/api.sh +++ b/init/logbot/core/api.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/core.sh b/init/logbot/core/core.sh index 9b7d9697e..6f64adb70 100644 --- a/init/logbot/core/core.sh +++ b/init/logbot/core/core.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/methods/apiMethods.sh b/init/logbot/core/methods/apiMethods.sh index 26615c159..15fc85828 100644 --- a/init/logbot/core/methods/apiMethods.sh +++ b/init/logbot/core/methods/apiMethods.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/methods/methods.sh b/init/logbot/core/methods/methods.sh index b8c3ca011..4f7d58a09 100644 --- a/init/logbot/core/methods/methods.sh +++ b/init/logbot/core/methods/methods.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/methods/rawMethods.sh b/init/logbot/core/methods/rawMethods.sh index 958b1b778..2fd842f9f 100644 --- a/init/logbot/core/methods/rawMethods.sh +++ b/init/logbot/core/methods/rawMethods.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/types/message.sh b/init/logbot/core/types/message.sh index 3da301dfd..47fdeacb8 100644 --- a/init/logbot/core/types/message.sh +++ b/init/logbot/core/types/message.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/types/messageClass.sh b/init/logbot/core/types/messageClass.sh index 3388ffa23..171ff6a2b 100644 --- a/init/logbot/core/types/messageClass.sh +++ b/init/logbot/core/types/messageClass.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/types/types.sh b/init/logbot/core/types/types.sh index 8b404ae58..67c18a6e0 100644 --- a/init/logbot/core/types/types.sh +++ b/init/logbot/core/types/types.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/core/utils.sh b/init/logbot/core/utils.sh index b90765515..70037d77f 100644 --- a/init/logbot/core/utils.sh +++ b/init/logbot/core/utils.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/logbot.sh b/init/logbot/logbot.sh index 5baf09d62..365ced5ab 100644 --- a/init/logbot/logbot.sh +++ b/init/logbot/logbot.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/methods/basic.sh b/init/logbot/methods/basic.sh index 1f02677f7..cffefdfea 100644 --- a/init/logbot/methods/basic.sh +++ b/init/logbot/methods/basic.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/methods/methods.sh b/init/logbot/methods/methods.sh index 89ad804e8..a459a481c 100644 --- a/init/logbot/methods/methods.sh +++ b/init/logbot/methods/methods.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/init/logbot/methods/polling.sh b/init/logbot/methods/polling.sh index 09ffa6e67..c121fc438 100644 --- a/init/logbot/methods/polling.sh +++ b/init/logbot/methods/polling.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -17,6 +17,7 @@ startLogBotPolling() { endLogBotPolling() { test -z $BOT_TOKEN || echo quit >> $_input + wait } _polling() { diff --git a/init/utils.sh b/init/utils.sh index 3bf16dfc3..c8612d85d 100644 --- a/init/utils.sh +++ b/init/utils.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -20,8 +20,8 @@ getPythonVersion() { count+=1 [[ $count -gt $maxPVer ]] && break done - declare -gr pVer=$(sed -E 's/Python (3\.[0-9]{1,2}\.[0-9]{1,2}).*/\1/g' <<< \ - "$(python3.$count -V 2> /dev/null)") + local ptn='s/Python (3\.[0-9]{1,2}\.[0-9]{1,2}).*/\1/g' + declare -gr pVer=$(sed -E "$ptn" <<< "$(python3.$count -V 2> /dev/null)") } log() { diff --git a/requirements.txt b/requirements.txt index e9e670fcf..9cd5b3f71 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,3 +43,4 @@ ruamel.yaml==0.16.12 pymediainfo>=5.0.3 ujson>=4.0.1 youtube-search-python==1.4.0 +git+https://github.com/code-rgb/google-images-download.git diff --git a/run b/run index cb9f9d894..3bdb50a74 100644 --- a/run +++ b/run @@ -1,13 +1,44 @@ #!/bin/bash # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. -. init/init.sh +trap joinProc INT TERM -runUserge "$@" +declare -i bgProc +declare -ir usr1=138 +declare -r cmd='. init/init.sh; runUserge "$@"' + +setProc() { + bgProc=$1 +} + +waitProc() { + wait $bgProc +} + +killProc() { + kill $bgProc &> /dev/null +} + +joinProc() { + if test $bgProc; then + killProc + waitProc + fi +} + +run() { + joinProc + bash -c "$cmd" $0 "$@" & + setProc $! + waitProc + test $? -eq $usr1 && run "$@" +} + +run "$@" diff --git a/runtime.txt b/runtime.txt index 3e4835ce2..1a1817944 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.8.7 +python-3.9.1 diff --git a/userge/config.py b/userge/config.py index 2a37a5546..4905395f3 100644 --- a/userge/config.py +++ b/userge/config.py @@ -29,8 +29,8 @@ class Config: API_ID = int(os.environ.get("API_ID")) API_HASH = os.environ.get("API_HASH") WORKERS = int(os.environ.get("WORKERS")) or os.cpu_count() + 4 - BOT_TOKEN = os.environ.get("BOT_TOKEN", None) - HU_STRING_SESSION = os.environ.get("HU_STRING_SESSION", None) + BOT_TOKEN = os.environ.get("BOT_TOKEN") + HU_STRING_SESSION = os.environ.get("HU_STRING_SESSION") OWNER_ID = tuple(filter(lambda x: x, map(int, os.environ.get("OWNER_ID", "0").split()))) LOG_CHANNEL_ID = int(os.environ.get("LOG_CHANNEL_ID")) AUTH_CHATS = (OWNER_ID[0], LOG_CHANNEL_ID) if OWNER_ID else (LOG_CHANNEL_ID,) @@ -41,27 +41,27 @@ class Config: SUDO_TRIGGER = os.environ.get("SUDO_TRIGGER") FINISHED_PROGRESS_STR = os.environ.get("FINISHED_PROGRESS_STR") UNFINISHED_PROGRESS_STR = os.environ.get("UNFINISHED_PROGRESS_STR") - ALIVE_MEDIA = os.environ.get("ALIVE_MEDIA", None) + ALIVE_MEDIA = os.environ.get("ALIVE_MEDIA") CUSTOM_PACK_NAME = os.environ.get("CUSTOM_PACK_NAME") INSTA_ID = os.environ.get("INSTA_ID") INSTA_PASS = os.environ.get("INSTA_PASS") UPSTREAM_REPO = os.environ.get("UPSTREAM_REPO") UPSTREAM_REMOTE = os.environ.get("UPSTREAM_REMOTE") - SPAM_WATCH_API = os.environ.get("SPAM_WATCH_API", None) - CURRENCY_API = os.environ.get("CURRENCY_API", None) - OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY", None) - OPEN_WEATHER_MAP = os.environ.get("OPEN_WEATHER_MAP", None) - REMOVE_BG_API_KEY = os.environ.get("REMOVE_BG_API_KEY", None) - WEATHER_DEFCITY = os.environ.get("WEATHER_DEFCITY", None) + SPAM_WATCH_API = os.environ.get("SPAM_WATCH_API") + CURRENCY_API = os.environ.get("CURRENCY_API") + OCR_SPACE_API_KEY = os.environ.get("OCR_SPACE_API_KEY") + OPEN_WEATHER_MAP = os.environ.get("OPEN_WEATHER_MAP") + REMOVE_BG_API_KEY = os.environ.get("REMOVE_BG_API_KEY") + WEATHER_DEFCITY = os.environ.get("WEATHER_DEFCITY") TZ_NUMBER = os.environ.get("TZ_NUMBER", 1) - 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_PARENT_ID = os.environ.get("G_DRIVE_PARENT_ID", None) - G_DRIVE_INDEX_LINK = os.environ.get("G_DRIVE_INDEX_LINK", None) - GOOGLE_CHROME_DRIVER = os.environ.get("GOOGLE_CHROME_DRIVER", None) - GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN", None) - HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None) - HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None) + G_DRIVE_CLIENT_ID = os.environ.get("G_DRIVE_CLIENT_ID") + G_DRIVE_CLIENT_SECRET = os.environ.get("G_DRIVE_CLIENT_SECRET") + G_DRIVE_PARENT_ID = os.environ.get("G_DRIVE_PARENT_ID") + G_DRIVE_INDEX_LINK = os.environ.get("G_DRIVE_INDEX_LINK") + GOOGLE_CHROME_DRIVER = os.environ.get("GOOGLE_CHROME_DRIVER") + GOOGLE_CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN") + HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY") + HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME") G_DRIVE_IS_TD = os.environ.get("G_DRIVE_IS_TD") == "true" LOAD_UNOFFICIAL_PLUGINS = os.environ.get( "LOAD_UNOFFICIAL_PLUGINS") == "true" @@ -82,25 +82,26 @@ class Config: ALLOWED_COMMANDS: Set[str] = set() ANTISPAM_SENTRY = False RUN_DYNO_SAVER = False + HEROKU_ENV = bool(int(os.environ.get("HEROKU_ENV", "0"))) HEROKU_APP = heroku3.from_key(HEROKU_API_KEY).apps()[HEROKU_APP_NAME] \ - if HEROKU_API_KEY and HEROKU_APP_NAME else None + if HEROKU_ENV and HEROKU_API_KEY and HEROKU_APP_NAME else None STATUS = None BOT_FORWARDS = False - BOT_MEDIA = os.environ.get("BOT_MEDIA", None) + BOT_MEDIA = os.environ.get("BOT_MEDIA") ### Spotify - SPOTIFY_CLIENT_ID = os.environ.get('SPOTIFY_CLIENT_ID', None) - SPOTIFY_CLIENT_SECRET = os.environ.get('SPOTIFY_CLIENT_SECRET', None) + SPOTIFY_CLIENT_ID = os.environ.get('SPOTIFY_CLIENT_ID') + SPOTIFY_CLIENT_SECRET = os.environ.get('SPOTIFY_CLIENT_SECRET') SPOTIFY_MODE = False ### MEME Generator - IMGFLIP_ID = os.environ.get('IMGFLIP_ID', None) - IMGFLIP_PASS = os.environ.get('IMGFLIP_PASS', None) + IMGFLIP_ID = os.environ.get('IMGFLIP_ID') + IMGFLIP_PASS = os.environ.get('IMGFLIP_PASS') ALLOW_NSFW = os.environ.get("ALLOW_NSFW", "False") PM_LOG_GROUP_ID = int(os.environ.get("PM_LOG_GROUP_ID", 0)) PM_LOGGING = False - DEEP_AI = os.environ.get("DEEP_AI", None) + DEEP_AI = os.environ.get("DEEP_AI") ### Last FM - LASTFM_USERNAME = os.environ.get("LASTFM_USERNAME", None) - LASTFM_API_KEY = os.environ.get("LASTFM_API_KEY", None) + LASTFM_USERNAME = os.environ.get("LASTFM_USERNAME") + LASTFM_API_KEY = os.environ.get("LASTFM_API_KEY") TG_IDS = [777000, 1087968824, 454000] INLINE_NOTES = False @@ -119,5 +120,5 @@ def get_version() -> str: return f"{ver}-fork-[X].{len(diff)}" except Exception as e: _LOG.error(e) - return "For Fix See -> https://github.com/code-rgb/USERGE-X/issues/17" + return " Check Updates" return ver diff --git a/userge/core/__init__.py b/userge/core/__init__.py index 62df144c7..18ed1603b 100644 --- a/userge/core/__init__.py +++ b/userge/core/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/client.py b/userge/core/client.py index ab2040973..c89255e40 100644 --- a/userge/core/client.py +++ b/userge/core/client.py @@ -1,15 +1,16 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. __all__ = ['Userge'] +import os import time import signal import asyncio @@ -33,6 +34,7 @@ _IMPORTED: List[ModuleType] = [] _INIT_TASKS: List[asyncio.Task] = [] _START_TIME = time.time() +_SEND_SIGNAL = False async def _complete_init_tasks() -> None: @@ -52,7 +54,7 @@ def is_bot(self) -> bool: @property def uptime(self) -> str: - """ returns USERGE-X uptime """ + """ returns userge uptime """ return time_formatter(time.time() - _START_TIME) async def finalize_load(self) -> None: @@ -60,7 +62,7 @@ async def finalize_load(self) -> None: await asyncio.gather(_complete_init_tasks(), self.manager.init()) async def load_plugin(self, name: str, reload_plugin: bool = False) -> None: - """ Load plugin to USERGE-X """ + """ Load plugin to Userge """ _LOG.debug(_LOG_STR, f"Importing {name}") _IMPORTED.append( importlib.import_module(f"userge.plugins.{name}")) @@ -107,7 +109,7 @@ async def reload_plugins(self) -> int: class UsergeBot(_AbstractUserge): """ USERGE-X Bot """ def __init__(self, **kwargs) -> None: - _LOG.info(_LOG_STR, "Setting UsergeBot Configs") + _LOG.info(_LOG_STR, "Setting X-BOT Configs") super().__init__(session_name=":memory:", **kwargs) @property @@ -117,7 +119,7 @@ def ubot(self) -> 'Userge': class Userge(_AbstractUserge): - """ USERGE-X Bot """ + """ Userge, the userbot """ has_bot = bool(Config.BOT_TOKEN) @@ -140,7 +142,7 @@ def __init__(self, **kwargs) -> None: @property def bot(self) -> Union['UsergeBot', 'Userge']: - """ returns USERGE-X Bot """ + """ returns usergebot """ if self._bot is None: if Config.BOT_TOKEN: return self @@ -152,14 +154,14 @@ async def start(self) -> None: _LOG.info(_LOG_STR, "Starting USERGE-X") await super().start() if self._bot is not None: - _LOG.info(_LOG_STR, "Starting -X- Bot") + _LOG.info(_LOG_STR, "Starting X-Bot") await self._bot.start() await self._load_plugins() async def stop(self) -> None: # pylint: disable=arguments-differ """ stop client and bot """ if self._bot is not None: - _LOG.info(_LOG_STR, "Stopping -X- Bot") + _LOG.info(_LOG_STR, "Stopping X-Bot") await self._bot.stop() _LOG.info(_LOG_STR, "Stopping USERGE-X") await super().stop() @@ -167,14 +169,14 @@ async def stop(self) -> None: # pylint: disable=arguments-differ pool._stop() # pylint: disable=protected-access def begin(self, coro: Optional[Awaitable[Any]] = None) -> None: - """ start USERGE-X """ + """ start userge """ lock = asyncio.Lock() running_tasks: List[asyncio.Task] = [] async def _finalize() -> None: async with lock: - for task in running_tasks: - task.cancel() + for t in running_tasks: + t.cancel() if self.is_initialized: await self.stop() else: @@ -186,13 +188,16 @@ async def _finalize() -> None: self.loop.stop() _LOG.info(_LOG_STR, "Loop Stopped !") - async def _shutdown(sig: signal.Signals) -> None: - _LOG.info(_LOG_STR, f"Received Stop Signal [{sig.name}], Exiting USERGE-X ...") + async def _shutdown(_sig: signal.Signals) -> None: + global _SEND_SIGNAL # pylint: disable=global-statement + _LOG.info(_LOG_STR, f"Received Stop Signal [{_sig.name}], Exiting USERGE-X ...") await _finalize() + if _sig == _sig.SIGUSR1: + _SEND_SIGNAL = True - for sig in (signal.SIGHUP, signal.SIGTERM, signal.SIGINT): + for sig in (signal.SIGHUP, signal.SIGTERM, signal.SIGINT, signal.SIGUSR1): self.loop.add_signal_handler( - sig, lambda sig=sig: self.loop.create_task(_shutdown(sig))) + sig, lambda _sig=sig: self.loop.create_task(_shutdown(_sig))) self.loop.run_until_complete(self.start()) for task in self._tasks: running_tasks.append(self.loop.create_task(task())) @@ -212,3 +217,5 @@ async def _shutdown(sig: signal.Signals) -> None: finally: self.loop.close() _LOG.info(_LOG_STR, "Loop Closed !") + if _SEND_SIGNAL: + os.kill(os.getpid(), signal.SIGUSR1) diff --git a/userge/core/database.py b/userge/core/database.py index a16f66600..fcb694d59 100644 --- a/userge/core/database.py +++ b/userge/core/database.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/ext/__init__.py b/userge/core/ext/__init__.py index e1b17a434..eac2c49f0 100644 --- a/userge/core/ext/__init__.py +++ b/userge/core/ext/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/ext/pool.py b/userge/core/ext/pool.py index 4c3a786d8..5d41a7d49 100644 --- a/userge/core/ext/pool.py +++ b/userge/core/ext/pool.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/ext/raw_client.py b/userge/core/ext/raw_client.py index b1482fe48..c5306ebb8 100644 --- a/userge/core/ext/raw_client.py +++ b/userge/core/ext/raw_client.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -63,9 +63,9 @@ async def send(self, data: TLObject, retries: int = Session.MAX_RETRIES, key = int(tmp.chat_id) elif isinstance(tmp, (types.InputPeerUser, types.InputPeerUserFromMessage)): key = int(tmp.user_id) - elif isinstance(data, funcs.channels.DeleteMessages): - if isinstance(data.channel, (types.InputChannel, types.InputChannelFromMessage)): - key = int(data.channel.channel_id) + elif isinstance(data, funcs.channels.DeleteMessages) and isinstance( + data.channel, (types.InputChannel, types.InputChannelFromMessage)): + key = int(data.channel.channel_id) if key: async with self.REQ_LOCK: try: @@ -132,4 +132,4 @@ def add(self, log: float) -> None: self._logs.append(log) def update(self, t: float) -> None: - self._logs = [i for i in self._logs if i > t] \ No newline at end of file + self._logs = [i for i in self._logs if i > t] diff --git a/userge/core/methods/__init__.py b/userge/core/methods/__init__.py index 9a61dd319..7e7e84689 100644 --- a/userge/core/methods/__init__.py +++ b/userge/core/methods/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/chats/__init__.py b/userge/core/methods/chats/__init__.py index 6672796b5..9f25aa65b 100644 --- a/userge/core/methods/chats/__init__.py +++ b/userge/core/methods/chats/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/chats/conversation.py b/userge/core/methods/chats/conversation.py index c14f25e1a..b2a5df871 100644 --- a/userge/core/methods/chats/conversation.py +++ b/userge/core/methods/chats/conversation.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/chats/send_read_acknowledge.py b/userge/core/methods/chats/send_read_acknowledge.py index 73a684dcc..d33f0668d 100644 --- a/userge/core/methods/chats/send_read_acknowledge.py +++ b/userge/core/methods/chats/send_read_acknowledge.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/decorators/__init__.py b/userge/core/methods/decorators/__init__.py index c1d9e0305..ef8a205b7 100644 --- a/userge/core/methods/decorators/__init__.py +++ b/userge/core/methods/decorators/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/decorators/add_task.py b/userge/core/methods/decorators/add_task.py index c3bffc25a..0310be68e 100644 --- a/userge/core/methods/decorators/add_task.py +++ b/userge/core/methods/decorators/add_task.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/decorators/on_cmd.py b/userge/core/methods/decorators/on_cmd.py index 1fbc6640d..8aa5bcf64 100644 --- a/userge/core/methods/decorators/on_cmd.py +++ b/userge/core/methods/decorators/on_cmd.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/decorators/on_filters.py b/userge/core/methods/decorators/on_filters.py index 31d61f0a3..762c93adb 100644 --- a/userge/core/methods/decorators/on_filters.py +++ b/userge/core/methods/decorators/on_filters.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/decorators/on_left_member.py b/userge/core/methods/decorators/on_left_member.py index 5037f1b1f..4af281bf7 100644 --- a/userge/core/methods/decorators/on_left_member.py +++ b/userge/core/methods/decorators/on_left_member.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/decorators/on_new_member.py b/userge/core/methods/decorators/on_new_member.py index e0498ad6f..589fe363a 100644 --- a/userge/core/methods/decorators/on_new_member.py +++ b/userge/core/methods/decorators/on_new_member.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/messages/__init__.py b/userge/core/methods/messages/__init__.py index 21de42c80..c820d90ed 100644 --- a/userge/core/methods/messages/__init__.py +++ b/userge/core/methods/messages/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/messages/edit_message_text.py b/userge/core/methods/messages/edit_message_text.py index d48fd7551..68df6f06f 100644 --- a/userge/core/methods/messages/edit_message_text.py +++ b/userge/core/methods/messages/edit_message_text.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/messages/send_as_file.py b/userge/core/methods/messages/send_as_file.py index 1d6a0d61a..fa8ed5a62 100644 --- a/userge/core/methods/messages/send_as_file.py +++ b/userge/core/methods/messages/send_as_file.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -60,10 +60,6 @@ async def send_as_file(self, to the log channel. If ``str``, the logger name will be updated. - delete_message (``bool``, *optional*): - If ``True``, the message will be deleted - after sending the file. - reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. diff --git a/userge/core/methods/messages/send_message.py b/userge/core/methods/messages/send_message.py index 28d85e35d..65dc79d60 100644 --- a/userge/core/methods/messages/send_message.py +++ b/userge/core/methods/messages/send_message.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/users/__init__.py b/userge/core/methods/users/__init__.py index e19a65e30..460d21021 100644 --- a/userge/core/methods/users/__init__.py +++ b/userge/core/methods/users/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/users/get_user_dict.py b/userge/core/methods/users/get_user_dict.py index 5739547be..48037b5d8 100644 --- a/userge/core/methods/users/get_user_dict.py +++ b/userge/core/methods/users/get_user_dict.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/utils/__init__.py b/userge/core/methods/utils/__init__.py index 28103ffbb..82ef641bf 100644 --- a/userge/core/methods/utils/__init__.py +++ b/userge/core/methods/utils/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/utils/get_channel_logger.py b/userge/core/methods/utils/get_channel_logger.py index 8efe1ee17..ab64eb21e 100644 --- a/userge/core/methods/utils/get_channel_logger.py +++ b/userge/core/methods/utils/get_channel_logger.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/utils/get_logger.py b/userge/core/methods/utils/get_logger.py index d8dfd5cc3..43c6b2352 100644 --- a/userge/core/methods/utils/get_logger.py +++ b/userge/core/methods/utils/get_logger.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/methods/utils/restart.py b/userge/core/methods/utils/restart.py index 53204857c..cb605c7d2 100644 --- a/userge/core/methods/utils/restart.py +++ b/userge/core/methods/utils/restart.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -12,6 +12,7 @@ import os import sys +import signal import psutil @@ -23,19 +24,24 @@ class Restart(RawClient): # pylint: disable=missing-class-docstring - async def restart(self, update_req: bool = False) -> None: # pylint: disable=arguments-differ - """ Restart the AbstractUserge """ + async def restart(self, update_req: bool = False, # pylint: disable=arguments-differ + hard: bool = False) -> None: + """ Restart the Abstract USERGE-X""" _LOG.info(_LOG_STR, "Restarting USERGE-X") await self.stop() - try: - c_p = psutil.Process(os.getpid()) - for handler in c_p.open_files() + c_p.connections(): - os.close(handler.fd) - except Exception as c_e: # pylint: disable=broad-except - print(_LOG_STR % c_e) if update_req: - print(_LOG_STR % "Installing Requirements...") + _LOG.info(_LOG_STR, "Installing Requirements...") os.system( # nosec "pip3 install -U pip && pip3 install --no-cache-dir -r requirements.txt") - os.execl(sys.executable, sys.executable, '-m', 'userge') # nosec - sys.exit() + _LOG.info(_LOG_STR, "Requirements Installed !") + if hard: + os.kill(os.getpid(), signal.SIGUSR1) + else: + try: + c_p = psutil.Process(os.getpid()) + for handler in c_p.open_files() + c_p.connections(): + os.close(handler.fd) + except Exception as c_e: # pylint: disable=broad-except + print(_LOG_STR % c_e) + os.execl(sys.executable, sys.executable, '-m', 'userge') # nosec + sys.exit() diff --git a/userge/core/methods/utils/terminate.py b/userge/core/methods/utils/terminate.py index f5cab8ee9..5e30e1724 100644 --- a/userge/core/methods/utils/terminate.py +++ b/userge/core/methods/utils/terminate.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/__init__.py b/userge/core/types/__init__.py index 8ee3e1b1a..f51ac59df 100644 --- a/userge/core/types/__init__.py +++ b/userge/core/types/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/bound/__init__.py b/userge/core/types/bound/__init__.py index bcfd489e8..44973faa6 100644 --- a/userge/core/types/bound/__init__.py +++ b/userge/core/types/bound/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/bound/message.py b/userge/core/types/bound/message.py index 3798e1a5c..65929675b 100644 --- a/userge/core/types/bound/message.py +++ b/userge/core/types/bound/message.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/new/__init__.py b/userge/core/types/new/__init__.py index c09c8af60..c602a7417 100644 --- a/userge/core/types/new/__init__.py +++ b/userge/core/types/new/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/new/conversation.py b/userge/core/types/new/conversation.py index 283393bd5..a2becfaaf 100644 --- a/userge/core/types/new/conversation.py +++ b/userge/core/types/new/conversation.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -179,7 +179,7 @@ async def _on_conversation(_, msg: RawMessage) -> None: _filters.create( lambda _, __, query: _CONV_DICT and query.chat and ( query.chat.id, client - ) in _CONV_DICT, 0 + ) in _CONV_DICT, "conversation" ) ) ) diff --git a/userge/core/types/new/manager.py b/userge/core/types/new/manager.py index f88028a32..67252f4ab 100644 --- a/userge/core/types/new/manager.py +++ b/userge/core/types/new/manager.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/raw/__init__.py b/userge/core/types/raw/__init__.py index ab1d40c42..922ecea63 100644 --- a/userge/core/types/raw/__init__.py +++ b/userge/core/types/raw/__init__.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/raw/command.py b/userge/core/types/raw/command.py index b362a9a02..4f38a3257 100644 --- a/userge/core/types/raw/command.py +++ b/userge/core/types/raw/command.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -52,8 +52,8 @@ def parse(cls, command: str, # pylint: disable=arguments-differ outgoing_flt = filters.create( lambda _, __, m: m.via_bot is None - and not m.forward_sender_name - and not m.forward_from + and not m.scheduled + and not (m.forward_from or m.forward_sender_name) and not (m.from_user and m.from_user.is_bot) and (m.outgoing or (m.from_user and m.from_user.is_self)) and not (m.chat and m.chat.type == "channel" and m.edit_date) @@ -61,10 +61,10 @@ def parse(cls, command: str, # pylint: disable=arguments-differ incoming_flt = filters.create( lambda _, __, m: m.via_bot is None - and not m.forward_sender_name - and not m.forward_from and not m.outgoing and trigger + and not m.scheduled + and not (m.forward_from or m.forward_sender_name) and m.from_user and m.text and ((m.from_user.id in Config.OWNER_ID) or (Config.SUDO_ENABLED and (m.from_user.id in Config.SUDO_USERS) diff --git a/userge/core/types/raw/filter.py b/userge/core/types/raw/filter.py index 73ea5b3de..ce456615a 100644 --- a/userge/core/types/raw/filter.py +++ b/userge/core/types/raw/filter.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/core/types/raw/plugin.py b/userge/core/types/raw/plugin.py index dfaef639e..05068121a 100644 --- a/userge/core/types/raw/plugin.py +++ b/userge/core/types/raw/plugin.py @@ -1,10 +1,10 @@ # pylint: disable=missing-module-docstring # -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. diff --git a/userge/plugins/misc/google_img.py b/userge/plugins/misc/google_img.py new file mode 100644 index 000000000..529315e53 --- /dev/null +++ b/userge/plugins/misc/google_img.py @@ -0,0 +1,202 @@ +"""Google IMGS""" + +# Copyright (C) 2021 BY USERGE-X +# All rights reserved. +# +# Author: https://github.com/code-rgb [TG: @DeletedUser420] + + +import asyncio +import os +from datetime import datetime +from pathlib import Path +from shutil import rmtree + +from google_images_download.google_images_download import googleimagesdownload +from pyrogram.errors import FloodWait +from pyrogram.types import InputMediaDocument, InputMediaPhoto + +from userge import Config, Message, pool, userge +from userge.utils import sublists + +from .upload import doc_upload, photo_upload + + +class Colors: + # fmt: off + choice = [ + "red", "orange", "yellow", + "green", "teal", "blue", + "purple", "pink", "white", + "gray", "black", "brown", + ] + # fmt: on + + +@userge.on_cmd( + "gimg", + about={ + "header": "Google Image Downloader", + "description": "Search and download images from google and upload to telegram", + "flags": { + "-l": "limit [1 - 40] (default is 5)", + "-q": "quality [0-2] (2 is best | default is 1)", + "-d": "Upload as document", + "-gif": "download gifs", + "-down": "download only", + }, + "usage": "{tr}gimg [flags] [query|reply to text]", + "color": ["-" + _ for _ in Colors.choice], + "examples": [ + "{tr}gimg wallpaper", + "{tr}gimg -red wallpaper ", + "{tr}gimg tigers ", + "{tr}gimg -d -l20 tigers ", + "{tr}gimg -gif rain ", + ], + }, + del_pre=True, +) +async def gimg_down(message: Message): + """google images downloader""" + reply = message.reply_to_message + args = message.filtered_input_str + if args: + text = args + elif reply: + text = args or reply.text or reply.caption + else: + await message.err("`Input not found!...`", del_in=5) + return + await message.edit("🔎") + start_t = datetime.now() + color_ = None + flags_ = message.flags + allow_gif = bool("gif" in flags_) + upload_ = not bool("down" in flags_ or allow_gif) + doc_ = bool("d" in flags_) + limit = min(int(flags_.get("l", 3)), 40) + if flags_: + size = min(int(flags_.get("q", 1)), 2) + for i in flags_: + if i in Colors.choice: + color_ = i + break + arguments = await get_arguments( + query=text, + limit=limit, + img_format="gif" if allow_gif else "jpg", + color=color_, + upload=upload_, + size=size, + ) + else: + arguments = await get_arguments(query=text) + media_type = "Gifs" if allow_gif else "Pics" + await message.edit(f"⬇️ Downloading {limit} {media_type}...") + try: + results = await gimg_downloader(arguments) + except Exception as e: + await message.err(str(e), del_in=7) + return + if upload_: + await message.edit(f"⬆️ Uploading {limit} {media_type}......") + try: + await upload_image_grp(results, message, doc_) + except Exception as err: + await message.err(str(err), del_in=7) + else: + end_t = datetime.now() + time_taken_s = (end_t - start_t).seconds + await message.edit( + f"Uploaded {limit} Pics in {time_taken_s} sec with {results[1]} errors.", + del_in=5, + log=__name__, + ) + else: + end_t = datetime.now() + time_taken_s = (end_t - start_t).seconds + await message.edit( + f'Downloaded {limit} {media_type} to `{arguments["output_directory"]}` in {time_taken_s}' + f"sec with {results[1]} errors.", + log=__name__, + ) + + +async def get_arguments( + query: str, + limit: int = 5, + img_format: str = "jpg", + color: str = None, + upload: bool = True, + size: int = 1, +): + arguments = { + "keywords": query, + "limit": limit, + "format": img_format, + } + if upload: + output_directory = await check_path() + arguments["no_directory"] = "no_directory" + else: + output_directory = await check_path(path_name=query) + arguments["output_directory"] = output_directory + if color: + arguments["color"] = color + # ------ size ------ # + if size <= 0: + size_ = "icon" + elif size == 1: + size_ = "medium" + else: + size_ = "large" + arguments["size"] = size_ + # ------------------- # + return arguments + + +@pool.run_in_thread +def check_path(path_name: str = "GIMG"): + path_ = os.path.join(Config.DOWN_PATH, path_name) + if os.path.lexists(path_): + rmtree(path_, ignore_errors=True) + os.mkdir(path_) + return path_ + + +@pool.run_in_thread +def gimg_downloader(arguments): + response = googleimagesdownload() + path_ = response.download(arguments) + return path_ + + +async def upload_image_grp(results, message: Message, doc: bool = False): + key_ = list(results[0])[0] + medias_ = results[0][key_] + if message.process_is_canceled: + await message.client.stop_transmission() + if len(medias_) == 0: + await message.err(f"No result Found `'{key_}'`", del_in=7) + if len(medias_) == 1: + path_ = Path(medias_[0]) + if doc: + await doc_upload(message=message, path=path_, del_path=True) + else: + await photo_upload(message=message, path=path_, del_path=True) + else: + mgroups = sublists( + [ + (InputMediaDocument(media=x) if doc else InputMediaPhoto(media=x)) + for x in medias_ + if x.endswith(".jpg") + ], + width=10, + ) + for m_ in mgroups: + try: + await message.client.send_media_group(message.chat.id, media=m_) + await asyncio.sleep(1) + except FloodWait as f: + await asyncio.sleep(f.x + 3) diff --git a/userge/plugins/tools/system.py b/userge/plugins/tools/system.py index c895bb454..78c86befc 100644 --- a/userge/plugins/tools/system.py +++ b/userge/plugins/tools/system.py @@ -1,9 +1,9 @@ """ system commands """ -# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. +# Copyright (C) 2020-2021 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". -# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > +# Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. @@ -46,7 +46,7 @@ async def _init() -> None: about={ "header": "Restarts the bot and reload all plugins", "flags": { - "-h": "restart heroku dyno", + "-h": "restart hard", "-t": "clean temp loaded plugins", "-d": "clean working folder", }, @@ -57,28 +57,34 @@ async def _init() -> None: allow_channels=False, ) async def restart_(message: Message): - """ restart userge """ - await message.edit("Restarting USERGE-X Services", log=__name__) + """ restart USERGE-X """ + await message.edit("`Restarting USERGE-X Services`", log=__name__) LOG.info("USERGE-X Services - Restart initiated") if "t" in message.flags: shutil.rmtree(Config.TMP_PATH, ignore_errors=True) if "d" in message.flags: shutil.rmtree(Config.DOWN_PATH, ignore_errors=True) - if Config.HEROKU_APP and "h" in message.flags: - await message.edit( - "`Heroku app found, trying to restart dyno...\nthis will take upto 30 sec`", - del_in=3, - ) - Config.HEROKU_APP.restart() - time.sleep(30) + if "h" in message.flags: + if Config.HEROKU_APP: + await message.edit( + "`Heroku app found, trying to restart dyno...\nthis will take upto 30 sec`", + del_in=3, + ) + Config.HEROKU_APP.restart() + time.sleep(30) + else: + await message.edit("`Restarting [HARD] ...`", del_in=1) + asyncio.get_event_loop().create_task(userge.restart(hard=True)) else: - await message.edit("finalizing...", del_in=1) + await message.edit("`Restarting [SOFT] ...`", del_in=1) asyncio.get_event_loop().create_task(userge.restart()) -@userge.on_cmd("shutdown", about={"header": "shutdown userge :)"}, allow_channels=False) +@userge.on_cmd( + "shutdown", about={"header": "shutdown USERGE-X :)"}, allow_channels=False +) async def shutdown_(message: Message) -> None: - """ shutdown userge """ + """ shutdown USERGE-X """ await message.edit("`shutting down ...`") if Config.HEROKU_APP: try: @@ -103,7 +109,7 @@ async def shutdown_(message: Message) -> None: allow_channels=False, ) async def die_(message: Message) -> None: - """ set offline timeout to die userge """ + """ set offline timeout to die USERGE-X """ global MAX_IDLE_TIME # pylint: disable=global-statement if not Config.HEROKU_APP: await message.err("`heroku app not detected !`") @@ -331,11 +337,11 @@ async def view_disabled_chats_(message: Message): @userge.on_cmd( "sleep (\\d+)", - about={"header": "sleep userge :P", "usage": "{tr}sleep [timeout in seconds]"}, + about={"header": "sleep USERGE-X :P", "usage": "{tr}sleep [timeout in seconds]"}, allow_channels=False, ) async def sleep_(message: Message) -> None: - """ sleep userge """ + """ sleep USERGE-X """ seconds = int(message.matches[0].group(1)) await message.edit(f"`sleeping {seconds} seconds...`") asyncio.get_event_loop().create_task(_slp_wrkr(seconds)) diff --git a/userge/plugins/tools/updater.py b/userge/plugins/tools/updater.py index 3fb887252..49b9ed11f 100644 --- a/userge/plugins/tools/updater.py +++ b/userge/plugins/tools/updater.py @@ -1,4 +1,5 @@ import asyncio +from os import system from time import time from git import Repo @@ -46,7 +47,6 @@ async def check_update(message: Message): flags.remove("push") if len(flags) == 1: branch = flags[0] - repo = Repo() if branch not in repo.branches: await message.err(f"invalid branch name : {branch}") @@ -54,8 +54,14 @@ async def check_update(message: Message): try: out = _get_updates(repo, branch) except GitCommandError as g_e: - await message.err(g_e, del_in=5) - return + if "128" in str(g_e): + system( + f"git fetch {Config.UPSTREAM_REMOTE} {branch} && git checkout -f {branch}" + ) + out = _get_updates(repo, branch) + else: + await message.err(g_e, del_in=5) + return if not (pull_from_repo or push_to_heroku): if out: change_log = ( diff --git a/userge/utils/aiohttp_helper.py b/userge/utils/aiohttp_helper.py index 09f826bcb..9059803c5 100644 --- a/userge/utils/aiohttp_helper.py +++ b/userge/utils/aiohttp_helper.py @@ -1,3 +1,8 @@ +""" +Idea by @Pokurt +Repo: https://github.com/pokurt/Nana-Remix/blob/master/nana/utils/aiohttp_helper.py +""" + from aiohttp import ClientSession, ClientTimeout