diff --git a/app.json b/app.json
index 155e90e..7ffa52c 100644
--- a/app.json
+++ b/app.json
@@ -25,7 +25,7 @@
"required": false
},
"SESSION": {
- "description": "Your session string. Can be added now, or after deploy. (The bot will NOT work without a session string!!)",
+ "description": "Session String (telethon or pyrogram) for your telegram user account. The userbot will NOT work without a session string!!",
"value": ""
},
"REDIS_URI": {
diff --git a/assistant/callbackstuffs.py b/assistant/callbackstuffs.py
index 2209972..5829115 100644
--- a/assistant/callbackstuffs.py
+++ b/assistant/callbackstuffs.py
@@ -289,7 +289,8 @@ async def update(eve):
heroku = heroku3.from_key(heroku_api)
heroku_app = None
heroku_applications = heroku.apps()
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await eve.edit("`Wrong HEROKU_API.`")
for app in heroku_applications:
if app.name == app_name:
@@ -807,14 +808,14 @@ async def media(event):
)
response = await conv.get_response()
try:
- themssg = response.message.message
+ themssg = response.message
if themssg == "/cancel":
return await conv.send_message(
"Operation cancelled!!",
buttons=get_back_button("cbs_alvcstm"),
)
- except BaseException:
- pass
+ except BaseException as er:
+ LOGS.exception(er)
if (
not (response.text).startswith("/")
and response.text != ""
@@ -829,7 +830,8 @@ async def media(event):
x = upl(media)
url = f"https://graph.org/{x[0]}"
remove(media)
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await conv.send_message(
"Terminated.",
buttons=get_back_button("cbs_alvcstm"),
@@ -848,7 +850,8 @@ async def dell(event):
return await event.edit(
get_string("clst_5"), buttons=get_back_button("cbs_alabs_vcstm")
)
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await event.edit(
get_string("clst_4"),
buttons=get_back_button("cbs_alabs_vcstm"),
@@ -944,14 +947,14 @@ async def media(event):
)
response = await conv.get_response()
try:
- themssg = response.message.message
+ themssg = response.message
if themssg == "/cancel":
return await conv.send_message(
"Operation cancelled!!",
buttons=get_back_button("cbs_pmcstm"),
)
- except BaseException:
- pass
+ except BaseException as er:
+ LOGS.exception(er)
media = await event.client.download_media(response, "pmpc")
if (
not (response.text).startswith("/")
@@ -966,7 +969,8 @@ async def media(event):
x = upl(media)
url = f"https://graph.org/{x[0]}"
remove(media)
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await conv.send_message(
"Terminated.",
buttons=get_back_button("cbs_pmcstm"),
@@ -985,7 +989,8 @@ async def dell(event):
return await event.edit(
get_string("clst_5"), buttons=get_back_button("cbs_pmcstm")
)
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await event.edit(
get_string("clst_4"),
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
@@ -1010,7 +1015,8 @@ async def apof(event):
"Done! AUTOAPPROVE Stopped!!",
buttons=[[Button.inline("« Bᴀᴄᴋ", data="cbs_apauto")]],
)
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await event.edit(
get_string("clst_4"),
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
@@ -1052,7 +1058,8 @@ async def pmlogof(event):
"Done! PMLOGGER Stopped!!",
buttons=[[Button.inline("« Bᴀᴄᴋ", data="pml")]],
)
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await event.edit(
get_string("clst_4"),
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
@@ -1212,14 +1219,14 @@ async def media(event):
)
response = await conv.get_response()
try:
- themssg = response.message.message
+ themssg = response.message
if themssg == "/cancel":
return await conv.send_message(
"Operation cancelled!!",
buttons=get_back_button("setter"),
)
- except BaseException:
- pass
+ except BaseException as er:
+ LOGS.exception(er)
media = await event.client.download_media(response, "inlpic")
if (
not (response.text).startswith("/")
@@ -1232,7 +1239,8 @@ async def media(event):
x = upl(media)
url = f"https://graph.org/{x[0]}"
remove(media)
- except BaseException:
+ except BaseException as er:
+ LOGS.exception(er)
return await conv.send_message(
"Terminated.",
buttons=get_back_button("setter"),
diff --git a/installer.sh b/installer.sh
index cdd1617..e8067a7 100644
--- a/installer.sh
+++ b/installer.sh
@@ -41,6 +41,7 @@ clone_repo(){
}
install_requirements(){
+ pip install --upgrade pip
echo -e "\n\nInstalling requirements... "
pip3 install -q --no-cache-dir -r $DIR/requirements.txt
pip3 install -q -r $DIR/resources/startup/optional-requirements.txt
diff --git a/plugins/admintools.py b/plugins/admintools.py
index 0ff267a..75224dc 100644
--- a/plugins/admintools.py
+++ b/plugins/admintools.py
@@ -43,7 +43,6 @@ from . import (
)
async def prmte(ult):
xx = await ult.eor(get_string("com_1"))
- await ult.get_chat()
user, rank = await get_uinfo(ult)
rank = rank or "Admin"
FullRight = False
@@ -87,7 +86,6 @@ async def prmte(ult):
)
async def dmote(ult):
xx = await ult.eor(get_string("com_1"))
- await ult.get_chat()
user, rank = await get_uinfo(ult)
if not rank:
rank = "Not Admin"
diff --git a/plugins/fedutils.py b/plugins/fedutils.py
deleted file mode 100644
index b07887c..0000000
--- a/plugins/fedutils.py
+++ /dev/null
@@ -1,336 +0,0 @@
-# Ultroid - UserBot
-# Copyright (C) 2021-2022 TeamUltroid
-#
-# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
-# PLease read the GNU Affero General Public License in
-# .
-
-from . import get_help
-
-__doc__ = get_help("help_fedutils")
-
-import asyncio
-import os
-
-from telethon.errors.rpcerrorlist import YouBlockedUserError
-
-from pyUltroid.dB import DEVLIST
-
-from . import get_string, udB, ultroid_bot, ultroid_cmd
-
-bot = "@MissRose_bot"
-
-
-@ultroid_cmd(
- pattern="superfban( (.*)|$)",
-)
-async def _(event):
- msg = await event.eor(get_string("sf_1"))
- inputt = event.pattern_match.group(1).strip()
- if event.reply_to_msg_id:
- FBAN = (await event.get_reply_message()).sender_id
- if inputt:
- REASON = inputt
- elif inputt:
- REASON = "#ULTMassBanned"
- arg = event.text.split()
- if len(arg) == 2:
- FBAN = await event.client.parse_id(arg[1])
- elif len(arg) > 2:
- FBAN = await event.client.parse_id(arg[1])
- REASON = event.text.split(maxsplit=2)[-1]
- else:
- return await msg.edit(get_string("sf_22"))
- else:
- return await msg.edit("`Reply to a message or give some input...`")
- if FBAN in DEVLIST:
- return await msg.edit("The user is my Dev and cannot be FBanned!")
-
- if udB.get_key("FBAN_GROUP_ID"):
- chat = int(udB.get_key("FBAN_GROUP_ID"))
- else:
- chat = await event.get_chat()
- fedList = []
- if not fedList:
- for a in range(3):
- async with event.client.conversation("@MissRose_bot") as bot_conv:
- await bot_conv.send_message("/start")
- await asyncio.sleep(3)
- await bot_conv.send_message("/myfeds")
- await asyncio.sleep(3)
- try:
- response = await bot_conv.get_response()
- except asyncio.exceptions.TimeoutError:
- return await msg.edit(
- get_string("sf_4"),
- )
- await asyncio.sleep(3)
- if "make a file" in response.text or "Looks like" in response.text:
- await response.click(0)
- await asyncio.sleep(3)
- fedfile = await bot_conv.get_response()
- await asyncio.sleep(3)
- if fedfile.media:
- downloaded_file_name = await ultroid_bot.download_media(
- fedfile,
- "fedlist",
- )
- await asyncio.sleep(6)
- file = open(downloaded_file_name, errors="ignore")
- lines = file.readlines()
- for line in lines:
- try:
- fedList.append(line[:36])
- except BaseException:
- pass
- elif get_string("sf_5") in (await bot_conv.get_edit):
- return await msg.edit(get_string("sf_6"))
- if not fedList:
- await msg.edit(
- f"Unable to collect FedAdminList. Retrying ({a+1}/3)...",
- )
- else:
- break
- else:
- await msg.edit(get_string("sf_8"))
- In = False
- tempFedId = ""
- for x in response.text:
- if x == "`":
- if In:
- In = False
- fedList.append(tempFedId)
- tempFedId = ""
- else:
- In = True
- elif In:
- tempFedId += x
- if not fedList:
- return await msg.edit(get_string("sf_9"))
- await msg.edit(f"FBaning in {len(fedList)} feds.")
- try:
- await ultroid_bot.send_message(chat, "/start")
- except BaseException:
- return await msg.edit(get_string("sf_11"))
- await asyncio.sleep(3)
- if udB.get_key("EXCLUDE_FED"):
- excludeFed = udB.get_key("EXCLUDE_FED").split(" ")
- for num, item in enumerate(excludeFed):
- excludeFed[num] = item.strip()
- exCount = 0
- for fed in fedList:
- if udB.get_key("EXCLUDE_FED") and fed in excludeFed:
- await ultroid_bot.send_message(chat, f"{fed} Excluded.")
- exCount += 1
- continue
- await event.client.send_message(chat, f"/joinfed {fed}")
- await asyncio.sleep(3)
- await event.client.send_message(chat, f"/fban {FBAN} {REASON}")
- await asyncio.sleep(3)
- try:
- os.remove("fedlist")
- except Exception as e:
- print(f"Error in removing FedAdmin file.\n{e}")
- await msg.edit(
- f"SuperFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\nAffected {len(fedList) - exCount} feds.\n#Ultroid",
- )
-
-
-@ultroid_cmd(
- pattern="superunfban( (.*)|$)",
-)
-async def _(event):
- msg = await event.eor(get_string("sf_15"))
- fedList = []
- if event.reply_to_msg_id:
- previous_message = await event.get_reply_message()
- if previous_message.media:
- downloaded_file_name = await ultroid_bot.download_media(
- previous_message,
- "fedlist",
- )
- file = open(downloaded_file_name, encoding="utf8")
- lines = file.readlines()
- for line in lines:
- try:
- fedList.append(line[:36])
- except BaseException:
- pass
- arg = event.text.split(" ", maxsplit=2)
- FBAN = arg[1]
- REASON = arg[2] if len(arg) > 2 else ""
- else:
- FBAN = previous_message.sender_id
- try:
- REASON = event.text.split(" ", maxsplit=1)[1]
- except BaseException:
- REASON = ""
- if not REASON.strip():
- REASON = ""
- else:
- arg = event.text.split(" ", maxsplit=2)
- if len(arg) > 2:
- try:
- FBAN = arg[1]
- REASON = arg[2]
- except BaseException:
- return await msg.edit(get_string("sf_2"))
- else:
- try:
- FBAN = arg[1]
- REASON = " #ULTMassUnBanned "
- except BaseException:
- return await msg.edit(get_string("sf_2"))
- if udB.get_key("FBAN_GROUP_ID"):
- chat = int(udB.get_key("FBAN_GROUP_ID"))
- else:
- chat = await event.get_chat()
- if not fedList:
- for a in range(3):
- async with event.client.conversation("@MissRose_bot") as bot_conv:
- await bot_conv.send_message("/start")
- await asyncio.sleep(3)
- await bot_conv.send_message("/myfeds")
- await asyncio.sleep(3)
- try:
- response = await bot_conv.get_response()
- except asyncio.exceptions.TimeoutError:
- return await msg.edit(
- get_string("sf_4"),
- )
- await asyncio.sleep(3)
- if "make a file" in response.text or "Looks like" in response.text:
- await response.click(0)
- await asyncio.sleep(3)
- fedfile = await bot_conv.get_response()
- await asyncio.sleep(3)
- if fedfile.media:
- downloaded_file_name = await ultroid_bot.download_media(
- fedfile,
- "fedlist",
- )
- await asyncio.sleep(6)
- file = open(downloaded_file_name, errors="ignore")
- lines = file.readlines()
- for line in lines:
- try:
- fedList.append(line[:36])
- except BaseException:
- pass
- elif get_string("sf_5") in (await bot_conv.get_edit):
- return await msg.edit(get_string("sf_6"))
- if not fedList:
- await msg.edit(
- f"Unable to collect FedAdminList. Retrying ({a+1}/3)...",
- )
- else:
- break
- else:
- await msg.edit(get_string("sf_8"))
- In = False
- tempFedId = ""
- for x in response.text:
- if x == "`":
- if In:
- In = False
- fedList.append(tempFedId)
- tempFedId = ""
- else:
- In = True
- elif In:
- tempFedId += x
- if not fedList:
- return await msg.edit(get_string("sf_9"))
- await msg.edit(f"UnFBaning in {len(fedList)} feds.")
- try:
- await event.client.send_message(chat, "/start")
- except BaseException:
- return await msg.edit(get_string("sf_11"))
- await asyncio.sleep(3)
- if udB.get_key("EXCLUDE_FED"):
- excludeFed = udB.get_key("EXCLUDE_FED").split(" ")
- for n, m in enumerate(excludeFed):
- excludeFed[n] = excludeFed[n].strip()
- exCount = 0
- for fed in fedList:
- if udB.get_key("EXCLUDE_FED") and fed in excludeFed:
- await event.client.send_message(chat, f"{fed} Excluded.")
- exCount += 1
- continue
- await ultroid_bot.send_message(chat, f"/joinfed {fed}")
- await asyncio.sleep(3)
- await ultroid_bot.send_message(chat, f"/unfban {FBAN} {REASON}")
- await asyncio.sleep(3)
- try:
- os.remove("fedlist")
- except Exception as e:
- print(f"Error in removing FedAdmin file.\n{e}")
- await msg.edit(
- f"SuperUnFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\n Affected {len(fedList) - exCount} feds.\n#TB",
- )
-
-
-@ultroid_cmd(
- pattern="fstat( (.*)|$)",
-)
-async def _(event):
- ok = await event.eor("`Checking...`")
- if event.reply_to_msg_id:
- previous_message = await event.get_reply_message()
- sysarg = str(previous_message.sender_id)
- user = f"[user](tg://user?id={sysarg})"
- if event.pattern_match.group(1).strip():
- sysarg += f" {event.pattern_match.group(1).strip()}"
- else:
- sysarg = event.pattern_match.group(1).strip()
- user = sysarg
- if sysarg == "":
- await ok.edit(
- get_string("sf_17"),
- )
- else:
- async with event.client.conversation(bot) as conv:
- try:
- await conv.send_message("/start")
- await conv.get_response()
- await conv.send_message(f"/fedstat {sysarg}")
- audio = await conv.get_response()
- if audio.message.startswith("This command can only be used once"):
- await ok.edit(
- "Oops, you can use this command only once every minute!",
- )
- elif "Looks like" in audio.text:
- await audio.click(0)
- await asyncio.sleep(2)
- audio = await conv.get_response()
- await event.client.send_file(
- event.chat_id,
- audio,
- caption=f"List of feds {user} has been banned in.\n\nCollected using Ultroid.",
- link_preview=False,
- )
- await ok.delete()
- else:
- okk = await conv.get_edit()
- await ok.edit(okk.message)
- await ultroid_bot.send_read_acknowledge(bot)
- except YouBlockedUserError:
- await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
-
-
-@ultroid_cmd(
- pattern="fedinfo( (.*)|$)",
-)
-async def _(event):
- ok = await event.edit(get_string("sf_20"))
- sysarg = event.pattern_match.group(1).strip()
- async with event.client.conversation(bot) as conv:
- try:
- await conv.send_message("/start")
- await conv.get_response()
- await conv.send_message(f"/fedinfo {sysarg}")
- audio = await conv.get_response()
- await event.client.send_read_acknowledge(bot)
- await ok.edit(audio.text + "\n\nFedInfo Extracted by Ultroid")
- except YouBlockedUserError:
- await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
diff --git a/plugins/mediatools.py b/plugins/mediatools.py
index 2acdbe8..3ed6d30 100644
--- a/plugins/mediatools.py
+++ b/plugins/mediatools.py
@@ -7,7 +7,7 @@
"""
✘ Commands Available -
-• `{i}mediainfo `
+• `{i}mediainfo //`
To get info about it.
• `{i}rotate `
@@ -21,7 +21,16 @@ from datetime import datetime as dt
from pyUltroid.fns.misc import rotate_image
from pyUltroid.fns.tools import make_html_telegraph
-from . import LOGS, Telegraph, bash, downloader, get_string, mediainfo, ultroid_cmd
+from . import (
+ LOGS,
+ Telegraph,
+ bash,
+ downloader,
+ get_string,
+ is_url_ok,
+ mediainfo,
+ ultroid_cmd,
+)
try:
import cv2
@@ -63,7 +72,9 @@ async def mi(e):
naam = dl.name
else:
naam = await r.download_media()
- elif match and os.path.isfile(match):
+ elif match and (
+ os.path.isfile(match) or (match.startswith("https://") and is_url_ok(match))
+ ):
naam, xx = match, "file"
else:
return await e.eor(get_string("cvt_3"), time=5)
@@ -74,7 +85,10 @@ async def mi(e):
return await e.edit(out, link_preview=False)
makehtml = ""
if naam.endswith((".jpg", ".png")):
- med = "https://graph.org" + Telegraph.upload_file(naam)[0]["src"]
+ if os.path.exists(naam):
+ med = "https://graph.org" + Telegraph.upload_file(naam)[0]["src"]
+ else:
+ med = match
makehtml += f"
"
for line in out.split("\n"):
line = line.strip()
diff --git a/plugins/specialtools.py b/plugins/specialtools.py
index 767e748..b7a1c2b 100644
--- a/plugins/specialtools.py
+++ b/plugins/specialtools.py
@@ -210,7 +210,7 @@ async def hbd(event):
elif month == "09":
sign = "Virgo" if (day < 23) else "Libra"
elif month == "10":
- sign = "Libra" if (day < 23) else "Scorpion"
+ sign = "Libra" if (day < 23) else "Scorpio"
elif month == "11":
sign = "Scorpio" if (day < 22) else "Sagittarius"
elif month == "12":
diff --git a/pyUltroid/__main__.py b/pyUltroid/__main__.py
index 6fabcac..56a4d60 100644
--- a/pyUltroid/__main__.py
+++ b/pyUltroid/__main__.py
@@ -62,7 +62,7 @@ def main():
suc_msg = """
----------------------------------------------------------------------
- Ultroid has been deployed! Visit @TeamUltroid for updates!!
+ Ultroid has been deployed! Visit @TheUltroid for updates!!
----------------------------------------------------------------------
"""
diff --git a/pyUltroid/fns/tools.py b/pyUltroid/fns/tools.py
index 3481b06..b7622e1 100644
--- a/pyUltroid/fns/tools.py
+++ b/pyUltroid/fns/tools.py
@@ -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",
diff --git a/pyUltroid/startup/BaseClient.py b/pyUltroid/startup/BaseClient.py
index c1f2051..3d037b4 100644
--- a/pyUltroid/startup/BaseClient.py
+++ b/pyUltroid/startup/BaseClient.py
@@ -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.
diff --git a/pyUltroid/startup/connections.py b/pyUltroid/startup/connections.py
index 280769a..521ec38 100644
--- a/pyUltroid/startup/connections.py
+++ b/pyUltroid/startup/connections.py
@@ -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"))
diff --git a/pyUltroid/startup/loader.py b/pyUltroid/startup/loader.py
index 780e4e6..021d12e 100644
--- a/pyUltroid/startup/loader.py
+++ b/pyUltroid/startup/loader.py
@@ -5,7 +5,7 @@
# PLease read the GNU Affero General Public License in
# .
-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")
diff --git a/pyUltroid/version.py b/pyUltroid/version.py
index 608730d..e1c53e1 100644
--- a/pyUltroid/version.py
+++ b/pyUltroid/version.py
@@ -1,2 +1,2 @@
__version__ = "2022.08.30"
-ultroid_version = "0.7"
+ultroid_version = "0.7.1"
diff --git a/requirements.txt b/requirements.txt
index 0bec444..a7d7d9a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
# Important Requirements here.
-https://github.com/New-dev0/Telethon/archive/Carbon.zip
+https://github.com/New-dev0/Telethon/archive/diamond.zip
python-decouple
python-dotenv
diff --git a/resources/session/ssgen.py b/resources/session/ssgen.py
index 9cd18f7..8d063c9 100644
--- a/resources/session/ssgen.py
+++ b/resources/session/ssgen.py
@@ -19,8 +19,11 @@ ULTROID = r"""
"""
-def spinner():
- print("Checking if Telethon is installed...")
+def spinner(x):
+ if x == "tele":
+ print("Checking if Telethon is installed...")
+ else:
+ print("Checking if Pyrogram is installed...")
for _ in range(3):
for frame in r"-\|/-\|/":
print("\b", frame, sep="", end="", flush=True)
@@ -51,18 +54,17 @@ def get_api_id_and_hash():
def telethon_session():
try:
- spinner()
- import telethon # ignore: pylint
+ spinner("tele")
- text = "\bFound an existing installation of Telethon...\nSuccessfully Imported.\n\n"
+ x = "\bFound an existing installation of Telethon...\nSuccessfully Imported.\n\n"
except ImportError:
print("Installing Telethon...")
os.system("pip uninstall telethon -y && pip install -U telethon")
- text = "\bDone. Installed and imported Telethon."
+ x = "\bDone. Installed and imported Telethon."
clear_screen()
print(ULTROID)
- print(text)
+ print(x)
# the imports
@@ -81,7 +83,7 @@ def telethon_session():
with TelegramClient(StringSession(), API_ID, API_HASH) as ultroid:
print("Generating a string session for •ULTROID•")
try:
- ult = ultroid.send_message(
+ ultroid.send_message(
"me",
f"**ULTROID** `SESSION`:\n\n`{ultroid.session.save()}`\n\n**Do not share this anywhere!**",
)
@@ -110,11 +112,52 @@ def telethon_session():
print("If you think It as a Bug, Report to @UltroidSupportChat.\n\n")
+def pyro_session():
+ try:
+ spinner("pyro")
+ from pyrogram import Client
+
+ x = "\bFound an existing installation of Pyrogram...\nSuccessfully Imported.\n\n"
+ except BaseException:
+ print("Installing Pyrogram...")
+ os.system("pip install pyrogram tgcrypto")
+ x = "\bDone. Installed and imported Pyrogram."
+ clear_screen()
+ print(ULTROID)
+ print(x)
+
+ # generate a session
+ API_ID, API_HASH = get_api_id_and_hash()
+ print("Enter phone number when asked.\n\n")
+ with Client(":memory:", api_id=API_ID, api_hash=API_HASH) as pyro:
+ ss = pyro.export_session_string()
+ pyro.send_message(
+ "me",
+ f"`{ss}`\n\nAbove is your Pyrogram Session String for @TheUltroid. **DO NOT SHARE it.**",
+ )
+ print("Session has been sent to your saved messages!")
+ exit(0)
+
+
def main():
clear_screen()
print(ULTROID)
- telethon_session()
- x = input("Run again? (y/n)")
+ try:
+ type_of_ss = int(
+ input(
+ "\nUltroid supports both telethon as well as pyrogram sessions.\n\nWhich session do you want to generate?\n1. Telethon Session.\n2. Pyrogram Session.\n\nEnter choice: "
+ )
+ )
+ except Exception as e:
+ print(e)
+ exit(0)
+ if type_of_ss == 1:
+ telethon_session()
+ elif type_of_ss == 2:
+ pyro_session()
+ else:
+ print("Invalid choice.")
+ x = input("Run again? (Y/n)")
if x.lower() in ["y", "yes"]:
main()
else:
diff --git a/resources/startup/optional-requirements.txt b/resources/startup/optional-requirements.txt
index 6242526..28a8e43 100644
--- a/resources/startup/optional-requirements.txt
+++ b/resources/startup/optional-requirements.txt
@@ -24,7 +24,7 @@ pytz
qrcode
requests
tabulate
-telegraph
+git+https://github.com/xditya/telegraph.git@41fd800#egg=telegraph
tgcrypto
youtube-search-python
yt-dlp
diff --git a/strings/README.md b/strings/README.md
index d828724..5133377 100644
--- a/strings/README.md
+++ b/strings/README.md
@@ -3,30 +3,30 @@
| Code | Language | Translated | Remaining |
|----|-------|-------|---|
-| en | English [English] | 490 | 0 |
-| ar | Arabic [العربية] | 490 | NULL |
-| az | Azerbaijan [Azərbaycan] | 490 | NULL |
-| bn | Bengali [বাংলা] | 490 | NULL |
-| cn | Chinese [简体中文] | 490 | NULL |
-| es | Spanish [Español] | 490 | NULL |
-| fa | Persian [Farsi] | 491 | -1 |
-| fr | French [Français] | 490 | NULL |
-| gu | Gujarati [ગુજરાતી] | 490 | NULL |
-| hi | Hindi [हिंदी] | 490 | NULL |
-| id | Indonesia [Indonesia] | 490 | NULL |
-| it | Italian [italiano] | 490 | NULL |
-| jp | Japanese [日本] | 490 | NULL |
-| ka | Kannada [ಕನ್ನಡ] | 490 | NULL |
-| ml | Malayalam [മലയാളം] | 490 | NULL |
-| mr | Marathi [मराठी] | 491 | -1 |
-| my | Malay [Bahasa Melayu] | 490 | NULL |
-| or | Odia [ଓଡିଆ] | 490 | NULL |
-| pt-br | Português [Português] | 490 | NULL |
-| ru | Russian [Русский] | 490 | NULL |
-| si | sinhala [සිංහල] | 490 | NULL |
-| ta | தமிழ் [தமிழ்] | 490 | NULL |
-| tr | Turkish [Türk] | 490 | NULL |
-| uz | Uzbekcha [Uzbekcha] | 490 | NULL |
+| en | English [English] | 494 | 0 |
+| ar | Arabic [العربية] | 490 | 4 |
+| az | Azerbaijan [Azərbaycan] | 490 | 4 |
+| bn | Bengali [বাংলা] | 490 | 4 |
+| cn | Chinese [简体中文] | 490 | 4 |
+| es | Spanish [Español] | 490 | 4 |
+| fa | Persian [Farsi] | 491 | 3 |
+| fr | French [Français] | 490 | 4 |
+| gu | Gujarati [ગુજરાતી] | 490 | 4 |
+| hi | Hindi [हिंदी] | 490 | 4 |
+| id | Indonesia [Indonesia] | 490 | 4 |
+| it | Italian [italiano] | 490 | 4 |
+| jp | Japanese [日本] | 490 | 4 |
+| ka | Kannada [ಕನ್ನಡ] | 490 | 4 |
+| ml | Malayalam [മലയാളം] | 490 | 4 |
+| mr | Marathi [मराठी] | 491 | 3 |
+| my | Malay [Bahasa Melayu] | 490 | 4 |
+| or | Odia [ଓଡିଆ] | 490 | 4 |
+| pt-br | Português [Português] | 490 | 4 |
+| ru | Russian [Русский] | 490 | 4 |
+| si | sinhala [සිංහල] | 490 | 4 |
+| ta | தமிழ் [தமிழ்] | 490 | 4 |
+| tr | Turkish [Türk] | 490 | 4 |
+| uz | Uzbekcha [Uzbekcha] | 490 | 4 |
If Strings are not present, Google Translation will be used to Translate them at time of Usage.
\ No newline at end of file
diff --git a/strings/__init__.py b/strings/__init__.py
index 15bd68d..cdf1354 100644
--- a/strings/__init__.py
+++ b/strings/__init__.py
@@ -53,7 +53,7 @@ def get_string(key: str, _res: bool = True) -> Any:
return languages["en"].get(key) or f"Failed to load language string '{key}'"
def get_help(key):
- doc = get_string(key, _res=False)
+ doc = get_string(f"help_{key}", _res=False)
if doc:
return get_string("cmda") + doc
diff --git a/strings/strings/en.yml b/strings/strings/en.yml
index 8c28363..2e7e31c 100644
--- a/strings/strings/en.yml
+++ b/strings/strings/en.yml
@@ -471,7 +471,7 @@ sts_8: "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.
sts_9: "`Ooo Animated Sticker 👀...`"
sts_10: "`Reply to any media...`"
sts_11: "Kanging this Sticker..."
-sts_12: "`Kanged!`\n`Emoji- {}\n`Sticker Pack` [here](t.me/addstickers/{})"
+sts_12: "`Kanged!`\n`Emoji-` {}\n`Sticker Pack` [here](t.me/addstickers/{})"
sts_13: "`Switching to Pack {} due to insufficient space`"
# whichsong