1Danish-00 New-dev0 xditya Amit Sharma sppidy Arnab Paryali divkix hellboi_atul Programming Error commited on
Commit
63a96fc
·
1 Parent(s): 5d42148

v0.0.9 18/07/2021

Browse files

Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com>
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
Co-authored-by: sppidy <sppidy@users.noreply.github.com>
Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com>
Co-authored-by: divkix <divkix@users.noreply.github.com>
Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com>
Co-authored-by: Programming Error <error@notavailable.live>

This view is limited to 50 files because it contains too many changes.   See raw diff
.env.sample CHANGED
@@ -4,4 +4,4 @@ API_ID=
4
  API_HASH=
5
  SESSION=
6
  REDIS_URI=
7
- REDIS_PASSWORD=
 
4
  API_HASH=
5
  SESSION=
6
  REDIS_URI=
7
+ REDIS_PASSWORD=
.github/ISSUE_TEMPLATE/config.yml CHANGED
@@ -5,4 +5,4 @@ contact_links:
5
  about: Please drop your doubts or queries there for an immediate response.
6
  - name: Documentation
7
  url: https://ultroid.tech/
8
- about: Basic documentation for setting up.
 
5
  about: Please drop your doubts or queries there for an immediate response.
6
  - name: Documentation
7
  url: https://ultroid.tech/
8
+ about: Basic documentation for setting up.
.gitignore CHANGED
@@ -21,4 +21,4 @@ node_modules/
21
  glitch_me/
22
  .idea/
23
  .vscode/
24
- temp/
 
21
  glitch_me/
22
  .idea/
23
  .vscode/
24
+ temp/
Dockerfile CHANGED
@@ -14,6 +14,4 @@ WORKDIR /root/TeamUltroid/
14
 
15
  RUN pip3 install --no-cache-dir -r requirements.txt
16
 
17
- RUN npm install -g npm@7.16.0 -g
18
- RUN npm install
19
- RUN npm run build
 
14
 
15
  RUN pip3 install --no-cache-dir -r requirements.txt
16
 
