Spaces:
Paused
Paused
Update Ultroid v0.7.1
Browse filesCo-authored-by: Amit Sharma <[email protected]>
Co-authored-by: Aditya <[email protected]>
Co-authored-by: ᴀɴᴏɴʏᴍᴏᴜs <[email protected]>
- app.json +1 -1
- assistant/callbackstuffs.py +25 -17
- installer.sh +1 -0
- plugins/admintools.py +0 -2
- plugins/fedutils.py +0 -336
- plugins/mediatools.py +18 -4
- plugins/specialtools.py +1 -1
- pyUltroid/__main__.py +1 -1
- pyUltroid/fns/tools.py +2 -0
- pyUltroid/startup/BaseClient.py +3 -3
- pyUltroid/startup/connections.py +10 -4
- pyUltroid/startup/loader.py +16 -13
- pyUltroid/version.py +1 -1
- requirements.txt +1 -1
- resources/session/ssgen.py +53 -10
- resources/startup/optional-requirements.txt +1 -1
- strings/README.md +24 -24
- strings/__init__.py +1 -1
- strings/strings/en.yml +1 -1
app.json
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
"required": false
|
26 |
},
|
27 |
"SESSION": {
|
28 |
-
"description": "
|
29 |
"value": ""
|
30 |
},
|
31 |
"REDIS_URI": {
|
|
|
25 |
"required": false
|
26 |
},
|
27 |
"SESSION": {
|
28 |
+
"description": "Session String (telethon or pyrogram) for your telegram user account. The userbot will NOT work without a session string!!",
|
29 |
"value": ""
|
30 |
},
|
31 |
"REDIS_URI": {
|
assistant/callbackstuffs.py
CHANGED
@@ -289,7 +289,8 @@ async def update(eve):
|
|
289 |
heroku = heroku3.from_key(heroku_api)
|
290 |
heroku_app = None
|
291 |
heroku_applications = heroku.apps()
|
292 |
-
except BaseException:
|
|
|
293 |
return await eve.edit("`Wrong HEROKU_API.`")
|
294 |
for app in heroku_applications:
|
295 |
if app.name == app_name:
|
@@ -807,14 +808,14 @@ async def media(event):
|
|
807 |
)
|
808 |
response = await conv.get_response()
|
809 |
try:
|
810 |
-
themssg = response.message
|
811 |
if themssg == "/cancel":
|
812 |
return await conv.send_message(
|
813 |
"Operation cancelled!!",
|
814 |
buttons=get_back_button("cbs_alvcstm"),
|
815 |
)
|
816 |
-
except BaseException:
|
817 |
-
|
818 |
if (
|
819 |
not (response.text).startswith("/")
|
820 |
and response.text != ""
|
@@ -829,7 +830,8 @@ async def media(event):
|
|
829 |
x = upl(media)
|
830 |
url = f"https://graph.org/{x[0]}"
|
831 |
remove(media)
|
832 |
-
except BaseException:
|
|
|
833 |
return await conv.send_message(
|
834 |
"Terminated.",
|
835 |
buttons=get_back_button("cbs_alvcstm"),
|
@@ -848,7 +850,8 @@ async def dell(event):
|
|
848 |
return await event.edit(
|
849 |
get_string("clst_5"), buttons=get_back_button("cbs_alabs_vcstm")
|
850 |
)
|
851 |
-
except BaseException:
|
|
|
852 |
return await event.edit(
|
853 |
get_string("clst_4"),
|
854 |
buttons=get_back_button("cbs_alabs_vcstm"),
|
@@ -944,14 +947,14 @@ async def media(event):
|
|
944 |
)
|
945 |
response = await conv.get_response()
|
946 |
try:
|
947 |
-
themssg = response.message
|
948 |
if themssg == "/cancel":
|
949 |
return await conv.send_message(
|
950 |
"Operation cancelled!!",
|
951 |
buttons=get_back_button("cbs_pmcstm"),
|
952 |
)
|
953 |
-
except BaseException:
|
954 |
-
|
955 |
media = await event.client.download_media(response, "pmpc")
|
956 |
if (
|
957 |
not (response.text).startswith("/")
|
@@ -966,7 +969,8 @@ async def media(event):
|
|
966 |
x = upl(media)
|
967 |
url = f"https://graph.org/{x[0]}"
|
968 |
remove(media)
|
969 |
-
except BaseException:
|
|
|
970 |
return await conv.send_message(
|
971 |
"Terminated.",
|
972 |
buttons=get_back_button("cbs_pmcstm"),
|
@@ -985,7 +989,8 @@ async def dell(event):
|
|
985 |
return await event.edit(
|
986 |
get_string("clst_5"), buttons=get_back_button("cbs_pmcstm")
|
987 |
)
|
988 |
-
except BaseException:
|
|
|
989 |
return await event.edit(
|
990 |
get_string("clst_4"),
|
991 |
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
|
@@ -1010,7 +1015,8 @@ async def apof(event):
|
|
1010 |
"Done! AUTOAPPROVE Stopped!!",
|
1011 |
buttons=[[Button.inline("« Bᴀᴄᴋ", data="cbs_apauto")]],
|
1012 |
)
|
1013 |
-
except BaseException:
|
|
|
1014 |
return await event.edit(
|
1015 |
get_string("clst_4"),
|
1016 |
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
|
@@ -1052,7 +1058,8 @@ async def pmlogof(event):
|
|
1052 |
"Done! PMLOGGER Stopped!!",
|
1053 |
buttons=[[Button.inline("« Bᴀᴄᴋ", data="pml")]],
|
1054 |
)
|
1055 |
-
except BaseException:
|
|
|
1056 |
return await event.edit(
|
1057 |
get_string("clst_4"),
|
1058 |
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
|
@@ -1212,14 +1219,14 @@ async def media(event):
|
|
1212 |
)
|
1213 |
response = await conv.get_response()
|
1214 |
try:
|
1215 |
-
themssg = response.message
|
1216 |
if themssg == "/cancel":
|
1217 |
return await conv.send_message(
|
1218 |
"Operation cancelled!!",
|
1219 |
buttons=get_back_button("setter"),
|
1220 |
)
|
1221 |
-
except BaseException:
|
1222 |
-
|
1223 |
media = await event.client.download_media(response, "inlpic")
|
1224 |
if (
|
1225 |
not (response.text).startswith("/")
|
@@ -1232,7 +1239,8 @@ async def media(event):
|
|
1232 |
x = upl(media)
|
1233 |
url = f"https://graph.org/{x[0]}"
|
1234 |
remove(media)
|
1235 |
-
except BaseException:
|
|
|
1236 |
return await conv.send_message(
|
1237 |
"Terminated.",
|
1238 |
buttons=get_back_button("setter"),
|
|
|
289 |
heroku = heroku3.from_key(heroku_api)
|
290 |
heroku_app = None
|
291 |
heroku_applications = heroku.apps()
|
292 |
+
except BaseException as er:
|
293 |
+
LOGS.exception(er)
|
294 |
return await eve.edit("`Wrong HEROKU_API.`")
|
295 |
for app in heroku_applications:
|
296 |
if app.name == app_name:
|
|
|
808 |
)
|
809 |
response = await conv.get_response()
|
810 |
try:
|
811 |
+
themssg = response.message
|
812 |
if themssg == "/cancel":
|
813 |
return await conv.send_message(
|
814 |
"Operation cancelled!!",
|
815 |
buttons=get_back_button("cbs_alvcstm"),
|
816 |
)
|
817 |
+
except BaseException as er:
|
818 |
+
LOGS.exception(er)
|
819 |
if (
|
820 |
not (response.text).startswith("/")
|
821 |
and response.text != ""
|
|
|
830 |
x = upl(media)
|
831 |
url = f"https://graph.org/{x[0]}"
|
832 |
remove(media)
|
833 |
+
except BaseException as er:
|
834 |
+
LOGS.exception(er)
|
835 |
return await conv.send_message(
|
836 |
"Terminated.",
|
837 |
buttons=get_back_button("cbs_alvcstm"),
|
|
|
850 |
return await event.edit(
|
851 |
get_string("clst_5"), buttons=get_back_button("cbs_alabs_vcstm")
|
852 |
)
|
853 |
+
except BaseException as er:
|
854 |
+
LOGS.exception(er)
|
855 |
return await event.edit(
|
856 |
get_string("clst_4"),
|
857 |
buttons=get_back_button("cbs_alabs_vcstm"),
|
|
|
947 |
)
|
948 |
response = await conv.get_response()
|
949 |
try:
|
950 |
+
themssg = response.message
|
951 |
if themssg == "/cancel":
|
952 |
return await conv.send_message(
|
953 |
"Operation cancelled!!",
|
954 |
buttons=get_back_button("cbs_pmcstm"),
|
955 |
)
|
956 |
+
except BaseException as er:
|
957 |
+
LOGS.exception(er)
|
958 |
media = await event.client.download_media(response, "pmpc")
|
959 |
if (
|
960 |
not (response.text).startswith("/")
|
|
|
969 |
x = upl(media)
|
970 |
url = f"https://graph.org/{x[0]}"
|
971 |
remove(media)
|
972 |
+
except BaseException as er:
|
973 |
+
LOGS.exception(er)
|
974 |
return await conv.send_message(
|
975 |
"Terminated.",
|
976 |
buttons=get_back_button("cbs_pmcstm"),
|
|
|
989 |
return await event.edit(
|
990 |
get_string("clst_5"), buttons=get_back_button("cbs_pmcstm")
|
991 |
)
|
992 |
+
except BaseException as er:
|
993 |
+
LOGS.exception(er)
|
994 |
return await event.edit(
|
995 |
get_string("clst_4"),
|
996 |
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
|
|
|
1015 |
"Done! AUTOAPPROVE Stopped!!",
|
1016 |
buttons=[[Button.inline("« Bᴀᴄᴋ", data="cbs_apauto")]],
|
1017 |
)
|
1018 |
+
except BaseException as er:
|
1019 |
+
LOGS.exception(er)
|
1020 |
return await event.edit(
|
1021 |
get_string("clst_4"),
|
1022 |
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
|
|
|
1058 |
"Done! PMLOGGER Stopped!!",
|
1059 |
buttons=[[Button.inline("« Bᴀᴄᴋ", data="pml")]],
|
1060 |
)
|
1061 |
+
except BaseException as er:
|
1062 |
+
LOGS.exception(er)
|
1063 |
return await event.edit(
|
1064 |
get_string("clst_4"),
|
1065 |
buttons=[[Button.inline("« Sᴇᴛᴛɪɴɢs", data="setter")]],
|
|
|
1219 |
)
|
1220 |
response = await conv.get_response()
|
1221 |
try:
|
1222 |
+
themssg = response.message
|
1223 |
if themssg == "/cancel":
|
1224 |
return await conv.send_message(
|
1225 |
"Operation cancelled!!",
|
1226 |
buttons=get_back_button("setter"),
|
1227 |
)
|
1228 |
+
except BaseException as er:
|
1229 |
+
LOGS.exception(er)
|
1230 |
media = await event.client.download_media(response, "inlpic")
|
1231 |
if (
|
1232 |
not (response.text).startswith("/")
|
|
|
1239 |
x = upl(media)
|
1240 |
url = f"https://graph.org/{x[0]}"
|
1241 |
remove(media)
|
1242 |
+
except BaseException as er:
|
1243 |
+
LOGS.exception(er)
|
1244 |
return await conv.send_message(
|
1245 |
"Terminated.",
|
1246 |
buttons=get_back_button("setter"),
|
installer.sh
CHANGED
@@ -41,6 +41,7 @@ clone_repo(){
|
|
41 |
}
|
42 |
|
43 |
install_requirements(){
|
|
|
44 |
echo -e "\n\nInstalling requirements... "
|
45 |
pip3 install -q --no-cache-dir -r $DIR/requirements.txt
|
46 |
pip3 install -q -r $DIR/resources/startup/optional-requirements.txt
|
|
|
41 |
}
|
42 |
|
43 |
install_requirements(){
|
44 |
+
pip install --upgrade pip
|
45 |
echo -e "\n\nInstalling requirements... "
|
46 |
pip3 install -q --no-cache-dir -r $DIR/requirements.txt
|
47 |
pip3 install -q -r $DIR/resources/startup/optional-requirements.txt
|
plugins/admintools.py
CHANGED
@@ -43,7 +43,6 @@ from . import (
|
|
43 |
)
|
44 |
async def prmte(ult):
|
45 |
xx = await ult.eor(get_string("com_1"))
|
46 |
-
await ult.get_chat()
|
47 |
user, rank = await get_uinfo(ult)
|
48 |
rank = rank or "Admin"
|
49 |
FullRight = False
|
@@ -87,7 +86,6 @@ async def prmte(ult):
|
|
87 |
)
|
88 |
async def dmote(ult):
|
89 |
xx = await ult.eor(get_string("com_1"))
|
90 |
-
await ult.get_chat()
|
91 |
user, rank = await get_uinfo(ult)
|
92 |
if not rank:
|
93 |
rank = "Not Admin"
|
|
|
43 |
)
|
44 |
async def prmte(ult):
|
45 |
xx = await ult.eor(get_string("com_1"))
|
|
|
46 |
user, rank = await get_uinfo(ult)
|
47 |
rank = rank or "Admin"
|
48 |
FullRight = False
|
|
|
86 |
)
|
87 |
async def dmote(ult):
|
88 |
xx = await ult.eor(get_string("com_1"))
|
|
|
89 |
user, rank = await get_uinfo(ult)
|
90 |
if not rank:
|
91 |
rank = "Not Admin"
|
plugins/fedutils.py
DELETED
@@ -1,336 +0,0 @@
|
|
1 |
-
# Ultroid - UserBot
|
2 |
-
# Copyright (C) 2021-2022 TeamUltroid
|
3 |
-
#
|
4 |
-
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
-
# PLease read the GNU Affero General Public License in
|
6 |
-
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
-
|
8 |
-
from . import get_help
|
9 |
-
|
10 |
-
__doc__ = get_help("help_fedutils")
|
11 |
-
|
12 |
-
import asyncio
|
13 |
-
import os
|
14 |
-
|
15 |
-
from telethon.errors.rpcerrorlist import YouBlockedUserError
|
16 |
-
|
17 |
-
from pyUltroid.dB import DEVLIST
|
18 |
-
|
19 |
-
from . import get_string, udB, ultroid_bot, ultroid_cmd
|
20 |
-
|
21 |
-
bot = "@MissRose_bot"
|
22 |
-
|
23 |
-
|
24 |
-
@ultroid_cmd(
|
25 |
-
pattern="superfban( (.*)|$)",
|
26 |
-
)
|
27 |
-
async def _(event):
|
28 |
-
msg = await event.eor(get_string("sf_1"))
|
29 |
-
inputt = event.pattern_match.group(1).strip()
|
30 |
-
if event.reply_to_msg_id:
|
31 |
-
FBAN = (await event.get_reply_message()).sender_id
|
32 |
-
if inputt:
|
33 |
-
REASON = inputt
|
34 |
-
elif inputt:
|
35 |
-
REASON = "#ULTMassBanned"
|
36 |
-
arg = event.text.split()
|
37 |
-
if len(arg) == 2:
|
38 |
-
FBAN = await event.client.parse_id(arg[1])
|
39 |
-
elif len(arg) > 2:
|
40 |
-
FBAN = await event.client.parse_id(arg[1])
|
41 |
-
REASON = event.text.split(maxsplit=2)[-1]
|
42 |
-
else:
|
43 |
-
return await msg.edit(get_string("sf_22"))
|
44 |
-
else:
|
45 |
-
return await msg.edit("`Reply to a message or give some input...`")
|
46 |
-
if FBAN in DEVLIST:
|
47 |
-
return await msg.edit("The user is my Dev and cannot be FBanned!")
|
48 |
-
|
49 |
-
if udB.get_key("FBAN_GROUP_ID"):
|
50 |
-
chat = int(udB.get_key("FBAN_GROUP_ID"))
|
51 |
-
else:
|
52 |
-
chat = await event.get_chat()
|
53 |
-
fedList = []
|
54 |
-
if not fedList:
|
55 |
-
for a in range(3):
|
56 |
-
async with event.client.conversation("@MissRose_bot") as bot_conv:
|
57 |
-
await bot_conv.send_message("/start")
|
58 |
-
await asyncio.sleep(3)
|
59 |
-
await bot_conv.send_message("/myfeds")
|
60 |
-
await asyncio.sleep(3)
|
61 |
-
try:
|
62 |
-
response = await bot_conv.get_response()
|
63 |
-
except asyncio.exceptions.TimeoutError:
|
64 |
-
return await msg.edit(
|
65 |
-
get_string("sf_4"),
|
66 |
-
)
|
67 |
-
await asyncio.sleep(3)
|
68 |
-
if "make a file" in response.text or "Looks like" in response.text:
|
69 |
-
await response.click(0)
|
70 |
-
await asyncio.sleep(3)
|
71 |
-
fedfile = await bot_conv.get_response()
|
72 |
-
await asyncio.sleep(3)
|
73 |
-
if fedfile.media:
|
74 |
-
downloaded_file_name = await ultroid_bot.download_media(
|
75 |
-
fedfile,
|
76 |
-
"fedlist",
|
77 |
-
)
|
78 |
-
await asyncio.sleep(6)
|
79 |
-
file = open(downloaded_file_name, errors="ignore")
|
80 |
-
lines = file.readlines()
|
81 |
-
for line in lines:
|
82 |
-
try:
|
83 |
-
fedList.append(line[:36])
|
84 |
-
except BaseException:
|
85 |
-
pass
|
86 |
-
elif get_string("sf_5") in (await bot_conv.get_edit):
|
87 |
-
return await msg.edit(get_string("sf_6"))
|
88 |
-
if not fedList:
|
89 |
-
await msg.edit(
|
90 |
-
f"Unable to collect FedAdminList. Retrying ({a+1}/3)...",
|
91 |
-
)
|
92 |
-
else:
|
93 |
-
break
|
94 |
-
else:
|
95 |
-
await msg.edit(get_string("sf_8"))
|
96 |
-
In = False
|
97 |
-
tempFedId = ""
|
98 |
-
for x in response.text:
|
99 |
-
if x == "`":
|
100 |
-
if In:
|
101 |
-
In = False
|
102 |
-
fedList.append(tempFedId)
|
103 |
-
tempFedId = ""
|
104 |
-
else:
|
105 |
-
In = True
|
106 |
-
elif In:
|
107 |
-
tempFedId += x
|
108 |
-
if not fedList:
|
109 |
-
return await msg.edit(get_string("sf_9"))
|
110 |
-
await msg.edit(f"FBaning in {len(fedList)} feds.")
|
111 |
-
try:
|
112 |
-
await ultroid_bot.send_message(chat, "/start")
|
113 |
-
except BaseException:
|
114 |
-
return await msg.edit(get_string("sf_11"))
|
115 |
-
await asyncio.sleep(3)
|
116 |
-
if udB.get_key("EXCLUDE_FED"):
|
117 |
-
excludeFed = udB.get_key("EXCLUDE_FED").split(" ")
|
118 |
-
for num, item in enumerate(excludeFed):
|
119 |
-
excludeFed[num] = item.strip()
|
120 |
-
exCount = 0
|
121 |
-
for fed in fedList:
|
122 |
-
if udB.get_key("EXCLUDE_FED") and fed in excludeFed:
|
123 |
-
await ultroid_bot.send_message(chat, f"{fed} Excluded.")
|
124 |
-
exCount += 1
|
125 |
-
continue
|
126 |
-
await event.client.send_message(chat, f"/joinfed {fed}")
|
127 |
-
await asyncio.sleep(3)
|
128 |
-
await event.client.send_message(chat, f"/fban {FBAN} {REASON}")
|
129 |
-
await asyncio.sleep(3)
|
130 |
-
try:
|
131 |
-
os.remove("fedlist")
|
132 |
-
except Exception as e:
|
133 |
-
print(f"Error in removing FedAdmin file.\n{e}")
|
134 |
-
await msg.edit(
|
135 |
-
f"SuperFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\nAffected {len(fedList) - exCount} feds.\n#Ultroid",
|
136 |
-
)
|
137 |
-
|
138 |
-
|
139 |
-
@ultroid_cmd(
|
140 |
-
pattern="superunfban( (.*)|$)",
|
141 |
-
)
|
142 |
-
async def _(event):
|
143 |
-
msg = await event.eor(get_string("sf_15"))
|
144 |
-
fedList = []
|
145 |
-
if event.reply_to_msg_id:
|
146 |
-
previous_message = await event.get_reply_message()
|
147 |
-
if previous_message.media:
|
148 |
-
downloaded_file_name = await ultroid_bot.download_media(
|
149 |
-
previous_message,
|
150 |
-
"fedlist",
|
151 |
-
)
|
152 |
-
file = open(downloaded_file_name, encoding="utf8")
|
153 |
-
lines = file.readlines()
|
154 |
-
for line in lines:
|
155 |
-
try:
|
156 |
-
fedList.append(line[:36])
|
157 |
-
except BaseException:
|
158 |
-
pass
|
159 |
-
arg = event.text.split(" ", maxsplit=2)
|
160 |
-
FBAN = arg[1]
|
161 |
-
REASON = arg[2] if len(arg) > 2 else ""
|
162 |
-
else:
|
163 |
-
FBAN = previous_message.sender_id
|
164 |
-
try:
|
165 |
-
REASON = event.text.split(" ", maxsplit=1)[1]
|
166 |
-
except BaseException:
|
167 |
-
REASON = ""
|
168 |
-
if not REASON.strip():
|
169 |
-
REASON = ""
|
170 |
-
else:
|
171 |
-
arg = event.text.split(" ", maxsplit=2)
|
172 |
-
if len(arg) > 2:
|
173 |
-
try:
|
174 |
-
FBAN = arg[1]
|
175 |
-
REASON = arg[2]
|
176 |
-
except BaseException:
|
177 |
-
return await msg.edit(get_string("sf_2"))
|
178 |
-
else:
|
179 |
-
try:
|
180 |
-
FBAN = arg[1]
|
181 |
-
REASON = " #ULTMassUnBanned "
|
182 |
-
except BaseException:
|
183 |
-
return await msg.edit(get_string("sf_2"))
|
184 |
-
if udB.get_key("FBAN_GROUP_ID"):
|
185 |
-
chat = int(udB.get_key("FBAN_GROUP_ID"))
|
186 |
-
else:
|
187 |
-
chat = await event.get_chat()
|
188 |
-
if not fedList:
|
189 |
-
for a in range(3):
|
190 |
-
async with event.client.conversation("@MissRose_bot") as bot_conv:
|
191 |
-
await bot_conv.send_message("/start")
|
192 |
-
await asyncio.sleep(3)
|
193 |
-
await bot_conv.send_message("/myfeds")
|
194 |
-
await asyncio.sleep(3)
|
195 |
-
try:
|
196 |
-
response = await bot_conv.get_response()
|
197 |
-
except asyncio.exceptions.TimeoutError:
|
198 |
-
return await msg.edit(
|
199 |
-
get_string("sf_4"),
|
200 |
-
)
|
201 |
-
await asyncio.sleep(3)
|
202 |
-
if "make a file" in response.text or "Looks like" in response.text:
|
203 |
-
await response.click(0)
|
204 |
-
await asyncio.sleep(3)
|
205 |
-
fedfile = await bot_conv.get_response()
|
206 |
-
await asyncio.sleep(3)
|
207 |
-
if fedfile.media:
|
208 |
-
downloaded_file_name = await ultroid_bot.download_media(
|
209 |
-
fedfile,
|
210 |
-
"fedlist",
|
211 |
-
)
|
212 |
-
await asyncio.sleep(6)
|
213 |
-
file = open(downloaded_file_name, errors="ignore")
|
214 |
-
lines = file.readlines()
|
215 |
-
for line in lines:
|
216 |
-
try:
|
217 |
-
fedList.append(line[:36])
|
218 |
-
except BaseException:
|
219 |
-
pass
|
220 |
-
elif get_string("sf_5") in (await bot_conv.get_edit):
|
221 |
-
return await msg.edit(get_string("sf_6"))
|
222 |
-
if not fedList:
|
223 |
-
await msg.edit(
|
224 |
-
f"Unable to collect FedAdminList. Retrying ({a+1}/3)...",
|
225 |
-
)
|
226 |
-
else:
|
227 |
-
break
|
228 |
-
else:
|
229 |
-
await msg.edit(get_string("sf_8"))
|
230 |
-
In = False
|
231 |
-
tempFedId = ""
|
232 |
-
for x in response.text:
|
233 |
-
if x == "`":
|
234 |
-
if In:
|
235 |
-
In = False
|
236 |
-
fedList.append(tempFedId)
|
237 |
-
tempFedId = ""
|
238 |
-
else:
|
239 |
-
In = True
|
240 |
-
elif In:
|
241 |
-
tempFedId += x
|
242 |
-
if not fedList:
|
243 |
-
return await msg.edit(get_string("sf_9"))
|
244 |
-
await msg.edit(f"UnFBaning in {len(fedList)} feds.")
|
245 |
-
try:
|
246 |
-
await event.client.send_message(chat, "/start")
|
247 |
-
except BaseException:
|
248 |
-
return await msg.edit(get_string("sf_11"))
|
249 |
-
await asyncio.sleep(3)
|
250 |
-
if udB.get_key("EXCLUDE_FED"):
|
251 |
-
excludeFed = udB.get_key("EXCLUDE_FED").split(" ")
|
252 |
-
for n, m in enumerate(excludeFed):
|
253 |
-
excludeFed[n] = excludeFed[n].strip()
|
254 |
-
exCount = 0
|
255 |
-
for fed in fedList:
|
256 |
-
if udB.get_key("EXCLUDE_FED") and fed in excludeFed:
|
257 |
-
await event.client.send_message(chat, f"{fed} Excluded.")
|
258 |
-
exCount += 1
|
259 |
-
continue
|
260 |
-
await ultroid_bot.send_message(chat, f"/joinfed {fed}")
|
261 |
-
await asyncio.sleep(3)
|
262 |
-
await ultroid_bot.send_message(chat, f"/unfban {FBAN} {REASON}")
|
263 |
-
await asyncio.sleep(3)
|
264 |
-
try:
|
265 |
-
os.remove("fedlist")
|
266 |
-
except Exception as e:
|
267 |
-
print(f"Error in removing FedAdmin file.\n{e}")
|
268 |
-
await msg.edit(
|
269 |
-
f"SuperUnFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\n Affected {len(fedList) - exCount} feds.\n#TB",
|
270 |
-
)
|
271 |
-
|
272 |
-
|
273 |
-
@ultroid_cmd(
|
274 |
-
pattern="fstat( (.*)|$)",
|
275 |
-
)
|
276 |
-
async def _(event):
|
277 |
-
ok = await event.eor("`Checking...`")
|
278 |
-
if event.reply_to_msg_id:
|
279 |
-
previous_message = await event.get_reply_message()
|
280 |
-
sysarg = str(previous_message.sender_id)
|
281 |
-
user = f"[user](tg://user?id={sysarg})"
|
282 |
-
if event.pattern_match.group(1).strip():
|
283 |
-
sysarg += f" {event.pattern_match.group(1).strip()}"
|
284 |
-
else:
|
285 |
-
sysarg = event.pattern_match.group(1).strip()
|
286 |
-
user = sysarg
|
287 |
-
if sysarg == "":
|
288 |
-
await ok.edit(
|
289 |
-
get_string("sf_17"),
|
290 |
-
)
|
291 |
-
else:
|
292 |
-
async with event.client.conversation(bot) as conv:
|
293 |
-
try:
|
294 |
-
await conv.send_message("/start")
|
295 |
-
await conv.get_response()
|
296 |
-
await conv.send_message(f"/fedstat {sysarg}")
|
297 |
-
audio = await conv.get_response()
|
298 |
-
if audio.message.startswith("This command can only be used once"):
|
299 |
-
await ok.edit(
|
300 |
-
"Oops, you can use this command only once every minute!",
|
301 |
-
)
|
302 |
-
elif "Looks like" in audio.text:
|
303 |
-
await audio.click(0)
|
304 |
-
await asyncio.sleep(2)
|
305 |
-
audio = await conv.get_response()
|
306 |
-
await event.client.send_file(
|
307 |
-
event.chat_id,
|
308 |
-
audio,
|
309 |
-
caption=f"List of feds {user} has been banned in.\n\nCollected using Ultroid.",
|
310 |
-
link_preview=False,
|
311 |
-
)
|
312 |
-
await ok.delete()
|
313 |
-
else:
|
314 |
-
okk = await conv.get_edit()
|
315 |
-
await ok.edit(okk.message)
|
316 |
-
await ultroid_bot.send_read_acknowledge(bot)
|
317 |
-
except YouBlockedUserError:
|
318 |
-
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
|
319 |
-
|
320 |
-
|
321 |
-
@ultroid_cmd(
|
322 |
-
pattern="fedinfo( (.*)|$)",
|
323 |
-
)
|
324 |
-
async def _(event):
|
325 |
-
ok = await event.edit(get_string("sf_20"))
|
326 |
-
sysarg = event.pattern_match.group(1).strip()
|
327 |
-
async with event.client.conversation(bot) as conv:
|
328 |
-
try:
|
329 |
-
await conv.send_message("/start")
|
330 |
-
await conv.get_response()
|
331 |
-
await conv.send_message(f"/fedinfo {sysarg}")
|
332 |
-
audio = await conv.get_response()
|
333 |
-
await event.client.send_read_acknowledge(bot)
|
334 |
-
await ok.edit(audio.text + "\n\nFedInfo Extracted by Ultroid")
|
335 |
-
except YouBlockedUserError:
|
336 |
-
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugins/mediatools.py
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
"""
|
8 |
✘ Commands Available -
|
9 |
|
10 |
-
• `{i}mediainfo <reply to media>`
|
11 |
To get info about it.
|
12 |
|
13 |
• `{i}rotate <degree/angle> <reply to media>`
|
@@ -21,7 +21,16 @@ from datetime import datetime as dt
|
|
21 |
from pyUltroid.fns.misc import rotate_image
|
22 |
from pyUltroid.fns.tools import make_html_telegraph
|
23 |
|
24 |
-
from . import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
try:
|
27 |
import cv2
|
@@ -63,7 +72,9 @@ async def mi(e):
|
|
63 |
naam = dl.name
|
64 |
else:
|
65 |
naam = await r.download_media()
|
66 |
-
elif match and
|
|
|
|
|
67 |
naam, xx = match, "file"
|
68 |
else:
|
69 |
return await e.eor(get_string("cvt_3"), time=5)
|
@@ -74,7 +85,10 @@ async def mi(e):
|
|
74 |
return await e.edit(out, link_preview=False)
|
75 |
makehtml = ""
|
76 |
if naam.endswith((".jpg", ".png")):
|
77 |
-
|
|
|
|
|
|
|
78 |
makehtml += f"<img src='{med}'><br>"
|
79 |
for line in out.split("\n"):
|
80 |
line = line.strip()
|
|
|
7 |
"""
|
8 |
✘ Commands Available -
|
9 |
|
10 |
+
• `{i}mediainfo <reply to media>/<file path>/<url>`
|
11 |
To get info about it.
|
12 |
|
13 |
• `{i}rotate <degree/angle> <reply to media>`
|
|
|
21 |
from pyUltroid.fns.misc import rotate_image
|
22 |
from pyUltroid.fns.tools import make_html_telegraph
|
23 |
|
24 |
+
from . import (
|
25 |
+
LOGS,
|
26 |
+
Telegraph,
|
27 |
+
bash,
|
28 |
+
downloader,
|
29 |
+
get_string,
|
30 |
+
is_url_ok,
|
31 |
+
mediainfo,
|
32 |
+
ultroid_cmd,
|
33 |
+
)
|
34 |
|
35 |
try:
|
36 |
import cv2
|
|
|
72 |
naam = dl.name
|
73 |
else:
|
74 |
naam = await r.download_media()
|
75 |
+
elif match and (
|
76 |
+
os.path.isfile(match) or (match.startswith("https://") and is_url_ok(match))
|
77 |
+
):
|
78 |
naam, xx = match, "file"
|
79 |
else:
|
80 |
return await e.eor(get_string("cvt_3"), time=5)
|
|
|
85 |
return await e.edit(out, link_preview=False)
|
86 |
makehtml = ""
|
87 |
if naam.endswith((".jpg", ".png")):
|
88 |
+
if os.path.exists(naam):
|
89 |
+
med = "https://graph.org" + Telegraph.upload_file(naam)[0]["src"]
|
90 |
+
else:
|
91 |
+
med = match
|
92 |
makehtml += f"<img src='{med}'><br>"
|
93 |
for line in out.split("\n"):
|
94 |
line = line.strip()
|
plugins/specialtools.py
CHANGED
@@ -210,7 +210,7 @@ async def hbd(event):
|
|
210 |
elif month == "09":
|
211 |
sign = "Virgo" if (day < 23) else "Libra"
|
212 |
elif month == "10":
|
213 |
-
sign = "Libra" if (day < 23) else "
|
214 |
elif month == "11":
|
215 |
sign = "Scorpio" if (day < 22) else "Sagittarius"
|
216 |
elif month == "12":
|
|
|
210 |
elif month == "09":
|
211 |
sign = "Virgo" if (day < 23) else "Libra"
|
212 |
elif month == "10":
|
213 |
+
sign = "Libra" if (day < 23) else "Scorpio"
|
214 |
elif month == "11":
|
215 |
sign = "Scorpio" if (day < 22) else "Sagittarius"
|
216 |
elif month == "12":
|
pyUltroid/__main__.py
CHANGED
@@ -62,7 +62,7 @@ def main():
|
|
62 |
|
63 |
suc_msg = """
|
64 |
----------------------------------------------------------------------
|
65 |
-
Ultroid has been deployed! Visit @
|
66 |
----------------------------------------------------------------------
|
67 |
"""
|
68 |
|
|
|
62 |
|
63 |
suc_msg = """
|
64 |
----------------------------------------------------------------------
|
65 |
+
Ultroid has been deployed! Visit @TheUltroid for updates!!
|
66 |
----------------------------------------------------------------------
|
67 |
"""
|
68 |
|
pyUltroid/fns/tools.py
CHANGED
@@ -407,6 +407,8 @@ async def get_paste(data: str, extension: str = "txt"):
|
|
407 |
|
408 |
|
409 |
async def get_chatbot_reply(message):
|
|
|
|
|
410 |
chatbot_base = "https://kukiapi.xyz/api/apikey=ULTROIDUSERBOT/Ultroid/{}/message={}"
|
411 |
req_link = chatbot_base.format(
|
412 |
ultroid_bot.me.first_name or "ultroid user",
|
|
|
407 |
|
408 |
|
409 |
async def get_chatbot_reply(message):
|
410 |
+
from .. import ultroid_bot
|
411 |
+
|
412 |
chatbot_base = "https://kukiapi.xyz/api/apikey=ULTROIDUSERBOT/Ultroid/{}/message={}"
|
413 |
req_link = chatbot_base.format(
|
414 |
ultroid_bot.me.first_name or "ultroid user",
|
pyUltroid/startup/BaseClient.py
CHANGED
@@ -33,13 +33,13 @@ class UltroidClient(TelegramClient):
|
|
33 |
udB=None,
|
34 |
logger: Logger = LOGS,
|
35 |
log_attempt=True,
|
36 |
-
|
37 |
*args,
|
38 |
**kwargs,
|
39 |
):
|
40 |
self._cache = {}
|
41 |
self._dialogs = []
|
42 |
-
self._handle_error =
|
43 |
self._log_at = log_attempt
|
44 |
self.logger = logger
|
45 |
self.udB = udB
|
@@ -74,7 +74,7 @@ class UltroidClient(TelegramClient):
|
|
74 |
if self._handle_error:
|
75 |
self.logger.critical("String session expired. Create new!")
|
76 |
return sys.exit()
|
77 |
-
|
78 |
except (AccessTokenExpiredError, AccessTokenInvalidError):
|
79 |
# AccessTokenError can only occur for Bot account
|
80 |
# And at Early Process, Its saved in DB.
|
|
|
33 |
udB=None,
|
34 |
logger: Logger = LOGS,
|
35 |
log_attempt=True,
|
36 |
+
exit_on_error=True,
|
37 |
*args,
|
38 |
**kwargs,
|
39 |
):
|
40 |
self._cache = {}
|
41 |
self._dialogs = []
|
42 |
+
self._handle_error = exit_on_error
|
43 |
self._log_at = log_attempt
|
44 |
self.logger = logger
|
45 |
self.udB = udB
|
|
|
74 |
if self._handle_error:
|
75 |
self.logger.critical("String session expired. Create new!")
|
76 |
return sys.exit()
|
77 |
+
self.logger.critical("String session expired.")
|
78 |
except (AccessTokenExpiredError, AccessTokenInvalidError):
|
79 |
# AccessTokenError can only occur for Bot account
|
80 |
# And at Early Process, Its saved in DB.
|
pyUltroid/startup/connections.py
CHANGED
@@ -30,7 +30,7 @@ DC_IPV4 = {
|
|
30 |
}
|
31 |
|
32 |
|
33 |
-
def validate_session(session, logger=LOGS):
|
34 |
from strings import get_string
|
35 |
if session:
|
36 |
# Telethon Session
|
@@ -63,19 +63,25 @@ def validate_session(session, logger=LOGS):
|
|
63 |
)
|
64 |
).decode("ascii")
|
65 |
)
|
|
|
|
|
|
|
|
|
66 |
logger.exception(get_string("py_c2"))
|
67 |
-
|
|
|
68 |
|
69 |
|
70 |
def vc_connection(udB, ultroid_bot):
|
71 |
from strings import get_string
|
72 |
VC_SESSION = Var.VC_SESSION or udB.get_key("VC_SESSION")
|
73 |
if VC_SESSION and VC_SESSION != Var.SESSION:
|
|
|
74 |
try:
|
75 |
return UltroidClient(
|
76 |
-
validate_session(VC_SESSION,
|
77 |
log_attempt=False,
|
78 |
-
|
79 |
)
|
80 |
except (AuthKeyDuplicatedError, EOFError):
|
81 |
LOGS.info(get_string("py_c3"))
|
|
|
30 |
}
|
31 |
|
32 |
|
33 |
+
def validate_session(session, logger=LOGS, _exit=True):
|
34 |
from strings import get_string
|
35 |
if session:
|
36 |
# Telethon Session
|
|
|
63 |
)
|
64 |
).decode("ascii")
|
65 |
)
|
66 |
+
else:
|
67 |
+
logger.exception(get_string("py_c1"))
|
68 |
+
if _exit:
|
69 |
+
sys.exit()
|
70 |
logger.exception(get_string("py_c2"))
|
71 |
+
if _exit:
|
72 |
+
sys.exit()
|
73 |
|
74 |
|
75 |
def vc_connection(udB, ultroid_bot):
|
76 |
from strings import get_string
|
77 |
VC_SESSION = Var.VC_SESSION or udB.get_key("VC_SESSION")
|
78 |
if VC_SESSION and VC_SESSION != Var.SESSION:
|
79 |
+
LOGS.info("Starting up VcClient.")
|
80 |
try:
|
81 |
return UltroidClient(
|
82 |
+
validate_session(VC_SESSION, _exit=False),
|
83 |
log_attempt=False,
|
84 |
+
exit_on_error=False
|
85 |
)
|
86 |
except (AuthKeyDuplicatedError, EOFError):
|
87 |
LOGS.info(get_string("py_c3"))
|
pyUltroid/startup/loader.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
7 |
|
8 |
-
import os
|
9 |
from shutil import rmtree
|
10 |
|
11 |
from decouple import config
|
@@ -27,6 +27,7 @@ def _after_load(loader, module, plugin_name=""):
|
|
27 |
doc = doc_.format(i=HNDLR)
|
28 |
except Exception as er:
|
29 |
loader._logger.exception(er)
|
|
|
30 |
return
|
31 |
if loader.key in HELP.keys():
|
32 |
update_cmd = HELP[loader.key]
|
@@ -64,26 +65,28 @@ def load_other_plugins(addons=None, pmbot=None, manager=None, vcbot=None):
|
|
64 |
# for addons
|
65 |
if addons:
|
66 |
if url := udB.get_key("ADDONS_URL"):
|
67 |
-
|
68 |
if os.path.exists("addons") and not os.path.exists("addons/.git"):
|
69 |
rmtree("addons")
|
70 |
if not os.path.exists("addons"):
|
71 |
-
|
72 |
-
f"git clone -q -b {Repo().active_branch} https://github.com/TeamUltroid/UltroidAddons.git addons"
|
|
|
73 |
)
|
74 |
else:
|
75 |
-
|
76 |
|
77 |
if not os.path.exists("addons"):
|
78 |
-
|
79 |
-
"git clone -q https://github.com/TeamUltroid/UltroidAddons.git addons"
|
|
|
80 |
)
|
81 |
if os.path.exists("addons/addons.txt"):
|
82 |
# generally addons req already there so it won't take much time
|
83 |
-
|
84 |
-
|
85 |
-
)
|
86 |
-
|
87 |
|
88 |
_exclude = udB.get_key("EXCLUDE_ADDONS")
|
89 |
_exclude = _exclude.split() if _exclude else []
|
@@ -113,11 +116,11 @@ def load_other_plugins(addons=None, pmbot=None, manager=None, vcbot=None):
|
|
113 |
|
114 |
if os.path.exists("vcbot"):
|
115 |
if os.path.exists("vcbot/.git"):
|
116 |
-
|
117 |
else:
|
118 |
rmtree("vcbot")
|
119 |
if not os.path.exists("vcbot"):
|
120 |
-
|
121 |
try:
|
122 |
if not os.path.exists("vcbot/downloads"):
|
123 |
os.mkdir("vcbot/downloads")
|
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
|
7 |
|
8 |
+
import os, subprocess
|
9 |
from shutil import rmtree
|
10 |
|
11 |
from decouple import config
|
|
|
27 |
doc = doc_.format(i=HNDLR)
|
28 |
except Exception as er:
|
29 |
loader._logger.exception(er)
|
30 |
+
loader._logger.info(f"Error in {plugin_name}: {module}")
|
31 |
return
|
32 |
if loader.key in HELP.keys():
|
33 |
update_cmd = HELP[loader.key]
|
|
|
65 |
# for addons
|
66 |
if addons:
|
67 |
if url := udB.get_key("ADDONS_URL"):
|
68 |
+
subprocess.run(f"git clone -q {url} addons", shell=True)
|
69 |
if os.path.exists("addons") and not os.path.exists("addons/.git"):
|
70 |
rmtree("addons")
|
71 |
if not os.path.exists("addons"):
|
72 |
+
subprocess.run(
|
73 |
+
f"git clone -q -b {Repo().active_branch} https://github.com/TeamUltroid/UltroidAddons.git addons",
|
74 |
+
shell=True,
|
75 |
)
|
76 |
else:
|
77 |
+
subprocess.run("cd addons && git pull -q && cd ..", shell=True)
|
78 |
|
79 |
if not os.path.exists("addons"):
|
80 |
+
subprocess.run(
|
81 |
+
"git clone -q https://github.com/TeamUltroid/UltroidAddons.git addons",
|
82 |
+
shell=True,
|
83 |
)
|
84 |
if os.path.exists("addons/addons.txt"):
|
85 |
# generally addons req already there so it won't take much time
|
86 |
+
# subprocess.run(
|
87 |
+
# "rm -rf /usr/local/lib/python3.*/site-packages/pip/_vendor/.wh*"
|
88 |
+
# )
|
89 |
+
subprocess.run("pip3 install --no-cache-dir -q -r ./addons/addons.txt", shell=True)
|
90 |
|
91 |
_exclude = udB.get_key("EXCLUDE_ADDONS")
|
92 |
_exclude = _exclude.split() if _exclude else []
|
|
|
116 |
|
117 |
if os.path.exists("vcbot"):
|
118 |
if os.path.exists("vcbot/.git"):
|
119 |
+
subprocess.run("cd vcbot && git pull", shell=True)
|
120 |
else:
|
121 |
rmtree("vcbot")
|
122 |
if not os.path.exists("vcbot"):
|
123 |
+
subprocess.run("git clone https://github.com/TeamUltroid/VcBot vcbot", shell=True)
|
124 |
try:
|
125 |
if not os.path.exists("vcbot/downloads"):
|
126 |
os.mkdir("vcbot/downloads")
|
pyUltroid/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
__version__ = "2022.08.30"
|
2 |
-
ultroid_version = "0.7"
|
|
|
1 |
__version__ = "2022.08.30"
|
2 |
+
ultroid_version = "0.7.1"
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# Important Requirements here.
|
2 |
|
3 |
-
https://github.com/New-dev0/Telethon/archive/
|
4 |
python-decouple
|
5 |
python-dotenv
|
|
|
1 |
# Important Requirements here.
|
2 |
|
3 |
+
https://github.com/New-dev0/Telethon/archive/diamond.zip
|
4 |
python-decouple
|
5 |
python-dotenv
|
resources/session/ssgen.py
CHANGED
@@ -19,8 +19,11 @@ ULTROID = r"""
|
|
19 |
"""
|
20 |
|
21 |
|
22 |
-
def spinner():
|
23 |
-
|
|
|
|
|
|
|
24 |
for _ in range(3):
|
25 |
for frame in r"-\|/-\|/":
|
26 |
print("\b", frame, sep="", end="", flush=True)
|
@@ -51,18 +54,17 @@ def get_api_id_and_hash():
|
|
51 |
|
52 |
def telethon_session():
|
53 |
try:
|
54 |
-
spinner()
|
55 |
-
import telethon # ignore: pylint
|
56 |
|
57 |
-
|
58 |
except ImportError:
|
59 |
print("Installing Telethon...")
|
60 |
os.system("pip uninstall telethon -y && pip install -U telethon")
|
61 |
|
62 |
-
|
63 |
clear_screen()
|
64 |
print(ULTROID)
|
65 |
-
print(
|
66 |
|
67 |
# the imports
|
68 |
|
@@ -81,7 +83,7 @@ def telethon_session():
|
|
81 |
with TelegramClient(StringSession(), API_ID, API_HASH) as ultroid:
|
82 |
print("Generating a string session for •ULTROID•")
|
83 |
try:
|
84 |
-
|
85 |
"me",
|
86 |
f"**ULTROID** `SESSION`:\n\n`{ultroid.session.save()}`\n\n**Do not share this anywhere!**",
|
87 |
)
|
@@ -110,11 +112,52 @@ def telethon_session():
|
|
110 |
print("If you think It as a Bug, Report to @UltroidSupportChat.\n\n")
|
111 |
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
def main():
|
114 |
clear_screen()
|
115 |
print(ULTROID)
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
if x.lower() in ["y", "yes"]:
|
119 |
main()
|
120 |
else:
|
|
|
19 |
"""
|
20 |
|
21 |
|
22 |
+
def spinner(x):
|
23 |
+
if x == "tele":
|
24 |
+
print("Checking if Telethon is installed...")
|
25 |
+
else:
|
26 |
+
print("Checking if Pyrogram is installed...")
|
27 |
for _ in range(3):
|
28 |
for frame in r"-\|/-\|/":
|
29 |
print("\b", frame, sep="", end="", flush=True)
|
|
|
54 |
|
55 |
def telethon_session():
|
56 |
try:
|
57 |
+
spinner("tele")
|
|
|
58 |
|
59 |
+
x = "\bFound an existing installation of Telethon...\nSuccessfully Imported.\n\n"
|
60 |
except ImportError:
|
61 |
print("Installing Telethon...")
|
62 |
os.system("pip uninstall telethon -y && pip install -U telethon")
|
63 |
|
64 |
+
x = "\bDone. Installed and imported Telethon."
|
65 |
clear_screen()
|
66 |
print(ULTROID)
|
67 |
+
print(x)
|
68 |
|
69 |
# the imports
|
70 |
|
|
|
83 |
with TelegramClient(StringSession(), API_ID, API_HASH) as ultroid:
|
84 |
print("Generating a string session for •ULTROID•")
|
85 |
try:
|
86 |
+
ultroid.send_message(
|
87 |
"me",
|
88 |
f"**ULTROID** `SESSION`:\n\n`{ultroid.session.save()}`\n\n**Do not share this anywhere!**",
|
89 |
)
|
|
|
112 |
print("If you think It as a Bug, Report to @UltroidSupportChat.\n\n")
|
113 |
|
114 |
|
115 |
+
def pyro_session():
|
116 |
+
try:
|
117 |
+
spinner("pyro")
|
118 |
+
from pyrogram import Client
|
119 |
+
|
120 |
+
x = "\bFound an existing installation of Pyrogram...\nSuccessfully Imported.\n\n"
|
121 |
+
except BaseException:
|
122 |
+
print("Installing Pyrogram...")
|
123 |
+
os.system("pip install pyrogram tgcrypto")
|
124 |
+
x = "\bDone. Installed and imported Pyrogram."
|
125 |
+
clear_screen()
|
126 |
+
print(ULTROID)
|
127 |
+
print(x)
|
128 |
+
|
129 |
+
# generate a session
|
130 |
+
API_ID, API_HASH = get_api_id_and_hash()
|
131 |
+
print("Enter phone number when asked.\n\n")
|
132 |
+
with Client(":memory:", api_id=API_ID, api_hash=API_HASH) as pyro:
|
133 |
+
ss = pyro.export_session_string()
|
134 |
+
pyro.send_message(
|
135 |
+
"me",
|
136 |
+
f"`{ss}`\n\nAbove is your Pyrogram Session String for @TheUltroid. **DO NOT SHARE it.**",
|
137 |
+
)
|
138 |
+
print("Session has been sent to your saved messages!")
|
139 |
+
exit(0)
|
140 |
+
|
141 |
+
|
142 |
def main():
|
143 |
clear_screen()
|
144 |
print(ULTROID)
|
145 |
+
try:
|
146 |
+
type_of_ss = int(
|
147 |
+
input(
|
148 |
+
"\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: "
|
149 |
+
)
|
150 |
+
)
|
151 |
+
except Exception as e:
|
152 |
+
print(e)
|
153 |
+
exit(0)
|
154 |
+
if type_of_ss == 1:
|
155 |
+
telethon_session()
|
156 |
+
elif type_of_ss == 2:
|
157 |
+
pyro_session()
|
158 |
+
else:
|
159 |
+
print("Invalid choice.")
|
160 |
+
x = input("Run again? (Y/n)")
|
161 |
if x.lower() in ["y", "yes"]:
|
162 |
main()
|
163 |
else:
|
resources/startup/optional-requirements.txt
CHANGED
@@ -24,7 +24,7 @@ pytz
|
|
24 |
qrcode
|
25 |
requests
|
26 |
tabulate
|
27 |
-
telegraph
|
28 |
tgcrypto
|
29 |
youtube-search-python
|
30 |
yt-dlp
|
|
|
24 |
qrcode
|
25 |
requests
|
26 |
tabulate
|
27 |
+
git+https://github.com/xditya/telegraph.git@41fd800#egg=telegraph
|
28 |
tgcrypto
|
29 |
youtube-search-python
|
30 |
yt-dlp
|
strings/README.md
CHANGED
@@ -3,30 +3,30 @@
|
|
3 |
|
4 |
| Code | Language | Translated | Remaining |
|
5 |
|----|-------|-------|---|
|
6 |
-
| en | English [English] |
|
7 |
-
| ar | Arabic [العربية] | 490 |
|
8 |
-
| az | Azerbaijan [Azərbaycan] | 490 |
|
9 |
-
| bn | Bengali [বাংলা] | 490 |
|
10 |
-
| cn | Chinese [简体中文] | 490 |
|
11 |
-
| es | Spanish [Español] | 490 |
|
12 |
-
| fa | Persian [Farsi] | 491 |
|
13 |
-
| fr | French [Français] | 490 |
|
14 |
-
| gu | Gujarati [ગુજરાતી] | 490 |
|
15 |
-
| hi | Hindi [हिंदी] | 490 |
|
16 |
-
| id | Indonesia [Indonesia] | 490 |
|
17 |
-
| it | Italian [italiano] | 490 |
|
18 |
-
| jp | Japanese [日本] | 490 |
|
19 |
-
| ka | Kannada [ಕನ್ನಡ] | 490 |
|
20 |
-
| ml | Malayalam [മലയാളം] | 490 |
|
21 |
-
| mr | Marathi [मराठी] | 491 |
|
22 |
-
| my | Malay [Bahasa Melayu] | 490 |
|
23 |
-
| or | Odia [ଓଡିଆ] | 490 |
|
24 |
-
| pt-br | Português [Português] | 490 |
|
25 |
-
| ru | Russian [Русский] | 490 |
|
26 |
-
| si | sinhala [සිංහල] | 490 |
|
27 |
-
| ta | தமிழ் [தமிழ்] | 490 |
|
28 |
-
| tr | Turkish [Türk] | 490 |
|
29 |
-
| uz | Uzbekcha [Uzbekcha] | 490 |
|
30 |
|
31 |
|
32 |
If Strings are not present, Google Translation will be used to Translate them at time of Usage.
|
|
|
3 |
|
4 |
| Code | Language | Translated | Remaining |
|
5 |
|----|-------|-------|---|
|
6 |
+
| en | English [English] | 494 | 0 |
|
7 |
+
| ar | Arabic [العربية] | 490 | 4 |
|
8 |
+
| az | Azerbaijan [Azərbaycan] | 490 | 4 |
|
9 |
+
| bn | Bengali [বাংলা] | 490 | 4 |
|
10 |
+
| cn | Chinese [简体中文] | 490 | 4 |
|
11 |
+
| es | Spanish [Español] | 490 | 4 |
|
12 |
+
| fa | Persian [Farsi] | 491 | 3 |
|
13 |
+
| fr | French [Français] | 490 | 4 |
|
14 |
+
| gu | Gujarati [ગુજરાતી] | 490 | 4 |
|
15 |
+
| hi | Hindi [हिंदी] | 490 | 4 |
|
16 |
+
| id | Indonesia [Indonesia] | 490 | 4 |
|
17 |
+
| it | Italian [italiano] | 490 | 4 |
|
18 |
+
| jp | Japanese [日本] | 490 | 4 |
|
19 |
+
| ka | Kannada [ಕನ್ನಡ] | 490 | 4 |
|
20 |
+
| ml | Malayalam [മലയാളം] | 490 | 4 |
|
21 |
+
| mr | Marathi [मराठी] | 491 | 3 |
|
22 |
+
| my | Malay [Bahasa Melayu] | 490 | 4 |
|
23 |
+
| or | Odia [ଓଡିଆ] | 490 | 4 |
|
24 |
+
| pt-br | Português [Português] | 490 | 4 |
|
25 |
+
| ru | Russian [Русский] | 490 | 4 |
|
26 |
+
| si | sinhala [සිංහල] | 490 | 4 |
|
27 |
+
| ta | தமிழ் [தமிழ்] | 490 | 4 |
|
28 |
+
| tr | Turkish [Türk] | 490 | 4 |
|
29 |
+
| uz | Uzbekcha [Uzbekcha] | 490 | 4 |
|
30 |
|
31 |
|
32 |
If Strings are not present, Google Translation will be used to Translate them at time of Usage.
|
strings/__init__.py
CHANGED
@@ -53,7 +53,7 @@ def get_string(key: str, _res: bool = True) -> Any:
|
|
53 |
return languages["en"].get(key) or f"Failed to load language string '{key}'"
|
54 |
|
55 |
def get_help(key):
|
56 |
-
doc = get_string(key, _res=False)
|
57 |
if doc:
|
58 |
return get_string("cmda") + doc
|
59 |
|
|
|
53 |
return languages["en"].get(key) or f"Failed to load language string '{key}'"
|
54 |
|
55 |
def get_help(key):
|
56 |
+
doc = get_string(f"help_{key}", _res=False)
|
57 |
if doc:
|
58 |
return get_string("cmda") + doc
|
59 |
|
strings/strings/en.yml
CHANGED
@@ -471,7 +471,7 @@ sts_8: "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.
|
|
471 |
sts_9: "`Ooo Animated Sticker 👀...`"
|
472 |
sts_10: "`Reply to any media...`"
|
473 |
sts_11: "Kanging this Sticker..."
|
474 |
-
sts_12: "`Kanged!`\n`Emoji
|
475 |
sts_13: "`Switching to Pack {} due to insufficient space`"
|
476 |
|
477 |
# whichsong
|
|
|
471 |
sts_9: "`Ooo Animated Sticker 👀...`"
|
472 |
sts_10: "`Reply to any media...`"
|
473 |
sts_11: "Kanging this Sticker..."
|
474 |
+
sts_12: "`Kanged!`\n`Emoji-` {}\n`Sticker Pack` [here](t.me/addstickers/{})"
|
475 |
sts_13: "`Switching to Pack {} due to insufficient space`"
|
476 |
|
477 |
# whichsong
|