Update Ultroid v0.7.1
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: Aditya <me@xditya.me> Co-authored-by: ᴀɴᴏɴʏᴍᴏᴜs <rahulking25102006@gmail.com>
This commit is contained in:
@@ -62,7 +62,7 @@ def main():
|
||||
|
||||
suc_msg = """
|
||||
----------------------------------------------------------------------
|
||||
Ultroid has been deployed! Visit @TeamUltroid for updates!!
|
||||
Ultroid has been deployed! Visit @TheUltroid for updates!!
|
||||
----------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
|
||||
@@ -407,6 +407,8 @@ async def get_paste(data: str, extension: str = "txt"):
|
||||
|
||||
|
||||
async def get_chatbot_reply(message):
|
||||
from .. import ultroid_bot
|
||||
|
||||
chatbot_base = "https://kukiapi.xyz/api/apikey=ULTROIDUSERBOT/Ultroid/{}/message={}"
|
||||
req_link = chatbot_base.format(
|
||||
ultroid_bot.me.first_name or "ultroid user",
|
||||
|
||||
@@ -33,13 +33,13 @@ class UltroidClient(TelegramClient):
|
||||
udB=None,
|
||||
logger: Logger = LOGS,
|
||||
log_attempt=True,
|
||||
handle_auth_error=True,
|
||||
exit_on_error=True,
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
self._cache = {}
|
||||
self._dialogs = []
|
||||
self._handle_error = handle_auth_error
|
||||
self._handle_error = exit_on_error
|
||||
self._log_at = log_attempt
|
||||
self.logger = logger
|
||||
self.udB = udB
|
||||
@@ -74,7 +74,7 @@ class UltroidClient(TelegramClient):
|
||||
if self._handle_error:
|
||||
self.logger.critical("String session expired. Create new!")
|
||||
return sys.exit()
|
||||
raise er
|
||||
self.logger.critical("String session expired.")
|
||||
except (AccessTokenExpiredError, AccessTokenInvalidError):
|
||||
# AccessTokenError can only occur for Bot account
|
||||
# And at Early Process, Its saved in DB.
|
||||
|
||||
@@ -30,7 +30,7 @@ DC_IPV4 = {
|
||||
}
|
||||
|
||||
|
||||
def validate_session(session, logger=LOGS):
|
||||
def validate_session(session, logger=LOGS, _exit=True):
|
||||
from strings import get_string
|
||||
if session:
|
||||
# Telethon Session
|
||||
@@ -63,19 +63,25 @@ def validate_session(session, logger=LOGS):
|
||||
)
|
||||
).decode("ascii")
|
||||
)
|
||||
else:
|
||||
logger.exception(get_string("py_c1"))
|
||||
if _exit:
|
||||
sys.exit()
|
||||
logger.exception(get_string("py_c2"))
|
||||
sys.exit()
|
||||
if _exit:
|
||||
sys.exit()
|
||||
|
||||
|
||||
def vc_connection(udB, ultroid_bot):
|
||||
from strings import get_string
|
||||
VC_SESSION = Var.VC_SESSION or udB.get_key("VC_SESSION")
|
||||
if VC_SESSION and VC_SESSION != Var.SESSION:
|
||||
LOGS.info("Starting up VcClient.")
|
||||
try:
|
||||
return UltroidClient(
|
||||
validate_session(VC_SESSION, LOGS),
|
||||
validate_session(VC_SESSION, _exit=False),
|
||||
log_attempt=False,
|
||||
handle_auth_error=False,
|
||||
exit_on_error=False
|
||||
)
|
||||
except (AuthKeyDuplicatedError, EOFError):
|
||||
LOGS.info(get_string("py_c3"))
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# PLease read the GNU Affero General Public License in
|
||||
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
||||
|
||||
import os
|
||||
import os, subprocess
|
||||
from shutil import rmtree
|
||||
|
||||
from decouple import config
|
||||
@@ -27,6 +27,7 @@ def _after_load(loader, module, plugin_name=""):
|
||||
doc = doc_.format(i=HNDLR)
|
||||
except Exception as er:
|
||||
loader._logger.exception(er)
|
||||
loader._logger.info(f"Error in {plugin_name}: {module}")
|
||||
return
|
||||
if loader.key in HELP.keys():
|
||||
update_cmd = HELP[loader.key]
|
||||
@@ -64,26 +65,28 @@ def load_other_plugins(addons=None, pmbot=None, manager=None, vcbot=None):
|
||||
# for addons
|
||||
if addons:
|
||||
if url := udB.get_key("ADDONS_URL"):
|
||||
os.system(f"git clone -q {url} addons")
|
||||
subprocess.run(f"git clone -q {url} addons", shell=True)
|
||||
if os.path.exists("addons") and not os.path.exists("addons/.git"):
|
||||
rmtree("addons")
|
||||
if not os.path.exists("addons"):
|
||||
os.system(
|
||||
f"git clone -q -b {Repo().active_branch} https://github.com/TeamUltroid/UltroidAddons.git addons"
|
||||
subprocess.run(
|
||||
f"git clone -q -b {Repo().active_branch} https://github.com/TeamUltroid/UltroidAddons.git addons",
|
||||
shell=True,
|
||||
)
|
||||
else:
|
||||
os.system("cd addons && git pull -q && cd ..")
|
||||
subprocess.run("cd addons && git pull -q && cd ..", shell=True)
|
||||
|
||||
if not os.path.exists("addons"):
|
||||
os.system(
|
||||
"git clone -q https://github.com/TeamUltroid/UltroidAddons.git addons"
|
||||
subprocess.run(
|
||||
"git clone -q https://github.com/TeamUltroid/UltroidAddons.git addons",
|
||||
shell=True,
|
||||
)
|
||||
if os.path.exists("addons/addons.txt"):
|
||||
# generally addons req already there so it won't take much time
|
||||
os.system(
|
||||
"rm -rf /usr/local/lib/python3.9/site-packages/pip/_vendor/.wh.appdirs.py"
|
||||
)
|
||||
os.system("pip3 install --no-cache-dir -q -r ./addons/addons.txt")
|
||||
# subprocess.run(
|
||||
# "rm -rf /usr/local/lib/python3.*/site-packages/pip/_vendor/.wh*"
|
||||
# )
|
||||
subprocess.run("pip3 install --no-cache-dir -q -r ./addons/addons.txt", shell=True)
|
||||
|
||||
_exclude = udB.get_key("EXCLUDE_ADDONS")
|
||||
_exclude = _exclude.split() if _exclude else []
|
||||
@@ -113,11 +116,11 @@ def load_other_plugins(addons=None, pmbot=None, manager=None, vcbot=None):
|
||||
|
||||
if os.path.exists("vcbot"):
|
||||
if os.path.exists("vcbot/.git"):
|
||||
os.system("cd vcbot && git pull")
|
||||
subprocess.run("cd vcbot && git pull", shell=True)
|
||||
else:
|
||||
rmtree("vcbot")
|
||||
if not os.path.exists("vcbot"):
|
||||
os.system("git clone https://github.com/TeamUltroid/VcBot vcbot")
|
||||
subprocess.run("git clone https://github.com/TeamUltroid/VcBot vcbot", shell=True)
|
||||
try:
|
||||
if not os.path.exists("vcbot/downloads"):
|
||||
os.mkdir("vcbot/downloads")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
__version__ = "2022.08.30"
|
||||
ultroid_version = "0.7"
|
||||
ultroid_version = "0.7.1"
|
||||
|
||||
Reference in New Issue
Block a user