Anonymous xditya Danish Amit Sharma sppidy Arnab Paryali divkix hellboi_atul Programming Error New-dev0 commited on
Commit
83c6c4d
·
1 Parent(s): 8ff64cd

Ultroid v0.0.8 | 17-6-21

Browse files

Co-authored-by: Aditya <[email protected]>
Co-authored-by: Danish <[email protected]>
Co-authored-by: Amit Sharma <[email protected]>
Co-authored-by: sppidy <[email protected]>
Co-authored-by: Arnab Paryali <[email protected]>
Co-authored-by: divkix <[email protected]>
Co-authored-by: hellboi_atul <[email protected]>
Co-authored-by: Programming Error <[email protected]>
Co-authored-by: New-dev0 <[email protected]>

This view is limited to 50 files because it contains too many changes.   See raw diff
.gitignore CHANGED
@@ -1,21 +1,24 @@
1
  .env
2
- venv/
3
- __pycache__
4
- ultroid.session-journal
5
- ultroid.session
6
  *.mp3
7
  *.webm
8
  *.webp
9
  *.mp4
10
  *.tgs
11
- .vscode/*
12
  /*.jpg
13
  /*.png
14
  /*.mp4
15
- addons/
16
- ultroid.log
17
  target/npmlist.json
 
 
 
 
 
18
  node_modules/
19
  glitch_me/
20
- .idea
21
- venv/
 
 
1
  .env
2
+ *.session-journal
3
+ *.session
4
+ build
 
5
  *.mp3
6
  *.webm
7
  *.webp
8
  *.mp4
9
  *.tgs
 
10
  /*.jpg
11
  /*.png
12
  /*.mp4
13
+ *.log
 
14
  target/npmlist.json
15
+ package-lock.json
16
+ # Directories
17
+ addons/
18
+ __pycache__/
19
+ venv/
20
  node_modules/
21
  glitch_me/
22
+ .idea/
23
+ .vscode/
24
+ temp/
Dockerfile CHANGED
@@ -1,19 +1,18 @@
1
  # Ultroid - UserBot
2
- # Copyright (C) 2020 TeamUltroid
3
  # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
4
  # PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
5
 
6
- FROM programmingerror/ultroid:v0.0.2
7
 
8
  ENV TZ=Asia/Kolkata
9
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
10
- RUN apt-get autoremove --purge
11
 
12
  RUN git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/
13
 
14
  WORKDIR /root/TeamUltroid/
15
 
16
- RUN pip3 install -r requirements.txt
17
- RUN npm install -g npm@7.12.1 -g
18
  RUN npm install
19
  RUN npm run build
 
1
  # Ultroid - UserBot
2
+ # Copyright (C) 2021 TeamUltroid
3
  # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
4
  # PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
5
 
6
+ FROM programmingerror/ultroid:b0.1
7
 
8
  ENV TZ=Asia/Kolkata
9
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
10
 
11
  RUN git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/
12
 
13
  WORKDIR /root/TeamUltroid/
14
 
15
+ RUN pip3 install --no-cache-dir -r requirements.txt
16
+ RUN npm install -g npm@7.16.0 -g
17
  RUN npm install
18
  RUN npm run build
app.json CHANGED
@@ -48,13 +48,9 @@
48
  }
49
  },
50
  "formation": {
51
- "worker": {
52
  "quantity": 1,
53
  "size": "free"
54
- },
55
- "web": {
56
- "quantity": 0,
57
- "size": "free"
58
  }
59
  }
60
  }
 
48
  }
49
  },
50
  "formation": {
51
+ "ultroid": {
52
  "quantity": 1,
53
  "size": "free"
 
 
 
 
54
  }
55
  }
56
  }
assistant/__init__.py CHANGED
@@ -1,5 +1,5 @@
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
 
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
assistant/api_setter.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -16,15 +16,14 @@ async def apiset(event):
16
  await event.edit(
17
  get_string("ast_1"),
18
  buttons=[
19
- [Button.inline("Remove.bg", data="rmbg")],
 
 
20
  [Button.inline("« Back", data="setter")],
21
  ],
22
  )
23
 
24
 
25
- # remove.bg api
26
-
27
-
28
  @callback("rmbg")
29
  @owner
30
  async def rmbgapi(event):
@@ -48,3 +47,53 @@ async def rmbgapi(event):
48
  f"{name} changed to {themssg}",
49
  buttons=get_back_button("apiset"),
50
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
16
  await event.edit(
17
  get_string("ast_1"),
18
  buttons=[
19
+ [Button.inline("Remove.bg API", data="rmbg")],
20
+ [Button.inline("DEEP API", data="dapi")],
21
+ [Button.inline("OCR API", data="oapi")],
22
  [Button.inline("« Back", data="setter")],
23
  ],
24
  )
25
 
26
 
 
 
 
27
  @callback("rmbg")
28
  @owner
29
  async def rmbgapi(event):
 
47
  f"{name} changed to {themssg}",
48
  buttons=get_back_button("apiset"),
49
  )
50
+
51
+
52
+ @callback("dapi")
53
+ @owner
54
+ async def rmbgapi(event):
55
+ await event.delete()
56
+ pru = event.sender_id
57
+ var = "DEEP_API"
58
+ name = "DEEP AI API Key"
59
+ async with event.client.conversation(pru) as conv:
60
+ await conv.send_message("Get Your Deep Api from deepai.org and send here.")
61
+ response = conv.wait_event(events.NewMessage(chats=pru))
62
+ response = await response
63
+ themssg = response.message.message
64
+ if themssg == "/cancel":
65
+ return await conv.send_message(
66
+ "Cancelled!!",
67
+ buttons=get_back_button("apiset"),
68
+ )
69
+ else:
70
+ await setit(event, var, themssg)
71
+ await conv.send_message(
72
+ f"{name} changed to {themssg}",
73
+ buttons=get_back_button("apiset"),
74
+ )
75
+
76
+
77
+ @callback("oapi")
78
+ @owner
79
+ async def rmbgapi(event):
80
+ await event.delete()
81
+ pru = event.sender_id
82
+ var = "OCR_API"
83
+ name = "OCR API Key"
84
+ async with event.client.conversation(pru) as conv:
85
+ await conv.send_message("Get Your OCR api from ocr.space Send Send Here.")
86
+ response = conv.wait_event(events.NewMessage(chats=pru))
87
+ response = await response
88
+ themssg = response.message.message
89
+ if themssg == "/cancel":
90
+ return await conv.send_message(
91
+ "Cancelled!!",
92
+ buttons=get_back_button("apiset"),
93
+ )
94
+ else:
95
+ await setit(event, var, themssg)
96
+ await conv.send_message(
97
+ f"{name} changed to {themssg}",
98
+ buttons=get_back_button("apiset"),
99
+ )
assistant/inlinestuff.py CHANGED
@@ -1,15 +1,16 @@
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
  import base64
 
 
9
  from random import choice
10
  from re import compile as re_compile
11
  from re import findall
12
- from urllib.request import urlopen
13
 
14
  import requests
15
  from bs4 import BeautifulSoup
@@ -19,6 +20,8 @@ from search_engine_parser import GoogleSearch, YahooSearch
19
  from telethon import Button
20
  from telethon.tl.types import InputWebDocument as wb
21
 
 
 
22
  from . import *
23
  from . import humanbytes as hb
24
 
@@ -153,15 +156,7 @@ async def repo(e):
153
  description="Userbot | Telethon",
154
  thumb=wb(ultpic, 0, "image/jpeg", []),
155
  text="• **ULTROID USERBOT** •",
156
- buttons=[
157
- [
158
- Button.url("Repo", url="https://github.com/TeamUltroid/Ultroid"),
159
- Button.url(
160
- "Addons", url="https://github.com/TeamUltroid/UltroidAddons"
161
- ),
162
- ],
163
- [Button.url("Support", url="t.me/UltroidSupport")],
164
- ],
165
  ),
166
  ]
167
  await e.answer(res, switch_pm="Ultroid Repo.", switch_pm_param="start")
@@ -426,22 +421,75 @@ async def _(e):
426
  await e.answer(modss, switch_pm="Search Mod Applications.", switch_pm_param="start")
427
 
428
 
429
- @in_pattern("clipart")
430
  @in_owner
431
  async def clip(e):
432
  try:
433
  quer = e.text.split(" ", maxsplit=1)[1]
434
  except IndexError:
435
- await e.answer([], switch_pm="ClipArt Search.", switch_pm_param="start")
 
 
 
436
  quer = quer.replace(" ", "+")
437
- sear = f"https://clipartix.com/search/{quer}"
438
- html = urlopen(sear)
439
- bs = BeautifulSoup(html, "html.parser", from_encoding="utf-8")
440
- resul = bs.find_all("img", "attachment-full size-full")
 
 
 
 
 
441
  buil = e.builder
 
 
 
 
 
 
 
 
442
  hm = []
443
- for res in resul:
444
- hm += [buil.photo(include_media=True, file=res["src"])]
445
- await e.answer(
446
- hm, gallery=True, switch_pm="Clipart Searcher.", switch_pm_param="start"
447
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  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
 
14
 
15
  import requests
16
  from bs4 import BeautifulSoup
 
20
  from telethon import Button
21
  from telethon.tl.types import InputWebDocument as wb
22
 
23
+ from plugins._inline import SUP_BUTTONS
24
+
25
  from . import *
26
  from . import humanbytes as hb
27
 
 
156
  description="Userbot | Telethon",
157
  thumb=wb(ultpic, 0, "image/jpeg", []),
158
  text="• **ULTROID USERBOT** •",
159
+ buttons=SUP_BUTTONS,
 
 
 
 
 
 
 
 
160
  ),
161
  ]
162
  await e.answer(res, switch_pm="Ultroid Repo.", switch_pm_param="start")
 
421
  await e.answer(modss, switch_pm="Search Mod Applications.", switch_pm_param="start")
422
 
423
 
424
+ @in_pattern("ebooks")
425
  @in_owner
426
  async def clip(e):
427
  try:
428
  quer = e.text.split(" ", maxsplit=1)[1]
429
  except IndexError:
430
+ await e.answer(
431
+ [], switch_pm="Enter Query to Look for EBook", switch_pm_param="start"
432
+ )
433
+ return
434
  quer = quer.replace(" ", "+")
435
+ sear = f"http://www.gutenberg.org/ebooks/search/?query={quer}&submit_search=Go%21"
436
+ magma = requests.get(sear).content
437
+ bs = BeautifulSoup(magma, "html.parser", from_encoding="utf-8")
438
+ out = bs.find_all("img")
439
+ Alink = bs.find_all("a", "link")
440
+ if len(out) == 0:
441
+ return await e.answer(
442
+ [], switch_pm="No Results Found !", switch_pm_param="start"
443
+ )
444
  buil = e.builder
445
+ dont_take = [
446
+ "Authors",
447
+ "Did you mean",
448
+ "Sort Alpha",
449
+ "Sort by",
450
+ "Subjects",
451
+ "Bookshelves",
452
+ ]
453
  hm = []
454
+ titles = []
455
+ for num in Alink:
456
+ try:
457
+ rt = num.find("span", "title").text
458
+ if not rt.startswith(tuple(dont_take)):
459
+ titles.append(rt)
460
+ except BaseException:
461
+ pass
462
+ for rs in range(len(out)):
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)
assistant/localization.py CHANGED
@@ -1,5 +1,5 @@
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
 
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
assistant/othervars.py CHANGED
@@ -1,12 +1,14 @@
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
  import re
 
9
  from os import remove
 
10
 
11
  import requests
12
  from telegraph import Telegraph
@@ -24,9 +26,14 @@ auth_url = r["auth_url"]
24
  TOKEN_FILE = "resources/auths/auth_token.txt"
25
 
26
 
27
- @callback(re.compile("sndplug_(.*)"))
 
 
28
  async def send(eve):
29
  name = (eve.data_match.group(1)).decode("UTF-8")
 
 
 
30
  if name.startswith("def"):
31
  plug_name = name.replace(f"def_plugin_", "")
32
  plugin = f"plugins/{plug_name}.py"
@@ -57,7 +64,7 @@ async def send(eve):
57
  Button.inline("••Cʟᴏꜱᴇ••", data="close"),
58
  ],
59
  ]
60
- await eve.edit(file=plugin, buttons=buttons)
61
 
62
 
63
  @callback("updatenow")
@@ -74,14 +81,12 @@ async def update(eve):
74
  heroku_app = None
75
  heroku_applications = heroku.apps()
76
  except BaseException:
77
- return await eve.edit(
78
- "`Invalid Heroku credentials for updating userbot dyno.`"
79
- )
80
  for app in heroku_applications:
81
  if app.name == Var.HEROKU_APP_NAME:
82
  heroku_app = app
83
  if not heroku_app:
84
- await eve.edit("`Invalid Heroku credentials for updating userbot dyno.`")
85
  repo.__del__()
86
  return
87
  await eve.edit(
@@ -105,6 +110,9 @@ async def update(eve):
105
  return
106
  await eve.edit("`Successfully Updated!\nRestarting, please wait...`")
107
  else:
 
 
 
108
  try:
109
  ups_rem.pull(ac_br)
110
  except GitCommandError:
@@ -143,7 +151,11 @@ async def changes(okk):
143
  )
144
 
145
 
146
- @callback(re.compile("pasta-(.*)"))
 
 
 
 
147
  @owner
148
  async def _(e):
149
  ok = (e.data_match.group(1)).decode("UTF-8")
@@ -296,6 +308,7 @@ async def otvaar(event):
296
  Button.inline("Eᴍᴏᴊɪ ɪɴ Hᴇʟᴘ", data="emoj"),
297
  Button.inline("Sᴇᴛ ɢDʀɪᴠᴇ", data="gdrive"),
298
  ],
 
299
  [Button.inline("« Bᴀᴄᴋ", data="setter")],
300
  ],
301
  )
@@ -405,7 +418,27 @@ async def hndlrr(event):
405
 
406
  @callback("taglog")
407
  @owner
408
- async def tagloggerr(event):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  await event.delete()
410
  pru = event.sender_id
411
  var = "TAG_LOG"
@@ -420,13 +453,13 @@ async def tagloggerr(event):
420
  if themssg == "/cancel":
421
  return await conv.send_message(
422
  "Cancelled!!",
423
- buttons=get_back_button("otvars"),
424
  )
425
  else:
426
  await setit(event, var, themssg)
427
  await conv.send_message(
428
  f"{name} changed to {themssg}",
429
- buttons=get_back_button("otvars"),
430
  )
431
 
432
 
@@ -1039,3 +1072,48 @@ async def name(event):
1039
  ),
1040
  buttons=get_back_button("vcb"),
1041
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  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
 
26
  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")
34
+ thumb = ""
35
+ for m in choices(sorted(glob("resources/extras/*.jpg"))):
36
+ thumb += m
37
  if name.startswith("def"):
38
  plug_name = name.replace(f"def_plugin_", "")
39
  plugin = f"plugins/{plug_name}.py"
 
64
  Button.inline("••Cʟᴏꜱᴇ••", data="close"),
65
  ],
66
  ]
67
+ await eve.edit(file=plugin, thumb=thumb, buttons=buttons)
68
 
69
 
70
  @callback("updatenow")
 
81
  heroku_app = None
82
  heroku_applications = heroku.apps()
83
  except BaseException:
84
+ return await eve.edit("`Wrong HEROKU_API.`")
 
 
85
  for app in heroku_applications:
86
  if app.name == Var.HEROKU_APP_NAME:
87
  heroku_app = app
88
  if not heroku_app:
89
+ await eve.edit("`Wrong HEROKU_APP_NAME.`")
90
  repo.__del__()
91
  return
92
  await eve.edit(
 
110
  return
111
  await eve.edit("`Successfully Updated!\nRestarting, please wait...`")
112
  else:
113
+ await eve.edit(
114
+ "`Userbot dyno build in progress, please wait for it to complete.`"
115
+ )
116
  try:
117
  ups_rem.pull(ac_br)
118
  except GitCommandError:
 
151
  )
152
 
153
 
154
+ @callback(
155
+ re.compile(
156
+ "pasta-(.*)",
157
+ ),
158
+ )
159
  @owner
160
  async def _(e):
161
  ok = (e.data_match.group(1)).decode("UTF-8")
 
308
  Button.inline("Eᴍᴏᴊɪ ɪɴ Hᴇʟᴘ", data="emoj"),
309
  Button.inline("Sᴇᴛ ɢDʀɪᴠᴇ", data="gdrive"),
310
  ],
311
+ [Button.inline("Inline Pic", data="inli_pic")],
312
  [Button.inline("« Bᴀᴄᴋ", data="setter")],
313
  ],
314
  )
 
418
 
419
  @callback("taglog")
420
  @owner
421
+ async def tagloggrr(e):
422
+ await e.edit(
423
+ "Choose Options",
424
+ buttons=[
425
+ [Button.inline("SET TAG LOG", data="settag")],
426
+ [Button.inline("DELETE TAG LOG", data="deltag")],
427
+ [Button.inline("« Bᴀᴄᴋ", data="otvars")],
428
+ ],
429
+ )
430
+
431
+
432
+ @callback("deltag")
433
+ @owner
434
+ async def delfuk(e):
435
+ udB.delete("TAG_LOG")
436
+ await e.answer("Done!!! TAG lOG Off")
437
+
438
+
439
+ @callback("settag")
440
+ @owner
441
+ async def taglogerr(event):
442
  await event.delete()
443
  pru = event.sender_id
444
  var = "TAG_LOG"
 
453
  if themssg == "/cancel":
454
  return await conv.send_message(
455
  "Cancelled!!",
456
+ buttons=get_back_button("taglog"),
457
  )
458
  else:
459
  await setit(event, var, themssg)
460
  await conv.send_message(
461
  f"{name} changed to {themssg}",
462
+ buttons=get_back_button("taglog"),
463
  )
464
 
465
 
 
1072
  ),
1073
  buttons=get_back_button("vcb"),
1074
  )
1075
+
1076
+
1077
+ @callback("inli_pic")
1078
+ @owner
1079
+ async def media(event):
1080
+ await event.delete()
1081
+ pru = event.sender_id
1082
+ var = "INLINE_PIC"
1083
+ name = "Inline Media"
1084
+ async with event.client.conversation(pru) as conv:
1085
+ await conv.send_message(
1086
+ "**Inline Media**\nSend me a pic/gif/ or link to set as inline media.\n\nUse /cancel to terminate the operation.",
1087
+ )
1088
+ response = await conv.get_response()
1089
+ try:
1090
+ themssg = response.message.message
1091
+ if themssg == "/cancel":
1092
+ return await conv.send_message(
1093
+ "Operation cancelled!!",
1094
+ buttons=get_back_button("setter"),
1095
+ )
1096
+ except BaseException:
1097
+ pass
1098
+ media = await event.client.download_media(response, "inlpic")
1099
+ if (
1100
+ not (response.text).startswith("/")
1101
+ and not response.text == ""
1102
+ and not response.media
1103
+ ):
1104
+ url = response.text
1105
+ else:
1106
+ try:
1107
+ x = upl(media)
1108
+ url = f"https://telegra.ph/{x[0]}"
1109
+ remove(media)
1110
+ except BaseException:
1111
+ return await conv.send_message(
1112
+ "Terminated.",
1113
+ buttons=get_back_button("setter"),
1114
+ )
1115
+ await setit(event, var, url)
1116
+ await conv.send_message(
1117
+ f"{name} has been set.",
1118
+ buttons=get_back_button("setter"),
1119
+ )
assistant/ping.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -8,7 +8,7 @@
8
  from datetime import datetime
9
 
10
 
11
- @asst_cmd("ping")
12
  @owner
13
  async def _(event):
14
  start = datetime.now()
@@ -16,5 +16,5 @@ async def _(event):
16
  ms = (end - start).microseconds / 1000
17
  await asst.send_message(
18
  event.chat_id,
19
- f"**Pong!!**\n `{ms}ms`",
20
  )
 
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
 
8
  from datetime import datetime
9
 
10
 
11
+ @asst_cmd("ping$")
12
  @owner
13
  async def _(event):
14
  start = datetime.now()
 
16
  ms = (end - start).microseconds / 1000
17
  await asst.send_message(
18
  event.chat_id,
19
+ f"**Pong!!**\n `{ms} milliseconds`",
20
  )
assistant/pmbot/banuser.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -7,8 +7,12 @@
7
 
8
  from . import *
9
 
 
10
  @asst_cmd("ban")
 
11
  async def banhammer(event):
 
 
12
  x = await event.get_reply_message()
13
  if x is None:
14
  return await event.edit("Please reply to someone to ban him.")
@@ -25,7 +29,10 @@ async def banhammer(event):
25
 
26
 
27
  @asst_cmd("unban")
 
28
  async def banhammer(event):
 
 
29
  x = await event.get_reply_message()
30
  if x is None:
31
  return await event.edit("Please reply to someone to ban him.")
 
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
 
7
 
8
  from . import *
9
 
10
+
11
  @asst_cmd("ban")
12
+ @owner
13
  async def banhammer(event):
14
+ if not event.is_private:
15
+ return
16
  x = await event.get_reply_message()
17
  if x is None:
18
  return await event.edit("Please reply to someone to ban him.")
 
29
 
30
 
31
  @asst_cmd("unban")
32
+ @owner
33
  async def banhammer(event):
34
+ if not event.is_private:
35
+ return
36
  x = await event.get_reply_message()
37
  if x is None:
38
  return await event.edit("Please reply to someone to ban him.")
assistant/pmbot/incoming.py CHANGED
@@ -1,5 +1,5 @@
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
 
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
assistant/pmbot/outgoing.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -21,9 +21,15 @@ async def on_out_mssg(event):
21
  return
22
  who = event.sender_id
23
  if who == OWNER_ID:
24
- if event.text.startswith("/"):
25
- return
26
  to_user = get_who(x.id)
 
 
 
 
 
 
 
 
27
  if event.media:
28
  if event.text:
29
  await asst.send_file(int(to_user), event.media, caption=event.text)
 
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
 
21
  return
22
  who = event.sender_id
23
  if who == OWNER_ID:
 
 
24
  to_user = get_who(x.id)
25
+ if event.text.startswith("/who"):
26
+ try:
27
+ k = await asst.get_entity(int(to_user))
28
+ return await event.reply(f"[{k.first_name}](tg://user?id={k.id})")
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
@@ -1,5 +1,5 @@
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
@@ -8,8 +8,8 @@
8
  from datetime import datetime
9
 
10
  from pyUltroid.functions.asst_fns import *
11
- from pyUltroid.misc._decorators import sed
12
- from telethon import Button, events
13
  from telethon.utils import get_display_name
14
 
15
  from plugins import *
@@ -25,21 +25,63 @@ Owner_info_msg = f"""
25
  __Ultroid {ultroid_version}, powered by @TeamUltroid__
26
  """
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
- @asst_cmd("start")
30
- async def assistant(event):
31
- if event.is_group and event.sender_id in sed:
32
- bnn = (await asst.get_me()).username
33
- return await event.reply(
34
- "`I dont work in groups`",
35
- buttons=[Button.url("⚙️Sᴛᴀʀᴛ⚙️", url=f"https://t.me/{bnn}?start=set")],
36
- )
37
- else:
38
- if not is_added(event.sender_id) and event.sender_id not in sed:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  add_user(event.sender_id)
40
  ok = ""
41
- if event.is_private and event.sender_id in sed:
42
- return
43
  u = await event.client.get_entity(event.chat_id)
44
  if not udB.get("STARTMSG"):
45
  if udB.get("PMBOT") == "True":
@@ -55,45 +97,20 @@ async def assistant(event):
55
  Redis("STARTMSG").format(me=me, mention=mention),
56
  buttons=[Button.inline("Info.", data="ownerinfo")],
57
  )
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
 
60
- @callback("ownerinfo")
61
- async def own(event):
62
- await event.edit(Owner_info_msg, buttons=[Button.inline("Close", data="closeit")])
63
-
64
-
65
- @callback("closeit")
66
- async def closet(lol):
67
- await lol.delete()
68
-
69
-
70
- @asst_cmd("start ?(.*)")
71
- @owner
72
- async def ultroid(event):
73
- if event.pattern_match.group(1):
74
- return
75
- if event.is_group:
76
- return
77
- name = event.sender.first_name
78
- if event.sender.last_name:
79
- name += f" {event.sender.last_name}"
80
- await asst.send_message(
81
- event.chat_id,
82
- get_string("ast_3").format(name),
83
- buttons=[
84
- [
85
- Button.inline("Language 🌐", data="lang"),
86
- Button.inline("Sᴇᴛᴛɪɴɢs ⚙️", data="setter"),
87
- ],
88
- [
89
- Button.inline("Sᴛᴀᴛs ✨", data="stat"),
90
- Button.inline("Bʀᴏᴀᴅᴄᴀsᴛ 📻", data="bcast"),
91
- ],
92
- ],
93
- )
94
-
95
-
96
- # aah, repeat the codes..
97
  @callback("mainmenu")
98
  @owner
99
  async def ultroid(event):
@@ -101,16 +118,7 @@ async def ultroid(event):
101
  return
102
  await event.edit(
103
  get_string("ast_3").format(OWNER_NAME),
104
- buttons=[
105
- [
106
- Button.inline("Language 🌐", data="lang"),
107
- Button.inline("Sᴇᴛᴛɪɴɢs ⚙️", data="setter"),
108
- ],
109
- [
110
- Button.inline("Sᴛᴀᴛs ✨", data="stat"),
111
- Button.inline("Bʀᴏᴀᴅᴄᴀsᴛ 📻", data="bcast"),
112
- ],
113
- ],
114
  )
115
 
116
 
@@ -166,38 +174,5 @@ Failed for {fail} user(s).""",
166
  async def setting(event):
167
  await event.edit(
168
  "Choose from the below options -",
169
- buttons=[
170
- [
171
- Button.inline("API Kᴇʏs", data="apiset"),
172
- Button.inline("Pᴍ Bᴏᴛ", data="chatbot"),
173
- ],
174
- [
175
- Button.inline("Aʟɪᴠᴇ", data="alvcstm"),
176
- Button.inline("PᴍPᴇʀᴍɪᴛ", data="ppmset"),
177
- ],
178
- [Button.inline("Fᴇᴀᴛᴜʀᴇs", data="otvars")],
179
- [Button.inline("VC Sᴏɴɢ Bᴏᴛ", data="vcb")],
180
- [Button.inline("« Bᴀᴄᴋ", data="mainmenu")],
181
- ],
182
- )
183
-
184
-
185
- @asst_cmd("start set")
186
- @owner
187
- async def set(event):
188
- await event.reply(
189
- "Choose from the below options -",
190
- buttons=[
191
- [
192
- Button.inline("API Kᴇʏs", data="apiset"),
193
- Button.inline("Pᴍ Bᴏᴛ", data="chatbot"),
194
- ],
195
- [
196
- Button.inline("Aʟɪᴠᴇ", data="alvcstm"),
197
- Button.inline("PᴍPᴇʀᴍɪᴛ", data="ppmset"),
198
- ],
199
- [Button.inline("Fᴇᴀᴛᴜʀᴇs", data="otvars")],
200
- [Button.inline("VC Sᴏɴɢ Bᴏᴛ", data="vcb")],
201
- [Button.inline("« Bᴀᴄᴋ", data="mainmenu")],
202
- ],
203
  )
 
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
 
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
13
  from telethon.utils import get_display_name
14
 
15
  from plugins import *
 
25
  __Ultroid {ultroid_version}, powered by @TeamUltroid__
26
  """
27
 
28
+ _settings = [
29
+ [
30
+ Button.inline("API Kᴇʏs", data="apiset"),
31
+ Button.inline("Pᴍ Bᴏᴛ", data="chatbot"),
32
+ ],
33
+ [
34
+ Button.inline("Aʟɪᴠᴇ", data="alvcstm"),
35
+ Button.inline("PᴍPᴇʀᴍɪᴛ", data="ppmset"),
36
+ ],
37
+ [Button.inline("Fᴇᴀᴛᴜʀᴇs", data="otvars")],
38
+ [Button.inline("VC Sᴏɴɢ Bᴏᴛ", data="vcb")],
39
+ [Button.inline("« Bᴀᴄᴋ", data="mainmenu")],
40
+ ]
41
+
42
+ _start = [
43
+ [
44
+ Button.inline("Lᴀɴɢᴜᴀɢᴇ 🌐", data="lang"),
45
+ Button.inline("Sᴇᴛᴛɪɴɢs ⚙️", data="setter"),
46
+ ],
47
+ [
48
+ Button.inline("Sᴛᴀᴛs ✨", data="stat"),
49
+ Button.inline("Bʀᴏᴀᴅᴄᴀsᴛ 📻", data="bcast"),
50
+ ],
51
+ ]
52
 
53
+
54
+ @callback("ownerinfo")
55
+ async def own(event):
56
+ await event.edit(
57
+ Owner_info_msg,
58
+ buttons=[Button.inline("Close", data=f"closeit")],
59
+ )
60
+
61
+
62
+ @callback("closeit")
63
+ async def closet(lol):
64
+ await lol.delete()
65
+
66
+
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
+ if (
80
+ not is_added(event.sender_id)
81
+ and str(event.sender_id) not in owner_and_sudos()
82
+ ):
83
  add_user(event.sender_id)
84
  ok = ""
 
 
85
  u = await event.client.get_entity(event.chat_id)
86
  if not udB.get("STARTMSG"):
87
  if udB.get("PMBOT") == "True":
 
97
  Redis("STARTMSG").format(me=me, mention=mention),
98
  buttons=[Button.inline("Info.", data="ownerinfo")],
99
  )
100
+ else:
101
+ name = get_display_name(event.sender_id)
102
+ if event.pattern_match.group(1) == "set":
103
+ await event.reply(
104
+ "Choose from the below options -",
105
+ buttons=_settings,
106
+ )
107
+ else:
108
+ await event.reply(
109
+ get_string("ast_3").format(name),
110
+ buttons=_start,
111
+ )
112
 
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  @callback("mainmenu")
115
  @owner
116
  async def ultroid(event):
 
118
  return
119
  await event.edit(
120
  get_string("ast_3").format(OWNER_NAME),
121
+ buttons=_start,
 
 
 
 
 
 
 
 
 
122
  )
123
 
124
 
 
174
  async def setting(event):
175
  await event.edit(
176
  "Choose from the below options -",
177
+ buttons=_settings,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  )
assistant/ytdl.py CHANGED
@@ -6,19 +6,21 @@
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
 
9
- import asyncio
10
  import os
11
  import re
12
  import time
 
13
 
 
14
  from pyUltroid.functions.all import *
15
  from telethon import Button
16
- from telethon.errors import UserNotParticipantError
17
- from telethon.tl.types import DocumentAttributeAudio
18
  from telethon.tl.types import InputWebDocument as wb
 
19
  from youtubesearchpython import VideosSearch
20
 
21
  ytt = "https://telegra.ph/file/afd04510c13914a06dd03.jpg"
 
22
 
23
 
24
  @in_pattern("yt")
@@ -44,9 +46,9 @@ async def _(event):
44
  nub = search.result()
45
  nibba = nub["result"]
46
  for v in nibba:
47
- link = v["link"]
48
- title = v["title"]
49
  ids = v["id"]
 
 
50
  duration = v["duration"]
51
  thumb = f"https://img.youtube.com/vi/{ids}/hqdefault.jpg"
52
  text = f"**•Tɪᴛʟᴇ•** `{title}`\n\n**••[Lɪɴᴋ]({link})••**\n\n**••Dᴜʀᴀᴛɪᴏɴ••** `{duration}`\n\n\n"
@@ -60,8 +62,8 @@ async def _(event):
60
  include_media=True,
61
  buttons=[
62
  [
63
- Button.inline("Audio", data=f"audio{link}"),
64
- Button.inline("Video", data=f"video{link}"),
65
  ],
66
  [
67
  Button.switch_inline(
@@ -81,181 +83,120 @@ async def _(event):
81
  await event.answer(results)
82
 
83
 
84
- @callback(re.compile("audio(.*)"))
 
 
 
 
85
  @owner
86
- async def _(sur):
87
- url = sur.pattern_match.group(1).decode("UTF-8")
88
- sur.sender_id
89
- opts = {
90
- "format": "bestaudio",
91
- "addmetadata": True,
92
- "key": "FFmpegMetadata",
93
- "writethumbnail": True,
94
- "prefer_ffmpeg": True,
95
- "geo_bypass": True,
96
- "nocheckcertificate": True,
97
- "postprocessors": [
98
- {
99
- "key": "FFmpegExtractAudio",
100
- "preferredcodec": "mp3",
101
- "preferredquality": "320",
102
- },
103
- ],
104
- "outtmpl": "%(id)s.mp3",
105
- "quiet": True,
106
- "logtostderr": False,
107
- }
108
- song = True
109
- ytdl_data = await dler(sur, opts, url)
110
- jpg = f"{ytdl_data['id']}.mp3.jpg"
111
- png = f"{ytdl_data['id']}.mp3.png"
112
- webp = f"{ytdl_data['id']}.mp3.webp"
113
- dir = os.listdir()
114
-
115
- if jpg in dir:
116
- thumb = jpg
117
- elif png in dir:
118
- thumb = png
119
- elif webp in dir:
120
- thumb = webp
121
- else:
122
- thumb = None
123
 
124
- c_time = time.time()
125
- if song:
126
- await sur.edit(
127
- f"`Preparing to upload song:`\
128
- \n**{ytdl_data['title']}**\
129
- \nby *{ytdl_data['uploader']}*",
130
- )
131
- MSG = f"**{ytdl_data['title']}** Uploaded Successfully !"
132
- chat = sur.chat_id
133
- whome = ultroid_bot
134
- if sur.is_private and sur.sender_id != ultroid_bot.uid:
135
- chat = sur.sender_id
136
- whome = asst
137
- MSG += f"\nGet at {asst.me.username}"
138
- try:
139
- await whome.send_file(
140
- chat,
141
- f"{ytdl_data['id']}.mp3",
142
- thumb=thumb,
143
- caption=f"**{ytdl_data['title']}\n{time_formatter((ytdl_data['duration'])*1000)}\n{ytdl_data['uploader']}**",
144
- supports_streaming=True,
145
- attributes=[
146
- DocumentAttributeAudio(
147
- duration=int(ytdl_data["duration"]),
148
- title=str(ytdl_data["title"]),
149
- performer=str(ytdl_data["uploader"]),
150
- ),
151
- ],
152
- progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
153
- progress(
154
- d,
155
- t,
156
- sur,
157
- c_time,
158
- "Uploading..",
159
- f"{ytdl_data['title']}.mp3",
160
- ),
161
- ),
162
- )
163
- except UserNotParticipantError:
164
- await asst.send_file(
165
- sur.sender_id,
166
- f"{ytdl_data['id']}.mp3",
167
- thumb=thumb,
168
- caption=f"**{ytdl_data['title']}\n{time_formatter((ytdl_data['duration'])*1000)}\n{ytdl_data['uploader']}**",
169
- supports_streaming=True,
170
- attributes=[
171
- DocumentAttributeAudio(
172
- duration=int(ytdl_data["duration"]),
173
- title=str(ytdl_data["title"]),
174
- performer=str(ytdl_data["uploader"]),
175
- ),
176
- ],
177
- )
178
- os.system(f"rm {ytdl_data['id']}.mp*")
179
- await sur.edit(
180
- MSG,
181
- buttons=Button.switch_inline("Search More", query="yt ", same_peer=True),
182
- )
183
 
184
-
185
- @callback(re.compile("video(.*)"))
 
 
 
186
  @owner
187
- async def _(fuk):
188
- url = fuk.pattern_match.group(1).decode("UTF-8")
189
- fuk.sender_id
190
- event = fuk
191
- opts = {
192
- "format": "best",
193
- "addmetadata": True,
194
- "key": "FFmpegMetadata",
195
- "writethumbnail": True,
196
- "prefer_ffmpeg": True,
197
- "geo_bypass": True,
198
- "nocheckcertificate": True,
199
- "postprocessors": [{"key": "FFmpegVideoConvertor", "preferedformat": "mp4"}],
200
- "outtmpl": "%(id)s.mp4",
201
- "logtostderr": False,
202
- "quiet": True,
203
- }
204
- video = True
205
- ytdl_data = await dler(fuk, opts, url)
206
-
207
- c_time = time.time()
208
- if video:
209
- await fuk.edit(
210
- f"`Preparing to upload video:`\
211
- \n**{ytdl_data['title']}**\
212
- \nby *{ytdl_data['uploader']}*",
 
 
 
213
  )
214
- MSG = f"**{ytdl_data['title']}** Uploaded Successfully !"
215
- chat = fuk.chat_id
216
- whome = ultroid_bot
217
- if event.is_private and event.sender_id != ultroid_bot.uid:
218
- chat = fuk.sender_id
219
- whome = asst
220
- MSG += f"\nGet at {asst.me.username}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  try:
222
- await whome.send_file(
223
- chat,
224
- f"{ytdl_data['id']}.mp4",
225
- thumb=f"./resources/extras/ultroid.jpg",
226
- caption=f"**{ytdl_data['title']}\n{time_formatter((ytdl_data['duration'])*1000)}\n{ytdl_data['uploader']}**",
227
- supports_streaming=True,
228
- progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
229
- progress(
230
- d,
231
- t,
232
- fuk,
233
- c_time,
234
- "Uploading..",
235
- f"{ytdl_data['title']}.mp4",
236
- ),
237
- ),
238
- )
239
- except UserNotParticipantError:
240
- await asst.send_file(
241
- chat,
242
- f"{ytdl_data['id']}.mp4",
243
- thumb=f"./resources/extras/ultroid.jpg",
244
- caption=f"**{ytdl_data['title']}\n{time_formatter((ytdl_data['duration'])*1000)}\n{ytdl_data['uploader']}**",
245
- supports_streaming=True,
246
- progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
247
- progress(
248
- d,
249
- t,
250
- fuk,
251
- c_time,
252
- "Uploading..",
253
- f"{ytdl_data['title']}.mp4",
254
- ),
255
- ),
256
- )
257
- os.remove(f"{ytdl_data['id']}.mp4")
258
- await fuk.edit(
259
- MSG,
260
- buttons=Button.switch_inline("Search More", query="yt ", same_peer=True),
261
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
 
 
9
  import os
10
  import re
11
  import time
12
+ from urllib.request import urlretrieve
13
 
14
+ from numerize import numerize
15
  from pyUltroid.functions.all import *
16
  from telethon import Button
17
+ from telethon.tl.types import DocumentAttributeAudio, DocumentAttributeVideo
 
18
  from telethon.tl.types import InputWebDocument as wb
19
+ from youtube_dl import YoutubeDL
20
  from youtubesearchpython import VideosSearch
21
 
22
  ytt = "https://telegra.ph/file/afd04510c13914a06dd03.jpg"
23
+ _yt_base_url = "https://www.youtube.com/watch?v="
24
 
25
 
26
  @in_pattern("yt")
 
46
  nub = search.result()
47
  nibba = nub["result"]
48
  for v in nibba:
 
 
49
  ids = v["id"]
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"
 
62
  include_media=True,
63
  buttons=[
64
  [
65
+ Button.inline("Audio", data=f"ytdl_audio_{ids}"),
66
+ Button.inline("Video", data=f"ytdl_video_{ids}"),
67
  ],
68
  [
69
  Button.switch_inline(
 
83
  await event.answer(results)
84
 
85
 
86
+ @callback(
87
+ re.compile(
88
+ "ytdl_(.*)",
89
+ ),
90
+ )
91
  @owner
92
+ async def _(e):
93
+ _e = e.pattern_match.group(1).decode("UTF-8")
94
+ _lets_split = _e.split("_", maxsplit=1)
95
+ _ytdl_data = await dler(e, _yt_base_url + _lets_split[1])
96
+ _data = get_data(_lets_split[0], _ytdl_data)
97
+ _buttons = get_buttons(
98
+ "ytdownload_" + _lets_split[0] + "_" + _lets_split[1] + ":", _data
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
 
106
+ @callback(
107
+ re.compile(
108
+ "ytdownload_(.*)",
109
+ ),
110
+ )
111
  @owner
112
+ async def _(event):
113
+ url = event.pattern_match.group(1).decode("UTF-8")
114
+ lets_split = url.split("_", maxsplit=1)
115
+ vid_id = lets_split[1].split(":")[0]
116
+ link = _yt_base_url + vid_id
117
+ format = url.split(":")[1]
118
+ if lets_split[0] == "audio":
119
+ opts = {
120
+ "format": str(format),
121
+ "addmetadata": True,
122
+ "key": "FFmpegMetadata",
123
+ "prefer_ffmpeg": True,
124
+ "geo_bypass": True,
125
+ "outtmpl": "%(id)s.mp3",
126
+ "quiet": True,
127
+ "logtostderr": False,
128
+ }
129
+ ytdl_data = await dler(event, link)
130
+ YoutubeDL(opts).download([link])
131
+ title = ytdl_data["title"]
132
+ artist = ytdl_data["uploader"]
133
+ views = numerize.numerize(ytdl_data["view_count"])
134
+ urlretrieve(f"https://i.ytimg.com/vi/{vid_id}/hqdefault.jpg", f"{title}.jpg")
135
+ thumb = f"{title}.jpg"
136
+ duration = ytdl_data["duration"]
137
+ os.rename(f"{ytdl_data['id']}.mp3", f"{title}.mp3")
138
+ c_time = time.time()
139
+ file = await uploader(
140
+ f"{title}.mp3", f"{title}.mp3", c_time, event, "Uploading " + title + "..."
141
  )
142
+ attributes = [
143
+ DocumentAttributeAudio(
144
+ duration=int(duration),
145
+ title=title,
146
+ performer=artist,
147
+ ),
148
+ ]
149
+ elif lets_split[0] == "video":
150
+ opts = {
151
+ "format": str(format),
152
+ "addmetadata": True,
153
+ "key": "FFmpegMetadata",
154
+ "prefer_ffmpeg": True,
155
+ "geo_bypass": True,
156
+ "outtmpl": "%(id)s.mp4",
157
+ "logtostderr": False,
158
+ "quiet": True,
159
+ }
160
+ ytdl_data = await dler(event, link)
161
+ YoutubeDL(opts).download([link])
162
+ title = ytdl_data["title"]
163
+ artist = ytdl_data["uploader"]
164
+ views = numerize.numerize(ytdl_data["view_count"])
165
+ urlretrieve(f"https://i.ytimg.com/vi/{vid_id}/hqdefault.jpg", f"{title}.jpg")
166
+ thumb = f"{title}.jpg"
167
+ duration = ytdl_data["duration"]
168
  try:
169
+ os.rename(f"{ytdl_data['id']}.mp4", f"{title}.mp4")
170
+ except FileNotFoundError:
171
+ try:
172
+ os.rename(f"{ytdl_data['id']}.mkv", f"{title}.mp4")
173
+ except FileNotFoundError:
174
+ os.rename(f"{ytdl_data['id']}.webm", f"{title}.mp4")
175
+ except Exception as ex:
176
+ return await event.edit(str(ex))
177
+ wi, _ = await bash(f'mediainfo "{title}.mp4" | grep "Width"')
178
+ hi, _ = await bash(f'mediainfo "{title}.mp4" | grep "Height"')
179
+ c_time = time.time()
180
+ file = await uploader(
181
+ f"{title}.mp4", f"{title}.mp4", c_time, event, "Uploading " + title + "..."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  )
183
+ attributes = [
184
+ DocumentAttributeVideo(
185
+ duration=int(duration),
186
+ w=int(wi.split(":")[1].split()[0]),
187
+ h=int(hi.split(":")[1].split()[0]),
188
+ supports_streaming=True,
189
+ ),
190
+ ]
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}"*')
heroku.yml CHANGED
@@ -1,7 +1,5 @@
1
  build:
2
  docker:
3
- worker: Dockerfile
4
- web: Dockerfile
5
  run:
6
- worker: bash resources/startup/startup.sh
7
- web: python vcstarter.py
 
1
  build:
2
  docker:
3
+ ultroid: Dockerfile
 
4
  run:
5
+ ultroid: bash resources/startup/startup.sh
 
package-lock.json DELETED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -18,7 +18,7 @@
18
  "redis": "^3.0.2",
19
  "telegraf": "^4.3.0",
20
  "tgcalls": "^0.1.2",
21
- "ws": "^7.4.3"
22
  },
23
  "devDependencies": {
24
  "@types/node": "^14.14.25",
 
18
  "redis": "^3.0.2",
19
  "telegraf": "^4.3.0",
20
  "tgcalls": "^0.1.2",
21
+ "ws": "^7.4.6"
22
  },
23
  "devDependencies": {
24
  "@types/node": "^14.14.25",
plugins/__init__.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -10,14 +10,14 @@ import time
10
  from pyUltroid.dB import *
11
  from pyUltroid.dB.core import *
12
  from pyUltroid.functions.all import *
 
13
  from pyUltroid.functions.broadcast_db import *
14
  from pyUltroid.functions.gban_mute_db import *
15
- from pyUltroid.functions.goodbye_db import *
16
- from pyUltroid.functions.google_image import googleimagesdownload
17
  from pyUltroid.functions.sudos import *
18
- from pyUltroid.functions.welcome_db import *
19
- from pyUltroid.functions.ytdl import *
20
  from pyUltroid.utils import *
 
 
21
 
22
  from strings import get_string
23
 
@@ -30,7 +30,7 @@ except ModuleNotFoundError:
30
 
31
 
32
  start_time = time.time()
33
- ultroid_version = "v0.0.7.2"
34
  OWNER_NAME = ultroid_bot.me.first_name
35
  OWNER_ID = ultroid_bot.me.id
36
 
@@ -43,7 +43,7 @@ def grt(seconds: int) -> str:
43
  count = 0
44
  up_time = ""
45
  time_list = []
46
- time_suffix_list = ["s", "m", "h", "days"]
47
 
48
  while count < 4:
49
  count += 1
@@ -67,6 +67,283 @@ def grt(seconds: int) -> str:
67
  return up_time
68
 
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  KANGING_STR = [
71
  "Using Witchery to kang this sticker...",
72
  "Plagiarising hehe...",
 
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
 
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
 
22
  from strings import get_string
23
 
 
30
 
31
 
32
  start_time = time.time()
33
+ ultroid_version = "v0.0.8"
34
  OWNER_NAME = ultroid_bot.me.first_name
35
  OWNER_ID = ultroid_bot.me.id
36
 
 
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
 
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...",
plugins/_help.py CHANGED
@@ -1,5 +1,5 @@
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
 
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
plugins/_inline.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -10,19 +10,18 @@ import time
10
  from datetime import datetime
11
  from math import ceil
12
  from os import remove
13
- from platform import python_version as PyVer
14
 
15
  from git import Repo
16
- from pyUltroid import __version__ as UltVer
17
  from support import *
18
- from telethon import Button, __version__
19
- from telethon.tl.types import InputWebDocument
20
 
21
  from . import *
22
 
23
  # ================================================#
24
  notmine = f"This bot is for {OWNER_NAME}"
25
- ULTROID_PIC = "https://telegra.ph/file/115f149ed8e154641708b.jpg"
 
26
  helps = get_string("inline_1")
27
 
28
  add_ons = udB.get("ADDONS")
@@ -30,49 +29,74 @@ if add_ons == "True" or add_ons is None:
30
  zhelps = get_string("inline_2")
31
  else:
32
  zhelps = get_string("inline_3")
33
- if udB.get("INLINE_PIC"):
34
- _file_to_replace = udB.get("INLINE_PIC")
 
 
 
 
35
  else:
36
  _file_to_replace = "resources/extras/inline.jpg"
37
  # ============================================#
38
 
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  @in_pattern("")
41
  @in_owner
42
- async def e(o):
43
  if len(o.text) == 0:
44
  b = o.builder
 
45
  uptime = grt(time.time() - start_time)
46
- header = udB.get("ALIVE_TEXT") if udB.get("ALIVE_TEXT") else "Hey, I am alive."
47
- ALIVEMSG = get_string("alive_1").format(
48
- header,
49
- OWNER_NAME,
50
- ultroid_version,
51
- UltVer,
52
- uptime,
53
- PyVer(),
54
- __version__,
55
- Repo().active_branch,
56
  )
57
- res = [
58
- await b.article(
 
 
 
 
 
 
 
59
  title="Ultroid Userbot",
60
- url="https://t.me/TeamUltroid",
61
- description="Userbot | Telethon ",
62
- text=ALIVEMSG,
63
- thumb=InputWebDocument(ULTROID_PIC, 0, "image/jpeg", []),
64
- buttons=[
65
- [Button.url(text="Support Group", url="t.me/UltroidSupport")],
66
- [
67
- Button.url(
68
- text="Repo",
69
- url="https://github.com/Teamultroid/Ultroid",
70
- ),
71
- ],
72
- ],
73
- ),
74
  ]
75
- await o.answer(res, switch_pm=f"👥 ULTROID PORTAL", switch_pm_param="start")
76
 
77
 
78
  @in_pattern("ultd")
@@ -82,8 +106,6 @@ async def inline_handler(event):
82
  for x in LIST.values():
83
  for y in x:
84
  z.append(y)
85
- cmd = len(z)
86
- bnn = asst.me.username
87
  result = event.builder.photo(
88
  file=_file_to_replace,
89
  link_preview=False,
@@ -91,37 +113,42 @@ async def inline_handler(event):
91
  OWNER_NAME,
92
  len(PLUGINS),
93
  len(ADDONS),
94
- cmd,
95
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  buttons=[
97
  [
98
- Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
99
- Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
100
- ],
101
- [
102
- Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
103
- Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
104
- ],
105
- [
106
- Button.url("⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{bnn}?start=set"),
107
  ],
108
- [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
109
  ],
110
  )
111
  await event.answer([result])
112
 
113
 
114
- @in_pattern("paste")
115
  @in_owner
116
  async def _(event):
117
  ok = event.text.split(" ")[1]
118
- link = "https://nekobin.com/"
119
  result = event.builder.article(
120
  title="Paste",
121
- text="Pᴀsᴛᴇᴅ Tᴏ Nᴇᴋᴏʙɪɴ!",
122
  buttons=[
123
  [
124
- Button.url("NekoBin", url=f"{link}{ok}"),
125
  Button.url("Raw", url=f"{link}raw/{ok}"),
126
  ],
127
  ],
@@ -202,8 +229,8 @@ async def _(event):
202
  async def _(event):
203
  start = datetime.now()
204
  end = datetime.now()
205
- ms = (end - start).microseconds / 1000
206
- pin = f"🌋Pɪɴɢ = {ms}ms"
207
  await event.answer(pin, cache_time=0, alert=True)
208
 
209
 
@@ -256,8 +283,8 @@ async def _(e):
256
  ],
257
  [
258
  Button.switch_inline(
259
- "CʟɪᴘAʀᴛ Sᴇᴀʀᴄʜ",
260
- query="clipart frog",
261
  same_peer=True,
262
  ),
263
  Button.switch_inline(
@@ -384,37 +411,18 @@ async def backr(event):
384
  @callback("open")
385
  @owner
386
  async def opner(event):
387
- bnn = asst.me.username
388
- buttons = [
389
- [
390
- Button.inline("• Pʟᴜɢɪɴs ", data="hrrrr"),
391
- Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
392
- ],
393
- [
394
- Button.inline("Oᴡɴᴇʀ•Tᴏᴏʟꜱ", data="ownr"),
395
- Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
396
- ],
397
- [
398
- Button.url(
399
- "⚙️Sᴇᴛᴛɪɴɢs⚙️",
400
- url=f"https://t.me/{bnn}?start={ultroid_bot.me.id}",
401
- ),
402
- ],
403
- [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
404
- ]
405
  z = []
406
  for x in LIST.values():
407
  for y in x:
408
  z.append(y)
409
- cmd = len(z) + 10
410
  await event.edit(
411
  get_string("inline_4").format(
412
  OWNER_NAME,
413
  len(PLUGINS),
414
  len(ADDONS),
415
- cmd,
416
  ),
417
- buttons=buttons,
418
  link_preview=False,
419
  )
420
 
@@ -425,7 +433,7 @@ async def on_plug_in_callback_query_handler(event):
425
  await event.edit(
426
  get_string("inline_5"),
427
  file=_file_to_replace,
428
- buttons=Button.inline("Oᴘᴇɴ Mᴀɪɴ Mᴇɴᴜ Aɢᴀɪɴ", data="open"),
429
  )
430
 
431
 
@@ -461,7 +469,7 @@ async def on_plug_in_callback_query_handler(event):
461
  ],
462
  ]
463
  try:
464
- if event.query.user_id in sed:
465
  await event.edit(
466
  reply_pop_up_alert,
467
  buttons=buttons,
@@ -520,7 +528,7 @@ async def on_plug_in_callback_query_handler(event):
520
  ],
521
  ]
522
  try:
523
- if event.query.user_id in sed:
524
  await event.edit(
525
  reply_pop_up_alert,
526
  buttons=buttons,
 
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
 
10
  from datetime import datetime
11
  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
 
18
 
19
  from . import *
20
 
21
  # ================================================#
22
  notmine = f"This bot is for {OWNER_NAME}"
23
+
24
+ TLINK = "https://telegra.ph/file/d9c9bc13647fa1d96e764.jpg"
25
  helps = get_string("inline_1")
26
 
27
  add_ons = udB.get("ADDONS")
 
29
  zhelps = get_string("inline_2")
30
  else:
31
  zhelps = get_string("inline_3")
32
+
33
+ C_PIC = udB.get("INLINE_PIC")
34
+
35
+ if C_PIC:
36
+ _file_to_replace = C_PIC
37
+ TLINK = C_PIC
38
  else:
39
  _file_to_replace = "resources/extras/inline.jpg"
40
  # ============================================#
41
 
42
 
43
+ # --------------------BUTTONS--------------------#
44
+
45
+ _main_help_menu = [
46
+ [
47
+ Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
48
+ Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
49
+ ],
50
+ [
51
+ Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
52
+ Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
53
+ ],
54
+ [
55
+ Button.url("⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{asst.me.username}?start=set"),
56
+ ],
57
+ [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
58
+ ]
59
+
60
+ SUP_BUTTONS = [
61
+ [
62
+ Button.url("Repo", url="https://github.com/TeamUltroid/Ultroid"),
63
+ Button.url("Addons", url="https://github.com/TeamUltroid/UltroidAddons"),
64
+ ],
65
+ [Button.url("Support", url="t.me/UltroidSupport")],
66
+ ]
67
+
68
+ # --------------------BUTTONS--------------------#
69
+
70
+
71
  @in_pattern("")
72
  @in_owner
73
+ 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(
81
+ "https://telegra.ph/file/55dd0f381c70e72557cb1.jpg", 0, "image/jpg", []
 
 
 
 
 
 
82
  )
83
+ RES = [
84
+ InputBotInlineResult(
85
+ str(o.id),
86
+ "photo",
87
+ send_message=await b._message(
88
+ text=MSG,
89
+ media=True,
90
+ buttons=SUP_BUTTONS,
91
+ ),
92
  title="Ultroid Userbot",
93
+ description="Userbot | Telethon",
94
+ url=TLINK,
95
+ thumb=WEB0,
96
+ content=InputWebDocument(TLINK, 0, "image/jpg", []),
97
+ )
 
 
 
 
 
 
 
 
 
98
  ]
99
+ await o.answer(RES, switch_pm=f"👥 ULTROID PORTAL", switch_pm_param="start")
100
 
101
 
102
  @in_pattern("ultd")
 
106
  for x in LIST.values():
107
  for y in x:
108
  z.append(y)
 
 
109
  result = event.builder.photo(
110
  file=_file_to_replace,
111
  link_preview=False,
 
113
  OWNER_NAME,
114
  len(PLUGINS),
115
  len(ADDONS),
116
+ len(z),
117
  ),
118
+ buttons=_main_help_menu,
119
+ )
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
  ],
 
229
  async def _(event):
230
  start = datetime.now()
231
  end = datetime.now()
232
+ ms = (end - start).microseconds
233
+ pin = f"🌋Pɪɴɢ = {ms} microseconds"
234
  await event.answer(pin, cache_time=0, alert=True)
235
 
236
 
 
283
  ],
284
  [
285
  Button.switch_inline(
286
+ "EBᴏᴏᴋs Uᴘʟᴏᴀᴅᴇʀ",
287
+ query="ebooks India",
288
  same_peer=True,
289
  ),
290
  Button.switch_inline(
 
411
  @callback("open")
412
  @owner
413
  async def opner(event):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
  z = []
415
  for x in LIST.values():
416
  for y in x:
417
  z.append(y)
 
418
  await event.edit(
419
  get_string("inline_4").format(
420
  OWNER_NAME,
421
  len(PLUGINS),
422
  len(ADDONS),
423
+ len(z),
424
  ),
425
+ buttons=_main_help_menu,
426
  link_preview=False,
427
  )
428
 
 
433
  await event.edit(
434
  get_string("inline_5"),
435
  file=_file_to_replace,
436
+ buttons=Button.inline("Oᴘᴇɴ Aɢᴀɪɴ", data="open"),
437
  )
438
 
439
 
 
469
  ],
470
  ]
471
  try:
472
+ if str(event.query.user_id) in owner_and_sudos():
473
  await event.edit(
474
  reply_pop_up_alert,
475
  buttons=buttons,
 
528
  ],
529
  ]
530
  try:
531
+ if str(event.query.user_id) in owner_and_sudos():
532
  await event.edit(
533
  reply_pop_up_alert,
534
  buttons=buttons,
plugins/_ultroid.py CHANGED
@@ -1,5 +1,5 @@
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
 
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
plugins/_userlogs.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -107,7 +107,11 @@ async def _(e):
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()).title
 
 
 
 
111
  tmp = event.added_by
112
  if user.is_self:
113
  buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot")
@@ -125,7 +129,11 @@ async def when_asst_added_to_chat(event):
125
  async def when_ultd_added_to_chat(event):
126
  if event.user_added:
127
  user = await event.get_user()
128
- chat = (await event.get_chat()).title
 
 
 
 
129
  tmp = event.added_by
130
  if user.is_self:
131
  buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
@@ -136,7 +144,11 @@ async def when_ultd_added_to_chat(event):
136
  )
137
  elif event.user_joined:
138
  user = await event.get_user()
139
- chat = (await event.get_chat()).title
 
 
 
 
140
  if user.is_self:
141
  buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
142
  return await asst.send_message(
 
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
 
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")
 
129
  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")
 
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})"
152
  if user.is_self:
153
  buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
154
  return await asst.send_message(
plugins/_wspr.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -22,7 +22,7 @@ from telethon.tl.types import UserStatusRecently as rec
22
  from . import *
23
 
24
  snap = {}
25
- buddhhu = []
26
 
27
 
28
  @ultroid_cmd(
@@ -32,8 +32,7 @@ async def _(e):
32
  if e.reply_to_msg_id:
33
  okk = (await e.get_reply_message()).sender_id
34
  try:
35
- zyx = await ultroid_bot(gu(id=okk))
36
- put = zyx.user.username
37
  except ValueError as ex:
38
  return await eor(e, str(ex))
39
  except AttributeError:
@@ -57,16 +56,19 @@ async def _(e):
57
 
58
 
59
  @in_pattern("msg")
 
60
  async def _(e):
61
  vvv = e.text
62
  zzz = vvv.split(" ", maxsplit=1)
63
  try:
64
  ggg = zzz[1]
65
  sed = ggg.split(" wspr ", maxsplit=1)
66
- query = sed[0]
 
 
67
  except IndexError:
68
  return
69
- meme = e.query.user_id
70
  try:
71
  desc = sed[1]
72
  except IndexError:
@@ -77,6 +79,7 @@ async def _(e):
77
  name = logi.user.first_name
78
  ids = logi.user.id
79
  username = logi.user.username
 
80
  x = logi.user.status
81
  bio = logi.about
82
  if isinstance(x, on):
@@ -93,11 +96,16 @@ async def _(e):
93
  status = "Can't Tell"
94
  text = f"**Name:** `{name}`\n"
95
  text += f"**Id:** `{ids}`\n"
96
- text += f"**Username:** `{username}`\n"
 
 
 
 
 
97
  text += f"**Status:** `{status}`\n"
98
  text += f"**About:** `{bio}`"
99
  button = [
100
- Button.url("Private", url=f"t.me/{username}"),
101
  Button.switch_inline(
102
  "Secret msg",
103
  query=f"msg {query} wspr Hello 👋",
@@ -120,8 +128,8 @@ async def _(e):
120
  try:
121
  logi = await ultroid_bot.get_entity(query)
122
  button = [
123
- Button.inline("Secret Msg", data=f"dd_{logi.id}"),
124
- Button.inline("Delete Msg", data=f"del"),
125
  ]
126
  us = logi.username
127
  sur = e.builder.article(
@@ -130,9 +138,8 @@ async def _(e):
130
  text=get_string("wspr_1").format(us),
131
  buttons=button,
132
  )
133
- buddhhu.append(meme)
134
- buddhhu.append(logi.id)
135
- snap.update({logi.id: desc})
136
  except ValueError:
137
  sur = e.builder.article(
138
  title="Type ur msg",
@@ -148,21 +155,22 @@ async def _(e):
148
  )
149
  async def _(e):
150
  ids = int(e.pattern_match.group(1).decode("UTF-8"))
151
- if e.sender_id in buddhhu:
152
- await e.answer(snap[ids], alert=True)
 
 
 
153
  else:
154
- await e.answer("Not For You", alert=True)
155
 
156
 
157
- @callback("del")
158
  async def _(e):
159
- if e.sender_id in buddhhu:
160
- for k in buddhhu:
161
- try:
162
- del snap[k]
163
- buddhhu.clear()
164
- except KeyError:
165
- pass
166
  try:
167
  await e.edit(get_string("wspr_2"))
168
  except np:
 
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
 
22
  from . import *
23
 
24
  snap = {}
25
+ buddhhu = {}
26
 
27
 
28
  @ultroid_cmd(
 
32
  if e.reply_to_msg_id:
33
  okk = (await e.get_reply_message()).sender_id
34
  try:
35
+ put = okk
 
36
  except ValueError as ex:
37
  return await eor(e, str(ex))
38
  except AttributeError:
 
56
 
57
 
58
  @in_pattern("msg")
59
+ @in_owner
60
  async def _(e):
61
  vvv = e.text
62
  zzz = vvv.split(" ", maxsplit=1)
63
  try:
64
  ggg = zzz[1]
65
  sed = ggg.split(" wspr ", maxsplit=1)
66
+ query = sed[0].replace(" ", "")
67
+ if query.isdigit():
68
+ query = int(query)
69
  except IndexError:
70
  return
71
+ iuser = e.query.user_id
72
  try:
73
  desc = sed[1]
74
  except IndexError:
 
79
  name = logi.user.first_name
80
  ids = logi.user.id
81
  username = logi.user.username
82
+ mention = f"[{name}](tg://user?id={ids})"
83
  x = logi.user.status
84
  bio = logi.about
85
  if isinstance(x, on):
 
96
  status = "Can't Tell"
97
  text = f"**Name:** `{name}`\n"
98
  text += f"**Id:** `{ids}`\n"
99
+ if username:
100
+ text += f"**Username:** `{username}`\n"
101
+ url = f"https://t.me/{username}"
102
+ else:
103
+ text += f"**Mention:** `{mention}`\n"
104
+ url = f"tg://user?id={ids}"
105
  text += f"**Status:** `{status}`\n"
106
  text += f"**About:** `{bio}`"
107
  button = [
108
+ Button.url("Private", url=url),
109
  Button.switch_inline(
110
  "Secret msg",
111
  query=f"msg {query} wspr Hello 👋",
 
128
  try:
129
  logi = await ultroid_bot.get_entity(query)
130
  button = [
131
+ Button.inline("Secret Msg", data=f"dd_{e.id}"),
132
+ Button.inline("Delete Msg", data=f"del_{e.id}"),
133
  ]
134
  us = logi.username
135
  sur = e.builder.article(
 
138
  text=get_string("wspr_1").format(us),
139
  buttons=button,
140
  )
141
+ buddhhu.update({e.id: [logi.id, iuser]})
142
+ snap.update({e.id: desc})
 
143
  except ValueError:
144
  sur = e.builder.article(
145
  title="Type ur msg",
 
155
  )
156
  async def _(e):
157
  ids = int(e.pattern_match.group(1).decode("UTF-8"))
158
+ if buddhhu.get(ids):
159
+ if e.sender_id in buddhhu[ids]:
160
+ await e.answer(snap[ids], alert=True)
161
+ else:
162
+ await e.answer("Not For You", alert=True)
163
  else:
164
+ await e.answer("Message Deleted", alert=True)
165
 
166
 
167
+ @callback(re.compile("del_(.*)"))
168
  async def _(e):
169
+ ids = int(e.pattern_match.group(1).decode("UTF-8"))
170
+ if buddhhu.get(ids):
171
+ if e.sender_id in buddhhu[ids]:
172
+ buddhhu.pop(ids)
173
+ snap.pop(ids)
 
 
174
  try:
175
  await e.edit(get_string("wspr_2"))
176
  except np:
plugins/admintools.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -50,6 +50,7 @@ import asyncio
50
  from telethon.errors import BadRequestError
51
  from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidError
52
  from telethon.tl.functions.channels import DeleteUserHistoryRequest, EditAdminRequest
 
53
  from telethon.tl.functions.messages import SetHistoryTTLRequest
54
  from telethon.tl.types import ChatAdminRights, InputMessagesFilterPinned
55
 
@@ -236,10 +237,7 @@ async def kck(ult):
236
  pattern="pin ?(.*)",
237
  )
238
  async def pin(msg):
239
- if not msg.is_private:
240
- # for pin(s) in private messages
241
- await msg.get_chat()
242
- cht = await ultroid_bot.get_entity(msg.chat_id)
243
  xx = msg.reply_to_msg_id
244
  tt = msg.text
245
  try:
@@ -250,22 +248,24 @@ async def pin(msg):
250
  pass
251
  if not msg.is_reply:
252
  return
 
 
 
253
  ch = msg.pattern_match.group(1)
254
  if ch != "silent":
255
  slnt = True
256
- x = await eor(msg, get_string("com_1"))
257
  try:
258
  await ultroid_bot.pin_message(msg.chat_id, xx, notify=slnt)
259
  except BadRequestError:
260
- return await x.edit("`Hmm, I'm have no rights here...`")
261
  except Exception as e:
262
- return await x.edit(f"**ERROR:**`{str(e)}`")
263
- await x.edit(f"`Pinned` [this message](https://t.me/c/{cht.id}/{xx})!")
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, I'm have no rights here...`")
269
  except Exception as e:
270
  return await eor(msg, f"**ERROR:**`{str(e)}`")
271
  try:
@@ -288,14 +288,14 @@ async def unp(ult):
288
  try:
289
  await ultroid_bot.unpin_message(ult.chat_id, msg)
290
  except BadRequestError:
291
- return await xx.edit("`Hmm, I'm 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, I'm have no rights here...`")
299
  except Exception as e:
300
  return await xx.edit(f"**ERROR:**`{str(e)}`")
301
  else:
@@ -424,7 +424,9 @@ async def _(e):
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 = (await event.get_chat()).title
 
 
428
  tem = ""
429
  c = 0
430
 
@@ -480,6 +482,3 @@ async def autodelte(ult): # Tg Feature
480
  except ChatNotModifiedError:
481
  return await eod(ult, f"Auto Delete Setting is Already same to `{match}`")
482
  await eor(ult, f"Auto Delete Status Changed to {match} !")
483
-
484
-
485
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
50
  from telethon.errors import BadRequestError
51
  from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidError
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
 
 
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:
 
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:
 
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:
300
  return await xx.edit(f"**ERROR:**`{str(e)}`")
301
  else:
 
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
 
 
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} !")
 
 
 
plugins/afk.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -249,6 +249,3 @@ async def _(event):
249
  await ultroid_bot.send_message(LOG, get_string("afk_8"))
250
  except BaseException:
251
  pass
252
-
253
-
254
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
249
  await ultroid_bot.send_message(LOG, get_string("afk_8"))
250
  except BaseException:
251
  pass
 
 
 
plugins/anime.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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}airing`
12
+ Get details about currently airing anime.
13
+
14
+ • `{i}anime <anime name>`
15
+ Get anime details from anilist.
16
+
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
+
27
+
28
+ @ultroid_cmd(pattern="airing")
29
+ async def airing_anime(event):
30
+ try:
31
+ await eor(event, airing_eps())
32
+ except BaseException:
33
+ info = airing_eps()
34
+ t = info.replace("*", "").replace("`", "")
35
+ with open("animes.txt", "w") as f:
36
+ f.write(t)
37
+ await event.reply(file="animes.txt")
38
+ remove("anime.txt")
39
+ await event.delete()
40
+
41
+
42
+ """
43
+ @ultroid_cmd(pattern="anime ?(.*)")
44
+ async def anilist(event):
45
+ name = event.pattern_match.group(1)
46
+ x = await eor(event, get_string("com_1"))
47
+ if not name:
48
+ return await eod(x, "`Enter a anime name!`", time=5)
49
+ banner, title, year, episodes, info = get_anime_src_res(name)
50
+ msg = f"**{title}**\n{year} | {episodes} Episodes.\n\n{info}"
51
+ await event.reply(msg, file=banner, link_preview=True)
52
+ await x.delete()
53
+ """
54
+
55
+
56
+ @ultroid_cmd(pattern="character ?(.*)")
57
+ async def anime_char_search(event):
58
+ xx = await eor(event, get_string("com_1"))
59
+ char_name = event.pattern_match.group(1)
60
+ if not char_name:
61
+ await eod(xx, "`Enter the name of a character too please!`", time=5)
62
+ jikan = jikanpy.jikan.Jikan()
63
+ try:
64
+ s = jikan.search("character", char_name)
65
+ except jikanpy.exceptions.APIException:
66
+ return await eod(xx, "`Couldn't find character!`", time=5)
67
+ a = s["results"][0]["mal_id"]
68
+ char_json = jikan.character(a)
69
+ pic = char_json["image_url"]
70
+ msg = f"**[{char_json['name']}]({char_json['url']})**"
71
+ if char_json["name_kanji"] != "Japanese":
72
+ msg += f" [{char_json['name_kanji']}]\n"
73
+ else:
74
+ msg += "\n"
75
+ if char_json["nicknames"]:
76
+ nicknames_string = ", ".join(char_json["nicknames"])
77
+ msg += f"\n**Nicknames** : `{nicknames_string}`\n"
78
+ about = char_json["about"].split("\n", 1)[0].strip().replace("\n", "")
79
+ msg += f"\n**About**: __{about}__"
80
+ await event.reply(msg, file=pic, force_document=False)
81
+ await xx.delete()
plugins/antiflood.py ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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}setflood <integer>`
12
+ Set flood limit in a chat.
13
+
14
+ • `{i}remflood`
15
+ Remove flood limit from a chat.
16
+
17
+ • `{i}getflood`
18
+ Get flood limit of a chat.
19
+ """
20
+
21
+
22
+ import re
23
+
24
+ from pyUltroid.functions.antiflood_db import (
25
+ get_flood,
26
+ get_flood_limit,
27
+ rem_flood,
28
+ set_flood,
29
+ )
30
+ from telethon.events import NewMessage as NewMsg
31
+
32
+ from . import *
33
+
34
+ _check_flood = {}
35
+
36
+
37
+ if Redis("ANTIFLOOD") is not (None or ""):
38
+
39
+ @ultroid_bot.on(
40
+ NewMsg(
41
+ chats=list(get_flood().keys()),
42
+ ),
43
+ )
44
+ async def flood_checm(event):
45
+ count = 1
46
+ chat = (await event.get_chat()).title
47
+ if event.chat_id in _check_flood.keys():
48
+ if event.sender_id == [x for x in _check_flood[event.chat_id].keys()][0]:
49
+ count = _check_flood[event.chat_id][event.sender_id]
50
+ _check_flood[event.chat_id] = {event.sender_id: count + 1}
51
+ else:
52
+ _check_flood[event.chat_id] = {event.sender_id: count}
53
+ else:
54
+ _check_flood[event.chat_id] = {event.sender_id: count}
55
+ if await check_if_admin(event) or event.sender.bot:
56
+ return
57
+ if str(event.sender_id) in DEVLIST:
58
+ return
59
+ if _check_flood[event.chat_id][event.sender_id] >= int(
60
+ get_flood_limit(event.chat_id)
61
+ ):
62
+ try:
63
+ name = event.sender.first_name
64
+ await event.client.edit_permissions(
65
+ event.chat_id, event.sender_id, send_messages=False
66
+ )
67
+ del _check_flood[event.chat_id]
68
+ await event.reply("#AntiFlood\n\n`You have been muted.`")
69
+ await asst.send_message(
70
+ int(Redis("LOG_CHANNEL")),
71
+ f"#Antiflood\n\n`Muted `[{name}](tg://user?id={event.sender_id})` in {chat}`",
72
+ buttons=Button.inline(
73
+ "Unmute", data=f"anti_{event.sender_id}_{event.chat_id}"
74
+ ),
75
+ )
76
+ except BaseException:
77
+ pass
78
+
79
+
80
+ @callback(
81
+ re.compile(
82
+ "anti_(.*)",
83
+ ),
84
+ )
85
+ async def unmuting(e):
86
+ ino = (e.data_match.group(1)).decode("UTF-8").split("_")
87
+ user = int(ino[0])
88
+ chat = int(ino[1])
89
+ user_name = (await ultroid_bot.get_entity(user)).first_name
90
+ chat_title = (await ultroid_bot.get_entity(chat)).title
91
+ await ultroid_bot.edit_permissions(chat, user, send_messages=True)
92
+ await e.edit(
93
+ f"#Antiflood\n\n`Unmuted `[{user_name}](tg://user?id={user})` in {chat_title}`"
94
+ )
95
+
96
+
97
+ @ultroid_cmd(
98
+ pattern="setflood ?(\\d+)",
99
+ admins_only=True,
100
+ )
101
+ async def setflood(e):
102
+ input = e.pattern_match.group(1)
103
+ if not input:
104
+ return await eod(e, "`What?`")
105
+ if not input.isdigit():
106
+ return await eod(e, "`Invalid Input`")
107
+ m = set_flood(e.chat_id, input)
108
+ if m:
109
+ return await eod(
110
+ e, f"`Successfully Updated Antiflood Settings to {input} in this chat.`"
111
+ )
112
+
113
+
114
+ @ultroid_cmd(
115
+ pattern="remflood$",
116
+ admins_only=True,
117
+ )
118
+ async def remove_flood(e):
119
+ hmm = rem_flood(e.chat_id)
120
+ try:
121
+ del _check_flood[e.chat_id]
122
+ except BaseException:
123
+ pass
124
+ if hmm:
125
+ return await eod(e, "`Antiflood Settings Disabled`")
126
+ await eod(e, "`No flood limits in this chat.`")
127
+
128
+
129
+ @ultroid_cmd(
130
+ pattern="getflood$",
131
+ admins_only=True,
132
+ )
133
+ async def getflood(e):
134
+ ok = get_flood_limit(e.chat_id)
135
+ if ok:
136
+ return await eod(e, f"`Flood limit for this chat is {ok}.`")
137
+ await eod(e, "`No flood limits in this chat.`")
plugins/ascii.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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}ascii <reply image>`
12
+ Convert replied image into html.
13
+ """
14
+
15
+
16
+ import os
17
+
18
+ from img2html.converter import Img2HTMLConverter
19
+
20
+ from . import *
21
+
22
+
23
+ @ultroid_cmd(
24
+ pattern="ascii ?(.*)",
25
+ )
26
+ async def _(e):
27
+ if not e.reply_to_msg_id:
28
+ return await eor(e, "`Reply to image.`")
29
+ m = await eor(e, "`Converting to html...`")
30
+ img = await (await e.get_reply_message()).download_media()
31
+ char = "■" if not e.pattern_match.group(1) else e.pattern_match.group(1)
32
+ converter = Img2HTMLConverter(char=char)
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")
plugins/asst_cmd.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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}addcmd <new cmd> <reply>`
12
+ It will set new cmd for your assistant bot with that reply message.
13
+
14
+ •`{i}remcmd <cmd name>`
15
+ It will remove your cmd.
16
+
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 *
24
+ from telegraph import upload_file as uf
25
+ from telethon.utils import pack_bot_file_id
26
+
27
+ from . import *
28
+
29
+
30
+ @ultroid_cmd(pattern="addcmd ?(.*)")
31
+ async def ac(e):
32
+ wrd = (e.pattern_match.group(1)).lower()
33
+ wt = await e.get_reply_message()
34
+ if not (wt and wrd):
35
+ return await eod(e, "`Use this Command with Reply and word to use a command.`")
36
+ if "/" in wrd:
37
+ wrd = wrd.replace("/", "")
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]
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 bot.download_media(wt.media)
50
+ variable = uf(dl)
51
+ os.remove(dl)
52
+ m = "https://telegra.ph" + variable[0]
53
+ else:
54
+ m = pack_bot_file_id(wt.media)
55
+ if wt.text:
56
+ add_cmd(wrd, wt.text, m)
57
+ else:
58
+ add_cmd(wrd, None, m)
59
+ else:
60
+ add_cmd(wrd, wt.text, None)
61
+ await eor(e, f"Done Command : `/{wrd}` saved.")
62
+
63
+
64
+ @ultroid_cmd(pattern="remcmd ?(.*)")
65
+ async def rc(e):
66
+ wrd = (e.pattern_match.group(1)).lower()
67
+ if not wrd:
68
+ return await eod(e, "`Give me the command which you want to remove.`")
69
+ if wrd.startswith("/"):
70
+ wrd = wrd.replace("/", "")
71
+ rem_cmd(wrd)
72
+ await eor(e, f"Done Command: `/{wrd}` Removed.")
73
+
74
+
75
+ @ultroid_cmd(pattern="listcmd$")
76
+ async def lscmd(e):
77
+ if list_cmds():
78
+ ok = "**ALL ASSISTANT CMDS**\n\n"
79
+ for x in list_cmds():
80
+ ok += "/" + x + "\n"
81
+ return await eor(e, ok)
82
+ return await eor(e, "No commands found")
83
+
84
+
85
+ @asst.on(events.NewMessage())
86
+ async def ascmds(e):
87
+ xx = e.text
88
+ if not xx.startswith("/"):
89
+ return
90
+ xx = (xx.replace("/", "")).lower()
91
+ if " " in xx:
92
+ xx = xx.split(" ")[0]
93
+ if cmd_reply(xx):
94
+ msg, media = cmd_reply(xx)
95
+ await e.reply(msg, file=media)
plugins/autocorrect.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -53,6 +53,3 @@ async def gramme(event):
53
  await event.edit(res)
54
  except BaseException:
55
  pass
56
-
57
-
58
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
53
  await event.edit(res)
54
  except BaseException:
55
  pass
 
 
 
plugins/autopic.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -37,6 +37,11 @@ async def autopic(e):
37
  return await eod(e, get_string("autopic_2").format(search))
38
  await eor(e, get_string("autopic_3").format(search))
39
  udB.set("AUTOPIC", "True")
 
 
 
 
 
40
  while True:
41
  for lie in clls:
42
  ge = udB.get("AUTOPIC")
@@ -56,7 +61,7 @@ async def autopic(e):
56
  file = await ultroid_bot.upload_file(kar)
57
  await ultroid_bot(UploadProfilePhotoRequest(file))
58
  os.remove(kar)
59
- await asyncio.sleep(1111)
60
 
61
 
62
  @ultroid_cmd(pattern="stoppic$")
@@ -66,6 +71,3 @@ async def stoppo(ult):
66
  return await eod(ult, "AUTOPIC was not in used !!")
67
  udB.set("AUTOPIC", "None")
68
  await eod(ult, "AUTOPIC Stopped !!")
69
-
70
-
71
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
37
  return await eod(e, get_string("autopic_2").format(search))
38
  await eor(e, get_string("autopic_3").format(search))
39
  udB.set("AUTOPIC", "True")
40
+ ST = udB.get("SLEEP_TIME")
41
+ if ST:
42
+ SLEEP_TIME = int(ST)
43
+ else:
44
+ SLEEP_TIME = 1221
45
  while True:
46
  for lie in clls:
47
  ge = udB.get("AUTOPIC")
 
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
 
66
 
67
  @ultroid_cmd(pattern="stoppic$")
 
71
  return await eod(ult, "AUTOPIC was not in used !!")
72
  udB.set("AUTOPIC", "None")
73
  await eod(ult, "AUTOPIC Stopped !!")
 
 
 
plugins/blacklist.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -27,11 +27,8 @@ from pyUltroid.functions.blacklist_db import *
27
  from . import *
28
 
29
 
30
- @ultroid_cmd(pattern="blacklist ?(.*)")
31
  async def af(e):
32
- if e.is_group:
33
- if not e._chat.admin_rights:
34
- return await eod(e, "`You are Not Admin Here`")
35
  wrd = e.pattern_match.group(1)
36
  chat = e.chat_id
37
  if not (wrd):
@@ -43,11 +40,8 @@ async def af(e):
43
  await eor(e, f"Done : `{wrd}` Blacklisted here.")
44
 
45
 
46
- @ultroid_cmd(pattern="remblacklist ?(.*)")
47
  async def rf(e):
48
- if e.is_group:
49
- if not e._chat.admin_rights:
50
- return await eod(e, "`You are Not Admin Here`")
51
  wrd = e.pattern_match.group(1)
52
  chat = e.chat_id
53
  if not wrd:
@@ -59,11 +53,8 @@ async def rf(e):
59
  await eor(e, f"Done : `{wrd}` Removed from Blacklist.")
60
 
61
 
62
- @ultroid_cmd(pattern="listblacklist")
63
  async def lsnote(e):
64
- if e.is_group:
65
- if not e._chat.admin_rights:
66
- return await eod(e, "`You are Not Admin Here`")
67
  x = list_blacklist(e.chat_id)
68
  if x:
69
  sd = "Blacklist Found In This Chats Are\n\n"
@@ -83,6 +74,3 @@ async def bl(e):
83
  if z in yy:
84
  await e.delete()
85
  break
86
-
87
-
88
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
27
  from . import *
28
 
29
 
30
+ @ultroid_cmd(pattern="blacklist ?(.*)", admins_only=True)
31
  async def af(e):
 
 
 
32
  wrd = e.pattern_match.group(1)
33
  chat = e.chat_id
34
  if not (wrd):
 
40
  await eor(e, f"Done : `{wrd}` Blacklisted here.")
41
 
42
 
43
+ @ultroid_cmd(pattern="remblacklist ?(.*)", admins_only=True)
44
  async def rf(e):
 
 
 
45
  wrd = e.pattern_match.group(1)
46
  chat = e.chat_id
47
  if not wrd:
 
53
  await eor(e, f"Done : `{wrd}` Removed from Blacklist.")
54
 
55
 
56
+ @ultroid_cmd(pattern="listblacklist$", admins_only=True)
57
  async def lsnote(e):
 
 
 
58
  x = list_blacklist(e.chat_id)
59
  if x:
60
  sd = "Blacklist Found In This Chats Are\n\n"
 
74
  if z in yy:
75
  await e.delete()
76
  break
 
 
 
plugins/bot.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -34,30 +34,13 @@ import time
34
  from datetime import datetime as dt
35
  from platform import python_version as pyver
36
 
37
- import heroku3
38
- import re
39
- import requests
40
  from git import Repo
41
- from pyUltroid import __version__ as UltVer
42
  from telethon import __version__, events
43
  from telethon.errors.rpcerrorlist import ChatSendMediaForbiddenError
44
 
45
  from . import *
46
 
47
- HEROKU_API = None
48
- HEROKU_APP_NAME = None
49
-
50
- try:
51
- if Var.HEROKU_API and Var.HEROKU_APP_NAME:
52
- HEROKU_API = Var.HEROKU_API
53
- HEROKU_APP_NAME = Var.HEROKU_APP_NAME
54
- Heroku = heroku3.from_key(Var.HEROKU_API)
55
- heroku_api = "https://api.heroku.com"
56
- app = Heroku.app(Var.HEROKU_APP_NAME)
57
- except BaseException:
58
- HEROKU_API = None
59
- HEROKU_APP_NAME = None
60
-
61
 
62
  @ultroid_cmd(
63
  pattern="alive$",
@@ -99,8 +82,7 @@ async def lol(ult):
99
  await eor(ult, als, link_preview=False)
100
 
101
 
102
-
103
- @ultroid_bot.on(events.NewMessage(pattern=re.escape(f"{HNDLR}ping")))
104
  async def _(event):
105
  if event.fwd_from:
106
  return
@@ -125,32 +107,22 @@ async def cmds(event):
125
  pattern="restart$",
126
  )
127
  async def restartbt(ult):
 
128
  if Var.HEROKU_API:
129
- await restart(ult)
130
  else:
131
  await bash("pkill python3 && python3 -m pyUltroid")
132
 
133
 
134
- @ultroid_cmd(pattern="shutdown")
135
  async def shutdownbot(ult):
136
  if not ult.out:
137
  if not is_fullsudo(ult.sender_id):
138
  return await eod(ult, "`This Command Is Sudo Restricted.`")
139
- try:
140
- dyno = ult.text.split(" ", maxsplit=1)[1]
141
- except IndexError:
142
- dyno = None
143
- if dyno:
144
- if dyno not in ["userbot", "vcbot", "web", "worker"]:
145
- await eor(ult, "Invalid Dyno Type specified !")
146
- return
147
- await shutdown(ult, dyno)
148
- else:
149
- await shutdown(ult)
150
 
151
 
152
-
153
- @ultroid_bot.on(events.NewMessage(pattern=re.escape(f"{HNDLR}logs")))
154
  async def _(event):
155
  if event.fwd_from:
156
  return
@@ -166,52 +138,3 @@ async def _(event):
166
  await def_logs(event)
167
  else:
168
  await def_logs(event)
169
-
170
-
171
- async def heroku_logs(event):
172
- if HEROKU_API is None and HEROKU_APP_NAME is None:
173
- return await eor(
174
- event, "Please set `HEROKU_APP_NAME` and `HEROKU_API` in vars."
175
- )
176
- await eor(event, "`Downloading Logs...`")
177
- ok = app.get_log()
178
- with open("ultroid-heroku.log", "w") as log:
179
- log.write(ok)
180
- key = (
181
- requests.post("https://nekobin.com/api/documents", json={"content": ok})
182
- .json()
183
- .get("result")
184
- .get("key")
185
- )
186
- url = f"https://nekobin.com/{key}"
187
- await ultroid.send_file(
188
- event.chat_id,
189
- file="ultroid-heroku.log",
190
- thumb="resources/extras/ultroid.jpg",
191
- caption=f"**Ultroid Heroku Logs.**\nPasted [here]({url}) too!",
192
- )
193
- os.remove("ultroid-heroku.log")
194
-
195
-
196
- async def def_logs(ult):
197
- xx = await eor(ult, "`Processing...`")
198
- with open("ultroid.log") as f:
199
- k = f.read()
200
- key = (
201
- requests.post("https://nekobin.com/api/documents", json={"content": k})
202
- .json()
203
- .get("result")
204
- .get("key")
205
- )
206
- url = f"https://nekobin.com/{key}"
207
- await ultroid.send_file(
208
- ult.chat_id,
209
- file="ultroid.log",
210
- thumb="resources/extras/ultroid.jpg",
211
- caption=f"**Ultroid Logs.**\nPasted [here]({url}) too!",
212
- )
213
- await xx.edit("Done")
214
- await xx.delete()
215
-
216
-
217
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
34
  from datetime import datetime as dt
35
  from platform import python_version as pyver
36
 
 
 
 
37
  from git import Repo
38
+ from pyUltroid.version import __version__ as UltVer
39
  from telethon import __version__, events
40
  from telethon.errors.rpcerrorlist import ChatSendMediaForbiddenError
41
 
42
  from . import *
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  @ultroid_cmd(
46
  pattern="alive$",
 
82
  await eor(ult, als, link_preview=False)
83
 
84
 
85
+ @ultroid_bot.on(events.NewMessage(pattern=f"\\{HNDLR}ping$"))
 
86
  async def _(event):
87
  if event.fwd_from:
88
  return
 
107
  pattern="restart$",
108
  )
109
  async def restartbt(ult):
110
+ ok = await eor(ult, "`Restarting...`")
111
  if Var.HEROKU_API:
112
+ await restart(ok)
113
  else:
114
  await bash("pkill python3 && python3 -m pyUltroid")
115
 
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
 
138
  await def_logs(event)
139
  else:
140
  await def_logs(event)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugins/broadcast.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -248,6 +248,3 @@ async def sending(event):
248
  )
249
  except BaseException:
250
  pass
251
-
252
-
253
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
248
  )
249
  except BaseException:
250
  pass
 
 
 
plugins/calculator.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -141,6 +141,3 @@ async def _(e):
141
  lst = list(zip(tultd[::4], tultd[1::4], tultd[2::4], tultd[3::4]))
142
  lst.append([Button.inline("=", data="calc=")])
143
  await e.edit("Noice Inline Calculator", buttons=lst)
144
-
145
-
146
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
141
  lst = list(zip(tultd[::4], tultd[1::4], tultd[2::4], tultd[3::4]))
142
  lst.append([Button.inline("=", data="calc=")])
143
  await e.edit("Noice Inline Calculator", buttons=lst)
 
 
 
plugins/carbon.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -10,13 +10,14 @@
10
 
11
  • `{i}carbon <text/reply to msg/reply to document>`
12
  Carbonise the text with default settings.
 
13
  • `{i}rcarbon <text/reply to msg/reply to document>`
14
  Carbonise the text, with random bg colours.
15
  """
16
 
17
- import os
18
  import random
19
 
 
20
  from carbonnow import Carbon
21
 
22
  from . import *
@@ -190,16 +191,19 @@ async def crbn(event):
190
  code = temp.message
191
  else:
192
  code = event.text.split(" ", maxsplit=1)[1]
193
- carbon = Carbon(code=code)
194
- xx = await carbon.save("ultroid_carbon")
 
 
 
 
 
195
  await xxxx.delete()
196
  await ultroid_bot.send_file(
197
  event.chat_id,
198
  xx,
199
  caption=f"Carbonised by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
200
- force_document=True,
201
  )
202
- os.remove(xx)
203
 
204
 
205
  @ultroid_cmd(
@@ -220,16 +224,18 @@ async def crbn(event):
220
  else:
221
  code = event.text.split(" ", maxsplit=1)[1]
222
  col = random.choice(all_col)
223
- carbon = Carbon(code=code, background=col)
224
- xx = await carbon.save("ultroid_carbon")
 
 
 
 
 
 
 
225
  await xxxx.delete()
226
  await ultroid_bot.send_file(
227
  event.chat_id,
228
  xx,
229
  caption=f"Carbonised by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
230
- force_document=True,
231
  )
232
- os.remove(xx)
233
-
234
-
235
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
10
 
11
  • `{i}carbon <text/reply to msg/reply to document>`
12
  Carbonise the text with default settings.
13
+
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
21
  from carbonnow import Carbon
22
 
23
  from . import *
 
191
  code = temp.message
192
  else:
193
  code = event.text.split(" ", maxsplit=1)[1]
194
+ webs = requests.get("https://carbonara.vercel.app/api/cook")
195
+ if webs.status_code == 502:
196
+ return await eor(
197
+ event, "`Temporary Server Error has Occured !\nPlease Try Again Later`"
198
+ )
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
 
209
  @ultroid_cmd(
 
224
  else:
225
  code = event.text.split(" ", maxsplit=1)[1]
226
  col = random.choice(all_col)
227
+ webs = requests.get("https://carbonara.vercel.app/api/cook")
228
+ if webs.status_code == 502:
229
+ return await eor(
230
+ event, "`Temporary Server Error has Occured !\nPlease Try Again Later`"
231
+ )
232
+ carbon = Carbon(
233
+ base_url="https://carbonara.vercel.app/api/cook", code=code, background=col
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
  )
 
 
 
 
plugins/channelhacks.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -87,7 +87,7 @@ async def _(e):
87
  return
88
  async for msg in ultroid_bot.iter_messages(int(c), reverse=True):
89
  try:
90
- await asyncio.sleep(1.3)
91
  await ultroid_bot.send_message(int(d), msg)
92
  except BaseException:
93
  pass
@@ -260,6 +260,3 @@ async def list_all(event):
260
  await x.delete()
261
  else:
262
  await x.edit(msg)
263
-
264
-
265
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
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
 
260
  await x.delete()
261
  else:
262
  await x.edit(msg)
 
 
 
plugins/chats.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -38,8 +38,6 @@ from . import *
38
  groups_only=True,
39
  )
40
  async def _(e):
41
- if BOT_MODE:
42
- return await eor(e, "You Cant Use This Command in BOT_MODE")
43
  xx = await eor(e, "`Processing...`")
44
  try:
45
  await e.client(DeleteChannelRequest(e.chat_id))
@@ -71,8 +69,6 @@ async def _(e):
71
  pattern="create (b|g|c)(?: |$)(.*)",
72
  )
73
  async def _(e):
74
- if BOT_MODE:
75
- return await eor(e, "You Cant use this Command in BOT_MODE")
76
  type_of_group = e.pattern_match.group(1)
77
  group_name = e.pattern_match.group(2)
78
  xx = await eor(e, "`Processing...`")
@@ -123,6 +119,3 @@ async def _(e):
123
  )
124
  except Exception as ex:
125
  await xx.edit(str(ex))
126
-
127
-
128
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
38
  groups_only=True,
39
  )
40
  async def _(e):
 
 
41
  xx = await eor(e, "`Processing...`")
42
  try:
43
  await e.client(DeleteChannelRequest(e.chat_id))
 
69
  pattern="create (b|g|c)(?: |$)(.*)",
70
  )
71
  async def _(e):
 
 
72
  type_of_group = e.pattern_match.group(1)
73
  group_name = e.pattern_match.group(2)
74
  xx = await eor(e, "`Processing...`")
 
119
  )
120
  except Exception as ex:
121
  await xx.edit(str(ex))
 
 
 
plugins/clean_action.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -63,6 +63,3 @@ async def _(event):
63
  await event.delete()
64
  except BaseException:
65
  pass
66
-
67
-
68
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
63
  await event.delete()
64
  except BaseException:
65
  pass
 
 
 
plugins/compressor.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -27,6 +27,7 @@ from datetime import datetime as dt
27
 
28
  from hachoir.metadata import extractMetadata
29
  from hachoir.parser import createParser
 
30
  from telethon.tl.types import DocumentAttributeVideo
31
 
32
  from . import *
@@ -74,16 +75,10 @@ async def _(e):
74
  with open(progress, "w") as fk:
75
  pass
76
  proce = await asyncio.create_subprocess_shell(
77
- f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -c:v libx265 -crf {crf} -map 0:v -c:a aac -map 0:a -c:s copy -map 0:s? """{out}""" -y',
78
  stdout=asyncio.subprocess.PIPE,
79
  stderr=asyncio.subprocess.PIPE,
80
  )
81
- if proce.returncode is None:
82
- proce = await asyncio.create_subprocess_shell(
83
- f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -vcodec libx265 -crf {crf} """{out}""" -y',
84
- stdout=asyncio.subprocess.PIPE,
85
- stderr=asyncio.subprocess.PIPE,
86
- )
87
  while proce.returncode != 0:
88
  await asyncio.sleep(3)
89
  with open(progress, "r+") as fil:
@@ -96,13 +91,31 @@ async def _(e):
96
  if len(size):
97
  size = int(size[-1])
98
  per = elapse * 100 / int(total_frames)
99
- progress_str = "`[{0}{1}] {2}%\n`".format(
 
 
 
 
 
 
100
  "".join(["●" for i in range(math.floor(per / 5))]),
101
  "".join(["" for i in range(20 - math.floor(per / 5))]),
102
  round(per, 2),
103
  )
104
  e_size = humanbytes(size)
105
- await xxx.edit(progress_str + "\n" + "`" + e_size + "`")
 
 
 
 
 
 
 
 
 
 
 
 
106
  os.remove(file.name)
107
  c_size = os.path.getsize(out)
108
  f_time = time.time()
@@ -158,6 +171,3 @@ async def _(e):
158
  await eod(e, "`Reply To Video File Only`")
159
  else:
160
  await eod(e, "`Reply To Video File Only`")
161
-
162
-
163
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
27
 
28
  from hachoir.metadata import extractMetadata
29
  from hachoir.parser import createParser
30
+ from telethon.errors.rpcerrorlist import MessageNotModifiedError
31
  from telethon.tl.types import DocumentAttributeVideo
32
 
33
  from . import *
 
75
  with open(progress, "w") as fk:
76
  pass
77
  proce = await asyncio.create_subprocess_shell(
78
+ f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -vcodec libx265 -crf {crf} """{out}""" -y',
79
  stdout=asyncio.subprocess.PIPE,
80
  stderr=asyncio.subprocess.PIPE,
81
  )
 
 
 
 
 
 
82
  while proce.returncode != 0:
83
  await asyncio.sleep(3)
84
  with open(progress, "r+") as fil:
 
91
  if len(size):
92
  size = int(size[-1])
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
109
+ + progress_str
110
+ + "`"
111
+ + e_size
112
+ + "`"
113
+ + "\n\n`"
114
+ + eta
115
+ + "`"
116
+ )
117
+ except MessageNotModifiedError:
118
+ pass
119
  os.remove(file.name)
120
  c_size = os.path.getsize(out)
121
  f_time = time.time()
 
171
  await eod(e, "`Reply To Video File Only`")
172
  else:
173
  await eod(e, "`Reply To Video File Only`")
 
 
 
plugins/converter.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -32,7 +32,6 @@ import os
32
  import time
33
 
34
  import cv2
35
- import requests
36
  from PIL import Image
37
  from telegraph import upload_file as uf
38
  from telethon.tl.types import MessageMediaDocument as doc
@@ -43,7 +42,9 @@ from . import *
43
  opn = []
44
 
45
 
46
- @ultroid_cmd(pattern="thumbnail$")
 
 
47
  async def _(e):
48
  r = await e.get_reply_message()
49
  pop = "`Reply to img or file with thumbnail.`"
@@ -64,7 +65,9 @@ async def _(e):
64
  await eor(e, f"Added [This]({nn}) As Your Custom Thumbnail", link_preview=False)
65
 
66
 
67
- @ultroid_cmd(pattern="rename ?(.*)")
 
 
68
  async def imak(event):
69
  reply = await event.get_reply_message()
70
  t = time.time()
@@ -100,7 +103,9 @@ async def imak(event):
100
  await xx.delete()
101
 
102
 
103
- @ultroid_cmd(pattern="mtoi$")
 
 
104
  async def imak(event):
105
  reply = await event.get_reply_message()
106
  if not (reply and (reply.media)):
@@ -122,7 +127,9 @@ async def imak(event):
122
  os.remove(image)
123
 
124
 
125
- @ultroid_cmd(pattern="mtos$")
 
 
126
  async def smak(event):
127
  reply = await event.get_reply_message()
128
  if not (reply and (reply.media)):
@@ -145,10 +152,12 @@ async def smak(event):
145
 
146
 
147
  @ultroid_cmd(
148
- pattern="doc",
149
  )
150
  async def _(event):
151
- input_str = event.text[5:]
 
 
152
  xx = await eor(event, get_string("com_1"))
153
  if event.reply_to_msg_id:
154
  a = await event.get_reply_message()
@@ -175,28 +184,26 @@ async def _(event):
175
  a = await event.get_reply_message()
176
  if a.media:
177
  b = await a.download_media()
178
- c = open(b)
179
- d = c.read()
180
- c.close()
 
 
 
181
  try:
182
  await xx.edit(f"```{d}```")
183
  except BaseException:
184
- key = (
185
- requests.post(
186
- "https://nekobin.com/api/documents", json={"content": d}
 
 
 
 
 
187
  )
188
- .json()
189
- .get("result")
190
- .get("key")
191
- )
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`", time=5)
198
  else:
199
  return await eod(xx, "`Reply to a readable file`", time=5)
200
-
201
-
202
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
32
  import time
33
 
34
  import cv2
 
35
  from PIL import Image
36
  from telegraph import upload_file as uf
37
  from telethon.tl.types import MessageMediaDocument as doc
 
42
  opn = []
43
 
44
 
45
+ @ultroid_cmd(
46
+ pattern="thumbnail$",
47
+ )
48
  async def _(e):
49
  r = await e.get_reply_message()
50
  pop = "`Reply to img or file with thumbnail.`"
 
65
  await eor(e, f"Added [This]({nn}) As Your Custom Thumbnail", link_preview=False)
66
 
67
 
68
+ @ultroid_cmd(
69
+ pattern="rename ?(.*)",
70
+ )
71
  async def imak(event):
72
  reply = await event.get_reply_message()
73
  t = time.time()
 
103
  await xx.delete()
104
 
105
 
106
+ @ultroid_cmd(
107
+ pattern="mtoi$",
108
+ )
109
  async def imak(event):
110
  reply = await event.get_reply_message()
111
  if not (reply and (reply.media)):
 
127
  os.remove(image)
128
 
129
 
130
+ @ultroid_cmd(
131
+ pattern="mtos$",
132
+ )
133
  async def smak(event):
134
  reply = await event.get_reply_message()
135
  if not (reply and (reply.media)):
 
152
 
153
 
154
  @ultroid_cmd(
155
+ pattern="doc ?(.*)",
156
  )
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()
 
184
  a = await event.get_reply_message()
185
  if a.media:
186
  b = await a.download_media()
187
+ try:
188
+ c = open(b)
189
+ d = c.read()
190
+ c.close()
191
+ except UnicodeDecodeError:
192
+ return await eod(xx, "`Not A Readable File.`")
193
  try:
194
  await xx.edit(f"```{d}```")
195
  except BaseException:
196
+ what, key = get_paste(message)
197
+ if "neko" in what:
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)
 
 
 
plugins/core.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -108,6 +108,3 @@ async def load(event):
108
  f"**Could not load** `{shortname}` **because of the following error.**\n`{str(e)}`",
109
  time=3,
110
  )
111
-
112
-
113
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
108
  f"**Could not load** `{shortname}` **because of the following error.**\n`{str(e)}`",
109
  time=3,
110
  )
 
 
 
plugins/dayevents.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -41,6 +41,3 @@ async def diela(e):
41
  for eve in ml[:5]:
42
  te += "• " + f'[{eve.text}]({eve["href"]})\n'
43
  await m.edit(te, link_preview=False)
44
-
45
-
46
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
41
  for eve in ml[:5]:
42
  te += "• " + f'[{eve.text}]({eve["href"]})\n'
43
  await m.edit(te, link_preview=False)
 
 
 
plugins/deezer.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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}deez <search query (| flac)>`
12
+ Download songs from Deezer
13
+ """
plugins/devtools.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -37,13 +37,14 @@ from . import *
37
  pattern="sysinfo$",
38
  )
39
  async def _(e):
40
- await eor(e, "`Sending...`")
41
  x, y = await bash("neofetch|sed 's/\x1B\\[[0-9;\\?]*[a-zA-Z]//g' >> neo.txt")
42
  with open("neo.txt", "r") as neo:
43
  p = (neo.read()).replace("\n\n", "")
44
- ok = Carbon(code=p)
45
  haa = await ok.save("neofetch")
46
  await e.client.send_file(e.chat_id, haa)
 
47
  remove("neofetch.jpg")
48
  remove("neo.txt")
49
 
@@ -93,7 +94,7 @@ async def _(event):
93
  )
94
  await xx.delete()
95
  else:
96
- await eor(xx, OUT)
97
 
98
 
99
  p = print # ignore: pylint
@@ -165,7 +166,7 @@ async def _(event):
165
  )
166
  await xx.delete()
167
  else:
168
- await eor(xx, final_output)
169
 
170
 
171
  async def aexec(code, event):
@@ -178,6 +179,3 @@ async def aexec(code, event):
178
  )
179
 
180
  return await locals()["__aexec"](event, event.client)
181
-
182
-
183
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
37
  pattern="sysinfo$",
38
  )
39
  async def _(e):
40
+ xx = await eor(e, "`Sending...`")
41
  x, y = await bash("neofetch|sed 's/\x1B\\[[0-9;\\?]*[a-zA-Z]//g' >> neo.txt")
42
  with open("neo.txt", "r") as neo:
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")
50
 
 
94
  )
95
  await xx.delete()
96
  else:
97
+ await xx.edit(OUT)
98
 
99
 
100
  p = print # ignore: pylint
 
166
  )
167
  await xx.delete()
168
  else:
169
+ await xx.edit(final_output)
170
 
171
 
172
  async def aexec(code, event):
 
179
  )
180
 
181
  return await locals()["__aexec"](event, event.client)
 
 
 
plugins/dm.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -16,6 +16,8 @@ from . import *
16
 
17
  @ultroid_cmd(pattern="dm ?(.*)")
18
  async def dm(e):
 
 
19
  if len(e.text) > 3:
20
  if not e.text[3] == " ": # weird fix
21
  return
@@ -43,6 +45,3 @@ async def dm(e):
43
  "`{i}help dm`",
44
  time=4,
45
  )
46
-
47
-
48
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
16
 
17
  @ultroid_cmd(pattern="dm ?(.*)")
18
  async def dm(e):
19
+ if not e.out and not is_fullsudo(e.sender_id):
20
+ return await eor(e, "`This Command is Full Sudo Restricted..`")
21
  if len(e.text) > 3:
22
  if not e.text[3] == " ": # weird fix
23
  return
 
45
  "`{i}help dm`",
46
  time=4,
47
  )
 
 
 
plugins/download_upload.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -84,7 +84,7 @@ async def download(event):
84
  ),
85
  ),
86
  )
87
- e = datetime.now()
88
  t = time_formatter(((e - s).seconds) * 1000)
89
  if t != "":
90
  await eor(xx, get_string("udl_2").format(file_name, t))
@@ -253,7 +253,7 @@ async def download(event):
253
  )
254
  except Exception as ve:
255
  return await eor(xx, str(ve))
256
- e = datetime.now()
257
  t = time_formatter(((e - s).seconds) * 1000)
258
  if t != "":
259
  if os.path.isdir(kk):
@@ -272,6 +272,3 @@ async def download(event):
272
  await eor(xx, f"Uploaded `{kk}` in `{t}`")
273
  else:
274
  await eor(xx, f"Uploaded `{kk}` in `0 second(s)`")
275
-
276
-
277
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
84
  ),
85
  ),
86
  )
87
+ e = dt.now()
88
  t = time_formatter(((e - s).seconds) * 1000)
89
  if t != "":
90
  await eor(xx, get_string("udl_2").format(file_name, t))
 
253
  )
254
  except Exception as ve:
255
  return await eor(xx, str(ve))
256
+ e = dt.now()
257
  t = time_formatter(((e - s).seconds) * 1000)
258
  if t != "":
259
  if os.path.isdir(kk):
 
272
  await eor(xx, f"Uploaded `{kk}` in `{t}`")
273
  else:
274
  await eor(xx, f"Uploaded `{kk}` in `0 second(s)`")
 
 
 
plugins/echo.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -93,6 +93,3 @@ async def lstecho(e):
93
  await eor(e, user)
94
  else:
95
  await eod(e, "`List is Empty, For echo`")
96
-
97
-
98
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
93
  await eor(e, user)
94
  else:
95
  await eod(e, "`List is Empty, For echo`")
 
 
 
plugins/evaljs.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -79,6 +79,3 @@ async def evaluateJs(event):
79
  startTime=start,
80
  )
81
  ).start()
82
-
83
-
84
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
79
  startTime=start,
80
  )
81
  ).start()
 
 
 
plugins/extra.py CHANGED
@@ -1,5 +1,5 @@
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
@@ -50,7 +50,7 @@ async def delete_it(delme):
50
  try:
51
  await msg_src.delete()
52
  await delme.delete()
53
- except BaseException:
54
  await eod(
55
  delme,
56
  f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`",
@@ -113,6 +113,3 @@ async def _(e):
113
  )
114
  else:
115
  await e.delete()
116
-
117
-
118
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
 
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
 
50
  try:
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)}`",
 
113
  )
114
  else:
115
  await e.delete()