17
+ CMD ["bash", "resources/startup/startup.sh"]
 
 
Makefile DELETED
@@ -1,24 +0,0 @@
1
- test:
2
- @pre-commit run --all-files
3
-
4
- install:
5
- @pip3 install --upgrade pip setuptools wheel
6
- @pip3 install --upgrade -r requirements.txt
7
-
8
-
9
- dev-install:
10
- @pip3 install --upgrade pip setuptools wheel
11
- @pip3 install --upgrade -r requirements-dev.txt
12
- @sleep 5
13
- @pre-commit
14
- @pre-commit install
15
-
16
- update:
17
- @git pull
18
- @pip3 install --upgrade pip setuptools wheel
19
- @pip3 install --upgrade -r requirements.txt
20
-
21
- ci:
22
- @pip3 install --upgrade pip setuptools wheel
23
- @pip3 install --upgrade -r requirements-dev.txt
24
- @pre-commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -16,7 +16,7 @@
16
  [![Open Source Love svg2](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/TeamUltroid/Ultroid)
17
  [![Contributors](https://img.shields.io/github/contributors/TeamUltroid/Ultroid?style=flat-square&color=green)](https://github.com/TeamUltroid/Ultroid/graphs/contributors)
18
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
19
- [![License](https://img.shields.io/badge/License-AGPL-blue)](https://github.com/TeamUltroid/Ultroid/blob/main/LICENSE)
20
  [![Sparkline](https://stars.medv.io/Teamultroid/Ultroid.svg)](https://stars.medv.io/TeamUltroid/Ultroid)
21
 
22
  ----
@@ -37,7 +37,7 @@
37
  ## Deploy to Heroku
38
  Get the [Necessary Variables](#Necessary-Variables) and then click the button below!
39
 
40
- [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2F1Danish-00%2FUltroid-1)
41
 
42
  ## Deploy Locally
43
  - [Traditional Method](#local-deploy---traditional-method)
@@ -45,8 +45,8 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
45
 
46
  ### Local Deploy - Easy Method
47
  - Linux - `bash -c "$(curl -fsSL https://git.io/JY9UM)"`
48
- - Windows - `cd desktop ; wget https://del.dog/raw/ultroid-termux -o locals.py ; python locals.py`
49
- - Termux - `sh -c "$(curl -fsSL https://del.dog/raw/ultroid-termux-deploy)"`
50
 
51
  ### Local Deploy - Traditional Method
52
  - Get your [Necessary Variables](#Necessary-Variables)
@@ -63,11 +63,11 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
63
  - For Linux users:
64
  `bash sessiongen`
65
  or
66
- `bash -c "$(curl -fsSL https://del.dog/ultroid)"`
67
  - For Termux users:
68
- `sh -c "$(curl -fsSL https://da.gd/termux-tel)"`
69
  - For Windows Users:
70
- `cd desktop ; wget https://del.dog/ultroid -o ultroid.py ; python ultroid.py`
71
  - Fill your details in a `.env` file, as given in [`.env.sample`](https://github.com/TeamUltroid/Ultroid/blob/main/.env.sample).
72
  (You can either edit and rename the file or make a new file named `.env`.)
73
  - Run the bot:
@@ -86,9 +86,10 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
86
  ## Session String
87
  Different ways to get your `SESSION`:
88
  * [![Run on Repl.it](https://replit.com/badge/github/TeamUltroid/Ultroid)](https://replit.com/@TeamUltroid/UltroidStringSession)
89
- * Linux : `bash -c "$(curl -fsSL https://del.dog/ultroid)"`
90
  * PowerShell : `cd desktop ; wget https://git.io/JY9JI ; python ultroid.py`
91
  * Termux : `sh -c "$(curl -fsSL https://da.gd/termux-tel)"`
 
92
 
93
  Made with 💕 by [@TeamUltroid](https://t.me/TeamUltroid). <br />
94
 
@@ -100,5 +101,6 @@ Ultroid is licensed under [GNU Affero General Public License](https://www.gnu.or
100
  # Credits
101
  * [![TeamUltroid-Devs](https://img.shields.io/static/v1?label=Teamultroid&message=devs&color=critical)](https://t.me/UltroidDevs)
102
  * [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon)
103
- * [AndrewLaneX](https://github.com/AndrewLaneX) for [tgcalls-base.](http://github.com/tgcallsjs/tgcalls)
 
104
 
 
16
  [![Open Source Love svg2](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/TeamUltroid/Ultroid)
17
  [![Contributors](https://img.shields.io/github/contributors/TeamUltroid/Ultroid?style=flat-square&color=green)](https://github.com/TeamUltroid/Ultroid/graphs/contributors)
18
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
19
+ [![License](https://img.shields.io/badge/License-AGPL-blue)](https://github.com/TeamUltroid/Ultroid/blob/main/LICENSE)
20
  [![Sparkline](https://stars.medv.io/Teamultroid/Ultroid.svg)](https://stars.medv.io/TeamUltroid/Ultroid)
21
 
22
  ----
 
37
  ## Deploy to Heroku
38
  Get the [Necessary Variables](#Necessary-Variables) and then click the button below!
39
 
40
+ [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2F1Danish-00%2FSideLoad)
41
 
42
  ## Deploy Locally
43
  - [Traditional Method](#local-deploy---traditional-method)
 
45
 
46
  ### Local Deploy - Easy Method
47
  - Linux - `bash -c "$(curl -fsSL https://git.io/JY9UM)"`
48
+ - Windows - `cd desktop ; wget https://git.io/JY9UM -o locals.py ; python locals.py`
49
+ - Termux - `sh -c "$(curl -fsSL https://git.io/JY9UM)"`
50
 
51
  ### Local Deploy - Traditional Method
52
  - Get your [Necessary Variables](#Necessary-Variables)
 
63
  - For Linux users:
64
  `bash sessiongen`
65
  or
66
+ `bash -c "$(curl -fsSL https://git.io/JY9JI)"`
67
  - For Termux users:
68
+ `sh -c "$(curl -fsSL https://git.io/JqgsR)"`
69
  - For Windows Users:
70
+ `cd desktop ; wget https://git.io/JY9JI -o ultroid.py ; python ultroid.py`
71
  - Fill your details in a `.env` file, as given in [`.env.sample`](https://github.com/TeamUltroid/Ultroid/blob/main/.env.sample).
72
  (You can either edit and rename the file or make a new file named `.env`.)
73
  - Run the bot:
 
86
  ## Session String
87
  Different ways to get your `SESSION`:
88
  * [![Run on Repl.it](https://replit.com/badge/github/TeamUltroid/Ultroid)](https://replit.com/@TeamUltroid/UltroidStringSession)
89
+ * Linux : `bash -c "$(curl -fsSL https://git.io/JY9JI)"`
90
  * PowerShell : `cd desktop ; wget https://git.io/JY9JI ; python ultroid.py`
91
  * Termux : `sh -c "$(curl -fsSL https://da.gd/termux-tel)"`
92
+ * TelegramBot : [@SessionGeneratorBot](https://t.me/SessionGeneratorBot)
93
 
94
  Made with 💕 by [@TeamUltroid](https://t.me/TeamUltroid). <br />
95
 
 
101
  # Credits
102
  * [![TeamUltroid-Devs](https://img.shields.io/static/v1?label=Teamultroid&message=devs&color=critical)](https://t.me/UltroidDevs)
103
  * [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon)
104
+ * [Dan](https://github.com/delivrance) for [Pyrogram.](https://github.com/pyrogram/pyrogram)
105
+ * [Pytgcalls](https://github.com/pytgcalls) for [PyTgCalls.](https://github.com/pytgcalls/pytgcalls)
106
 
assistant/{othervars.py → callbackstuffs.py} RENAMED
@@ -6,11 +6,11 @@
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
  import re
 
9
  from glob import glob
10
  from os import remove
11
  from random import choices
12
 
13
- import requests
14
  from telegraph import Telegraph
15
  from telegraph import upload_file as upl
16
 
@@ -27,7 +27,33 @@ TOKEN_FILE = "resources/auths/auth_token.txt"
27
 
28
 
29
  @callback(
30
- re.compile("sndplug_(.*)"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  )
32
  async def send(eve):
33
  name = (eve.data_match.group(1)).decode("UTF-8")
@@ -133,9 +159,9 @@ async def changes(okk):
133
  changelog_str = changelog + f"\n\nClick the below button to update!"
134
  if len(changelog_str) > 1024:
135
  await okk.edit(get_string("upd_4"))
136
- file = open(f"ultroid_updates.txt", "w+")
137
- file.write(tl_chnglog)
138
- file.close()
139
  await okk.edit(
140
  get_string("upd_5"),
141
  file="ultroid_updates.txt",
@@ -159,15 +185,14 @@ async def changes(okk):
159
  @owner
160
  async def _(e):
161
  ok = (e.data_match.group(1)).decode("UTF-8")
162
- hmm = open(ok)
163
- hmmm = hmm.read()
164
- hmm.close()
165
- key = (
166
- requests.post("https://nekobin.com/api/documents", json={"content": hmmm})
167
- .json()
168
- .get("result")
169
- .get("key")
170
- )
171
  if ok.startswith("plugins"):
172
  buttons = [
173
  Button.inline("« Bᴀᴄᴋ", data="back"),
@@ -179,9 +204,10 @@ async def _(e):
179
  Button.inline("••Cʟᴏꜱᴇ••", data="close"),
180
  ]
181
  await e.edit(
182
- f"Pasted to Nekobin\n 👉[Link](https://nekobin.com/{key})\n 👉[Raw Link](https://nekobin.com/raw/{key})",
183
  buttons=buttons,
184
  link_preview=False,
 
185
  )
186
 
187
 
@@ -220,7 +246,7 @@ async def _(e):
220
  + "4. Copy link of that folder.\n"
221
  + "5. Send all characters which is after id= .",
222
  )
223
- async with ultroid_bot.asst.conversation(e.sender_id) as conv:
224
  reply = conv.wait_event(events.NewMessage(from_users=e.sender_id))
225
  repl = await reply
226
  udB.set("GDRIVE_FOLDER_ID", repl.text)
@@ -236,7 +262,7 @@ async def _(e):
236
  if not e.is_private:
237
  return
238
  await e.edit("Send your CLIENT SECRET")
239
- async with ultroid_bot.asst.conversation(e.sender_id) as conv:
240
  reply = conv.wait_event(events.NewMessage(from_users=e.sender_id))
241
  repl = await reply
242
  udB.set("GDRIVE_CLIENT_SECRET", repl.text)
@@ -252,7 +278,7 @@ async def _(e):
252
  if not e.is_private:
253
  return
254
  await e.edit("Send your CLIENT ID ending with .com")
255
- async with ultroid_bot.asst.conversation(e.sender_id) as conv:
256
  reply = conv.wait_event(events.NewMessage(from_users=e.sender_id))
257
  repl = await reply
258
  if not repl.text.endswith(".com"):
@@ -720,11 +746,47 @@ async def alvcs(event):
720
  Button.inline("Sᴇᴛ Wᴀʀɴs", data="swarn"),
721
  Button.inline("Dᴇʟᴇᴛᴇ Pᴍ Mᴇᴅɪᴀ", data="delpmmed"),
722
  ],
 
723
  [Button.inline("« Bᴀᴄᴋ", data="ppmset")],
724
  ],
725
  )
726
 
727
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  @callback("pmtxt")
729
  @owner
730
  async def name(event):
@@ -988,7 +1050,7 @@ async def name(event):
988
  name = "Bot Welcome Message:"
989
  async with event.client.conversation(pru) as conv:
990
  await conv.send_message(
991
- "**BOT WELCOME MSG**\nEnter the msg which u want to show when someone start your assistant Bot.\n\nUse /cancel to terminate the operation.",
992
  )
993
  response = conv.wait_event(events.NewMessage(chats=pru))
994
  response = await response
 
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
  import re
9
+ import urllib
10
  from glob import glob
11
  from os import remove
12
  from random import choices
13
 
 
14
  from telegraph import Telegraph
15
  from telegraph import upload_file as upl
16
 
 
27
 
28
 
29
  @callback(
30
+ re.compile(
31
+ "ebk_(.*)",
32
+ ),
33
+ )
34
+ async def eupload(event):
35
+ match = event.pattern_match.group(1).decode("utf-8")
36
+ await event.answer("Uploading..")
37
+ try:
38
+ await event.edit(
39
+ file=f"https://www.gutenberg.org/files/{match}/{match}-pdf.pdf"
40
+ )
41
+ except BaseException:
42
+ book = "Ultroid-Book.epub"
43
+ urllib.request.urlretrieve(
44
+ "https://www.gutenberg.org/ebooks/132.epub.images", book
45
+ )
46
+ fn, media, _ = await asst._file_to_media(
47
+ book, thumb="resources/extras/ultroid.jpg"
48
+ )
49
+ await event.edit(file=media)
50
+ remove(book)
51
+
52
+
53
+ @callback(
54
+ re.compile(
55
+ "sndplug_(.*)",
56
+ ),
57
  )
58
  async def send(eve):
59
  name = (eve.data_match.group(1)).decode("UTF-8")
 
159
  changelog_str = changelog + f"\n\nClick the below button to update!"
160
  if len(changelog_str) > 1024:
161
  await okk.edit(get_string("upd_4"))
162
+ await asyncio.sleep(2)
163
+ with open(f"ultroid_updates.txt", "w+") as file:
164
+ file.write(tl_chnglog)
165
  await okk.edit(
166
  get_string("upd_5"),
167
  file="ultroid_updates.txt",
 
185
  @owner
186
  async def _(e):
187
  ok = (e.data_match.group(1)).decode("UTF-8")
188
+ with open(ok, "r") as hmm:
189
+ _, key = get_paste(hmm.read())
190
+ if _ == "dog":
191
+ link = "https://del.dog/" + key
192
+ raw = "https://del.dog/raw/" + key
193
+ else:
194
+ link = "https://nekobin.com/" + key
195
+ raw = "https://nekobin.com/raw/" + key
 
196
  if ok.startswith("plugins"):
197
  buttons = [
198
  Button.inline("« Bᴀᴄᴋ", data="back"),
 
204
  Button.inline("••Cʟᴏꜱᴇ••", data="close"),
205
  ]
206
  await e.edit(
207
+ f"<strong>Pasted\n 👉<a href={link}>[Link]</a>\n 👉<a href={raw}>[Raw Link]</a></strong>",
208
  buttons=buttons,
209
  link_preview=False,
210
+ parse_mode="html",
211
  )
212
 
213
 
 
246
  + "4. Copy link of that folder.\n"
247
  + "5. Send all characters which is after id= .",
248
  )
249
+ async with asst.conversation(e.sender_id) as conv:
250
  reply = conv.wait_event(events.NewMessage(from_users=e.sender_id))
251
  repl = await reply
252
  udB.set("GDRIVE_FOLDER_ID", repl.text)
 
262
  if not e.is_private:
263
  return
264
  await e.edit("Send your CLIENT SECRET")
265
+ async with asst.conversation(e.sender_id) as conv:
266
  reply = conv.wait_event(events.NewMessage(from_users=e.sender_id))
267
  repl = await reply
268
  udB.set("GDRIVE_CLIENT_SECRET", repl.text)
 
278
  if not e.is_private:
279
  return
280
  await e.edit("Send your CLIENT ID ending with .com")
281
+ async with asst.conversation(e.sender_id) as conv:
282
  reply = conv.wait_event(events.NewMessage(from_users=e.sender_id))
283
  repl = await reply
284
  if not repl.text.endswith(".com"):
 
746
  Button.inline("Sᴇᴛ Wᴀʀɴs", data="swarn"),
747
  Button.inline("Dᴇʟᴇᴛᴇ Pᴍ Mᴇᴅɪᴀ", data="delpmmed"),
748
  ],
749
+ [Button.inline("PMPermit Type", data="pmtype")],
750
  [Button.inline("« Bᴀᴄᴋ", data="ppmset")],
751
  ],
752
  )
753
 
754
 
755
+ @callback("pmtype")
756
+ @owner
757
+ async def pmtyp(e):
758
+ await event.edit(
759
+ "Select the type of PMPermit needed.",
760
+ buttons=[
761
+ [Button.inline("Inline", data="inpm_in")],
762
+ [Button.inline("Normal", data="inpm_no")],
763
+ [Button.inline("« Bᴀᴄᴋ", data="pmcstm")],
764
+ ],
765
+ )
766
+
767
+
768
+ @callback("inpm_in")
769
+ @owner
770
+ async def inl_on(event):
771
+ var = "INLINE_PM"
772
+ await setit(event, var, "True")
773
+ await event.edit(
774
+ f"Done!! PMPermit type has been set to inline!",
775
+ buttons=[[Button.inline("« Bᴀᴄᴋ", data="pmtype")]],
776
+ )
777
+
778
+
779
+ @callback("inpm_no")
780
+ @owner
781
+ async def inl_on(event):
782
+ var = "INLINE_PM"
783
+ await setit(event, var, "False")
784
+ await event.edit(
785
+ f"Done!! PMPermit type has been set to normal!",
786
+ buttons=[[Button.inline("« Bᴀᴄᴋ", data="pmtype")]],
787
+ )
788
+
789
+
790
  @callback("pmtxt")
791
  @owner
792
  async def name(event):
 
1050
  name = "Bot Welcome Message:"
1051
  async with event.client.conversation(pru) as conv:
1052
  await conv.send_message(
1053
+ "**BOT WELCOME MSG**\nEnter the msg which u want to show when someone start your assistant Bot.\nYou Can use `{me}` , `{mention}` Parameters Too\nUse /cancel to terminate the operation.",
1054
  )
1055
  response = conv.wait_event(events.NewMessage(chats=pru))
1056
  response = await response
assistant/inlinestuff.py CHANGED
@@ -6,8 +6,6 @@
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
  import base64
9
- import os
10
- import urllib
11
  from random import choice
12
  from re import compile as re_compile
13
  from re import findall
@@ -219,52 +217,6 @@ async def gsearch(q_event):
219
  await q_event.answer(searcher, switch_pm="Google Search.", switch_pm_param="start")
220
 
221
 
222
- @in_pattern("rex")
223
- @in_owner
224
- async def rextester(event):
225
- builder = event.builder
226
- try:
227
- omk = event.text.split(" ", maxsplit=1)[1]
228
- if omk is not None:
229
- if "|" in omk:
230
- lang, codee = omk.split("|")
231
- else:
232
- lang = "python3"
233
- codee = omk
234
- if lang == "php":
235
- code = f"<?php {codee} ?>"
236
- else:
237
- code = codee
238
- output = await rexec_aio(lang, code)
239
- stats = output.stats
240
- if output.errors is not None:
241
- outputt = output.errors
242
- resultm = builder.article(
243
- title="Code",
244
- description=f"Language-`{lang}` & Code-`{code}`",
245
- text=f"Language:\n`{lang}`\n\nCode:\n`{code}`\n\nErrors:\n`{outputt}`\n\nStats:\n`{stats}`",
246
- )
247
- else: # By @ProgrammingError
248
- outputt = output.results
249
- resultm = builder.article(
250
- title="Code", # By @ProgrammingError
251
- description=f"Language-`{lang}` & Code-`{code}`",
252
- text=f"Language:\n`{lang}`\n\nCode:\n`{code}`\n\nResult:\n`{outputt}`\n\nStats:\n`{stats}`",
253
- )
254
- await event.answer(
255
- [resultm], switch_pm="RexTester.", switch_pm_param="start"
256
- )
257
- except UnknownLanguage:
258
- resultm = builder.article(
259
- title="Error", # By @ProgrammingError
260
- description="Invalid language choosen",
261
- text=f"The list of valid languages are\n\n{rex_langs}\n\n\nFormat to use Rextester is `@Yourassistantusername rex langcode|code`",
262
- )
263
- await event.answer(
264
- [resultm], switch_pm="RexTester. Invalid Language!", switch_pm_param="start"
265
- )
266
-
267
-
268
  @in_pattern("yahoo")
269
  @in_owner
270
  async def yahoosearch(q_event):
@@ -463,33 +415,18 @@ async def clip(e):
463
  if "/cache/epub" in out[rs]["src"]:
464
  link = out[rs]["src"]
465
  num = link.split("/")[3]
 
 
466
  hm.append(
467
- buil.document(
468
  title=titles[rs],
 
469
  description="GutenBerg Search",
470
- file="https://gutenberg.org" + link.replace("small", "medium"),
 
 
471
  text=f"**• Ebook Search**\n\n->> `{titles[rs]}`",
472
  buttons=Button.inline("Get as Doc", data=f"ebk_{num}"),
473
  )
474
  )
475
  await e.answer(hm, switch_pm="Ebooks Search", switch_pm_param="start")
476
-
477
-
478
- @callback(re_compile("ebk_(.*)"))
479
- async def eupload(event):
480
- match = event.pattern_match.group(1).decode("utf-8")
481
- await event.answer("Uploading..")
482
- try:
483
- await event.edit(
484
- file=f"https://www.gutenberg.org/files/{match}/{match}-pdf.pdf"
485
- )
486
- except BaseException:
487
- book = "Ultroid-Book.epub"
488
- urllib.request.urlretrieve(
489
- "https://www.gutenberg.org/ebooks/132.epub.images", book
490
- )
491
- fn, media, _ = await asst._file_to_media(
492
- book, thumb="resources/extras/ultroid.jpg"
493
- )
494
- await event.edit(file=media)
495
- os.remove(book)
 
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
  import base64
 
 
9
  from random import choice
10
  from re import compile as re_compile
11
  from re import findall
 
217
  await q_event.answer(searcher, switch_pm="Google Search.", switch_pm_param="start")
218
 
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  @in_pattern("yahoo")
221
  @in_owner
222
  async def yahoosearch(q_event):
 
415
  if "/cache/epub" in out[rs]["src"]:
416
  link = out[rs]["src"]
417
  num = link.split("/")[3]
418
+ link = "https://gutenberg.org" + link.replace("small", "medium")
419
+ file = wb(link, 0, "image/jpeg", [])
420
  hm.append(
421
+ buil.article(
422
  title=titles[rs],
423
+ type="photo",
424
  description="GutenBerg Search",
425
+ thumb=file,
426
+ content=file,
427
+ include_media=True,
428
  text=f"**• Ebook Search**\n\n->> `{titles[rs]}`",
429
  buttons=Button.inline("Get as Doc", data=f"ebk_{num}"),
430
  )
431
  )
432
  await e.answer(hm, switch_pm="Ebooks Search", switch_pm_param="start")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assistant/manager/__init__.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2021 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
+
9
+ from plugins import *
10
+
11
+ asst = asst
assistant/pmbot/__init__.py CHANGED
@@ -1,5 +1,6 @@
1
  from pyUltroid.functions.asst_fns import *
2
  from pyUltroid.functions.botchat_db import *
 
3
  from .. import *
4
 
5
  OWNER_NAME = ultroid_bot.me.first_name
 
1
  from pyUltroid.functions.asst_fns import *
2
  from pyUltroid.functions.botchat_db import *
3
+
4
  from .. import *
5
 
6
  OWNER_NAME = ultroid_bot.me.first_name
assistant/pmbot/outgoing.py CHANGED
@@ -29,7 +29,7 @@ async def on_out_mssg(event):
29
  except BaseException:
30
  return
31
  elif event.text.startswith("/"):
32
- return
33
  if event.media:
34
  if event.text:
35
  await asst.send_file(int(to_user), event.media, caption=event.text)
 
29
  except BaseException:
30
  return
31
  elif event.text.startswith("/"):
32
+ return
33
  if event.media:
34
  if event.text:
35
  await asst.send_file(int(to_user), event.media, caption=event.text)
assistant/start.py CHANGED
@@ -7,6 +7,7 @@
7
 
8
  from datetime import datetime
9
 
 
10
  from pyUltroid.functions.asst_fns import *
11
  from pyUltroid.misc import owner_and_sudos
12
  from telethon import events
@@ -17,12 +18,12 @@ from plugins import *
17
  from . import *
18
 
19
  Owner_info_msg = f"""
20
- **Owner** - {OWNER_NAME}
21
- **OwnerID** - `{OWNER_ID}`
22
 
23
- **Message Forwards** - {udB.get("PMBOT")}
24
 
25
- __Ultroid {ultroid_version}, powered by @TeamUltroid__
26
  """
27
 
28
  _settings = [
@@ -48,6 +49,7 @@ _start = [
48
  Button.inline("Sᴛᴀᴛs ✨", data="stat"),
49
  Button.inline("Bʀᴏᴀᴅᴄᴀsᴛ 📻", data="bcast"),
50
  ],
 
51
  ]
52
 
53
 
@@ -56,6 +58,8 @@ async def own(event):
56
  await event.edit(
57
  Owner_info_msg,
58
  buttons=[Button.inline("Close", data=f"closeit")],
 
 
59
  )
60
 
61
 
@@ -67,15 +71,7 @@ async def closet(lol):
67
  @asst_cmd("start ?(.*)")
68
  async def ultroid(event):
69
  if event.is_group:
70
- if str(event.sender_id) in owner_and_sudos():
71
- return await event.reply(
72
- "`I dont work in groups`",
73
- buttons=[
74
- Button.url(
75
- "⚙️Sᴛᴀʀᴛ⚙️", url=f"https://t.me/{asst.me.username}?start=set"
76
- )
77
- ],
78
- )
79
  else:
80
  if (
81
  not is_added(event.sender_id)
@@ -178,3 +174,37 @@ async def setting(event):
178
  "Choose from the below options -",
179
  buttons=_settings,
180
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  from datetime import datetime
9
 
10
+ from pytz import timezone as tz
11
  from pyUltroid.functions.asst_fns import *
12
  from pyUltroid.misc import owner_and_sudos
13
  from telethon import events
 
18
  from . import *
19
 
20
  Owner_info_msg = f"""
21
+ <strong>Owner</strong> - {OWNER_NAME}
22
+ <stong>OwnerID</strong> - <code>{OWNER_ID}</code>
23
 
24
+ <strong>Message Forwards</strong> - {udB.get("PMBOT")}
25
 
26
+ <stong>Ultroid <a href=https://github.com/TeamUltroid/Ultroid>[v{ultroid_version}]</a>, powered by @TeamUltroid</strong>
27
  """
28
 
29
  _settings = [
 
49
  Button.inline("Sᴛᴀᴛs ✨", data="stat"),
50
  Button.inline("Bʀᴏᴀᴅᴄᴀsᴛ 📻", data="bcast"),
51
  ],
52
+ [Button.inline("TɪᴍᴇZᴏɴᴇ 🌎", data="tz")],
53
  ]
54
 
55
 
 
58
  await event.edit(
59
  Owner_info_msg,
60
  buttons=[Button.inline("Close", data=f"closeit")],
61
+ link_preview=False,
62
+ parse_mode="html",
63
  )
64
 
65
 
 
71
  @asst_cmd("start ?(.*)")
72
  async def ultroid(event):
73
  if event.is_group:
74
+ return
 
 
 
 
 
 
 
 
75
  else:
76
  if (
77
  not is_added(event.sender_id)
 
174
  "Choose from the below options -",
175
  buttons=_settings,
176
  )
177
+
178
+
179
+ @callback("tz")
180
+ @owner
181
+ async def timezone_(event):
182
+ await event.delete()
183
+ pru = event.sender_id
184
+ var = "TIMEZONE"
185
+ name = "Timezone"
186
+ async with event.client.conversation(pru) as conv:
187
+ await conv.send_message(
188
+ "Send Your TimeZone From This List [Check From Here](http://www.timezoneconverter.com/cgi-bin/findzone.tzc)"
189
+ )
190
+ response = conv.wait_event(events.NewMessage(chats=pru))
191
+ response = await response
192
+ themssg = response.message.message
193
+ if themssg == "/cancel":
194
+ return await conv.send_message(
195
+ "Cancelled!!",
196
+ buttons=get_back_button("mainmenu"),
197
+ )
198
+ else:
199
+ try:
200
+ tz(themssg)
201
+ await setit(event, var, themssg)
202
+ await conv.send_message(
203
+ f"{name} changed to {themssg}\n",
204
+ buttons=get_back_button("mainmenu"),
205
+ )
206
+ except BaseException:
207
+ await conv.send_message(
208
+ "Wrong TimeZone, Try again",
209
+ buttons=get_back_button("mainmenu"),
210
+ )
assistant/ytdl.py CHANGED
@@ -24,7 +24,6 @@ _yt_base_url = "https://www.youtube.com/watch?v="
24
 
25
 
26
  @in_pattern("yt")
27
- @in_owner
28
  async def _(event):
29
  try:
30
  string = event.text.split(" ", maxsplit=1)[1]
@@ -50,14 +49,17 @@ async def _(event):
50
  link = _yt_base_url + ids
51
  title = v["title"]
52
  duration = v["duration"]
53
- thumb = f"https://img.youtube.com/vi/{ids}/hqdefault.jpg"
54
  text = f"**•Tɪᴛʟᴇ•** `{title}`\n\n**••[Lɪɴᴋ]({link})••**\n\n**••Dᴜʀᴀᴛɪᴏɴ••** `{duration}`\n\n\n"
55
  desc = f"Title : {title}\nDuration : {duration}"
 
56
  results.append(
57
- await event.builder.document(
58
- file=thumb,
59
  title=title,
60
  description=desc,
 
 
61
  text=text,
62
  include_media=True,
63
  buttons=[
@@ -80,7 +82,7 @@ async def _(event):
80
  ],
81
  ),
82
  )
83
- await event.answer(results)
84
 
85
 
86
  @callback(
@@ -99,7 +101,7 @@ async def _(e):
99
  )
100
  _text = "`Select Your Format.`"
101
  if not _buttons:
102
- _text = "`Error domwloading from YouTube.\nTry Restarting your bot.`"
103
  await e.edit(_text, buttons=_buttons)
104
 
105
 
@@ -191,12 +193,12 @@ async def _(event):
191
  text = f"**Title:** `{title}`\n"
192
  text += f"**Duration:** `{time_formatter(int(duration)*1000)}`\n"
193
  text += f"**Views:** `{views}`\n"
194
- text += f"**Artist:** `{artist}`"
195
  await event.edit(
196
  text,
197
  file=file,
 
198
  attributes=attributes,
199
  thumb=thumb,
200
- buttons=Button.switch_inline("Search More", query="yt ", same_peer=True),
201
  )
202
  os.system(f'rm "{title}"*')
 
24
 
25
 
26
  @in_pattern("yt")
 
27
  async def _(event):
28
  try:
29
  string = event.text.split(" ", maxsplit=1)[1]
 
49
  link = _yt_base_url + ids
50
  title = v["title"]
51
  duration = v["duration"]
52
+ thumb = f"https://i.ytimg.com/vi/{ids}/hqdefault.jpg"
53
  text = f"**•Tɪᴛʟᴇ•** `{title}`\n\n**••[Lɪɴᴋ]({link})••**\n\n**••Dᴜʀᴀᴛɪᴏɴ••** `{duration}`\n\n\n"
54
  desc = f"Title : {title}\nDuration : {duration}"
55
+ file = wb(thumb, 0, "image/jpeg", [])
56
  results.append(
57
+ await event.builder.article(
58
+ type="photo",
59
  title=title,
60
  description=desc,
61
+ thumb=file,
62
+ content=file,
63
  text=text,
64
  include_media=True,
65
  buttons=[
 
82
  ],
83
  ),
84
  )
85
+ await event.answer(results[:50])
86
 
87
 
88
  @callback(
 
101
  )
102
  _text = "`Select Your Format.`"
103
  if not _buttons:
104
+ _text = "`Error downloading from YouTube.\nTry Restarting your bot.`"
105
  await e.edit(_text, buttons=_buttons)
106
 
107
 
 
193
  text = f"**Title:** `{title}`\n"
194
  text += f"**Duration:** `{time_formatter(int(duration)*1000)}`\n"
195
  text += f"**Views:** `{views}`\n"
196
+ text += f"**Artist:** `{artist}`\n\n"
197
  await event.edit(
198
  text,
199
  file=file,
200
+ buttons=Button.switch_inline("Search More", query="yt ", same_peer=True),
201
  attributes=attributes,
202
  thumb=thumb,
 
203
  )
204
  os.system(f'rm "{title}"*')
heroku.yml CHANGED
@@ -1,5 +1,3 @@
1
  build:
2
  docker:
3
  ultroid: Dockerfile
4
- run:
5
- ultroid: bash resources/startup/startup.sh
 
1
  build:
2
  docker:
3
  ultroid: Dockerfile
 
 
package.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "name": "ultroid-vcbot",
3
- "version": "1.0.0",
4
- "main": "index.js",
5
- "scripts": {
6
- "start": "node build/index.js",
7
- "build": "tsc",
8
- "test": "tsc --noEmit",
9
- "dev": "nodemon src/index.ts"
10
- },
11
- "author": "TeamUltroid <teamultroid@protonmail.ch>",
12
- "license": "AGPL-3.0",
13
- "dependencies": {
14
- "@mapbox/node-pre-gyp": "^1.0.0",
15
- "@youtwitface/escape-html": "^1.0.0",
16
- "dotenv": "^8.2.0",
17
- "envalid": "^7.0.0",
18
- "redis": "^3.0.2",
19
- "telegraf": "^4.4.0",
20
- "tgcalls": "^0.1.2",
21
- "ws": "^7.4.6"
22
- },
23
- "devDependencies": {
24
- "@types/node": "^14.14.25",
25
- "@types/redis": "^2.8.28",
26
- "@types/ws": "^7.4.0",
27
- "nodemon": "^2.0.7",
28
- "ts-node": "^9.1.1",
29
- "typegram": "^3.4.0",
30
- "typescript": "^4.1.3"
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugins/_ChatActions.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyUltroid.functions.all import get_chatbot_reply
2
+ from pyUltroid.functions.chatBot_db import chatbot_stats
3
+ from pyUltroid.functions.clean_db import *
4
+ from pyUltroid.functions.forcesub_db import *
5
+ from pyUltroid.functions.gban_mute_db import *
6
+ from pyUltroid.functions.greetings_db import *
7
+ from telethon.errors.rpcerrorlist import UserNotParticipantError
8
+ from telethon.tl.functions.channels import GetParticipantRequest
9
+ from telethon.utils import get_display_name
10
+
11
+ from . import *
12
+
13
+
14
+ @ultroid_bot.on(events.ChatAction())
15
+ async def ChatActionsHandler(ult): # sourcery no-metrics
16
+ # clean chat actions
17
+ if is_clean_added(ult.chat_id):
18
+ try:
19
+ await ult.delete()
20
+ except BaseException:
21
+ pass
22
+
23
+ # thank members
24
+ if must_thank(ult.chat_id):
25
+ chat_count = len(await ult.client.get_participants(await ult.get_chat()))
26
+ if chat_count % 100 == 0:
27
+ stik_id = chat_count / 100 - 1
28
+ sticker = stickers[stik_id]
29
+ await ultroid.send_message(ult.chat_id, file=sticker)
30
+ # force subscribe
31
+ if (
32
+ udB.get("FORCESUB")
33
+ and ((ult.user_joined or ult.user_added))
34
+ and get_forcesetting(ult.chat_id)
35
+ ):
36
+ user = await ult.get_user()
37
+ if not user.bot:
38
+ joinchat = get_forcesetting(ult.chat_id)
39
+ try:
40
+ await ultroid_bot(GetParticipantRequest(int(joinchat), user.id))
41
+ except UserNotParticipantError:
42
+ await ultroid_bot.edit_permissions(
43
+ ult.chat_id, user.id, send_messages=False
44
+ )
45
+ res = await ultroid_bot.inline_query(
46
+ asst.me.username, f"fsub {user.id}_{joinchat}"
47
+ )
48
+ await res[0].click(ult.chat_id, reply_to=ult.action_message.id)
49
+
50
+ # gban checks
51
+ if ult.user_joined and ult.added_by:
52
+ user = await ult.get_user()
53
+ chat = await ult.get_chat()
54
+ if is_gbanned(str(user.id)) and chat.admin_rights:
55
+ try:
56
+ await ultroid_bot.edit_permissions(
57
+ chat.id,
58
+ user.id,
59
+ view_messages=False,
60
+ )
61
+ reason = get_gban_reason(user.id)
62
+ gban_watch = f"#GBanned_User Joined.\n\n**User** - [{user.first_name}](tg://user?id={user.id})\n"
63
+ if reason is not None:
64
+ gban_watch += f"**Reason**: {reason}\n\n"
65
+ gban_watch += f"`User Banned.`"
66
+ await ult.reply(gban_watch)
67
+ except BaseException:
68
+ pass
69
+
70
+ # greetings
71
+ if get_welcome(ult.chat_id):
72
+ user = await ult.get_user()
73
+ chat = await ult.get_chat()
74
+ title = chat.title or "this chat"
75
+ pp = await ult.client.get_participants(chat)
76
+ count = len(pp)
77
+ mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
78
+ name = user.first_name
79
+ last = user.last_name
80
+ fullname = f"{name} {last}" if last else name
81
+ uu = user.username
82
+ username = f"@{uu}" if uu else mention
83
+ msgg = wel["welcome"]
84
+ med = wel["media"]
85
+ userid = user.id
86
+ if msgg and not is_gbanned(str(user.id)):
87
+ send = await ult.reply(
88
+ msgg.format(
89
+ mention=mention,
90
+ group=title,
91
+ count=count,
92
+ name=name,
93
+ fullname=fullname,
94
+ username=username,
95
+ userid=userid,
96
+ ),
97
+ file=med,
98
+ )
99
+ await asyncio.sleep(150)
100
+ await send.delete()
101
+ elif not is_gbanned(str(user.id)):
102
+ await ult.reply(file=med)
103
+ if (ult.user_left or ult.user_kicked) and get_goodbye(ult.chat_id):
104
+ user = await ult.get_user()
105
+ chat = await ult.get_chat()
106
+ title = chat.title or "this chat"
107
+ pp = await ult.client.get_participants(chat)
108
+ count = len(pp)
109
+ mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
110
+ name = user.first_name
111
+ last = user.last_name
112
+ fullname = f"{name} {last}" if last else name
113
+ uu = user.username
114
+ username = f"@{uu}" if uu else mention
115
+ msgg = wel["goodbye"]
116
+ med = wel["media"]
117
+ userid = user.id
118
+ if msgg:
119
+ send = await ult.reply(
120
+ msgg.format(
121
+ mention=mention,
122
+ group=title,
123
+ count=count,
124
+ name=name,
125
+ fullname=fullname,
126
+ username=username,
127
+ userid=userid,
128
+ ),
129
+ file=med,
130
+ )
131
+ await asyncio.sleep(150)
132
+ await send.delete()
133
+ else:
134
+ await ult.reply(file=med)
135
+
136
+
137
+ @ultroid_bot.on(events.NewMessage(incoming=True))
138
+ async def chatBot_replies(event):
139
+ if event.sender_id and chatbot_stats(event.sender_id) and event.text:
140
+ msg = get_chatbot_reply(event, event.text)
141
+ if msg:
142
+ await event.reply(msg)
plugins/__init__.py CHANGED
@@ -5,17 +5,14 @@
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
 
8
  import time
9
 
 
10
  from pyUltroid.dB import *
11
- from pyUltroid.dB.core import *
12
  from pyUltroid.functions.all import *
13
- from pyUltroid.functions.asstcmd_db import *
14
- from pyUltroid.functions.broadcast_db import *
15
- from pyUltroid.functions.gban_mute_db import *
16
- from pyUltroid.functions.nsfw_db import *
17
  from pyUltroid.functions.sudos import *
18
- from pyUltroid.utils import *
19
  from telethon import Button
20
  from telethon.tl import functions, types
21
 
@@ -30,7 +27,7 @@ except ModuleNotFoundError:
30
 
31
 
32
  start_time = time.time()
33
- ultroid_version = "v0.0.8.1"
34
  OWNER_NAME = ultroid_bot.me.first_name
35
  OWNER_ID = ultroid_bot.me.id
36
 
@@ -38,312 +35,13 @@ List = []
38
  Dict = {}
39
  N = 0
40
 
41
-
42
- def grt(seconds: int) -> str:
43
- count = 0
44
- up_time = ""
45
- time_list = []
46
- time_suffix_list = ["s", "m", "h", "d"]
47
-
48
- while count < 4:
49
- count += 1
50
- if count < 3:
51
- remainder, result = divmod(seconds, 60)
52
- else:
53
- remainder, result = divmod(seconds, 24)
54
- if seconds == 0 and remainder == 0:
55
- break
56
- time_list.append(int(result))
57
- seconds = int(remainder)
58
-
59
- for x in range(len(time_list)):
60
- time_list[x] = str(time_list[x]) + time_suffix_list[x]
61
- if len(time_list) == 4:
62
- up_time += time_list.pop() + ", "
63
-
64
- time_list.reverse()
65
- up_time += ":".join(time_list)
66
-
67
- return up_time
68
-
69
-
70
- _default = [
71
- "a",
72
- "b",
73
- "c",
74
- "d",
75
- "e",
76
- "f",
77
- "g",
78
- "h",
79
- "i",
80
- "j",
81
- "k",
82
- "l",
83
- "m",
84
- "n",
85
- "o",
86
- "p",
87
- "q",
88
- "r",
89
- "s",
90
- "t",
91
- "u",
92
- "v",
93
- "w",
94
- "x",
95
- "y",
96
- "z",
97
- "A",
98
- "B",
99
- "C",
100
- "D",
101
- "E",
102
- "F",
103
- "G",
104
- "H",
105
- "I",
106
- "J",
107
- "K",
108
- "L",
109
- "M",
110
- "N",
111
- "O",
112
- "P",
113
- "Q",
114
- "R",
115
- "S",
116
- "T",
117
- "U",
118
- "V",
119
- "W",
120
- "X",
121
- "Y",
122
- "Z",
123
- ]
124
-
125
-
126
- _small_caps = [
127
- "ᴀ",
128
- "ʙ",
129
- "ᴄ",
130
- "ᴅ",
131
- "ᴇ",
132
- "ғ",
133
- "ɢ",
134
- "ʜ",
135
- "ɪ",
136
- "ᴊ",
137
- "ᴋ",
138
- "ʟ",
139
- "ᴍ",
140
- "ɴ",
141
- "ᴏ",
142
- "ᴘ",
143
- "ϙ",
144
- "ʀ",
145
- "s",
146
- "ᴛ",
147
- "ᴜ",
148
- "ᴠ",
149
- "ᴡ",
150
- "x",
151
- "ʏ",
152
- "ᴢ",
153
- "A",
154
- "B",
155
- "C",
156
- "D",
157
- "E",
158
- "F",
159
- "G",
160
- "H",
161
- "I",
162
- "J",
163
- "K",
164
- "L",
165
- "M",
166
- "N",
167
- "O",
168
- "P",
169
- "Q",
170
- "R",
171
- "S",
172
- "T",
173
- "U",
174
- "V",
175
- "W",
176
- "X",
177
- "Y",
178
- "Z",
179
  ]
180
 
181
- _monospace = [
182
- "𝚊",
183
- "𝚋",
184
- "𝚌",
185
- "𝚍",
186
- "𝚎",
187
- "𝚏",
188
- "𝚐",
189
- "𝚑",
190
- "𝚒",
191
- "𝚓",
192
- "𝚔",
193
- "𝚕",
194
- "𝚖",
195
- "𝚗",
196
- "𝚘",
197
- "𝚙",
198
- "𝚚",
199
- "𝚛",
200
- "𝚜",
201
- "𝚝",
202
- "𝚞",
203
- "𝚟",
204
- "𝚠",
205
- "𝚡",
206
- "𝚢",
207
- "𝚣",
208
- "𝙰",
209
- "𝙱",
210
- "𝙲",
211
- "𝙳",
212
- "𝙴",
213
- "𝙵",
214
- "𝙶",
215
- "𝙷",
216
- "𝙸",
217
- "𝙹",
218
- "𝙺",
219
- "𝙻",
220
- "𝙼",
221
- "𝙽",
222
- "𝙾",
223
- "𝙿",
224
- "𝚀",
225
- "𝚁",
226
- "𝚂",
227
- "𝚃",
228
- "𝚄",
229
- "𝚅",
230
- "𝚆",
231
- "𝚇",
232
- "𝚈",
233
- "𝚉",
234
- ]
235
-
236
- _double_stroke = [
237
- "𝕒",
238
- "𝕓",
239
- "𝕔",
240
- "𝕕",
241
- "𝕖",
242
- "𝕗",
243
- "𝕘",
244
- "𝕙",
245
- "𝕚",
246
- "𝕛",
247
- "𝕜",
248
- "𝕝",
249
- "𝕞",
250
- "𝕟",
251
- "𝕠",
252
- "𝕡",
253
- "𝕢",
254
- "𝕣",
255
- "𝕤",
256
- "𝕥",
257
- "𝕦",
258
- "𝕧",
259
- "𝕨",
260
- "𝕩",
261
- "𝕪",
262
- "𝕫",
263
- "𝔸",
264
- "𝔹",
265
- "ℂ",
266
- "𝔻",
267
- "𝔼",
268
- "𝔽",
269
- "𝔾",
270
- "ℍ",
271
- "𝕀",
272
- "𝕁",
273
- "𝕂",
274
- "𝕃",
275
- "𝕄",
276
- "ℕ",
277
- "𝕆",
278
- "ℙ",
279
- "ℚ",
280
- "ℝ",
281
- "𝕊",
282
- "𝕋",
283
- "𝕌",
284
- "𝕍",
285
- "𝕎",
286
- "𝕏",
287
- "𝕐",
288
- "ℤ",
289
- ]
290
-
291
- _script_royal = [
292
- "𝒶",
293
- "𝒷",
294
- "𝒸",
295
- "𝒹",
296
- "𝑒",
297
- "𝒻",
298
- "𝑔",
299
- "𝒽",
300
- "𝒾",
301
- "𝒿",
302
- "𝓀",
303
- "𝓁",
304
- "𝓂",
305
- "𝓃",
306
- "𝑜",
307
- "𝓅",
308
- "𝓆",
309
- "𝓇",
310
- "𝓈",
311
- "𝓉",
312
- "𝓊",
313
- "𝓋",
314
- "𝓌",
315
- "𝓍",
316
- "𝓎",
317
- "𝓏",
318
- "𝒜",
319
- "ℬ",
320
- "𝒞",
321
- "𝒟",
322
- "ℰ",
323
- "ℱ",
324
- "𝒢",
325
- "ℋ",
326
- "ℐ",
327
- "𝒥",
328
- "𝒦",
329
- "ℒ",
330
- "ℳ",
331
- "𝒩",
332
- "𝒪",
333
- "𝒫",
334
- "𝒬",
335
- "ℛ",
336
- "𝒮",
337
- "𝒯",
338
- "𝒰",
339
- "𝒱",
340
- "𝒲",
341
- "𝒳",
342
- "𝒴",
343
- "𝒵",
344
- ]
345
-
346
-
347
  KANGING_STR = [
348
  "Using Witchery to kang this sticker...",
349
  "Plagiarising hehe...",
 
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
+ import asyncio
9
  import time
10
 
11
+ from pyUltroid import *
12
  from pyUltroid.dB import *
 
13
  from pyUltroid.functions.all import *
 
 
 
 
14
  from pyUltroid.functions.sudos import *
15
+ from pyUltroid.version import ultroid_version
16
  from telethon import Button
17
  from telethon.tl import functions, types
18
 
 
27
 
28
 
29
  start_time = time.time()
30
+
31
  OWNER_NAME = ultroid_bot.me.first_name
32
  OWNER_ID = ultroid_bot.me.id
33
 
 
35
  Dict = {}
36
  N = 0
37
 
38
+ NOSPAM_CHAT = [
39
+ -1001387666944, # @PyrogramChat
40
+ -1001109500936, # @TelethonChat
41
+ -1001050982793, # @Python
42
+ -1001256902287, # @DurovsChat
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  ]
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  KANGING_STR = [
46
  "Using Witchery to kang this sticker...",
47
  "Plagiarising hehe...",
plugins/_help.py CHANGED
@@ -5,21 +5,17 @@
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
- from support import *
9
  from telethon.errors.rpcerrorlist import BotInlineDisabledError as dis
10
  from telethon.errors.rpcerrorlist import BotMethodInvalidError
11
  from telethon.errors.rpcerrorlist import BotResponseTimeoutError as rep
12
- from telethon.tl.custom import Button
13
 
14
  from . import *
15
 
16
 
17
- @ultroid_cmd(
18
- pattern="help ?(.*)",
19
- )
20
- async def ult(ult):
21
  plug = ult.pattern_match.group(1)
22
- tgbot = asst.me.username
23
  if plug:
24
  try:
25
  if plug in HELP:
@@ -45,16 +41,16 @@ async def ult(ult):
45
  except BaseException:
46
  await eor(ult, "Error 🤔 occured.")
47
  else:
 
48
  try:
49
- results = await ultroid_bot.inline_query(tgbot, "ultd")
50
  except BotMethodInvalidError:
51
  z = []
52
  for x in LIST.values():
53
  for y in x:
54
  z.append(y)
55
  cmd = len(z) + 10
56
- bnn = asst.me.username
57
- return await ultroid_bot.send_message(
58
  ult.chat_id,
59
  get_string("inline_4").format(
60
  OWNER_NAME,
@@ -71,7 +67,11 @@ async def ult(ult):
71
  Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
72
  Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
73
  ],
74
- [Button.url("⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{bnn}?start=set")],
 
 
 
 
75
  [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
76
  ],
77
  )
 
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
+ from pyUltroid.dB.core import *
9
  from telethon.errors.rpcerrorlist import BotInlineDisabledError as dis
10
  from telethon.errors.rpcerrorlist import BotMethodInvalidError
11
  from telethon.errors.rpcerrorlist import BotResponseTimeoutError as rep
 
12
 
13
  from . import *
14
 
15
 
16
+ @ultroid_cmd(pattern="help ?(.*)")
17
+ async def _help(ult):
 
 
18
  plug = ult.pattern_match.group(1)
 
19
  if plug:
20
  try:
21
  if plug in HELP:
 
41
  except BaseException:
42
  await eor(ult, "Error 🤔 occured.")
43
  else:
44
+ tgbot = asst.me.username
45
  try:
46
+ results = await ult.client.inline_query(tgbot, "ultd")
47
  except BotMethodInvalidError:
48
  z = []
49
  for x in LIST.values():
50
  for y in x:
51
  z.append(y)
52
  cmd = len(z) + 10
53
+ return await ult.client.send_message(
 
54
  ult.chat_id,
55
  get_string("inline_4").format(
56
  OWNER_NAME,
 
67
  Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
68
  Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
69
  ],
70
+ [
71
+ Button.url(
72
+ "⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{tgbot}?start=set"
73
+ ),
74
+ ],
75
  [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
76
  ],
77
  )
plugins/_inline.py CHANGED
@@ -12,6 +12,7 @@ from math import ceil
12
  from os import remove
13
 
14
  from git import Repo
 
15
  from pyUltroid.misc import owner_and_sudos
16
  from support import *
17
  from telethon.tl.types import InputBotInlineResult, InputWebDocument
@@ -74,7 +75,7 @@ async def inline_alive(o):
74
  if len(o.text) == 0:
75
  b = o.builder
76
  MSG = "• **Ultroid Userbot •**"
77
- uptime = grt(time.time() - start_time)
78
  MSG += f"\n\n• **Uptime** - `{uptime}`\n"
79
  MSG += f"• **OWNER** - `{OWNER_NAME}`"
80
  WEB0 = InputWebDocument(
@@ -120,35 +121,17 @@ async def inline_handler(event):
120
  await event.answer([result], gallery=True)
121
 
122
 
123
- @in_pattern("paste")
124
  @in_owner
125
  async def _(event):
126
  ok = event.text.split(" ")[1]
127
- link = "https://nekobin.com/"
128
  result = event.builder.article(
129
  title="Paste",
130
- text="Pᴀsᴛᴇᴅ Tᴏ Nᴇᴋᴏʙɪɴ!",
131
  buttons=[
132
  [
133
- Button.url("NekoBin", url=f"{link}{ok}"),
134
- Button.url("Raw", url=f"{link}raw/{ok}"),
135
- ],
136
- ],
137
- )
138
- await event.answer([result])
139
-
140
-
141
- @in_pattern("dog")
142
- @in_owner
143
- async def _(event):
144
- ok = event.text.split(" ")[1]
145
- link = "https://del.dog/"
146
- result = event.builder.article(
147
- title="Paste",
148
- text="Pᴀsᴛᴇᴅ Tᴏ Dᴏɢʙɪɴ!",
149
- buttons=[
150
- [
151
- Button.url("DogBin", url=f"{link}{ok}"),
152
  Button.url("Raw", url=f"{link}raw/{ok}"),
153
  ],
154
  ],
@@ -236,7 +219,7 @@ async def _(event):
236
 
237
  @callback("upp")
238
  async def _(event):
239
- uptime = grt(time.time() - start_time)
240
  pin = f"🙋Uᴘᴛɪᴍᴇ = {uptime}"
241
  await event.answer(pin, cache_time=0, alert=True)
242
 
 
12
  from os import remove
13
 
14
  from git import Repo
15
+ from pyUltroid.dB.core import *
16
  from pyUltroid.misc import owner_and_sudos
17
  from support import *
18
  from telethon.tl.types import InputBotInlineResult, InputWebDocument
 
75
  if len(o.text) == 0:
76
  b = o.builder
77
  MSG = "• **Ultroid Userbot •**"
78
+ uptime = time_formatter((time.time() - start_time) * 1000)
79
  MSG += f"\n\n• **Uptime** - `{uptime}`\n"
80
  MSG += f"• **OWNER** - `{OWNER_NAME}`"
81
  WEB0 = InputWebDocument(
 
121
  await event.answer([result], gallery=True)
122
 
123
 
124
+ @in_pattern("haste")
125
  @in_owner
126
  async def _(event):
127
  ok = event.text.split(" ")[1]
128
+ link = "https://hastebin.com/"
129
  result = event.builder.article(
130
  title="Paste",
131
+ text="Pᴀsᴛᴇᴅ Tᴏ Hᴀsᴛᴇʙɪɴ!",
132
  buttons=[
133
  [
134
+ Button.url("HasteBin", url=f"{link}{ok}"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  Button.url("Raw", url=f"{link}raw/{ok}"),
136
  ],
137
  ],
 
219
 
220
  @callback("upp")
221
  async def _(event):
222
+ uptime = time_formatter((time.time() - start_time) * 1000)
223
  pin = f"🙋Uᴘᴛɪᴍᴇ = {uptime}"
224
  await event.answer(pin, cache_time=0, alert=True)
225
 
plugins/_ultroid.py CHANGED
@@ -4,27 +4,25 @@
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
-
9
  from telethon.errors import ChatSendInlineForbiddenError
10
  from telethon.errors.rpcerrorlist import BotMethodInvalidError as bmi
11
 
12
  from . import *
13
 
14
- REPOMSG = (
15
- "• **ULTROID USERBOT** •\n\n",
16
- "• Repo - [Click Here](https://github.com/TeamUltroid/Ultroid)\n",
17
- "• Addons - [Click Here](https://github.com/TeamUltroid/UltroidAddons)\n",
18
- "• Support - @UltroidSupport",
19
- )
20
 
21
 
22
- @ultroid_cmd(pattern="repo$")
23
  async def repify(e):
24
  try:
25
- q = await ultroid_bot.inline_query(asst.me.username, "repo")
26
  await q[0].click(e.chat_id)
27
- if e.sender_id == ultroid_bot.uid:
28
  await e.delete()
29
  except (ChatSendInlineForbiddenError, bmi):
30
  await eor(e, REPOMSG)
 
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
  from telethon.errors import ChatSendInlineForbiddenError
8
  from telethon.errors.rpcerrorlist import BotMethodInvalidError as bmi
9
 
10
  from . import *
11
 
12
+ REPOMSG = """
13
+ • **ULTROID USERBOT** •\n
14
+ • Repo - [Click Here](https://github.com/TeamUltroid/Ultroid)
15
+ • Addons - [Click Here](https://github.com/TeamUltroid/UltroidAddons)
16
+ • Support - @UltroidSupport
17
+ """
18
 
19
 
20
+ @ultroid_cmd(pattern="repo$", type=["official", "manager"], ignore_dualmode=True)
21
  async def repify(e):
22
  try:
23
+ q = await e.client.inline_query(asst.me.username, "repo")
24
  await q[0].click(e.chat_id)
25
+ if e.out:
26
  await e.delete()
27
  except (ChatSendInlineForbiddenError, bmi):
28
  await eor(e, REPOMSG)
plugins/_userlogs.py CHANGED
@@ -26,70 +26,69 @@ from . import *
26
  ),
27
  )
28
  async def all_messages_catcher(e):
29
- if udB.get("TAG_LOG"):
30
- try:
31
- NEEDTOLOG = int(udB.get("TAG_LOG"))
32
- except Exception:
33
- return LOGS.info("you given Wrong Grp/Channel ID in TAG_LOG.")
34
- x = e.sender
35
- if x.bot or x.verified:
36
- return
37
- y = e.chat
38
- where_n = get_display_name(y)
39
- who_n = get_display_name(x)
40
- where_l = f"https://t.me/c/{y.id}/{e.id}"
41
- send = await ultroid_bot.get_messages(e.chat_id, ids=e.id)
42
- try:
43
- if x.username:
44
- who_l = f"https://t.me/{x.username}"
45
- await asst.send_message(
46
- NEEDTOLOG,
47
- send,
48
- buttons=[
49
- [Button.url(who_n, who_l)],
50
- [Button.url(where_n, where_l)],
51
- ],
52
- )
53
- else:
54
- await asst.send_message(
55
- NEEDTOLOG,
56
- send,
57
- buttons=[
58
- [Button.inline(who_n, data=f"who{x.id}")],
59
- [Button.url(where_n, where_l)],
60
- ],
61
- )
62
- except MediaEmptyError:
63
- if x.username:
64
- who_l = f"https://t.me/{x.username}"
65
- await asst.send_message(
66
- NEEDTOLOG,
67
- "`Unsupported Media`",
68
- buttons=[
69
- [Button.url(who_n, who_l)],
70
- [Button.url(where_n, where_l)],
71
- ],
72
- )
73
- else:
74
- await asst.send_message(
75
- NEEDTOLOG,
76
- "`Unsupported Media`",
77
- buttons=[
78
- [Button.inline(who_n, data=f"who{x.id}")],
79
- [Button.url(where_n, where_l)],
80
- ],
81
- )
82
- except PeerIdInvalidError:
83
- await ultroid_bot.send_message(
84
- int(udB.get("LOG_CHANNEL")),
85
- "The Chat Id You Set In Tag Logger Is Wrong , Please Correct It",
86
- )
87
- except ChatWriteForbiddenError:
88
- await ultroid_bot.send_message(NEEDTOLOG, "Please Give Your Assistant Bot")
89
- except Exception as er:
90
- LOGS.info(str(er))
91
- else:
92
  return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
 
95
  @callback(re.compile("who(.*)"))
@@ -105,21 +104,22 @@ async def _(e):
105
  # log for assistant
106
  @asst.on(events.ChatAction)
107
  async def when_asst_added_to_chat(event):
108
- if event.user_added:
109
- user = await event.get_user()
110
- chat = await event.get_chat()
111
- if chat.username:
112
- chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
113
- else:
114
- chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
 
 
115
  tmp = event.added_by
116
- if user.is_self:
117
- buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot")
118
- return await asst.send_message(
119
- int(udB.get("LOG_CHANNEL")),
120
- f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
121
- buttons=buttons,
122
- )
123
 
124
 
125
  # log for user's new joins
@@ -130,22 +130,22 @@ async def when_ultd_added_to_chat(event):
130
  if event.user_added:
131
  user = await event.get_user()
132
  chat = await event.get_chat()
133
- if chat.username:
134
  chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
135
  else:
136
  chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
137
- tmp = event.added_by
138
  if user.is_self:
 
139
  buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
140
  return await asst.send_message(
141
  int(udB.get("LOG_CHANNEL")),
142
- f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) just added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
143
  buttons=buttons,
144
  )
145
  elif event.user_joined:
146
  user = await event.get_user()
147
  chat = await event.get_chat()
148
- if chat.username:
149
  chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
150
  else:
151
  chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
 
26
  ),
27
  )
28
  async def all_messages_catcher(e):
29
+ if not udB.get("TAG_LOG"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  return
31
+ try:
32
+ NEEDTOLOG = int(udB.get("TAG_LOG"))
33
+ except Exception:
34
+ return LOGS.info("you given Wrong Grp/Channel ID in TAG_LOG.")
35
+ x = e.sender
36
+ if x.bot or x.verified:
37
+ return
38
+ y = e.chat
39
+ where_n = get_display_name(y)
40
+ who_n = get_display_name(x)
41
+ where_l = f"https://t.me/c/{y.id}/{e.id}"
42
+ send = await ultroid_bot.get_messages(e.chat_id, ids=e.id)
43
+ try:
44
+ if x.username:
45
+ who_l = f"https://t.me/{x.username}"
46
+ await asst.send_message(
47
+ NEEDTOLOG,
48
+ send,
49
+ buttons=[
50
+ [Button.url(who_n, who_l)],
51
+ [Button.url(where_n, where_l)],
52
+ ],
53
+ )
54
+ else:
55
+ await asst.send_message(
56
+ NEEDTOLOG,
57
+ send,
58
+ buttons=[
59
+ [Button.inline(who_n, data=f"who{x.id}")],
60
+ [Button.url(where_n, where_l)],
61
+ ],
62
+ )
63
+ except MediaEmptyError:
64
+ if x.username:
65
+ who_l = f"https://t.me/{x.username}"
66
+ await asst.send_message(
67
+ NEEDTOLOG,
68
+ "`Unsupported Media`",
69
+ buttons=[
70
+ [Button.url(who_n, who_l)],
71
+ [Button.url(where_n, where_l)],
72
+ ],
73
+ )
74
+ else:
75
+ await asst.send_message(
76
+ NEEDTOLOG,
77
+ "`Unsupported Media`",
78
+ buttons=[
79
+ [Button.inline(who_n, data=f"who{x.id}")],
80
+ [Button.url(where_n, where_l)],
81
+ ],
82
+ )
83
+ except PeerIdInvalidError:
84
+ await ultroid_bot.send_message(
85
+ int(udB.get("LOG_CHANNEL")),
86
+ "The Chat Id You Set In Tag Logger Is Wrong , Please Correct It",
87
+ )
88
+ except ChatWriteForbiddenError:
89
+ await ultroid_bot.send_message(NEEDTOLOG, "Please Give Your Assistant Bot")
90
+ except Exception as er:
91
+ LOGS.info(str(er))
92
 
93
 
94
  @callback(re.compile("who(.*)"))
 
104
  # log for assistant
105
  @asst.on(events.ChatAction)
106
  async def when_asst_added_to_chat(event):
107
+ if not event.user_added:
108
+ return
109
+ user = await event.get_user()
110
+ chat = await event.get_chat()
111
+ if chat.username:
112
+ chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
113
+ else:
114
+ chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
115
+ if user.is_self:
116
  tmp = event.added_by
117
+ buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot")
118
+ return await asst.send_message(
119
+ int(udB.get("LOG_CHANNEL")),
120
+ f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
121
+ buttons=buttons,
122
+ )
 
123
 
124
 
125
  # log for user's new joins
 
130
  if event.user_added:
131
  user = await event.get_user()
132
  chat = await event.get_chat()
133
+ if hasattr(chat, "username") and chat.username:
134
  chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
135
  else:
136
  chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
 
137
  if user.is_self:
138
+ tmp = event.added_by
139
  buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
140
  return await asst.send_message(
141
  int(udB.get("LOG_CHANNEL")),
142
+ f"#ADD_LOG\n\n{inline_mention(tmp)} just added {inline_mention(user)} to {chat}.",
143
  buttons=buttons,
144
  )
145
  elif event.user_joined:
146
  user = await event.get_user()
147
  chat = await event.get_chat()
148
+ if hasattr(chat, "username") and chat.username:
149
  chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
150
  else:
151
  chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
plugins/_wspr.py CHANGED
@@ -41,7 +41,7 @@ async def _(e):
41
  put = e.pattern_match.group(1)
42
  if put:
43
  try:
44
- results = await ultroid_bot.inline_query(asst.me.username, f"msg {put}")
45
  except rep:
46
  return await eor(
47
  e,
 
41
  put = e.pattern_match.group(1)
42
  if put:
43
  try:
44
+ results = await e.client.inline_query(asst.me.username, f"msg {put}")
45
  except rep:
46
  return await eor(
47
  e,
plugins/admintools.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -44,7 +43,6 @@
44
  • `{i}purgeall`
45
  Delete all msgs of replied user.
46
  """
47
-
48
  import asyncio
49
 
50
  from telethon.errors import BadRequestError
@@ -52,15 +50,16 @@ from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidErro
52
  from telethon.tl.functions.channels import DeleteUserHistoryRequest, EditAdminRequest
53
  from telethon.tl.functions.channels import ExportMessageLinkRequest as ExpLink
54
  from telethon.tl.functions.messages import SetHistoryTTLRequest
55
- from telethon.tl.types import ChatAdminRights, InputMessagesFilterPinned
56
 
57
  from . import *
58
 
59
 
60
  @ultroid_cmd(
61
  pattern="promote ?(.*)",
62
- groups_only=True,
63
  admins_only=True,
 
 
64
  )
65
  async def prmte(ult):
66
  xx = await eor(ult, get_string("com_1"))
@@ -71,7 +70,7 @@ async def prmte(ult):
71
  if not user:
72
  return await xx.edit("`Reply to a user to promote him!`")
73
  try:
74
- await ultroid_bot(
75
  EditAdminRequest(
76
  ult.chat_id,
77
  user.id,
@@ -87,7 +86,7 @@ async def prmte(ult):
87
  ),
88
  )
89
  await xx.edit(
90
- f"[{user.first_name}](tg://user?id={user.id}) `is now an admin in {ult.chat.title} with title {rank}.`",
91
  )
92
  except BadRequestError:
93
  return await xx.edit("`I don't have the right to promote you.`")
@@ -97,8 +96,9 @@ async def prmte(ult):
97
 
98
  @ultroid_cmd(
99
  pattern="demote ?(.*)",
100
- groups_only=True,
101
  admins_only=True,
 
 
102
  )
103
  async def dmote(ult):
104
  xx = await eor(ult, get_string("com_1"))
@@ -109,7 +109,7 @@ async def dmote(ult):
109
  if not user:
110
  return await xx.edit("`Reply to a user to demote him!`")
111
  try:
112
- await ultroid_bot(
113
  EditAdminRequest(
114
  ult.chat_id,
115
  user.id,
@@ -125,7 +125,7 @@ async def dmote(ult):
125
  ),
126
  )
127
  await xx.edit(
128
- f"[{user.first_name}](tg://user?id={user.id}) `is no longer an admin in {ult.chat.title}`",
129
  )
130
  except BadRequestError:
131
  return await xx.edit("`I don't have the right to demote you.`")
@@ -135,72 +135,71 @@ async def dmote(ult):
135
 
136
  @ultroid_cmd(
137
  pattern="ban ?(.*)",
138
- groups_only=True,
139
  admins_only=True,
 
 
140
  )
141
  async def bban(ult):
142
  xx = await eor(ult, get_string("com_1"))
143
- await ult.get_chat()
144
  user, reason = await get_user_info(ult)
145
  if not user:
146
  return await xx.edit("`Reply to a user or give username to ban him!`")
147
  if str(user.id) in DEVLIST:
148
  return await xx.edit(" `LoL, I can't Ban my Developer 😂`")
149
  try:
150
- await ultroid_bot.edit_permissions(ult.chat_id, user.id, view_messages=False)
151
  except BadRequestError:
152
  return await xx.edit("`I don't have the right to ban a user.`")
153
  except UserIdInvalidError:
154
- await xx.edit("`I couldn't get who he is!`")
155
  try:
156
  reply = await ult.get_reply_message()
157
  if reply:
158
  await reply.delete()
159
  except BadRequestError:
160
  return await xx.edit(
161
- f"[{user.first_name}](tg://user?id={user.id}) **was banned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`\n**Reason**: `{reason}`\n**Messages Deleted**: `False`",
162
  )
 
 
163
  if reason:
164
  await xx.edit(
165
- f"[{user.first_name}](tg://user?id={user.id}) **was banned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`\n**Reason**: `{reason}`",
166
  )
167
  else:
168
  await xx.edit(
169
- f"[{user.first_name}](tg://user?id={user.id}) **was banned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`",
170
  )
171
 
172
 
173
  @ultroid_cmd(
174
  pattern="unban ?(.*)",
175
- groups_only=True,
176
  admins_only=True,
 
 
177
  )
178
  async def uunban(ult):
179
  xx = await eor(ult, get_string("com_1"))
180
- await ult.get_chat()
181
  user, reason = await get_user_info(ult)
182
  if not user:
183
  return await xx.edit("`Reply to a user or give username to unban him!`")
184
  try:
185
- await ultroid_bot.edit_permissions(ult.chat_id, user.id, view_messages=True)
186
  except BadRequestError:
187
  return await xx.edit("`I don't have the right to unban a user.`")
188
  except UserIdInvalidError:
189
  await xx.edit("`I couldn't get who he is!`")
 
190
  if reason:
191
- await xx.edit(
192
- f"[{user.first_name}](tg://user?id={user.id}) **was unbanned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`\n**Reason**: `{reason}`",
193
- )
194
- else:
195
- await xx.edit(
196
- f"[{user.first_name}](tg://user?id={user.id}) **was unbanned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`",
197
- )
198
 
199
 
200
  @ultroid_cmd(
201
  pattern="kick ?(.*)",
202
- groups_only=True,
203
  admins_only=True,
 
 
204
  )
205
  async def kck(ult):
206
  if ult.text == f"{HNDLR}kickme":
@@ -212,10 +211,10 @@ async def kck(ult):
212
  return await xx.edit("`Kick? Whom? I couldn't get his info...`")
213
  if str(user.id) in DEVLIST:
214
  return await xx.edit(" `Lol, I can't Kick my Developer`😂")
215
- if user.id == ultroid_bot.uid:
216
- return await xx.edit("`You Can't kick urself`")
217
  try:
218
- await ultroid_bot.kick_participant(ult.chat_id, user.id)
219
  await asyncio.sleep(0.5)
220
  except BadRequestError:
221
  return await xx.edit("`I don't have the right to kick a user.`")
@@ -223,21 +222,14 @@ async def kck(ult):
223
  return await xx.edit(
224
  f"`I don't have the right to kick a user.`\n\n**ERROR**:\n`{str(e)}`",
225
  )
 
226
  if reason:
227
- await xx.edit(
228
- f"[{user.first_name}](tg://user?id={user.id})` was kicked by` [{OWNER_NAME}](tg://user?id={OWNER_ID}) `in {ult.chat.title}`\n**Reason**: `{reason}`",
229
- )
230
- else:
231
- await xx.edit(
232
- f"[{user.first_name}](tg://user?id={user.id})` was kicked by` [{OWNER_NAME}](tg://user?id={OWNER_ID}) `in {ult.chat.title}`",
233
- )
234
 
235
 
236
- @ultroid_cmd(
237
- pattern="pin ?(.*)",
238
- )
239
  async def pin(msg):
240
- mss = "`Pinned.`"
241
  xx = msg.reply_to_msg_id
242
  tt = msg.text
243
  try:
@@ -247,35 +239,27 @@ async def pin(msg):
247
  except BaseException:
248
  pass
249
  if not msg.is_reply:
250
- return
251
- if not msg.is_private:
252
- link = (await ultroid_bot(ExpLink(msg.chat_id, xx))).link
253
- mss = f"`Pinned` [This Message]({link})"
254
  ch = msg.pattern_match.group(1)
255
  if ch != "silent":
256
- slnt = True
257
- try:
258
- await ultroid_bot.pin_message(msg.chat_id, xx, notify=slnt)
259
- except BadRequestError:
260
- return await eor(msg, "`Hmm.. Guess I have no rights here!`")
261
- except Exception as e:
262
- return await eor(msg, f"**ERROR:**`{str(e)}`")
263
- await eor(msg, mss)
264
  else:
265
- try:
266
- await ultroid_bot.pin_message(msg.chat_id, xx, notify=False)
267
- except BadRequestError:
268
- return await eor(msg, "`Hmm.. Guess I have no rights here!`")
269
- except Exception as e:
270
- return await eor(msg, f"**ERROR:**`{str(e)}`")
271
- try:
272
- await msg.delete()
273
- except BaseException:
274
- pass
275
 
276
 
277
  @ultroid_cmd(
278
- pattern="unpin($| (.*))",
279
  )
280
  async def unp(ult):
281
  xx = await eor(ult, get_string("com_1"))
@@ -286,14 +270,14 @@ async def unp(ult):
286
  msg = ult.reply_to_msg_id
287
  if msg and not ch:
288
  try:
289
- await ultroid_bot.unpin_message(ult.chat_id, msg)
290
  except BadRequestError:
291
  return await xx.edit("`Hmm.. Guess I have no rights here!`")
292
  except Exception as e:
293
  return await xx.edit(f"**ERROR:**\n`{str(e)}`")
294
  elif ch == "all":
295
  try:
296
- await ultroid_bot.unpin_message(ult.chat_id)
297
  except BadRequestError:
298
  return await xx.edit("`Hmm.. Guess I have no rights here!`")
299
  except Exception as e:
@@ -305,9 +289,7 @@ async def unp(ult):
305
  await xx.edit("`Unpinned!`")
306
 
307
 
308
- @ultroid_cmd(
309
- pattern="purge ?(.*)",
310
- )
311
  async def fastpurger(purg):
312
  chat = await purg.get_input_chat()
313
  match = purg.pattern_match.group(1)
@@ -317,9 +299,13 @@ async def fastpurger(purg):
317
  ABC = None
318
  if ABC and purg.text[6] in ["m", "a"]:
319
  return
 
 
 
 
320
  if match and not purg.is_reply:
321
  p = 0
322
- async for msg in ultroid_bot.iter_messages(purg.chat_id, limit=int(match)):
323
  await msg.delete()
324
  p += 0
325
  return await eod(purg, f"Purged {p} Messages! ")
@@ -327,26 +313,20 @@ async def fastpurger(purg):
327
  count = 0
328
  if not (purg.reply_to_msg_id or match):
329
  return await eod(purg, "`Reply to a message to purge from.`", time=10)
330
- async for msg in ultroid_bot.iter_messages(chat, min_id=purg.reply_to_msg_id):
331
  msgs.append(msg)
332
  count = count + 1
333
  msgs.append(purg.reply_to_msg_id)
334
  if len(msgs) == 100:
335
- await ultroid_bot.delete_messages(chat, msgs)
336
  msgs = []
337
 
338
  if msgs:
339
- await ultroid_bot.delete_messages(chat, msgs)
340
- done = await ultroid_bot.send_message(
341
- purg.chat_id,
342
- "__Fast purge complete!__\n**Purged** `"
343
- + str(len(msgs))
344
- + "` **of** `"
345
- + str(count)
346
- + "` **messages.**",
347
  )
348
- await asyncio.sleep(5)
349
- await done.delete()
350
 
351
 
352
  @ultroid_cmd(
@@ -361,7 +341,7 @@ async def fastpurgerme(purg):
361
  await eod(purg, "`Give a Valid Input.. `")
362
  return
363
  mp = 0
364
- async for mm in ultroid_bot.iter_messages(
365
  purg.chat_id, limit=nnt, from_user="me"
366
  ):
367
  await mm.delete()
@@ -377,7 +357,7 @@ async def fastpurgerme(purg):
377
  "`Reply to a message to purge from or use it like ``purgeme <num>`",
378
  time=10,
379
  )
380
- async for msg in ultroid_bot.iter_messages(
381
  chat,
382
  from_user="me",
383
  min_id=purg.reply_to_msg_id,
@@ -390,13 +370,11 @@ async def fastpurgerme(purg):
390
  msgs = []
391
 
392
  if msgs:
393
- await ultroid_bot.delete_messages(chat, msgs)
394
- done = await ultroid_bot.send_message(
395
- purg.chat_id,
396
  "__Fast purge complete!__\n**Purged** `" + str(count) + "` **messages.**",
397
  )
398
- await asyncio.sleep(5)
399
- await done.delete()
400
 
401
 
402
  @ultroid_cmd(
@@ -405,54 +383,37 @@ async def fastpurgerme(purg):
405
  async def _(e):
406
  xx = await eor(e, get_string("com_1"))
407
  if e.reply_to_msg_id:
408
- input = (await e.get_reply_message()).sender_id
409
- name = (await e.client.get_entity(input)).first_name
410
  try:
411
- await ultroid_bot(DeleteUserHistoryRequest(e.chat_id, input))
412
- await eod(e, f"Successfully Purged All Messages from {name}")
413
  except Exception as er:
414
- return await eod(xx, str(er), time=5)
415
  else:
416
  return await eod(
417
  xx,
418
  "`Reply to someone's msg to delete.`",
419
- time=5,
420
  )
421
 
422
 
423
- @ultroid_cmd(pattern="pinned")
424
- async def get_pinned(event):
425
- x = await eor(event, get_string("com_1"))
426
- chat_id = (str(event.chat_id)).replace("-100", "")
427
- chat_name = "This Chat"
428
- if not event.is_private:
429
- chat_name = (await event.get_chat()).title
430
- tem = ""
431
- c = 0
432
-
433
- async for i in ultroid.iter_messages(
434
- event.chat_id, filter=InputMessagesFilterPinned
435
- ):
436
- c += 1
437
- tem += f"The pinned message in {chat_name} can be found <a href=https://t.me/c/{chat_id}/{i.id}>here.</a>"
438
- if c == 1:
439
- return await x.edit(tem, parse_mode="html")
440
-
441
- if tem == "":
442
- return await eod(x, "There is no pinned message in chat!", time=5)
443
-
444
-
445
- @ultroid_cmd(pattern="listpinned")
446
  async def get_all_pinned(event):
447
  x = await eor(event, get_string("com_1"))
448
  chat_id = (str(event.chat_id)).replace("-100", "")
449
  chat_name = (await event.get_chat()).title
450
  a = ""
451
  c = 1
452
- async for i in ultroid.iter_messages(
453
  event.chat_id, filter=InputMessagesFilterPinned
454
  ):
455
- a += f"{c}. <a href=https://t.me/c/{chat_id}/{i.id}>Go to message.</a>\n"
 
 
 
 
 
456
  c += 1
457
 
458
  if c == 1:
@@ -461,12 +422,15 @@ async def get_all_pinned(event):
461
  m = f"<b>List of pinned message(s) in {chat_name}:</b>\n\n"
462
 
463
  if a == "":
464
- return await eod(x, "There is no message pinned in this group!", time=5)
465
 
466
  await x.edit(m + a, parse_mode="html")
467
 
468
 
469
- @ultroid_cmd(pattern="autodelete ?(.*)", groups_only=True, admins_only=True)
 
 
 
470
  async def autodelte(ult): # Tg Feature
471
  match = ult.pattern_match.group(1)
472
  if not match or match not in ["24h", "7d", "off"]:
@@ -478,7 +442,7 @@ async def autodelte(ult): # Tg Feature
478
  else:
479
  tt = 0
480
  try:
481
- await ultroid_bot(SetHistoryTTLRequest(ult.chat_id, period=tt))
482
  except ChatNotModifiedError:
483
  return await eod(ult, f"Auto Delete Setting is Already same to `{match}`")
484
  await eor(ult, f"Auto Delete Status Changed to {match} !")
 
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
  ✘ Commands Available -
9
 
 
43
  • `{i}purgeall`
44
  Delete all msgs of replied user.
45
  """
 
46
  import asyncio
47
 
48
  from telethon.errors import BadRequestError
 
50
  from telethon.tl.functions.channels import DeleteUserHistoryRequest, EditAdminRequest
51
  from telethon.tl.functions.channels import ExportMessageLinkRequest as ExpLink
52
  from telethon.tl.functions.messages import SetHistoryTTLRequest
53
+ from telethon.tl.types import Chat, ChatAdminRights, InputMessagesFilterPinned
54
 
55
  from . import *
56
 
57
 
58
  @ultroid_cmd(
59
  pattern="promote ?(.*)",
 
60
  admins_only=True,
61
+ type=["official", "manager"],
62
+ ignore_dualmode=True,
63
  )
64
  async def prmte(ult):
65
  xx = await eor(ult, get_string("com_1"))
 
70
  if not user:
71
  return await xx.edit("`Reply to a user to promote him!`")
72
  try:
73
+ await ult.client(
74
  EditAdminRequest(
75
  ult.chat_id,
76
  user.id,
 
86
  ),
87
  )
88
  await xx.edit(
89
+ f"{inline_mention(user)} `is now an admin in {ult.chat.title} with title {rank}.`",
90
  )
91
  except BadRequestError:
92
  return await xx.edit("`I don't have the right to promote you.`")
 
96
 
97
  @ultroid_cmd(
98
  pattern="demote ?(.*)",
 
99
  admins_only=True,
100
+ type=["official", "manager"],
101
+ ignore_dualmode=True,
102
  )
103
  async def dmote(ult):
104
  xx = await eor(ult, get_string("com_1"))
 
109
  if not user:
110
  return await xx.edit("`Reply to a user to demote him!`")
111
  try:
112
+ await ult.client(
113
  EditAdminRequest(
114
  ult.chat_id,
115
  user.id,
 
125
  ),
126
  )
127
  await xx.edit(
128
+ f"{inline_mention(user)} `is no longer an admin in {ult.chat.title}`",
129
  )
130
  except BadRequestError:
131
  return await xx.edit("`I don't have the right to demote you.`")
 
135
 
136
  @ultroid_cmd(
137
  pattern="ban ?(.*)",
 
138
  admins_only=True,
139
+ type=["official", "manager"],
140
+ ignore_dualmode=True,
141
  )
142
  async def bban(ult):
143
  xx = await eor(ult, get_string("com_1"))
 
144
  user, reason = await get_user_info(ult)
145
  if not user:
146
  return await xx.edit("`Reply to a user or give username to ban him!`")
147
  if str(user.id) in DEVLIST:
148
  return await xx.edit(" `LoL, I can't Ban my Developer 😂`")
149
  try:
150
+ await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=False)
151
  except BadRequestError:
152
  return await xx.edit("`I don't have the right to ban a user.`")
153
  except UserIdInvalidError:
154
+ return await xx.edit("`I couldn't get who he is!`")
155
  try:
156
  reply = await ult.get_reply_message()
157
  if reply:
158
  await reply.delete()
159
  except BadRequestError:
160
  return await xx.edit(
161
+ f"{inline_mention(user)}**was banned by** {inline_mention(ult.sender)} **in** `{ult.chat.title}`\n**Reason**: `{reason}`\n**Messages Deleted**: `False`",
162
  )
163
+ userme = inline_mention(user)
164
+ senderme = inline_mention(ult.sender)
165
  if reason:
166
  await xx.edit(
167
+ f"{userme} **was banned by** {senderme}**in** `{ult.chat.title}`\n**Reason**: `{reason}`",
168
  )
169
  else:
170
  await xx.edit(
171
+ f"{userme} **was banned by** {senderme} **in** `{ult.chat.title}`",
172
  )
173
 
174
 
175
  @ultroid_cmd(
176
  pattern="unban ?(.*)",
 
177
  admins_only=True,
178
+ type=["official", "manager"],
179
+ ignore_dualmode=True,
180
  )
181
  async def uunban(ult):
182
  xx = await eor(ult, get_string("com_1"))
 
183
  user, reason = await get_user_info(ult)
184
  if not user:
185
  return await xx.edit("`Reply to a user or give username to unban him!`")
186
  try:
187
+ await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=True)
188
  except BadRequestError:
189
  return await xx.edit("`I don't have the right to unban a user.`")
190
  except UserIdInvalidError:
191
  await xx.edit("`I couldn't get who he is!`")
192
+ text = f"{inline_mention(user)} **was unbanned by** {inline_mention(ult.sender)} **in** `{ult.chat.title}`"
193
  if reason:
194
+ text += f"\n**Reason**: `{reason}`"
195
+ await xx.edit(text)
 
 
 
 
 
196
 
197
 
198
  @ultroid_cmd(
199
  pattern="kick ?(.*)",
 
200
  admins_only=True,
201
+ type=["official", "manager"],
202
+ ignore_dualmode=True,
203
  )
204
  async def kck(ult):
205
  if ult.text == f"{HNDLR}kickme":
 
211
  return await xx.edit("`Kick? Whom? I couldn't get his info...`")
212
  if str(user.id) in DEVLIST:
213
  return await xx.edit(" `Lol, I can't Kick my Developer`😂")
214
+ if user.id in [ultroid_bot.uid, asst.me.id]:
215
+ return await xx.edit("`You Can't kick that powerhouse`")
216
  try:
217
+ await ult.client.kick_participant(ult.chat_id, user.id)
218
  await asyncio.sleep(0.5)
219
  except BadRequestError:
220
  return await xx.edit("`I don't have the right to kick a user.`")
 
222
  return await xx.edit(
223
  f"`I don't have the right to kick a user.`\n\n**ERROR**:\n`{str(e)}`",
224
  )
225
+ text = f"{inline_mention(user)} **was kicked by** {inline_mention(ult.sender)} **in** `{ult.chat.title}`"
226
  if reason:
227
+ text += f"\n**Reason**: `{reason}`"
228
+ await xx.edit(text)
 
 
 
 
 
229
 
230
 
231
+ @ultroid_cmd(pattern="pin ?(.*)", type=["official", "manager"], ignore_dualmode=True)
 
 
232
  async def pin(msg):
 
233
  xx = msg.reply_to_msg_id
234
  tt = msg.text
235
  try:
 
239
  except BaseException:
240
  pass
241
  if not msg.is_reply:
242
+ return await eor(msg, "Reply a Message to Pin !")
243
+ if not msg.client._bot and not msg.is_private and not isinstance(msg.chat, Chat):
244
+ link = (await msg.client(ExpLink(msg.chat_id, xx))).link
245
+ f"`Pinned` [This Message]({link})"
246
  ch = msg.pattern_match.group(1)
247
  if ch != "silent":
248
+ pass
 
 
 
 
 
 
 
249
  else:
250
+ pass
251
+ try:
252
+ await msg.client.pin_message(msg.chat_id, xx, notify=False)
253
+ except BadRequestError:
254
+ return await eor(msg, "`Hmm.. Guess I have no rights here!`")
255
+ except Exception as e:
256
+ return await eor(msg, f"**ERROR:**`{str(e)}`")
257
+ if msg.out:
258
+ await msg.delete()
 
259
 
260
 
261
  @ultroid_cmd(
262
+ pattern="unpin($| (.*))", type=["official", "manager"], ignore_dualmode=True
263
  )
264
  async def unp(ult):
265
  xx = await eor(ult, get_string("com_1"))
 
270
  msg = ult.reply_to_msg_id
271
  if msg and not ch:
272
  try:
273
+ await ult.client.unpin_message(ult.chat_id, msg)
274
  except BadRequestError:
275
  return await xx.edit("`Hmm.. Guess I have no rights here!`")
276
  except Exception as e:
277
  return await xx.edit(f"**ERROR:**\n`{str(e)}`")
278
  elif ch == "all":
279
  try:
280
+ await ult.client.unpin_message(ult.chat_id)
281
  except BadRequestError:
282
  return await xx.edit("`Hmm.. Guess I have no rights here!`")
283
  except Exception as e:
 
289
  await xx.edit("`Unpinned!`")
290
 
291
 
292
+ @ultroid_cmd(pattern="purge ?(.*)", type=["official", "manager"], ignore_dualmode=True)
 
 
293
  async def fastpurger(purg):
294
  chat = await purg.get_input_chat()
295
  match = purg.pattern_match.group(1)
 
299
  ABC = None
300
  if ABC and purg.text[6] in ["m", "a"]:
301
  return
302
+ if purg.client._bot:
303
+ return await purg.client.delete_messages(
304
+ purg.chat_id, [a for a in range(purg.reply_to_msg_id, purg.id)]
305
+ )
306
  if match and not purg.is_reply:
307
  p = 0
308
+ async for msg in purg.client.iter_messages(purg.chat_id, limit=int(match)):
309
  await msg.delete()
310
  p += 0
311
  return await eod(purg, f"Purged {p} Messages! ")
 
313
  count = 0
314
  if not (purg.reply_to_msg_id or match):
315
  return await eod(purg, "`Reply to a message to purge from.`", time=10)
316
+ async for msg in purg.client.iter_messages(chat, min_id=purg.reply_to_msg_id):
317
  msgs.append(msg)
318
  count = count + 1
319
  msgs.append(purg.reply_to_msg_id)
320
  if len(msgs) == 100:
321
+ await purg.client.delete_messages(chat, msgs)
322
  msgs = []
323
 
324
  if msgs:
325
+ await purg.client.delete_messages(chat, msgs)
326
+ await eod(
327
+ purg,
328
+ "__Fast purge complete!__\n**Purged** `" + str(count) + "` **messages.**",
 
 
 
 
329
  )
 
 
330
 
331
 
332
  @ultroid_cmd(
 
341
  await eod(purg, "`Give a Valid Input.. `")
342
  return
343
  mp = 0
344
+ async for mm in purg.client.iter_messages(
345
  purg.chat_id, limit=nnt, from_user="me"
346
  ):
347
  await mm.delete()
 
357
  "`Reply to a message to purge from or use it like ``purgeme <num>`",
358
  time=10,
359
  )
360
+ async for msg in purg.client.iter_messages(
361
  chat,
362
  from_user="me",
363
  min_id=purg.reply_to_msg_id,
 
370
  msgs = []
371
 
372
  if msgs:
373
+ await purg.client.delete_messages(chat, msgs)
374
+ await eod(
375
+ purg,
376
  "__Fast purge complete!__\n**Purged** `" + str(count) + "` **messages.**",
377
  )
 
 
378
 
379
 
380
  @ultroid_cmd(
 
383
  async def _(e):
384
  xx = await eor(e, get_string("com_1"))
385
  if e.reply_to_msg_id:
386
+ name = (await e.get_reply_message()).sender
 
387
  try:
388
+ await e.client(DeleteUserHistoryRequest(e.chat_id, name.id))
389
+ await eod(e, f"Successfully Purged All Messages from {name.first_name}")
390
  except Exception as er:
391
+ return await eod(xx, str(er))
392
  else:
393
  return await eod(
394
  xx,
395
  "`Reply to someone's msg to delete.`",
 
396
  )
397
 
398
 
399
+ @ultroid_cmd(
400
+ pattern="listpinned$",
401
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
402
  async def get_all_pinned(event):
403
  x = await eor(event, get_string("com_1"))
404
  chat_id = (str(event.chat_id)).replace("-100", "")
405
  chat_name = (await event.get_chat()).title
406
  a = ""
407
  c = 1
408
+ async for i in event.client.iter_messages(
409
  event.chat_id, filter=InputMessagesFilterPinned
410
  ):
411
+ if i.message:
412
+ t = " ".join(i.message.split()[0:4])
413
+ txt = "{}....".format(t)
414
+ else:
415
+ txt = "Go to message."
416
+ a += f"{c}. <a href=https://t.me/c/{chat_id}/{i.id}>{txt}</a>\n"
417
  c += 1
418
 
419
  if c == 1:
 
422
  m = f"<b>List of pinned message(s) in {chat_name}:</b>\n\n"
423
 
424
  if a == "":
425
+ return await eod(x, "There is no message pinned in this group!")
426
 
427
  await x.edit(m + a, parse_mode="html")
428
 
429
 
430
+ @ultroid_cmd(
431
+ pattern="autodelete ?(.*)",
432
+ admins_only=True,
433
+ )
434
  async def autodelte(ult): # Tg Feature
435
  match = ult.pattern_match.group(1)
436
  if not match or match not in ["24h", "7d", "off"]:
 
442
  else:
443
  tt = 0
444
  try:
445
+ await ult.client(SetHistoryTTLRequest(ult.chat_id, period=tt))
446
  except ChatNotModifiedError:
447
  return await eod(ult, f"Auto Delete Setting is Already same to `{match}`")
448
  await eor(ult, f"Auto Delete Status Changed to {match} !")
plugins/afk.py CHANGED
@@ -10,6 +10,7 @@
10
 
11
  • `{i}afk <optional reason>`
12
  AFK means away from keyboard,
 
13
  After u active this if Someone tag or msg u then It auto Reply Him/her,
14
  (Note : By Reply To any media U can set media afk too).
15
 
@@ -160,9 +161,11 @@ async def on_afk(event):
160
 
161
  @ultroid_cmd(pattern=r"afk ?(.*)")
162
  async def _(event):
163
- if not is_fullsudo(event.sender_id):
164
- return await eor(event, "`This Command Is Sudo Restricted.`")
165
  reply = await event.get_reply_message()
 
 
166
  global USER_AFK
167
  global afk_time
168
  global last_afk_message
 
10
 
11
  • `{i}afk <optional reason>`
12
  AFK means away from keyboard,
13
+
14
  After u active this if Someone tag or msg u then It auto Reply Him/her,
15
  (Note : By Reply To any media U can set media afk too).
16
 
 
161
 
162
  @ultroid_cmd(pattern=r"afk ?(.*)")
163
  async def _(event):
164
+ if not event.out and not is_fullsudo(event.sender_id):
165
+ return await eor(event, "`This Command Is Full Sudo Restricted.`")
166
  reply = await event.get_reply_message()
167
+ if event.client._bot:
168
+ return await eor(event, "Master, I am a Bot, I cant go AFK..")
169
  global USER_AFK
170
  global afk_time
171
  global last_afk_message
plugins/anime.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -17,10 +16,10 @@
17
  • `{i}character <character name>`
18
  Fetch anime character details.
19
  """
20
-
21
  from os import remove
22
 
23
  import jikanpy
 
24
 
25
  from . import *
26
 
@@ -47,7 +46,26 @@ async def anilist(event):
47
  return await eod(x, "`Enter a anime name!`", time=5)
48
  banner, title, year, episodes, info = get_anime_src_res(name)
49
  msg = f"**{title}**\n{year} | {episodes} Episodes.\n\n{info}"
50
- await event.reply(msg, file=banner, link_preview=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  await x.delete()
52
 
53
 
 
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
  ✘ Commands Available -
9
 
 
16
  • `{i}character <character name>`
17
  Fetch anime character details.
18
  """
 
19
  from os import remove
20
 
21
  import jikanpy
22
+ from telethon.errors.rpcerrorlist import MediaCaptionTooLongError
23
 
24
  from . import *
25
 
 
46
  return await eod(x, "`Enter a anime name!`", time=5)
47
  banner, title, year, episodes, info = get_anime_src_res(name)
48
  msg = f"**{title}**\n{year} | {episodes} Episodes.\n\n{info}"
49
+ try:
50
+ await event.reply(msg, file=banner, link_preview=True)
51
+ except MediaCaptionTooLongError:
52
+ nm = name.replace(" ", "_")
53
+ with open(f"{nm}.txt", "w") as f:
54
+ f.write(msg.replace("*", ""))
55
+ await bash(f"wget {banner} -O {nm}.jpg")
56
+ try:
57
+ await event.reply(file=f"{nm}.txt", thumb=f"{nm}.jpg")
58
+ except Exception as e:
59
+ await event.reply(file=f"{nm}.txt")
60
+ LOGS.warning(str(e))
61
+ try:
62
+ remove(f"{nm}.jpg")
63
+ except BaseException:
64
+ pass
65
+ try:
66
+ remove(f"{nm}.txt")
67
+ except BaseException:
68
+ pass
69
  await x.delete()
70
 
71
 
plugins/antiflood.py CHANGED
@@ -97,6 +97,7 @@ async def unmuting(e):
97
  @ultroid_cmd(
98
  pattern="setflood ?(\\d+)",
99
  admins_only=True,
 
100
  )
101
  async def setflood(e):
102
  input = e.pattern_match.group(1)
@@ -114,6 +115,7 @@ async def setflood(e):
114
  @ultroid_cmd(
115
  pattern="remflood$",
116
  admins_only=True,
 
117
  )
118
  async def remove_flood(e):
119
  hmm = rem_flood(e.chat_id)
@@ -129,6 +131,7 @@ async def remove_flood(e):
129
  @ultroid_cmd(
130
  pattern="getflood$",
131
  admins_only=True,
 
132
  )
133
  async def getflood(e):
134
  ok = get_flood_limit(e.chat_id)
 
97
  @ultroid_cmd(
98
  pattern="setflood ?(\\d+)",
99
  admins_only=True,
100
+ ignore_dualmode=True,
101
  )
102
  async def setflood(e):
103
  input = e.pattern_match.group(1)
 
115
  @ultroid_cmd(
116
  pattern="remflood$",
117
  admins_only=True,
118
+ ignore_dualmode=True,
119
  )
120
  async def remove_flood(e):
121
  hmm = rem_flood(e.chat_id)
 
131
  @ultroid_cmd(
132
  pattern="getflood$",
133
  admins_only=True,
134
+ ignore_dualmode=True,
135
  )
136
  async def getflood(e):
137
  ok = get_flood_limit(e.chat_id)
plugins/ascii.py CHANGED
@@ -4,15 +4,12 @@
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
  """
9
  ✘ Commands Available -
10
 
11
  • `{i}ascii <reply image>`
12
  Convert replied image into html.
13
  """
14
-
15
-
16
  import os
17
 
18
  from img2html.converter import Img2HTMLConverter
@@ -33,7 +30,7 @@ async def _(e):
33
  html = converter.convert(img)
34
  with open("html.html", "w") as t:
35
  t.write(html)
36
- await e.client.send_file(e.chat_id, "html.html", reply_to=e.reply_to_msg_id)
37
  await m.delete()
38
  os.remove(img)
39
  os.remove("html.html")
 
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
  ✘ Commands Available -
9
 
10
  • `{i}ascii <reply image>`
11
  Convert replied image into html.
12
  """
 
 
13
  import os
14
 
15
  from img2html.converter import Img2HTMLConverter
 
30
  html = converter.convert(img)
31
  with open("html.html", "w") as t:
32
  t.write(html)
33
+ await e.reply(file="html.html")
34
  await m.delete()
35
  os.remove(img)
36
  os.remove("html.html")
plugins/asst_cmd.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -17,7 +16,6 @@
17
  •`{i}listcmd`
18
  To Get list of all your custom cmd.
19
  """
20
-
21
  import os
22
 
23
  from pyUltroid.functions.asstcmd_db import *
@@ -38,7 +36,7 @@ async def ac(e):
38
  if wt and wt.media:
39
  wut = mediainfo(wt.media)
40
  if wut.startswith(("pic", "gif")):
41
- dl = await bot.download_media(wt.media)
42
  variable = uf(dl)
43
  os.remove(dl)
44
  m = "https://telegra.ph" + variable[0]
@@ -46,7 +44,7 @@ async def ac(e):
46
  if wt.media.document.size > 8 * 1000 * 1000:
47
  return await eod(x, "`Unsupported Media`")
48
  else:
49
- dl = await bot.download_media(wt.media)
50
  variable = uf(dl)
51
  os.remove(dl)
52
  m = "https://telegra.ph" + variable[0]
 
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
  ✘ Commands Available -
9
 
 
16
  •`{i}listcmd`
17
  To Get list of all your custom cmd.
18
  """
 
19
  import os
20
 
21
  from pyUltroid.functions.asstcmd_db import *
 
36
  if wt and wt.media:
37
  wut = mediainfo(wt.media)
38
  if wut.startswith(("pic", "gif")):
39
+ dl = await e.client.download_media(wt.media)
40
  variable = uf(dl)
41
  os.remove(dl)
42
  m = "https://telegra.ph" + variable[0]
 
44
  if wt.media.document.size > 8 * 1000 * 1000:
45
  return await eod(x, "`Unsupported Media`")
46
  else:
47
+ dl = await e.client.download_media(wt.media)
48
  variable = uf(dl)
49
  os.remove(dl)
50
  m = "https://telegra.ph" + variable[0]
plugins/autopic.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -48,9 +47,9 @@ async def autopic(e):
48
  if not ge == "True":
49
  return
50
  au = "https://unsplash.com" + lie["href"]
51
- et = await ultroid_bot(getweb(au))
52
  try:
53
- kar = await ultroid_bot.download_media(et.webpage.photo)
54
  except AttributeError:
55
  ct = r.get(au).content
56
  bsc = bs(ct, "html.parser", from_encoding="utf-8")
@@ -58,8 +57,8 @@ async def autopic(e):
58
  li = ft[0]["src"]
59
  kar = "autopic.png"
60
  urllib.request.urlretrieve(li, kar)
61
- file = await ultroid_bot.upload_file(kar)
62
- await ultroid_bot(UploadProfilePhotoRequest(file))
63
  os.remove(kar)
64
  await asyncio.sleep(SLEEP_TIME)
65
 
 
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
  ✘ Commands Available -
9
 
 
47
  if not ge == "True":
48
  return
49
  au = "https://unsplash.com" + lie["href"]
50
+ et = await e.client(getweb(au))
51
  try:
52
+ kar = await e.client.download_media(et.webpage.photo)
53
  except AttributeError:
54
  ct = r.get(au).content
55
  bsc = bs(ct, "html.parser", from_encoding="utf-8")
 
57
  li = ft[0]["src"]
58
  kar = "autopic.png"
59
  urllib.request.urlretrieve(li, kar)
60
+ file = await e.client.upload_file(kar)
61
+ await e.client(UploadProfilePhotoRequest(file))
62
  os.remove(kar)
63
  await asyncio.sleep(SLEEP_TIME)
64
 
plugins/bot.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available
10
 
@@ -29,7 +28,6 @@
29
  • `{i}shutdown`
30
  Turn off your bot.
31
  """
32
-
33
  import time
34
  from datetime import datetime as dt
35
  from platform import python_version as pyver
@@ -47,7 +45,7 @@ from . import *
47
  )
48
  async def lol(ult):
49
  pic = udB.get("ALIVE_PIC")
50
- uptime = grt(time.time() - start_time)
51
  header = udB.get("ALIVE_TEXT") if udB.get("ALIVE_TEXT") else "Hey, I am alive."
52
  y = Repo().active_branch
53
  xx = Repo().remotes[0].config_reader.get("url")
@@ -67,16 +65,14 @@ async def lol(ult):
67
  return await eor(ult, als)
68
  elif pic is not None and "telegra" in pic:
69
  try:
70
- await ultroid_bot.send_message(
71
- ult.chat_id, als, file=pic, link_preview=False
72
- )
73
  await ult.delete()
74
  except ChatSendMediaForbiddenError:
75
  await eor(ult, als, link_preview=False)
76
  else:
77
  try:
78
- await ultroid_bot.send_message(ult.chat_id, file=pic)
79
- await ultroid_bot.send_message(ult.chat_id, als, link_preview=False)
80
  await ult.delete()
81
  except ChatSendMediaForbiddenError:
82
  await eor(ult, als, link_preview=False)
@@ -92,7 +88,7 @@ async def _(event):
92
  x = await eor(event, "`Pong !`")
93
  end = dt.now()
94
  ms = (end - start).microseconds / 1000
95
- uptime = grt(time.time() - start_time)
96
  await x.edit(get_string("ping").format(ms, uptime))
97
 
98
 
@@ -116,13 +112,13 @@ async def restartbt(ult):
116
 
117
  @ultroid_cmd(pattern="shutdown$")
118
  async def shutdownbot(ult):
119
- if not ult.out:
120
- if not is_fullsudo(ult.sender_id):
121
- return await eod(ult, "`This Command Is Sudo Restricted.`")
122
  await shutdown(ult)
123
 
124
 
125
  @ultroid_bot.on(events.NewMessage(pattern=f"\\{HNDLR}logs ?(.*)"))
 
126
  async def _(event):
127
  if event.fwd_from:
128
  return
@@ -134,7 +130,5 @@ async def _(event):
134
  return await def_logs(event)
135
  if opt == "heroku":
136
  await heroku_logs(event)
137
- elif opt == "sys":
138
- await def_logs(event)
139
  else:
140
  await def_logs(event)
 
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
  ✘ Commands Available
9
 
 
28
  • `{i}shutdown`
29
  Turn off your bot.
30
  """
 
31
  import time
32
  from datetime import datetime as dt
33
  from platform import python_version as pyver
 
45
  )
46
  async def lol(ult):
47
  pic = udB.get("ALIVE_PIC")
48
+ uptime = time_formatter((time.time() - start_time) * 1000)
49
  header = udB.get("ALIVE_TEXT") if udB.get("ALIVE_TEXT") else "Hey, I am alive."
50
  y = Repo().active_branch
51
  xx = Repo().remotes[0].config_reader.get("url")
 
65
  return await eor(ult, als)
66
  elif pic is not None and "telegra" in pic:
67
  try:
68
+ await ult.reply(als, file=pic, link_preview=False)
 
 
69
  await ult.delete()
70
  except ChatSendMediaForbiddenError:
71
  await eor(ult, als, link_preview=False)
72
  else:
73
  try:
74
+ await ult.reply(file=pic)
75
+ await ult.reply(als, link_preview=False)
76
  await ult.delete()
77
  except ChatSendMediaForbiddenError:
78
  await eor(ult, als, link_preview=False)
 
88
  x = await eor(event, "`Pong !`")
89
  end = dt.now()
90
  ms = (end - start).microseconds / 1000
91
+ uptime = time_formatter((time.time() - start_time) * 1000)
92
  await x.edit(get_string("ping").format(ms, uptime))
93
 
94
 
 
112
 
113
  @ultroid_cmd(pattern="shutdown$")
114
  async def shutdownbot(ult):
115
+ if not ult.out and not is_fullsudo(ult.sender_id):
116
+ return await eod(ult, "`This Command Is Sudo Restricted.`")
 
117
  await shutdown(ult)
118
 
119
 
120
  @ultroid_bot.on(events.NewMessage(pattern=f"\\{HNDLR}logs ?(.*)"))
121
+ @asst.on(events.NewMessage(pattern="^/{HNDLR}logs ?(.*)"))
122
  async def _(event):
123
  if event.fwd_from:
124
  return
 
130
  return await def_logs(event)
131
  if opt == "heroku":
132
  await heroku_logs(event)
 
 
133
  else:
134
  await def_logs(event)
plugins/botecho.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2021 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
+ """
9
+ ✘ Commands Available -
10
+
11
+ • `{i}botecho text (optional -\n[button_text_1](https://t.me/TheUltroid)\n[button_text_2](https://t.me/TeamUltroid))`
12
+ Send a message from your assistant bot.
13
+ """
14
+
15
+ import re
16
+
17
+ from . import *
18
+
19
+ regex = r"\[(.*)\]\((\S*)\)"
20
+
21
+
22
+ def generate_url_button(text):
23
+ btns = []
24
+ if not text:
25
+ return None
26
+ bt_txt = re.sub(regex, "", text) or None
27
+ matches = re.finditer(regex, text, re.MULTILINE)
28
+ if not matches:
29
+ return None
30
+ for i, match in enumerate(matches):
31
+ if match.group(2).endswith(":same"):
32
+ btnurl = match.group(2)[:-5]
33
+ if i == 0:
34
+ btns.append([Button.url(text=match.group(1), url=btnurl)])
35
+ else:
36
+ btns[-1].append(Button.url(text=match.group(1), url=btnurl))
37
+ else:
38
+ btns.append([Button.url(text=match.group(1), url=match.group(2))])
39
+ if not btns:
40
+ btns = None
41
+ return bt_txt, btns
42
+
43
+
44
+ @ultroid_cmd(pattern="botecho")
45
+ async def button_parser(event):
46
+ try:
47
+ text = event.text.split(" ", 1)[1]
48
+ except IndexError:
49
+ return await eor(
50
+ event,
51
+ f"**Please give some text!**\n**Format:** `{hndlr}botecho text \n[button_text_1](https://t.me/TheUltroid)\n[button_text_2](https://t.me/TeamUltroid)`",
52
+ )
53
+ text, buttons = generate_url_button(text)
54
+ try:
55
+ if text is None:
56
+ return await eor(event, "`Please provide a text too!`")
57
+ await asst.send_message(event.chat_id, text, buttons=buttons)
58
+ await eor(event, "Done. Message sent.")
59
+ except Exception as e:
60
+ await eod(event, "**ERROR:**\n{}".format(str(e)), time=5)
plugins/broadcast.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available
10
 
@@ -23,10 +22,11 @@
23
  • `{i}listchannels`
24
  To get list of all added chats.
25
  """
26
-
27
  import asyncio
28
  import io
29
 
 
 
30
  from . import *
31
 
32
 
@@ -42,7 +42,7 @@ async def broadcast_adder(event):
42
  await x.edit(get_string("bd_2"))
43
  chats = [
44
  e.entity
45
- for e in await ultroid.get_dialogs()
46
  if (e.is_group or e.is_channel)
47
  ]
48
  for i in chats:
@@ -53,10 +53,8 @@ async def broadcast_adder(event):
53
  new += 1
54
  cid = f"-100{i.id}"
55
  add_channel(int(cid))
56
- else:
57
- pass
58
- except BaseException:
59
- pass
60
  await x.edit(get_string("bd_3").format(get_no_channels(), new))
61
  return
62
  if event.reply_to_msg_id:
@@ -73,11 +71,8 @@ async def broadcast_adder(event):
73
  await event.delete()
74
  return
75
  chat_id = event.chat_id
76
- try:
77
- if int(chat_id) == int(udB.get("LOG_CHANNEL")):
78
- return
79
- except BaseException:
80
- pass
81
  if not is_channel_added(chat_id):
82
  xx = add_channel(chat_id)
83
  if xx:
@@ -133,7 +128,7 @@ async def list_all(event):
133
  for channel in channels:
134
  name = ""
135
  try:
136
- name = (await ultroid.get_entity(int(channel))).title
137
  except BaseException:
138
  name = ""
139
  msg += f"=> **{name}** [`{channel}`]\n"
@@ -142,13 +137,11 @@ async def list_all(event):
142
  MSG = msg.replace("*", "").replace("`", "")
143
  with io.BytesIO(str.encode(MSG)) as out_file:
144
  out_file.name = "channels.txt"
145
- await ultroid_bot.send_file(
146
- event.chat_id,
147
- out_file,
148
  force_document=True,
149
  allow_cache=False,
150
- caption="Channels in database",
151
- reply_to=event,
152
  )
153
  await x.delete()
154
  else:
@@ -161,8 +154,8 @@ async def list_all(event):
161
  )
162
  async def forw(event):
163
  if not event.is_reply:
164
- await eor(event, "Reply to a message to broadcast.")
165
- return
166
  channels = get_channels()
167
  x = await eor(event, "Sending...")
168
  if get_no_channels() == 0:
@@ -185,25 +178,23 @@ async def forw(event):
185
  int(udB.get("LOG_CHANNEL")),
186
  f"Error in sending at {channel}.",
187
  )
188
- except BaseException:
189
- pass
190
  error_count += 1
191
  await x.edit(
192
  f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
193
  )
194
  await x.edit(f"{sent_count} messages sent with {error_count} errors.")
195
  if error_count > 0:
196
- try:
197
- await ultroid_bot.send_message(
198
- int(udB.get("LOG_CHANNEL")), f"{error_count} Errors"
199
- )
200
- except BaseException:
201
- await x.edit("Set up log channel for checking errors.")
202
 
203
 
204
  @ultroid_cmd(
205
  pattern="broadcast ?(.*)",
206
  allow_sudo=False,
 
207
  )
208
  async def sending(event):
209
  x = await eor(event, "`Processing...`")
@@ -228,23 +219,18 @@ async def sending(event):
228
  f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
229
  )
230
  except Exception as error:
231
- try:
232
- await ultroid_bot.send_message(
233
- int(udB.get("LOG_CHANNEL")),
234
- f"Error in sending at {channel}.\n\n{error}",
235
- )
236
- except BaseException:
237
- pass
238
  error_count += 1
239
  await x.edit(
240
  f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
241
  )
242
  await x.edit(f"{sent_count} messages sent with {error_count} errors.")
243
  if error_count > 0:
244
- try:
245
- await ultroid_bot.send_message(
246
- int(udB.get("LOG_CHANNEL")),
247
- f"{error_count} Errors",
248
- )
249
- except BaseException:
250
- pass
 
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
  ✘ Commands Available
9
 
 
22
  • `{i}listchannels`
23
  To get list of all added chats.
24
  """
 
25
  import asyncio
26
  import io
27
 
28
+ from pyUltroid.functions.broadcast_db import *
29
+
30
  from . import *
31
 
32
 
 
42
  await x.edit(get_string("bd_2"))
43
  chats = [
44
  e.entity
45
+ for e in await event.client.get_dialogs()
46
  if (e.is_group or e.is_channel)
47
  ]
48
  for i in chats:
 
53
  new += 1
54
  cid = f"-100{i.id}"
55
  add_channel(int(cid))
56
+ except Exception as Ex:
57
+ LOGS.info(Ex)
 
 
58
  await x.edit(get_string("bd_3").format(get_no_channels(), new))
59
  return
60
  if event.reply_to_msg_id:
 
71
  await event.delete()
72
  return
73
  chat_id = event.chat_id
74
+ if int(chat_id) == int(udB.get("LOG_CHANNEL")):
75
+ return
 
 
 
76
  if not is_channel_added(chat_id):
77
  xx = add_channel(chat_id)
78
  if xx:
 
128
  for channel in channels:
129
  name = ""
130
  try:
131
+ name = (await event.client.get_entity(int(channel))).title
132
  except BaseException:
133
  name = ""
134
  msg += f"=> **{name}** [`{channel}`]\n"
 
137
  MSG = msg.replace("*", "").replace("`", "")
138
  with io.BytesIO(str.encode(MSG)) as out_file:
139
  out_file.name = "channels.txt"
140
+ await event.reply(
141
+ "Channels in Database",
142
+ file=out_file,
143
  force_document=True,
144
  allow_cache=False,
 
 
145
  )
146
  await x.delete()
147
  else:
 
154
  )
155
  async def forw(event):
156
  if not event.is_reply:
157
+ return await eor(event, "Reply to a message to broadcast.")
158
+ ultroid_bot = event.client
159
  channels = get_channels()
160
  x = await eor(event, "Sending...")
161
  if get_no_channels() == 0:
 
178
  int(udB.get("LOG_CHANNEL")),
179
  f"Error in sending at {channel}.",
180
  )
181
+ except Exception as Em:
182
+ LOGS.info(Em)
183
  error_count += 1
184
  await x.edit(
185
  f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
186
  )
187
  await x.edit(f"{sent_count} messages sent with {error_count} errors.")
188
  if error_count > 0:
189
+ await ultroid_bot.send_message(
190
+ int(udB.get("LOG_CHANNEL")), f"{error_count} Errors"
191
+ )
 
 
 
192
 
193
 
194
  @ultroid_cmd(
195
  pattern="broadcast ?(.*)",
196
  allow_sudo=False,
197
+ ignore_dualmode=True,
198
  )
199
  async def sending(event):
200
  x = await eor(event, "`Processing...`")
 
219
  f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
220
  )
221
  except Exception as error:
222
+
223
+ await ultroid_bot.send_message(
224
+ int(udB.get("LOG_CHANNEL")),
225
+ f"Error in sending at {channel}.\n\n{error}",
226
+ )
 
 
227
  error_count += 1
228
  await x.edit(
229
  f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
230
  )
231
  await x.edit(f"{sent_count} messages sent with {error_count} errors.")
232
  if error_count > 0:
233
+ await ultroid_bot.send_message(
234
+ int(udB.get("LOG_CHANNEL")),
235
+ f"{error_count} Errors",
236
+ )
 
 
 
plugins/calculator.py CHANGED
@@ -4,14 +4,12 @@
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
  """
9
  ✘ Commands Available -
10
 
11
  •`{i}calc` - Inline Calculator
12
 
13
  """
14
-
15
  import re
16
 
17
  from . import *
@@ -20,7 +18,7 @@ from . import *
20
  @ultroid_cmd(pattern="calc")
21
  async def icalc(e):
22
  udB.delete("calc")
23
- results = await ultroid_bot.inline_query(asst.me.username, "calc")
24
  await results[0].click(e.chat_id, silent=True, hide_via=True)
25
  await e.delete()
26
 
 
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
  ✘ Commands Available -
9
 
10
  •`{i}calc` - Inline Calculator
11
 
12
  """
 
13
  import re
14
 
15
  from . import *
 
18
  @ultroid_cmd(pattern="calc")
19
  async def icalc(e):
20
  udB.delete("calc")
21
+ results = await e.client.inline_query(asst.me.username, "calc")
22
  await results[0].click(e.chat_id, silent=True, hide_via=True)
23
  await e.delete()
24
 
plugins/carbon.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -14,7 +13,6 @@
14
  • `{i}rcarbon <text/reply to msg/reply to document>`
15
  Carbonise the text, with random bg colours.
16
  """
17
-
18
  import random
19
 
20
  import requests
@@ -182,7 +180,7 @@ async def crbn(event):
182
  if event.reply_to_msg_id:
183
  temp = await event.get_reply_message()
184
  if temp.media:
185
- b = await ultroid_bot.download_media(temp)
186
  a = open(b)
187
  code = a.read()
188
  a.close()
@@ -199,10 +197,9 @@ async def crbn(event):
199
  carbon = Carbon(base_url="https://carbonara.vercel.app/api/cook", code=code)
200
  xx = await carbon.memorize("ultroid_carbon")
201
  await xxxx.delete()
202
- await ultroid_bot.send_file(
203
- event.chat_id,
204
- xx,
205
- caption=f"Carbonised by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
206
  )
207
 
208
 
@@ -214,7 +211,7 @@ async def crbn(event):
214
  if event.reply_to_msg_id:
215
  temp = await event.get_reply_message()
216
  if temp.media:
217
- b = await ultroid_bot.download_media(temp)
218
  a = open(b)
219
  code = a.read()
220
  a.close()
@@ -234,8 +231,7 @@ async def crbn(event):
234
  )
235
  xx = await carbon.memorize("ultroid_carbon")
236
  await xxxx.delete()
237
- await ultroid_bot.send_file(
238
- event.chat_id,
239
- xx,
240
- caption=f"Carbonised by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
241
  )
 
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
  ✘ Commands Available -
9
 
 
13
  • `{i}rcarbon <text/reply to msg/reply to document>`
14
  Carbonise the text, with random bg colours.
15
  """
 
16
  import random
17
 
18
  import requests
 
180
  if event.reply_to_msg_id:
181
  temp = await event.get_reply_message()
182
  if temp.media:
183
+ b = await event.client.download_media(temp)
184
  a = open(b)
185
  code = a.read()
186
  a.close()
 
197
  carbon = Carbon(base_url="https://carbonara.vercel.app/api/cook", code=code)
198
  xx = await carbon.memorize("ultroid_carbon")
199
  await xxxx.delete()
200
+ await event.reply(
201
+ f"Carbonised by {inline_mention(event.sender)}",
202
+ file=xx,
 
203
  )
204
 
205
 
 
211
  if event.reply_to_msg_id:
212
  temp = await event.get_reply_message()
213
  if temp.media:
214
+ b = await event.client.download_media(temp)
215
  a = open(b)
216
  code = a.read()
217
  a.close()
 
231
  )
232
  xx = await carbon.memorize("ultroid_carbon")
233
  await xxxx.delete()
234
+ await event.reply(
235
+ f"Carbonised by {inline_mention(event.sender)}",
236
+ file=xx,
 
237
  )
plugins/channelhacks.py CHANGED
@@ -73,7 +73,7 @@ async def _(e):
73
  c = int(a)
74
  except Exception:
75
  try:
76
- c = (await ultroid_bot.get_entity(a)).id
77
  except Exception:
78
  await z.edit("invalid Channel given")
79
  return
@@ -81,14 +81,14 @@ async def _(e):
81
  d = int(b)
82
  except Exception:
83
  try:
84
- d = (await ultroid_bot.get_entity(b)).id
85
  except Exception:
86
  await z.edit("invalid Channel given")
87
  return
88
- async for msg in ultroid_bot.iter_messages(int(c), reverse=True):
89
  try:
90
  await asyncio.sleep(2)
91
- await ultroid_bot.send_message(int(d), msg)
92
  except BaseException:
93
  pass
94
  await z.edit("Done")
@@ -115,7 +115,7 @@ async def source(e):
115
  @ultroid_cmd(pattern="dsource ?(.*)")
116
  async def dd(event):
117
  chat_id = event.pattern_match.group(1)
118
- x = await eor(event, "processing")
119
  if chat_id == "all":
120
  await x.edit("`Removing...`")
121
  udB.delete("CH_SOURCE")
@@ -125,24 +125,18 @@ async def dd(event):
125
  y = int(chat_id)
126
  except Exception:
127
  try:
128
- y = int((await bot.get_entity(chat_id)).id)
129
  except Exception as es:
130
  print(es)
131
  return
132
  if is_source_channel_added(y):
133
  rem_source_channel(y)
134
- await x.edit("Source removed from database")
135
- await asyncio.sleep(3)
136
- await x.delete()
137
  elif is_source_channel_added(y):
138
  rem_source_channel(y)
139
- await x.edit("Source removed from database")
140
- await asyncio.sleep(3)
141
- await x.delete()
142
  elif not is_source_channel_added(y):
143
- await x.edit("Source channel is already removed from database. ")
144
- await asyncio.sleep(3)
145
- await x.delete()
146
 
147
 
148
  @ultroid_cmd(pattern="listsource")
@@ -156,7 +150,7 @@ async def list_all(event):
156
  for channel in channels:
157
  name = ""
158
  try:
159
- name = (await ultroid.get_entity(int(channel))).title
160
  except BaseException:
161
  name = ""
162
  msg += f"=> **{name}** [`{channel}`]\n"
@@ -165,7 +159,7 @@ async def list_all(event):
165
  MSG = msg.replace("*", "").replace("`", "")
166
  with io.BytesIO(str.encode(MSG)) as out_file:
167
  out_file.name = "channels.txt"
168
- await ultroid_bot.send_file(
169
  event.chat_id,
170
  out_file,
171
  force_document=True,
@@ -185,7 +179,7 @@ async def destination(e):
185
  y = int(x)
186
  except Exception:
187
  try:
188
- y = int((await bot.get_entity(x)).id)
189
  except Exception as es:
190
  print(es)
191
  return
@@ -209,28 +203,23 @@ async def dd(event):
209
  y = int(chat_id)
210
  except Exception:
211
  try:
212
- y = int((await bot.get_entity(chat_id)).id)
213
  except Exception as es:
214
  print(es)
215
  return
216
  if is_destination_added(y):
217
  rem_destination(y)
218
- await x.edit("Destination removed from database")
219
- await asyncio.sleep(3)
220
- await x.delete()
221
  elif is_destination_added(y):
222
  rem_destination(y)
223
- await x.edit("Destination removed from database")
224
- await asyncio.sleep(3)
225
- await x.delete()
226
  elif not is_destination_added(y):
227
- await x.edit("Destination channel is already removed from database. ")
228
- await asyncio.sleep(3)
229
- await x.delete()
230
 
231
 
232
  @ultroid_cmd(pattern="listdest")
233
  async def list_all(event):
 
234
  x = await eor(event, "`Calculating...`")
235
  channels = get_destinations()
236
  num = get_no_destinations()
 
73
  c = int(a)
74
  except Exception:
75
  try:
76
+ c = (await e.client.get_entity(a)).id
77
  except Exception:
78
  await z.edit("invalid Channel given")
79
  return
 
81
  d = int(b)
82
  except Exception:
83
  try:
84
+ d = (await e.client.get_entity(b)).id
85
  except Exception:
86
  await z.edit("invalid Channel given")
87
  return
88
+ async for msg in e.client.iter_messages(int(c), reverse=True):
89
  try:
90
  await asyncio.sleep(2)
91
+ await e.client.send_message(int(d), msg)
92
  except BaseException:
93
  pass
94
  await z.edit("Done")
 
115
  @ultroid_cmd(pattern="dsource ?(.*)")
116
  async def dd(event):
117
  chat_id = event.pattern_match.group(1)
118
+ x = await eor(event, "`Processing..`")
119
  if chat_id == "all":
120
  await x.edit("`Removing...`")
121
  udB.delete("CH_SOURCE")
 
125
  y = int(chat_id)
126
  except Exception:
127
  try:
128
+ y = int((await event.client.get_entity(chat_id)).id)
129
  except Exception as es:
130
  print(es)
131
  return
132
  if is_source_channel_added(y):
133
  rem_source_channel(y)
134
+ await eod(x, "Source removed from database", time=3)
 
 
135
  elif is_source_channel_added(y):
136
  rem_source_channel(y)
137
+ await eod(x, "Source removed from database")
 
 
138
  elif not is_source_channel_added(y):
139
+ await eod(x, "Source channel is already removed from database. ", time=3)
 
 
140
 
141
 
142
  @ultroid_cmd(pattern="listsource")
 
150
  for channel in channels:
151
  name = ""
152
  try:
153
+ name = (await event.client.get_entity(int(channel))).title
154
  except BaseException:
155
  name = ""
156
  msg += f"=> **{name}** [`{channel}`]\n"
 
159
  MSG = msg.replace("*", "").replace("`", "")
160
  with io.BytesIO(str.encode(MSG)) as out_file:
161
  out_file.name = "channels.txt"
162
+ await event.client.send_file(
163
  event.chat_id,
164
  out_file,
165
  force_document=True,
 
179
  y = int(x)
180
  except Exception:
181
  try:
182
+ y = int((await e.client.get_entity(x)).id)
183
  except Exception as es:
184
  print(es)
185
  return
 
203
  y = int(chat_id)
204
  except Exception:
205
  try:
206
+ y = int((await event.client.get_entity(chat_id)).id)
207
  except Exception as es:
208
  print(es)
209
  return
210
  if is_destination_added(y):
211
  rem_destination(y)
212
+ await eor(x, "Destination removed from database")
 
 
213
  elif is_destination_added(y):
214
  rem_destination(y)
215
+ await eod(x, "Destination removed from database")
 
 
216
  elif not is_destination_added(y):
217
+ await eod(x, "Destination channel is already removed from database. ")
 
 
218
 
219
 
220
  @ultroid_cmd(pattern="listdest")
221
  async def list_all(event):
222
+ ultroid_bot = event.client
223
  x = await eor(event, "`Calculating...`")
224
  channels = get_destinations()
225
  num = get_no_destinations()
plugins/chat_bot.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2020 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
+ """
9
+ ✘ Commands Available -
10
+
11
+ • `{i}addai <reply to user/give username/userid>`
12
+ Add a AI ChatBot to reply to that user.
13
+
14
+ • `{i}remai <reply to user/give username/userid>`
15
+ Remove the AI ChatBot.
16
+
17
+ • `{i}repai <reply to user/give a message>`
18
+ Reply to the user with a message by an AI.
19
+
20
+ • `{i}listai`
21
+ List the currently AI added users.
22
+ """
23
+
24
+ from pyUltroid.functions.all import get_chatbot_reply
25
+ from pyUltroid.functions.chatBot_db import *
26
+
27
+
28
+ @ultroid_cmd(pattern="repai")
29
+ async def im_lonely_chat_with_me(event):
30
+ if event.reply_to_msg_id:
31
+ message = (await event.get_reply_message()).message
32
+ else:
33
+ try:
34
+ message = event.text.split(" ", 1)[1]
35
+ except IndexError:
36
+ return await eod(
37
+ event, "Give a message or Reply to a User's Message.", time=10
38
+ )
39
+ reply_ = get_chatbot_reply(event, message=message)
40
+ await eor(event, reply_)
41
+
42
+
43
+ @ultroid_cmd(pattern="addai")
44
+ async def add_chatBot(event):
45
+ await chat_bot_fn(event, type_="add")
46
+
47
+
48
+ @ultroid_cmd(pattern="remai")
49
+ async def rem_chatBot(event):
50
+ await chat_bot_fn(event, type_="remov")
51
+
52
+
53
+ @ultroid_cmd(pattern="listai")
54
+ async def lister(event):
55
+ users = get_all_added()
56
+ if udB.get("CHATBOT_USERS") is None:
57
+ return await eod(event, "`No user has AI added.`")
58
+ msg = ""
59
+ for i in users:
60
+ try:
61
+ user = await event.client.get_entity(int(i))
62
+ user = inline_mention(user)
63
+ except BaseException:
64
+ user = f"`{i}`"
65
+ msg += "- {}\n".format(user)
66
+ await eor(event, msg, link_preview=False)
67
+
68
+
69
+ async def chat_bot_fn(event, type_):
70
+ if event.reply_to_msg_id:
71
+ user = (await event.get_reply_message()).sender
72
+ else:
73
+ temp = event.text.split(" ", 1)
74
+ try:
75
+ usr = temp[1]
76
+ except IndexError:
77
+ return await eod(
78
+ event,
79
+ "Reply to a user or give me his id/username to add an AI ChatBot!",
80
+ )
81
+ user = await event.client.get_entity(usr)
82
+ if type_ == "add":
83
+ add_chatbot(user.id)
84
+ if type_ == "remov":
85
+ rem_chatbot(user.id)
86
+ await eor(
87
+ event, f"**ChatBot:**\n{type_}ed [{user.first_name}](tg://user?id={user.id})`"
88
+ )
plugins/chats.py CHANGED
@@ -53,6 +53,8 @@ async def _(e):
53
  @ultroid_cmd(
54
  pattern="getlink$",
55
  groups_only=True,
 
 
56
  )
57
  async def _(e):
58
  xx = await eor(e, "`Processing...`")
 
53
  @ultroid_cmd(
54
  pattern="getlink$",
55
  groups_only=True,
56
+ type=["official", "manager"],
57
+ ignore_dualmode=True,
58
  )
59
  async def _(e):
60
  xx = await eor(e, "`Processing...`")
plugins/clean_action.py CHANGED
@@ -28,9 +28,6 @@ from . import *
28
  async def _(e):
29
  add_clean(e.chat_id)
30
  await eod(e, "Added Clean Action Setting For this Chat")
31
- async for x in ultroid_bot.iter_messages(e.chat_id, limit=3000):
32
- if x.action:
33
- await x.delete()
34
 
35
 
36
  @ultroid_cmd(pattern="remclean$")
@@ -47,19 +44,10 @@ async def _(e):
47
  o = ""
48
  for x in k:
49
  try:
50
- title = (await ultroid_bot.get_entity(int(x))).title
51
  except BaseException:
52
  title = "`Invalid ID`"
53
  o += x + " " + title + "\n"
54
  await eor(e, o)
55
  else:
56
  await eod(e, "`No Chat Added`")
57
-
58
-
59
- @ultroid_bot.on(events.ChatAction())
60
- async def _(event):
61
- if is_clean_added(event.chat_id):
62
- try:
63
- await event.delete()
64
- except BaseException:
65
- pass
 
28
  async def _(e):
29
  add_clean(e.chat_id)
30
  await eod(e, "Added Clean Action Setting For this Chat")
 
 
 
31
 
32
 
33
  @ultroid_cmd(pattern="remclean$")
 
44
  o = ""
45
  for x in k:
46
  try:
47
+ title = e.chat.title
48
  except BaseException:
49
  title = "`Invalid ID`"
50
  o += x + " " + title + "\n"
51
  await eor(e, o)
52
  else:
53
  await eod(e, "`No Chat Added`")
 
 
 
 
 
 
 
 
 
plugins/compressor.py CHANGED
@@ -10,7 +10,7 @@
10
 
11
  • `{i}compress <reply to video>`
12
  optional `crf` and `stream`
13
- Example : `{i}compress 27 | stream` or `{i}compress 28`
14
  Encode the replied video according to CRF value.
15
  Less CRF == High Quality, More Size
16
  More CRF == Low Quality, Less Size
@@ -33,12 +33,18 @@ from telethon.tl.types import DocumentAttributeVideo
33
  from . import *
34
 
35
 
36
- @ultroid_cmd(pattern="compress ?((\\d+)(.*)|$)")
37
  async def _(e):
38
- crf = e.pattern_match.group(1)
39
- if not crf:
40
- crf = 27
41
- to_stream = e.pattern_match.group(2)
 
 
 
 
 
 
42
  vido = await e.get_reply_message()
43
  if vido and vido.media:
44
  if "video" in mediainfo(vido.media):
@@ -63,7 +69,7 @@ async def _(e):
63
  d_time = time.time()
64
  diff = time_formatter((d_time - c_time) * 1000)
65
  file_name = (file.name).split("/")[-1]
66
- out = file_name.replace(file_name.split(".")[-1], " compressed.mkv")
67
  await xxx.edit(
68
  f"`Downloaded {file.name} of {humanbytes(o_size)} in {diff}.\nNow Compressing...`"
69
  )
@@ -93,16 +99,17 @@ async def _(e):
93
  per = elapse * 100 / int(total_frames)
94
  time_diff = time.time() - int(d_time)
95
  speed = round(elapse / time_diff, 2)
96
- eta = time_formatter(
97
- ((int(total_frames) - elapse) / speed) * 1000
98
- )
99
  text = f"`Compressing {file_name} at {crf} CRF.\n`"
100
  progress_str = "`[{0}{1}] {2}%\n\n`".format(
101
  "".join(["●" for i in range(math.floor(per / 5))]),
102
  "".join(["" for i in range(20 - math.floor(per / 5))]),
103
  round(per, 2),
104
  )
105
- e_size = humanbytes(size)
 
 
 
106
  try:
107
  await xxx.edit(
108
  text
@@ -135,7 +142,7 @@ async def _(e):
135
  xxx,
136
  "Uploading " + out + "...",
137
  )
138
- if to_stream and "| stream" in to_stream:
139
  metadata = extractMetadata(createParser(out))
140
  duration = metadata.get("duration").seconds
141
  hi, _ = await bash(f'mediainfo "{out}" | grep "Height"')
 
10
 
11
  • `{i}compress <reply to video>`
12
  optional `crf` and `stream`
13
+ Example : `{i}compress 27 stream` or `{i}compress 28`
14
  Encode the replied video according to CRF value.
15
  Less CRF == High Quality, More Size
16
  More CRF == Low Quality, Less Size
 
33
  from . import *
34
 
35
 
36
+ @ultroid_cmd(pattern="compress ?(.*)")
37
  async def _(e):
38
+ cr = e.pattern_match.group(1)
39
+ crf = 27
40
+ to_stream = False
41
+ if cr:
42
+ k = e.text.split()
43
+ if len(k) == 2:
44
+ crf = int(k[1]) if k[1].isdigit() else 27
45
+ elif len(k) > 2:
46
+ crf = int(k[1]) if k[1].isdigit() else 27
47
+ to_stream = True if "stream" in k[2] else False
48
  vido = await e.get_reply_message()
49
  if vido and vido.media:
50
  if "video" in mediainfo(vido.media):
 
69
  d_time = time.time()
70
  diff = time_formatter((d_time - c_time) * 1000)
71
  file_name = (file.name).split("/")[-1]
72
+ out = file_name.replace(file_name.split(".")[-1], "compressed.mkv")
73
  await xxx.edit(
74
  f"`Downloaded {file.name} of {humanbytes(o_size)} in {diff}.\nNow Compressing...`"
75
  )
 
99
  per = elapse * 100 / int(total_frames)
100
  time_diff = time.time() - int(d_time)
101
  speed = round(elapse / time_diff, 2)
102
+ some_eta = ((int(total_frames) - elapse) / speed) * 1000
 
 
103
  text = f"`Compressing {file_name} at {crf} CRF.\n`"
104
  progress_str = "`[{0}{1}] {2}%\n\n`".format(
105
  "".join(["●" for i in range(math.floor(per / 5))]),
106
  "".join(["" for i in range(20 - math.floor(per / 5))]),
107
  round(per, 2),
108
  )
109
+ e_size = (
110
+ humanbytes(size) + " of ~" + humanbytes((size / per) * 100)
111
+ )
112
+ eta = "~" + time_formatter(some_eta)
113
  try:
114
  await xxx.edit(
115
  text
 
142
  xxx,
143
  "Uploading " + out + "...",
144
  )
145
+ if to_stream:
146
  metadata = extractMetadata(createParser(out))
147
  duration = metadata.get("duration").seconds
148
  hi, _ = await bash(f'mediainfo "{out}" | grep "Height"')
plugins/converter.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -27,7 +26,6 @@
27
  • `{i}thumbnail <reply to image/thumbnail file>`
28
  Upload Your file with your custom thumbnail.
29
  """
30
-
31
  import os
32
  import time
33
 
@@ -51,10 +49,10 @@ async def _(e):
51
  if not r:
52
  return await eor(e, pop)
53
  if isinstance(r.media, photu):
54
- dl = await ultroid_bot.download_media(r.media)
55
  elif isinstance(r.media, doc):
56
  if r.media.document.thumbs:
57
- dl = await ultroid_bot.download_media(r, thumb=-1)
58
  else:
59
  return await eor(e, pop)
60
  variable = uf(dl)
@@ -76,7 +74,7 @@ async def imak(event):
76
  return
77
  inp = event.pattern_match.group(1)
78
  if not inp:
79
- await eor(event, "Give The name nd extension of file")
80
  return
81
  xx = await eor(event, "`Processing...`")
82
  if reply.media:
@@ -91,13 +89,11 @@ async def imak(event):
91
  os.rename(file, inp)
92
  k = time.time()
93
  xxx = await uploader(inp, inp, k, xx, "Uploading...")
94
- await ultroid_bot.send_file(
95
- event.chat_id,
96
- xxx,
97
  force_document=True,
98
  thumb="resources/extras/ultroid.jpg",
99
- caption=f"`{xxx.name}`",
100
- reply_to=reply,
101
  )
102
  os.remove(inp)
103
  await xx.delete()
@@ -112,7 +108,7 @@ async def imak(event):
112
  await eor(event, "Reply to any media.")
113
  return
114
  xx = await eor(event, "`Processing...`")
115
- image = await ultroid_bot.download_media(reply)
116
  file = "ult.png"
117
  if image.endswith((".webp", ".png")):
118
  c = Image.open(image)
@@ -121,7 +117,7 @@ async def imak(event):
121
  img = cv2.VideoCapture(image)
122
  ult, roid = img.read()
123
  cv2.imwrite(file, roid)
124
- await ultroid_bot.send_file(event.chat_id, file, reply_to=reply)
125
  await xx.delete()
126
  os.remove(file)
127
  os.remove(image)
@@ -136,7 +132,7 @@ async def smak(event):
136
  await eor(event, "Reply to any media.")
137
  return
138
  xx = await eor(event, "`Processing...`")
139
- image = await ultroid_bot.download_media(reply)
140
  file = "ult.webp"
141
  if image.endswith((".webp", ".png", ".jpg")):
142
  c = Image.open(image)
@@ -145,7 +141,7 @@ async def smak(event):
145
  img = cv2.VideoCapture(image)
146
  ult, roid = img.read()
147
  cv2.imwrite(file, roid)
148
- await ultroid_bot.send_file(event.chat_id, file, reply_to=reply)
149
  await xx.delete()
150
  os.remove(file)
151
  os.remove(image)
@@ -157,7 +153,7 @@ async def smak(event):
157
  async def _(event):
158
  input_str = event.pattern_match.group(1)
159
  if not input_str:
160
- return await eod(event, "`Bsdk Give Name.`")
161
  xx = await eor(event, get_string("com_1"))
162
  if event.reply_to_msg_id:
163
  a = await event.get_reply_message()
@@ -168,9 +164,7 @@ async def _(event):
168
  b.write(str(a.message))
169
  b.close()
170
  await xx.edit(f"**Packing into** `{input_str}`")
171
- await event.client.send_file(
172
- event.chat_id, input_str, thumb="resources/extras/ultroid.jpg"
173
- )
174
  await xx.delete()
175
  os.remove(input_str)
176
 
@@ -198,12 +192,8 @@ async def _(event):
198
  await xx.edit(
199
  f"**MESSAGE EXCEEDS TELEGRAM LIMITS**\n\nSo Pasted It On [NEKOBIN](https://nekobin.com/{key})"
200
  )
201
- elif "dog" in what:
202
- await xx.edit(
203
- f"**MESSAGE EXCEEDS TELEGRAM LIMITS**\n\nSo Pasted It On [DOGBIN](https://del.dog/{key})"
204
- )
205
  os.remove(b)
206
  else:
207
- return await eod(xx, "`Reply to a readable file`", time=5)
208
  else:
209
- return await eod(xx, "`Reply to a readable file`", time=5)
 
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
  ✘ Commands Available -
9
 
 
26
  • `{i}thumbnail <reply to image/thumbnail file>`
27
  Upload Your file with your custom thumbnail.
28
  """
 
29
  import os
30
  import time
31
 
 
49
  if not r:
50
  return await eor(e, pop)
51
  if isinstance(r.media, photu):
52
+ dl = await e.client.download_media(r.media)
53
  elif isinstance(r.media, doc):
54
  if r.media.document.thumbs:
55
+ dl = await e.client.download_media(r, thumb=-1)
56
  else:
57
  return await eor(e, pop)
58
  variable = uf(dl)
 
74
  return
75
  inp = event.pattern_match.group(1)
76
  if not inp:
77
+ await eor(event, "Give The name and extension of file")
78
  return
79
  xx = await eor(event, "`Processing...`")
80
  if reply.media:
 
89
  os.rename(file, inp)
90
  k = time.time()
91
  xxx = await uploader(inp, inp, k, xx, "Uploading...")
92
+ await event.reply(
93
+ f"`{xxx.name}`",
94
+ file=xxx,
95
  force_document=True,
96
  thumb="resources/extras/ultroid.jpg",
 
 
97
  )
98
  os.remove(inp)
99
  await xx.delete()
 
108
  await eor(event, "Reply to any media.")
109
  return
110
  xx = await eor(event, "`Processing...`")
111
+ image = await reply.download_media()
112
  file = "ult.png"
113
  if image.endswith((".webp", ".png")):
114
  c = Image.open(image)
 
117
  img = cv2.VideoCapture(image)
118
  ult, roid = img.read()
119
  cv2.imwrite(file, roid)
120
+ await event.reply(file=file)
121
  await xx.delete()
122
  os.remove(file)
123
  os.remove(image)
 
132
  await eor(event, "Reply to any media.")
133
  return
134
  xx = await eor(event, "`Processing...`")
135
+ image = await reply.download_media()
136
  file = "ult.webp"
137
  if image.endswith((".webp", ".png", ".jpg")):
138
  c = Image.open(image)
 
141
  img = cv2.VideoCapture(image)
142
  ult, roid = img.read()
143
  cv2.imwrite(file, roid)
144
+ await event.reply(file=file)
145
  await xx.delete()
146
  os.remove(file)
147
  os.remove(image)
 
153
  async def _(event):
154
  input_str = event.pattern_match.group(1)
155
  if not input_str:
156
+ return await eod(event, "`Give The File Name.`")
157
  xx = await eor(event, get_string("com_1"))
158
  if event.reply_to_msg_id:
159
  a = await event.get_reply_message()
 
164
  b.write(str(a.message))
165
  b.close()
166
  await xx.edit(f"**Packing into** `{input_str}`")
167
+ await event.reply(file=input_str, thumb="resources/extras/ultroid.jpg")
 
 
168
  await xx.delete()
169
  os.remove(input_str)
170
 
 
192
  await xx.edit(
193
  f"**MESSAGE EXCEEDS TELEGRAM LIMITS**\n\nSo Pasted It On [NEKOBIN](https://nekobin.com/{key})"
194
  )
 
 
 
 
195
  os.remove(b)
196
  else:
197
+ return await eod(xx, "`Reply to a readable file`")
198
  else:
199
+ return await eod(xx, "`Reply to a readable file`")
plugins/deezer.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -14,7 +13,6 @@
14
  import os
15
  import time
16
  from json.decoder import JSONDecodeError
17
- from urllib.request import urlretrieve
18
 
19
  import requests as r
20
  from telethon.tl.types import DocumentAttributeAudio
@@ -56,8 +54,8 @@ async def siesace(e):
56
  singers = k["artist"]["name"]
57
  except Exception as ex:
58
  return await eod(lol, f"`{str(ex)}`")
59
- urlretrieve(urrl, title + "." + quality)
60
- urlretrieve(img, title + ".jpg")
61
  okk = await uploader(
62
  title + "." + quality,
63
  title + "." + quality,
@@ -65,10 +63,9 @@ async def siesace(e):
65
  lol,
66
  "Uploading " + title + "...",
67
  )
68
- await ultroid_bot.send_file(
69
- e.chat_id,
70
- okk,
71
- caption="`" + title + "`" + "\n`From Deezer`",
72
  attributes=[
73
  DocumentAttributeAudio(
74
  duration=int(duration),
 
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
  ✘ Commands Available -
9
 
 
13
  import os
14
  import time
15
  from json.decoder import JSONDecodeError
 
16
 
17
  import requests as r
18
  from telethon.tl.types import DocumentAttributeAudio
 
54
  singers = k["artist"]["name"]
55
  except Exception as ex:
56
  return await eod(lol, f"`{str(ex)}`")
57
+ await download_file(urrl, title + "." + quality)
58
+ await download_file(img, title + ".jpg")
59
  okk = await uploader(
60
  title + "." + quality,
61
  title + "." + quality,
 
63
  lol,
64
  "Uploading " + title + "...",
65
  )
66
+ await e.reply(
67
+ "`" + title + "`" + "\n`From Deezer`",
68
+ file=okk,
 
69
  attributes=[
70
  DocumentAttributeAudio(
71
  duration=int(duration),
plugins/devtools.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -27,6 +26,7 @@ import io
27
  import sys
28
  import traceback
29
  from os import remove
 
30
 
31
  from carbonnow import Carbon
32
 
@@ -43,7 +43,7 @@ async def _(e):
43
  p = (neo.read()).replace("\n\n", "")
44
  ok = Carbon(base_url="https://carbonara.vercel.app/api/cook", code=p)
45
  haa = await ok.save("neofetch")
46
- await e.client.send_file(e.chat_id, haa)
47
  await xx.delete()
48
  remove("neofetch.jpg")
49
  remove("neo.txt")
@@ -89,7 +89,7 @@ async def _(event):
89
  force_document=True,
90
  thumb="resources/extras/ultroid.jpg",
91
  allow_cache=False,
92
- caption=f"`{cmd}`",
93
  reply_to=reply_to_id,
94
  )
95
  await xx.delete()
@@ -97,7 +97,7 @@ async def _(event):
97
  await xx.edit(OUT)
98
 
99
 
100
- p = print # ignore: pylint
101
 
102
 
103
  @ultroid_cmd(
@@ -155,7 +155,7 @@ async def _(event):
155
  ultd = final_output.replace("`", "").replace("*", "").replace("_", "")
156
  with io.BytesIO(str.encode(ultd)) as out_file:
157
  out_file.name = "eval.txt"
158
- await ultroid_bot.send_file(
159
  event.chat_id,
160
  out_file,
161
  force_document=True,
@@ -174,7 +174,7 @@ async def aexec(code, event):
174
  f"async def __aexec(e, client): "
175
  + "\n message = event = e"
176
  + "\n reply = await event.get_reply_message()"
177
- + "\n chat = e.chat_id"
178
  + "".join(f"\n {l}" for l in code.split("\n")),
179
  )
180
 
 
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
  ✘ Commands Available -
9
 
 
26
  import sys
27
  import traceback
28
  from os import remove
29
+ from pprint import pprint
30
 
31
  from carbonnow import Carbon
32
 
 
43
  p = (neo.read()).replace("\n\n", "")
44
  ok = Carbon(base_url="https://carbonara.vercel.app/api/cook", code=p)
45
  haa = await ok.save("neofetch")
46
+ await e.reply(file=haa)
47
  await xx.delete()
48
  remove("neofetch.jpg")
49
  remove("neo.txt")
 
89
  force_document=True,
90
  thumb="resources/extras/ultroid.jpg",
91
  allow_cache=False,
92
+ caption=f"`{cmd}`" if (len(cmd) + 2) < 1000 else None,
93
  reply_to=reply_to_id,
94
  )
95
  await xx.delete()
 
97
  await xx.edit(OUT)
98
 
99
 
100
+ p, pp = print, pprint # ignore: pylint
101
 
102
 
103
  @ultroid_cmd(
 
155
  ultd = final_output.replace("`", "").replace("*", "").replace("_", "")
156
  with io.BytesIO(str.encode(ultd)) as out_file:
157
  out_file.name = "eval.txt"
158
+ await event.client.send_file(
159
  event.chat_id,
160
  out_file,
161
  force_document=True,
 
174
  f"async def __aexec(e, client): "
175
  + "\n message = event = e"
176
  + "\n reply = await event.get_reply_message()"
177
+ + "\n chat = (await event.get_chat()).id"
178
  + "".join(f"\n {l}" for l in code.split("\n")),
179
  )
180
 
plugins/dm.py CHANGED
@@ -10,7 +10,6 @@
10
  • `{i}dm <username/id> <reply/type>`
11
  Direct Message the User.
12
  """
13
-
14
  from . import *
15
 
16
 
@@ -26,22 +25,18 @@ async def dm(e):
26
  try:
27
  chat_id = await get_user_id(c[0])
28
  except Exception as ex:
29
- return await eod(e, "`" + str(ex) + "`", time=5)
30
  msg = ""
31
  masg = await e.get_reply_message()
32
  if e.reply_to_msg_id:
33
- await ultroid_bot.send_message(chat_id, masg)
34
- await eod(e, "`⚜️Message Delivered!`", time=4)
35
  for i in c[1:]:
36
  msg += i + " "
37
  if msg == "":
38
  return
39
  try:
40
- await ultroid_bot.send_message(chat_id, msg)
41
- await eod(e, "`⚜️Message Delivered!⚜️`", time=4)
42
  except BaseException:
43
- await eod(
44
- e,
45
- "`{i}help dm`",
46
- time=4,
47
- )
 
10
  • `{i}dm <username/id> <reply/type>`
11
  Direct Message the User.
12
  """
 
13
  from . import *
14
 
15
 
 
25
  try:
26
  chat_id = await get_user_id(c[0])
27
  except Exception as ex:
28
+ return await eod(e, "`" + str(ex) + "`")
29
  msg = ""
30
  masg = await e.get_reply_message()
31
  if e.reply_to_msg_id:
32
+ await e.client.send_message(chat_id, masg)
33
+ await eod(e, "`⚜️Message Delivered!`")
34
  for i in c[1:]:
35
  msg += i + " "
36
  if msg == "":
37
  return
38
  try:
39
+ await e.client.send_message(chat_id, msg)
40
+ await eod(e, "`⚜️Message Delivered!⚜️`")
41
  except BaseException:
42
+ await eod(e, f"Read Usage : `{HNDLR}help dm`")
 
 
 
 
plugins/download_upload.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -19,7 +18,6 @@
19
  Reply to file to download.
20
 
21
  """
22
-
23
  import glob
24
  import os
25
  import time
@@ -118,39 +116,46 @@ async def download(event):
118
  for kk in kk:
119
  try:
120
  try:
121
- res = await uploader(kk, kk, tt, xx, "Uploading...")
122
  except MessageNotModifiedError as err:
123
  return await xx.edit(str(err))
124
  title = kk.split("/")[-1]
125
- if title.endswith((".mp3", ".m4a", ".opus", ".ogg")):
126
  hmm = " | stream"
127
  if " | stream" in hmm:
128
  metadata = extractMetadata(createParser(res.name))
129
- if not metadata:
130
- return await event.reply(file=res, supports_streaming=True)
131
  wi = 512
132
  hi = 512
133
  duration = 0
134
- if metadata.has("width"):
135
- wi = metadata.get("width")
136
- if metadata.has("height"):
137
- hi = metadata.get("height")
138
- if metadata.has("duration"):
139
- duration = metadata.get("duration").seconds
140
- if metadata.has("artist"):
141
- artist = metadata.get("artist")
142
- else:
143
- if udB.get("artist"):
144
- artist = udB.get("artist")
145
  else:
146
- artist = ultroid_bot.first_name
147
- if res.name.endswith(tuple([".mkv", ".mp4", ".avi"])):
 
 
 
 
 
 
 
 
 
 
148
  attributes = [
149
  DocumentAttributeVideo(
150
  w=wi, h=hi, duration=duration, supports_streaming=True
151
  )
152
  ]
153
- elif res.name.endswith(tuple([".mp3", ".m4a", ".opus", ".ogg"])):
154
  attributes = [
155
  DocumentAttributeAudio(
156
  duration=duration,
@@ -161,26 +166,26 @@ async def download(event):
161
  else:
162
  attributes = None
163
  try:
164
- x = await event.client.send_file(
165
  event.chat_id,
166
  res,
167
- caption=f"`{title}`",
168
  attributes=attributes,
169
  supports_streaming=True,
170
  thumb="resources/extras/ultroid.jpg",
171
  )
172
  except BaseException:
173
- x = await event.client.send_file(
174
  event.chat_id,
175
  res,
176
- caption=f"`{title}`",
177
  thumb="resources/extras/ultroid.jpg",
178
  )
179
  else:
180
- x = await event.client.send_file(
181
  event.chat_id,
182
  res,
183
- caption=f"`{title}`",
184
  force_document=True,
185
  thumb="resources/extras/ultroid.jpg",
186
  )
@@ -189,36 +194,45 @@ async def download(event):
189
  else:
190
  try:
191
  try:
192
- res = await uploader(kk, kk, tt, xx, "Uploading...")
193
  except MessageNotModifiedError as err:
194
  return await xx.edit(str(err))
195
- if title.endswith((".mp3", ".m4a", ".opus", ".ogg")):
196
  hmm = " | stream"
197
  if " | stream" in hmm:
198
  metadata = extractMetadata(createParser(res.name))
199
  wi = 512
200
  hi = 512
201
  duration = 0
202
- if metadata.has("width"):
203
- wi = metadata.get("width")
204
- if metadata.has("height"):
205
- hi = metadata.get("height")
206
- if metadata.has("duration"):
207
- duration = metadata.get("duration").seconds
208
- if metadata.has("artist"):
209
- artist = metadata.get("artist")
210
- else:
211
- if udB.get("artist"):
212
- artist = udB.get("artist")
213
  else:
214
- artist = ultroid_bot.first_name
215
- if res.name.endswith(tuple([".mkv", ".mp4", ".avi"])):
 
 
 
 
 
 
 
 
 
 
216
  attributes = [
217
  DocumentAttributeVideo(
218
  w=wi, h=hi, duration=duration, supports_streaming=True
219
  )
220
  ]
221
- elif res.name.endswith(tuple([".mp3", ".m4a", ".opus", ".ogg"])):
222
  attributes = [
223
  DocumentAttributeAudio(
224
  duration=duration,
@@ -229,7 +243,7 @@ async def download(event):
229
  else:
230
  attributes = None
231
  try:
232
- x = await event.client.send_file(
233
  event.chat_id,
234
  res,
235
  caption=f"`{title}`",
@@ -238,7 +252,7 @@ async def download(event):
238
  thumb="resources/extras/ultroid.jpg",
239
  )
240
  except BaseException:
241
- x = await event.client.send_file(
242
  event.chat_id,
243
  res,
244
  caption=f"`{title}`",
@@ -246,7 +260,7 @@ async def download(event):
246
  thumb="resources/extras/ultroid.jpg",
247
  )
248
  else:
249
- x = await event.client.send_file(
250
  event.chat_id,
251
  res,
252
  caption=f"`{title}`",
@@ -266,7 +280,7 @@ async def download(event):
266
  size += os.path.getsize(fp)
267
  c = len(os.listdir(kk))
268
  await xx.delete()
269
- await ultroid_bot.send_message(
270
  event.chat_id,
271
  f"Uploaded Total - `{c}` files of `{humanbytes(size)}` in `{t}`",
272
  )
 
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
  ✘ Commands Available -
9
 
 
18
  Reply to file to download.
19
 
20
  """
 
21
  import glob
22
  import os
23
  import time
 
116
  for kk in kk:
117
  try:
118
  try:
119
+ res = await uploader(kk, kk, tt, xx, "Uploading {kk}...")
120
  except MessageNotModifiedError as err:
121
  return await xx.edit(str(err))
122
  title = kk.split("/")[-1]
123
+ if title.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
124
  hmm = " | stream"
125
  if " | stream" in hmm:
126
  metadata = extractMetadata(createParser(res.name))
 
 
127
  wi = 512
128
  hi = 512
129
  duration = 0
130
+ artist = ""
131
+ try:
132
+ if metadata.has("width"):
133
+ wi = metadata.get("width")
134
+ if metadata.has("height"):
135
+ hi = metadata.get("height")
136
+ if metadata.has("duration"):
137
+ duration = metadata.get("duration").seconds
138
+ if metadata.has("artist"):
139
+ artist = metadata.get("artist")
 
140
  else:
141
+ if udB.get("artist"):
142
+ artist = udB.get("artist")
143
+ else:
144
+ artist = ultroid_bot.first_name
145
+ except AttributeError:
146
+ return await event.client.send_file(
147
+ event.chat_id,
148
+ res,
149
+ caption=f"`{kk}/{title}`",
150
+ supports_streaming=True,
151
+ )
152
+ if res.name.endswith((".mkv", ".mp4", ".avi")):
153
  attributes = [
154
  DocumentAttributeVideo(
155
  w=wi, h=hi, duration=duration, supports_streaming=True
156
  )
157
  ]
158
+ elif res.name.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
159
  attributes = [
160
  DocumentAttributeAudio(
161
  duration=duration,
 
166
  else:
167
  attributes = None
168
  try:
169
+ await event.client.send_file(
170
  event.chat_id,
171
  res,
172
+ caption=f"`{kk}`",
173
  attributes=attributes,
174
  supports_streaming=True,
175
  thumb="resources/extras/ultroid.jpg",
176
  )
177
  except BaseException:
178
+ await event.client.send_file(
179
  event.chat_id,
180
  res,
181
+ caption=f"`{kk}`",
182
  thumb="resources/extras/ultroid.jpg",
183
  )
184
  else:
185
+ await event.client.send_file(
186
  event.chat_id,
187
  res,
188
+ caption=f"`{kk}`",
189
  force_document=True,
190
  thumb="resources/extras/ultroid.jpg",
191
  )
 
194
  else:
195
  try:
196
  try:
197
+ res = await uploader(kk, kk, tt, xx, f"Uploading {kk}...")
198
  except MessageNotModifiedError as err:
199
  return await xx.edit(str(err))
200
+ if title.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
201
  hmm = " | stream"
202
  if " | stream" in hmm:
203
  metadata = extractMetadata(createParser(res.name))
204
  wi = 512
205
  hi = 512
206
  duration = 0
207
+ artist = ""
208
+ try:
209
+ if metadata.has("width"):
210
+ wi = metadata.get("width")
211
+ if metadata.has("height"):
212
+ hi = metadata.get("height")
213
+ if metadata.has("duration"):
214
+ duration = metadata.get("duration").seconds
215
+ if metadata.has("artist"):
216
+ artist = metadata.get("artist")
 
217
  else:
218
+ if udB.get("artist"):
219
+ artist = udB.get("artist")
220
+ else:
221
+ artist = ultroid_bot.first_name
222
+ except AttributeError:
223
+ await event.client.send_file(
224
+ event.chat_id,
225
+ res,
226
+ caption=f"`{title}`",
227
+ supports_streaming=True,
228
+ )
229
+ if res.name.endswith((".mkv", ".mp4", ".avi")):
230
  attributes = [
231
  DocumentAttributeVideo(
232
  w=wi, h=hi, duration=duration, supports_streaming=True
233
  )
234
  ]
235
+ elif res.name.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
236
  attributes = [
237
  DocumentAttributeAudio(
238
  duration=duration,
 
243
  else:
244
  attributes = None
245
  try:
246
+ await event.client.send_file(
247
  event.chat_id,
248
  res,
249
  caption=f"`{title}`",
 
252
  thumb="resources/extras/ultroid.jpg",
253
  )
254
  except BaseException:
255
+ await event.client.send_file(
256
  event.chat_id,
257
  res,
258
  caption=f"`{title}`",
 
260
  thumb="resources/extras/ultroid.jpg",
261
  )
262
  else:
263
+ await event.client.send_file(
264
  event.chat_id,
265
  res,
266
  caption=f"`{title}`",
 
280
  size += os.path.getsize(fp)
281
  c = len(os.listdir(kk))
282
  await xx.delete()
283
+ await event.client.send_message(
284
  event.chat_id,
285
  f"Uploaded Total - `{c}` files of `{humanbytes(size)}` in `{t}`",
286
  )
plugins/echo.py CHANGED
@@ -34,7 +34,7 @@ async def echo(e):
34
  try:
35
  user = e.text.split()[1]
36
  if user.startswith("@"):
37
- ok = await ultroid_bot.get_entity(user)
38
  user = ok.id
39
  else:
40
  user = int(user)
@@ -43,7 +43,7 @@ async def echo(e):
43
  if check_echo(e.chat_id, user):
44
  return await eod(e, "Echo already activated for this user.")
45
  add_echo(e.chat_id, user)
46
- ok = await ultroid_bot.get_entity(user)
47
  user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
48
  await eor(e, f"Activated Echo For {user}.")
49
 
@@ -57,7 +57,7 @@ async def rm(e):
57
  try:
58
  user = e.text.split()[1]
59
  if user.startswith("@"):
60
- ok = await ultroid_bot.get_entity(user)
61
  user = ok.id
62
  else:
63
  user = int(user)
@@ -65,7 +65,7 @@ async def rm(e):
65
  return await eod(e, "Reply To A User.")
66
  if check_echo(e.chat_id, user):
67
  rem_echo(e.chat_id, user)
68
- ok = await ultroid_bot.get_entity(user)
69
  user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
70
  return await eor(e, f"Deactivated Echo For {user}.")
71
  await eor(e, "Echo not activated for this user")
@@ -75,8 +75,8 @@ async def rm(e):
75
  async def okk(e):
76
  if check_echo(e.chat_id, e.sender_id):
77
  try:
78
- ok = await bot.get_messages(e.chat_id, ids=e.id)
79
- return await ultroid_bot.send_message(e.chat_id, ok)
80
  except Exception as er:
81
  LOGS.info(er)
82
 
@@ -87,7 +87,7 @@ async def lstecho(e):
87
  if k:
88
  user = "**Activated Echo For Users:**\n\n"
89
  for x in k:
90
- ok = await ultroid_bot.get_entity(int(x))
91
  kk = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
92
  user += "•" + kk + "\n"
93
  await eor(e, user)
 
34
  try:
35
  user = e.text.split()[1]
36
  if user.startswith("@"):
37
+ ok = await e.client.get_entity(user)
38
  user = ok.id
39
  else:
40
  user = int(user)
 
43
  if check_echo(e.chat_id, user):
44
  return await eod(e, "Echo already activated for this user.")
45
  add_echo(e.chat_id, user)
46
+ ok = await e.client.get_entity(user)
47
  user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
48
  await eor(e, f"Activated Echo For {user}.")
49
 
 
57
  try:
58
  user = e.text.split()[1]
59
  if user.startswith("@"):
60
+ ok = await e.client.get_entity(user)
61
  user = ok.id
62
  else:
63
  user = int(user)
 
65
  return await eod(e, "Reply To A User.")
66
  if check_echo(e.chat_id, user):
67
  rem_echo(e.chat_id, user)
68
+ ok = await e.client.get_entity(user)
69
  user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
70
  return await eor(e, f"Deactivated Echo For {user}.")
71
  await eor(e, "Echo not activated for this user")
 
75
  async def okk(e):
76
  if check_echo(e.chat_id, e.sender_id):
77
  try:
78
+ ok = await e.client.get_messages(e.chat_id, ids=e.id)
79
+ return await e.client.send_message(e.chat_id, ok)
80
  except Exception as er:
81
  LOGS.info(er)
82
 
 
87
  if k:
88
  user = "**Activated Echo For Users:**\n\n"
89
  for x in k:
90
+ ok = await e.client.get_entity(int(x))
91
  kk = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
92
  user += "•" + kk + "\n"
93
  await eor(e, user)
plugins/evaljs.py CHANGED
@@ -4,22 +4,20 @@
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
  """
9
  ✘ Commands Available -
10
  • `{i}evaljs <javaScriptCommands>`
11
  Evaluate JavaScript code and upload.
12
  """
13
-
14
  # Inbuilt
15
  import os
16
  import time
17
  from threading import Thread
18
 
19
- # Ultroid
20
  from . import *
21
 
22
 
 
23
  async def evalJs(
24
  event,
25
  startTime: float,
@@ -34,14 +32,14 @@ async def evalJs(
34
  scriptFile.close()
35
  os.system(f"node ./src/ecmaHelper/eval.d.js")
36
  if os.path.exists("./src/ecmaHelper/evalJs.result.d.txt"):
37
- await ultroid_bot.send_file(
38
  event.chat_id,
39
  "./src/ecmaHelper/evalJs.result.d.txt",
40
  force_document=True,
41
  caption=f"**☞ evalJS\n\n• Command:**\n`{command}` \n\n**• TimeTaken:**\n`{time.time() - startTime:.2f}s` \n\n**• Result:**\n`[Info]: Uploaded File For Better Visualisation Of Indents.`",
42
  )
43
  else:
44
- await ultroid_bot.send_file(
45
  event.chat_id,
46
  "./src/ecmaHelper/evalJs.result.d.txt",
47
  force_document=True,
 
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
  ✘ Commands Available -
9
  • `{i}evaljs <javaScriptCommands>`
10
  Evaluate JavaScript code and upload.
11
  """
 
12
  # Inbuilt
13
  import os
14
  import time
15
  from threading import Thread
16
 
 
17
  from . import *
18
 
19
 
20
+ # Ultroid
21
  async def evalJs(
22
  event,
23
  startTime: float,
 
32
  scriptFile.close()
33
  os.system(f"node ./src/ecmaHelper/eval.d.js")
34
  if os.path.exists("./src/ecmaHelper/evalJs.result.d.txt"):
35
+ await event.client.send_file(
36
  event.chat_id,
37
  "./src/ecmaHelper/evalJs.result.d.txt",
38
  force_document=True,
39
  caption=f"**☞ evalJS\n\n• Command:**\n`{command}` \n\n**• TimeTaken:**\n`{time.time() - startTime:.2f}s` \n\n**• Result:**\n`[Info]: Uploaded File For Better Visualisation Of Indents.`",
40
  )
41
  else:
42
+ await event.client.send_file(
43
  event.chat_id,
44
  "./src/ecmaHelper/evalJs.result.d.txt",
45
  force_document=True,
plugins/extra.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -20,7 +19,6 @@
20
  • `{i}reply`
21
  Reply the last sent msg to replied user.
22
  """
23
-
24
  import asyncio
25
 
26
  from telethon.events import NewMessage as NewMsg
@@ -51,11 +49,7 @@ async def delete_it(delme):
51
  await msg_src.delete()
52
  await delme.delete()
53
  except Exception as e:
54
- await eod(
55
- delme,
56
- f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`",
57
- time=5,
58
- )
59
 
60
 
61
  @ultroid_cmd(
@@ -68,7 +62,7 @@ async def copy(e):
68
  await eor(e, reply.text)
69
  else:
70
  await reply.reply(reply)
71
- if e.sender_id == ultroid_bot.uid:
72
  await e.delete()
73
  else:
74
  await eod(e, "`Reply To any message`")
@@ -90,7 +84,7 @@ async def editer(edit):
90
  pass
91
  else:
92
  i = 1
93
- async for message in ultroid_bot.iter_messages(chat, ultroid_bot.uid):
94
  if i == 2:
95
  await message.edit(string)
96
  await edit.delete()
 
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
  ✘ Commands Available -
9
 
 
19
  • `{i}reply`
20
  Reply the last sent msg to replied user.
21
  """
 
22
  import asyncio
23
 
24
  from telethon.events import NewMessage as NewMsg
 
49
  await msg_src.delete()
50
  await delme.delete()
51
  except Exception as e:
52
+ await eod(delme, f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`")
 
 
 
 
53
 
54
 
55
  @ultroid_cmd(
 
62
  await eor(e, reply.text)
63
  else:
64
  await reply.reply(reply)
65
+ if e.out:
66
  await e.delete()
67
  else:
68
  await eod(e, "`Reply To any message`")
 
84
  pass
85
  else:
86
  i = 1
87
+ async for message in edit.client.iter_messages(chat, ultroid_bot.uid):
88
  if i == 2:
89
  await message.edit(string)
90
  await edit.delete()
plugins/fakeaction.py CHANGED
@@ -19,6 +19,9 @@
19
 
20
  • `{i}fgame <time/in secs>`
21
  `Show Fake Game Playing Action in current chat. `
 
 
 
22
  """
23
 
24
  from . import *
@@ -94,3 +97,10 @@ async def _(e):
94
  await eod(e, f"Starting Fake Game Playing For {t} sec.")
95
  async with e.client.action(e.chat_id, "game"):
96
  await asyncio.sleep(t)
 
 
 
 
 
 
 
 
19
 
20
  • `{i}fgame <time/in secs>`
21
  `Show Fake Game Playing Action in current chat. `
22
+
23
+ • `{i}stopaction`
24
+ `Stop any ongoing Chat Action going in Chat.`
25
  """
26
 
27
  from . import *
 
97
  await eod(e, f"Starting Fake Game Playing For {t} sec.")
98
  async with e.client.action(e.chat_id, "game"):
99
  await asyncio.sleep(t)
100
+
101
+
102
+ @ultroid_cmd(pattern="stopaction")
103
+ async def do_it(e):
104
+ async with e.client.action(e.chat_id, "cancel"):
105
+ pass
106
+ await e.reply("Fake Action Stopped.")
plugins/fedutils.py CHANGED
@@ -4,7 +4,6 @@
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
  """
9
  ✘ Commands Available -
10
 
@@ -22,7 +21,6 @@ Specify FBan Group and Feds to exclude in the assistant.
22
  • `{i}fedinfo <(fedid)>`
23
  Collect federation info of the given fed id, or of the fed you own, from Rose.
24
  """
25
-
26
  import asyncio
27
  import os
28
 
@@ -33,13 +31,13 @@ from . import *
33
  bot = "@MissRose_bot"
34
 
35
 
36
- @ultroid_cmd(pattern="superfban ?(.*)")
37
  async def _(event):
38
  msg = await eor(event, "Starting a Mass-FedBan...")
39
  if event.reply_to_msg_id:
40
  previous_message = await event.get_reply_message()
41
  if previous_message.media:
42
- downloaded_file_name = await ultroid.download_media(
43
  previous_message,
44
  "fedlist",
45
  )
@@ -85,7 +83,7 @@ async def _(event):
85
  except BaseException:
86
  return await msg.edit("Give username or id.")
87
  try:
88
- x = await ultroid_bot.get_entity(usr)
89
  uid = x.id
90
  except BaseException:
91
  return await msg.edit("Incorrect user was designated.")
@@ -100,7 +98,7 @@ async def _(event):
100
  fedList = []
101
  if not len(fedList):
102
  for a in range(3):
103
- async with ultroid.conversation("@MissRose_bot") as bot_conv:
104
  await bot_conv.send_message("/start")
105
  await asyncio.sleep(3)
106
  await bot_conv.send_message("/myfeds")
@@ -175,9 +173,9 @@ async def _(event):
175
  await ultroid.send_message(chat, f"{fed} Excluded.")
176
  exCount += 1
177
  continue
178
- await ultroid.send_message(chat, f"/joinfed {fed}")
179
  await asyncio.sleep(3)
180
- await ultroid.send_message(chat, f"/fban {uid} {REASON}")
181
  await asyncio.sleep(3)
182
  try:
183
  os.remove("fedlist")
@@ -188,7 +186,7 @@ async def _(event):
188
  )
189
 
190
 
191
- @ultroid_cmd(pattern="superunfban ?(.*)")
192
  async def _(event):
193
  msg = await eor(event, "Starting a Mass-UnFedBan...")
194
  fedList = []
@@ -241,7 +239,7 @@ async def _(event):
241
  chat = await event.get_chat()
242
  if not len(fedList):
243
  for a in range(3):
244
- async with ultroid.conversation("@MissRose_bot") as bot_conv:
245
  await bot_conv.send_message("/start")
246
  await asyncio.sleep(3)
247
  await bot_conv.send_message("/myfeds")
@@ -301,7 +299,7 @@ async def _(event):
301
  return
302
  await msg.edit(f"UnFBaning in {len(fedList)} feds.")
303
  try:
304
- await ultroid.send_message(chat, f"/start")
305
  except BaseException:
306
  await msg.edit("Specified FBan Group ID is incorrect.")
307
  return
@@ -313,7 +311,7 @@ async def _(event):
313
  exCount = 0
314
  for fed in fedList:
315
  if udB.get("EXCLUDE_FED") and fed in excludeFed:
316
- await ultroid.send_message(chat, f"{fed} Excluded.")
317
  exCount += 1
318
  continue
319
  await ultroid.send_message(chat, f"/joinfed {fed}")
@@ -329,7 +327,7 @@ async def _(event):
329
  )
330
 
331
 
332
- @ultroid_cmd(pattern="fstat ?(.*)")
333
  async def _(event):
334
  ok = await eor(event, "`Checking...`")
335
  if event.reply_to_msg_id:
@@ -347,7 +345,7 @@ async def _(event):
347
  )
348
  return
349
  else:
350
- async with ultroid.conversation(bot) as conv:
351
  try:
352
  await conv.send_message("/start")
353
  await conv.get_response()
@@ -361,7 +359,7 @@ async def _(event):
361
  await audio.click(0)
362
  await asyncio.sleep(2)
363
  audio = await conv.get_response()
364
- await ultroid.send_file(
365
  event.chat_id,
366
  audio,
367
  caption=f"List of feds {user} has been banned in.\n\nCollected using Ultroid.",
@@ -376,11 +374,11 @@ async def _(event):
376
  await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
377
 
378
 
379
- @ultroid_cmd(pattern="fedinfo ?(.*)")
380
  async def _(event):
381
  ok = await event.edit("`Extracting information...`")
382
  sysarg = event.pattern_match.group(1)
383
- async with ultroid.conversation(bot) as conv:
384
  try:
385
  await conv.send_message("/start")
386
  await conv.get_response()
 
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
  ✘ Commands Available -
9
 
 
21
  • `{i}fedinfo <(fedid)>`
22
  Collect federation info of the given fed id, or of the fed you own, from Rose.
23
  """
 
24
  import asyncio
25
  import os
26
 
 
31
  bot = "@MissRose_bot"
32
 
33
 
34
+ @ultroid_cmd(pattern="superfban ?(.*)", ignore_dualmode=True)
35
  async def _(event):
36
  msg = await eor(event, "Starting a Mass-FedBan...")
37
  if event.reply_to_msg_id:
38
  previous_message = await event.get_reply_message()
39
  if previous_message.media:
40
+ downloaded_file_name = await event.client.download_media(
41
  previous_message,
42
  "fedlist",
43
  )
 
83
  except BaseException:
84
  return await msg.edit("Give username or id.")
85
  try:
86
+ x = await event.client.get_entity(usr)
87
  uid = x.id
88
  except BaseException:
89
  return await msg.edit("Incorrect user was designated.")
 
98
  fedList = []
99
  if not len(fedList):
100
  for a in range(3):
101
+ async with event.client.conversation("@MissRose_bot") as bot_conv:
102
  await bot_conv.send_message("/start")
103
  await asyncio.sleep(3)
104
  await bot_conv.send_message("/myfeds")
 
173
  await ultroid.send_message(chat, f"{fed} Excluded.")
174
  exCount += 1
175
  continue
176
+ await event.client.send_message(chat, f"/joinfed {fed}")
177
  await asyncio.sleep(3)
178
+ await event.client.send_message(chat, f"/fban {uid} {REASON}")
179
  await asyncio.sleep(3)
180
  try:
181
  os.remove("fedlist")
 
186
  )
187
 
188
 
189
+ @ultroid_cmd(pattern="superunfban ?(.*)", ignore_dualmode=True)
190
  async def _(event):
191
  msg = await eor(event, "Starting a Mass-UnFedBan...")
192
  fedList = []
 
239
  chat = await event.get_chat()
240
  if not len(fedList):
241
  for a in range(3):
242
+ async with event.client.conversation("@MissRose_bot") as bot_conv:
243
  await bot_conv.send_message("/start")
244
  await asyncio.sleep(3)
245
  await bot_conv.send_message("/myfeds")
 
299
  return
300
  await msg.edit(f"UnFBaning in {len(fedList)} feds.")
301
  try:
302
+ await event.client.send_message(chat, f"/start")
303
  except BaseException:
304
  await msg.edit("Specified FBan Group ID is incorrect.")
305
  return
 
311
  exCount = 0
312
  for fed in fedList:
313
  if udB.get("EXCLUDE_FED") and fed in excludeFed:
314
+ await event.client.send_message(chat, f"{fed} Excluded.")
315
  exCount += 1
316
  continue
317
  await ultroid.send_message(chat, f"/joinfed {fed}")
 
327
  )
328
 
329
 
330
+ @ultroid_cmd(pattern="fstat ?(.*)", ignore_dualmode=True)
331
  async def _(event):
332
  ok = await eor(event, "`Checking...`")
333
  if event.reply_to_msg_id:
 
345
  )
346
  return
347
  else:
348
+ async with event.client.conversation(bot) as conv:
349
  try:
350
  await conv.send_message("/start")
351
  await conv.get_response()
 
359
  await audio.click(0)
360
  await asyncio.sleep(2)
361
  audio = await conv.get_response()
362
+ await event.client.send_file(
363
  event.chat_id,
364
  audio,
365
  caption=f"List of feds {user} has been banned in.\n\nCollected using Ultroid.",
 
374
  await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
375
 
376
 
377
+ @ultroid_cmd(pattern="fedinfo ?(.*)", ignore_dualmode=True)
378
  async def _(event):
379
  ok = await event.edit("`Extracting information...`")
380
  sysarg = event.pattern_match.group(1)
381
+ async with event.client.conversation(bot) as conv:
382
  try:
383
  await conv.send_message("/start")
384
  await conv.get_response()
plugins/filter.py CHANGED
@@ -19,6 +19,7 @@
19
  """
20
 
21
  import os
 
22
 
23
  from pyUltroid.functions.filter_db import *
24
  from telegraph import upload_file as uf
@@ -38,14 +39,14 @@ async def af(e):
38
  if wt and wt.media:
39
  wut = mediainfo(wt.media)
40
  if wut.startswith(("pic", "gif")):
41
- dl = await bot.download_media(wt.media)
42
  variable = uf(dl)
43
  m = "https://telegra.ph" + variable[0]
44
  elif wut == "video":
45
  if wt.media.document.size > 8 * 1000 * 1000:
46
  return await eod(x, "`Unsupported Media`")
47
  else:
48
- dl = await bot.download_media(wt.media)
49
  variable = uf(dl)
50
  os.remove(dl)
51
  m = "https://telegra.ph" + variable[0]
@@ -88,22 +89,11 @@ async def fl(e):
88
  chat = e.chat_id
89
  x = get_filter(int(chat))
90
  if x:
91
- if " " in xx:
92
- xx = xx.split(" ")
93
- kk = ""
94
- for c in xx:
95
- if c in x:
96
- k = get_reply(int(chat), c)
97
- if k:
98
- kk = k
99
- if kk:
100
- msg = k["msg"]
101
- media = k["media"]
102
- await e.reply(msg, file=media)
103
-
104
- else:
105
- k = get_reply(chat, xx)
106
- if k:
107
- msg = k["msg"]
108
- media = k["media"]
109
- await e.reply(msg, file=media)
 
19
  """
20
 
21
  import os
22
+ import re
23
 
24
  from pyUltroid.functions.filter_db import *
25
  from telegraph import upload_file as uf
 
39
  if wt and wt.media:
40
  wut = mediainfo(wt.media)
41
  if wut.startswith(("pic", "gif")):
42
+ dl = await wt.download_media()
43
  variable = uf(dl)
44
  m = "https://telegra.ph" + variable[0]
45
  elif wut == "video":
46
  if wt.media.document.size > 8 * 1000 * 1000:
47
  return await eod(x, "`Unsupported Media`")
48
  else:
49
+ dl = await wt.download_media()
50
  variable = uf(dl)
51
  os.remove(dl)
52
  m = "https://telegra.ph" + variable[0]
 
89
  chat = e.chat_id
90
  x = get_filter(int(chat))
91
  if x:
92
+ for c in x:
93
+ pat = r"( |^|[^\w])" + re.escape(c) + r"( |$|[^\w])"
94
+ if re.search(pat, xx):
95
+ k = get_reply(int(chat), c)
96
+ if k:
97
+ msg = k["msg"]
98
+ media = k["media"]
99
+ await e.reply(msg, file=media)