Devesh Pal Amit Sharma Aditya Kaif xditya 1Danish-00 Smartman commited on
Commit
c46d195
·
1 Parent(s): 7bd6302

Ultroid v0.5 Updates

Browse files

Co-authored-by: Amit Sharma <[email protected]>
Co-authored-by: Aditya <[email protected]>
Co-authored-by: Kaif <[email protected]>
Co-authored-by: Aditya <[email protected]>
Co-authored-by: 1Danish-00 <[email protected]>
Co-authored-by: smartman_ru <[email protected]>

This view is limited to 50 files because it contains too many changes.   See raw diff
.github/stalebot.yml CHANGED
@@ -7,7 +7,7 @@ staleLabel: inactive
7
  # Comment to post when marking an issue as stale. Set to `false` to disable
8
  markComment: >
9
  This issue has been automatically marked as stale because it has not had
10
- recent activity. It will be closed if no further activity occurs. Thank you
11
  for your contributions.
12
  # Comment to post when closing a stale issue. Set to `false` to disable
13
- closeComment: false
 
7
  # Comment to post when marking an issue as stale. Set to `false` to disable
8
  markComment: >
9
  This issue has been automatically marked as stale because it has not had
10
+ any recent activity. It will be closed if no further activity occurs. Thank you
11
  for your contributions.
12
  # Comment to post when closing a stale issue. Set to `false` to disable
13
+ closeComment: false
.gitignore CHANGED
@@ -2,6 +2,7 @@
2
  *.session-journal
3
  *.session
4
  build
 
5
  *.mp3
6
  *.webm
7
  *.webp
 
2
  *.session-journal
3
  *.session
4
  build
5
+ test*
6
  *.mp3
7
  *.webm
8
  *.webp
README.md CHANGED
@@ -48,7 +48,7 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
48
  ### Local Deploy - Easy Method
49
  - Linux - `wget -O locals.py https://git.io/JY9UM && python3 locals.py`
50
  - Windows - `cd desktop ; wget https://git.io/JY9UM -o locals.py ; python locals.py`
51
- - Termux - `wget -O locals.py https://git.io/JY9UM && python locals.py`
52
 
53
  ### Local Deploy - Traditional Method
54
  - Get your [Necessary Variables](#Necessary-Variables)
 
48
  ### Local Deploy - Easy Method
49
  - Linux - `wget -O locals.py https://git.io/JY9UM && python3 locals.py`
50
  - Windows - `cd desktop ; wget https://git.io/JY9UM -o locals.py ; python locals.py`
51
+ - Termux - `wget -O install-termux https://tiny.ultroid.tech/termux && bash install-termux`
52
 
53
  ### Local Deploy - Traditional Method
54
  - Get your [Necessary Variables](#Necessary-Variables)
assistant/__init__.py CHANGED
@@ -7,10 +7,10 @@
7
 
8
  from pyUltroid import *
9
  from pyUltroid import _ult_cache
 
 
10
  from pyUltroid.functions.helper import *
11
  from pyUltroid.functions.tools import get_stored_file
12
- from pyUltroid.misc import owner_and_sudos
13
- from pyUltroid.misc._assistant import asst_cmd, callback, in_pattern
14
  from telethon import Button, custom
15
 
16
  from plugins import ATRA_COL
 
7
 
8
  from pyUltroid import *
9
  from pyUltroid import _ult_cache
10
+ from pyUltroid._misc import owner_and_sudos
11
+ from pyUltroid._misc._assistant import asst_cmd, callback, in_pattern
12
  from pyUltroid.functions.helper import *
13
  from pyUltroid.functions.tools import get_stored_file
 
 
14
  from telethon import Button, custom
15
 
16
  from plugins import ATRA_COL
assistant/callbackstuffs.py CHANGED
@@ -15,7 +15,11 @@ from os import execl, remove
15
  from random import choice
16
 
17
  from bs4 import BeautifulSoup as bs
18
- from pyUltroid.functions.gDrive import GDriveManager
 
 
 
 
19
  from pyUltroid.functions.helper import fast_download, progress, uploader
20
  from pyUltroid.functions.tools import (
21
  Carbon,
@@ -33,7 +37,7 @@ from . import *
33
 
34
  # --------------------------------------------------------------------#
35
  telegraph = telegraph_client()
36
- GDrive = GDriveManager()
37
  # --------------------------------------------------------------------#
38
 
39
 
@@ -1306,4 +1310,4 @@ async def fdroid_dler(event):
1306
  if msg and hasattr(msg, "media"):
1307
  FD_MEDIA.update({uri: msg.media})
1308
  os.remove(thumb)
1309
- os.remove(file)
 
15
  from random import choice
16
 
17
  from bs4 import BeautifulSoup as bs
18
+
19
+ try:
20
+ from pyUltroid.functions.gDrive import GDriveManager
21
+ except ImportError:
22
+ GDriveManager = None
23
  from pyUltroid.functions.helper import fast_download, progress, uploader
24
  from pyUltroid.functions.tools import (
25
  Carbon,
 
37
 
38
  # --------------------------------------------------------------------#
39
  telegraph = telegraph_client()
40
+ GDrive = GDriveManager() if GDriveManager else None
41
  # --------------------------------------------------------------------#
42
 
43
 
 
1310
  if msg and hasattr(msg, "media"):
1311
  FD_MEDIA.update({uri: msg.media})
1312
  os.remove(thumb)
1313
+ os.remove(file)
assistant/games.py CHANGED
@@ -20,10 +20,17 @@ import uuid
20
  from html import unescape
21
  from random import choice, shuffle
22
 
23
- import akinator
 
 
 
 
 
 
 
 
24
  from pyUltroid.functions.helper import inline_mention
25
  from pyUltroid.functions.tools import async_searcher
26
- from pyUltroid.misc._decorators import ultroid_cmd
27
  from telethon.errors.rpcerrorlist import (
28
  BotMethodInvalidError,
29
  ChatSendStickersForbiddenError,
@@ -41,6 +48,8 @@ aki_photo = "https://telegra.ph/file/3cc8825c029fd0cab9edc.jpg"
41
 
42
  @ultroid_cmd(pattern="akinator")
43
  async def akina(e):
 
 
44
  sta = akinator.Akinator()
45
  games.update({e.chat_id: {e.id: sta}})
46
  try:
 
20
  from html import unescape
21
  from random import choice, shuffle
22
 
23
+ from . import LOGS
24
+
25
+ try:
26
+ import akinator
27
+ except ImportError:
28
+ akinator = None
29
+ LOGS.error("'akinator' not installed.")
30
+
31
+ from pyUltroid._misc._decorators import ultroid_cmd
32
  from pyUltroid.functions.helper import inline_mention
33
  from pyUltroid.functions.tools import async_searcher
 
34
  from telethon.errors.rpcerrorlist import (
35
  BotMethodInvalidError,
36
  ChatSendStickersForbiddenError,
 
48
 
49
  @ultroid_cmd(pattern="akinator")
50
  async def akina(e):
51
+ if not akinator:
52
+ return
53
  sta = akinator.Akinator()
54
  games.update({e.chat_id: {e.id: sta}})
55
  try:
assistant/inlinestuff.py CHANGED
@@ -6,6 +6,7 @@
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
  import base64
 
9
  from datetime import datetime
10
  from random import choice
11
  from re import compile as re_compile
@@ -20,6 +21,7 @@ from pyUltroid.functions.tools import (
20
  webuploader,
21
  )
22
  from telethon import Button
 
23
  from telethon.tl.types import DocumentAttributeAudio as Audio
24
  from telethon.tl.types import InputWebDocument as wb
25
 
@@ -158,7 +160,7 @@ async def _(e):
158
  filename = filename.split("/")[-1]
159
  await e.edit(f"Uploading `{filename}` on {host}")
160
  link = (await webuploader(chat_id, msg_id, host)).strip().replace("\n", "")
161
- await e.edit(f"Uploaded [{filename}]({link}) on {host}.")
162
 
163
 
164
  @in_pattern("repo", owner=True)
@@ -688,3 +690,197 @@ async def savn_s(event):
688
  )
689
  await event.answer(res, switch_pm=swi, switch_pm_param="start")
690
  _savn_cache.update({query: res})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
  import base64
9
+ import inspect
10
  from datetime import datetime
11
  from random import choice
12
  from re import compile as re_compile
 
21
  webuploader,
22
  )
23
  from telethon import Button
24
+ from telethon.tl.alltlobjects import LAYER, tlobjects
25
  from telethon.tl.types import DocumentAttributeAudio as Audio
26
  from telethon.tl.types import InputWebDocument as wb
27
 
 
160
  filename = filename.split("/")[-1]
161
  await e.edit(f"Uploading `{filename}` on {host}")
162
  link = (await webuploader(chat_id, msg_id, host)).strip().replace("\n", "")
163
+ await e.edit(f"Uploaded `{filename}` on {host}.", buttons=Button.url("View", link))
164
 
165
 
166
  @in_pattern("repo", owner=True)
 
690
  )
691
  await event.answer(res, switch_pm=swi, switch_pm_param="start")
692
  _savn_cache.update({query: res})
693
+
694
+
695
+ _OMG = {}
696
+
697
+
698
+ @in_pattern("omgu", owner=True)
699
+ async def omgubuntu(ult):
700
+ try:
701
+ match = ult.text.split(maxsplit=1)[1].lower()
702
+ except IndexError:
703
+ return await ult.answer(
704
+ [], switch_pm="Enter Query to search...", switch_pm_param="start"
705
+ )
706
+ if _OMG.get(match):
707
+ return await ult.answer(
708
+ _OMG[match], switch_pm="OMG Ubuntu Search :]", switch_pm_param="start"
709
+ )
710
+ get_web = "https://www.omgubuntu.co.uk/?s=" + match.replace(" ", "+")
711
+ get_ = await async_searcher(get_web, re_content=True)
712
+ BSC = bs(get_, "html.parser", from_encoding="utf-8")
713
+ res = []
714
+ for cont in BSC.find_all("div", "sbs-layout__item"):
715
+ img = cont.find("div", "sbs-layout__image")
716
+ url = img.find("a")["href"]
717
+ src = img.find("img")["src"]
718
+ con = cont.find("div", "sbs-layout__content")
719
+ tit = con.find("a", "layout__title-link")
720
+ title = tit.text.strip()
721
+ desc = con.find("p", "layout__description").text.strip()
722
+ text = f"[{title.strip()}]({url})\n\n{desc}"
723
+ img = wb(src, 0, "image/jpeg", [])
724
+ res.append(
725
+ await ult.builder.article(
726
+ title=title,
727
+ type="photo",
728
+ description=desc,
729
+ url=url,
730
+ text=text,
731
+ buttons=Button.switch_inline(
732
+ "Search Again", query=ult.text, same_peer=True
733
+ ),
734
+ include_media=True,
735
+ content=img,
736
+ thumb=img,
737
+ )
738
+ )
739
+ await ult.answer(
740
+ res,
741
+ switch_pm=f"Showing {len(res)} results!" if res else "No Results Found :[",
742
+ switch_pm_param="start",
743
+ )
744
+ _OMG[match] = res
745
+
746
+
747
+ @in_pattern("tl", owner=True)
748
+ async def inline_tl(ult):
749
+ try:
750
+ match = ult.text.split(maxsplit=1)[1]
751
+ except IndexError:
752
+ text = f"**It is Telegram TlObjects Searcher.**\n__(Don't use if you don't know what it is!)__\n\n• Example Usage\n`@{asst.me.username} tl GetUserRequest`"
753
+ return await ult.answer(
754
+ [
755
+ await ult.builder.article(
756
+ title="How to Use?",
757
+ description="Tl Searcher by Ultroid",
758
+ url="https://t.me/TheUltroid",
759
+ text=text,
760
+ )
761
+ ],
762
+ switch_pm="Tl Search 🔍",
763
+ switch_pm_param="start",
764
+ )
765
+ res = []
766
+ for key in tlobjects.values():
767
+ if match.lower() in key.__name__.lower():
768
+ tyyp = "Function" if "tl.functions." in str(key) else "Type"
769
+ text = f"**Name:** `{key.__name__}`\n"
770
+ text += f"**Category:** `{tyyp}`\n"
771
+ text += f"\n`from {key.__module__} import {key.__name__}`\n\n"
772
+ args = str(inspect.signature(key))[1:][:-1]
773
+ if args:
774
+ text += "**Parameter:**\n"
775
+ for para in args.split(","):
776
+ text += " " * 4 + "`" + para + "`\n"
777
+ text += f"\n**Layer:** `{LAYER}`"
778
+ res.append(
779
+ await ult.builder.article(
780
+ title=key.__name__,
781
+ description=tyyp,
782
+ url="https://t.me/TheUltroid",
783
+ text=text[:4000],
784
+ )
785
+ )
786
+ if not res:
787
+ mo = f"No Results for {match}!"
788
+ else:
789
+ mo = f"Showing {len(res)} results!"
790
+ await ult.answer(res[:50], switch_pm=mo, switch_pm_param="start")
791
+
792
+
793
+ @in_pattern("gh", owner=True)
794
+ async def gh_feeds(ult):
795
+ try:
796
+ username = ult.text.split(maxsplit=1)[1]
797
+ except IndexError:
798
+ return await ult.answer(
799
+ [],
800
+ switch_pm="Enter Github Username to see feeds...",
801
+ switch_pm_param="start",
802
+ )
803
+ if not username.endswith("."):
804
+ return await ult.answer(
805
+ [], switch_pm="End your query with . to search...", switch_pm_param="start"
806
+ )
807
+ username = username[:-1]
808
+ data = await async_searcher(
809
+ f"https://api.github.com/users/{username}/events", re_json=True
810
+ )
811
+ if not isinstance(data, list):
812
+ msg = ""
813
+ for ak in list(data.keys()):
814
+ msg += ak + ": `" + data[ak] + "`\n"
815
+ return await ult.answer(
816
+ [
817
+ await ult.builder.article(
818
+ title=data["message"], text=msg, link_preview=False
819
+ )
820
+ ],
821
+ cache_time=300,
822
+ switch_pm="Error!!!",
823
+ switch_pm_param="start",
824
+ )
825
+ res = []
826
+ res_ids = []
827
+ for cont in data[:50]:
828
+ text = f"<b><a href='https://github.com/{username}'>@{username}</a></b>"
829
+ title = f"@{username}"
830
+ extra = None
831
+ if cont["type"] == "PushEvent":
832
+ text += " pushed in"
833
+ title += " pushed in"
834
+ dt = cont["payload"]["commits"][-1]
835
+ url = "https://github.com/" + dt["url"].split("/repos/")[-1]
836
+ extra = f"\n-> <b>message:</b> <code>{dt['message']}</code>"
837
+ elif cont["type"] == "IssueCommentEvent":
838
+ title += " commented at"
839
+ text += " commented at"
840
+ url = cont["payload"]["comment"]["html_url"]
841
+ elif cont["type"] == "CreateEvent":
842
+ title += " created"
843
+ text += " created"
844
+ url = "https://github.com/" + cont["repo"]["name"]
845
+ elif cont["type"] == "PullRequestEvent":
846
+ if (
847
+ cont["payload"]["pull_request"].get("user", {}).get("login")
848
+ != username.lower()
849
+ ):
850
+ continue
851
+ url = cont["payload"]["pull_request"]["html_url"]
852
+ text += " created a pull request in"
853
+ title += " created a pull request in"
854
+ elif cont["type"] == "ForkEvent":
855
+ text += " forked"
856
+ title += " forked"
857
+ url = cont["payload"]["forkee"]["html_url"]
858
+ else:
859
+ continue
860
+ repo = cont["repo"]["name"]
861
+ repo_url = "https://github.com/" + repo
862
+ title += " " + repo
863
+ text += f" <b><a href='{repo_url}'>{repo}</a></b>"
864
+ if extra:
865
+ text += extra
866
+ thumb = wb(cont["actor"]["avatar_url"], 0, "image/jpeg", [])
867
+ article = await ult.builder.article(
868
+ title=title,
869
+ text=text,
870
+ url=repo_url,
871
+ parse_mode="html",
872
+ link_preview=False,
873
+ thumb=thumb,
874
+ buttons=[
875
+ Button.url("View", url),
876
+ Button.switch_inline("Search again", query=ult.text, same_peer=True),
877
+ ],
878
+ )
879
+ if article.id not in res_ids:
880
+ res_ids.append(article.id)
881
+ res.append(article)
882
+ if res:
883
+ msg = f"Showing {len(res)} feeds!"
884
+ else:
885
+ msg = "Nothing Found"
886
+ await ult.answer(res, cache_time=5000, switch_pm=msg, switch_pm_param="start")
assistant/manager/__init__.py CHANGED
@@ -5,7 +5,7 @@
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
 
8
  from pyUltroid.functions.helper import inline_mention
9
- from pyUltroid.misc._decorators import ultroid_cmd
10
 
11
  from .. import *
 
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
+ from pyUltroid._misc._decorators import ultroid_cmd
9
  from pyUltroid.functions.helper import inline_mention
 
10
 
11
  from .. import *
assistant/manager/stickermanager.py CHANGED
@@ -7,7 +7,7 @@
7
 
8
  import random
9
 
10
- from pyUltroid.functions.misc import create_quotly
11
  from pyUltroid.functions.tools import TgConverter
12
  from telethon import errors
13
  from telethon.errors.rpcerrorlist import StickersetInvalidError
@@ -54,7 +54,7 @@ async def kang_cmd(ult):
54
  image = TgConverter.resize_photo_sticker(dl)
55
  image.save(name, "WEBP")
56
  elif reply.text:
57
- dl = await create_quotly(reply)
58
  else:
59
  return await ult.eor("`Reply to sticker or text to add it in your pack...`")
60
  if not emoji:
 
7
 
8
  import random
9
 
10
+ from pyUltroid.functions.misc import Quotly
11
  from pyUltroid.functions.tools import TgConverter
12
  from telethon import errors
13
  from telethon.errors.rpcerrorlist import StickersetInvalidError
 
54
  image = TgConverter.resize_photo_sticker(dl)
55
  image.save(name, "WEBP")
56
  elif reply.text:
57
+ dl = await Quotly().create_quotly(reply)
58
  else:
59
  return await ult.eor("`Reply to sticker or text to add it in your pack...`")
60
  if not emoji:
assistant/start.py CHANGED
@@ -8,9 +8,9 @@
8
  from datetime import datetime
9
 
10
  from pytz import timezone as tz
 
11
  from pyUltroid.dB.asst_fns import *
12
  from pyUltroid.functions.helper import inline_mention
13
- from pyUltroid.misc import SUDO_M, owner_and_sudos
14
  from telethon import Button, events
15
  from telethon.errors.rpcerrorlist import MessageDeleteForbiddenError
16
  from telethon.utils import get_display_name
 
8
  from datetime import datetime
9
 
10
  from pytz import timezone as tz
11
+ from pyUltroid._misc import SUDO_M, owner_and_sudos
12
  from pyUltroid.dB.asst_fns import *
13
  from pyUltroid.functions.helper import inline_mention
 
14
  from telethon import Button, events
15
  from telethon.errors.rpcerrorlist import MessageDeleteForbiddenError
16
  from telethon.utils import get_display_name
docker-compose.yml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: "3.9"
2
+ services:
3
+ worker:
4
+ build: .
5
+ environment:
6
+ REDIS_URI: $REDIS_URI
7
+ REDIS_PASSWORD: $REDIS_PASSWORD
8
+ SESSION: $SESSION
9
+ API_ID: $API_ID # defaults to None
10
+ API_HASH: $API_HASH # defaults to None
11
+ MONGO_URI: $MONGO_URI # defaults to None
12
+ DATABASE_URL: $DATABASE_URL # defaults to None
install-termux ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Ultroid - UserBot
3
+ # Copyright (C) 2021-2022 TeamUltroid
4
+ #
5
+ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
6
+ # PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
+
8
+ if [ -d "resources" ]
9
+ then
10
+ echo "Current directory Identified.."
11
+ else
12
+ apt install git -y
13
+ git clone https://github.com/TeamUltroid/Ultroid
14
+ cd Ultroid
15
+ fi
16
+ bash resources/startup/termux.sh
plugins/__init__.py CHANGED
@@ -11,15 +11,16 @@ import os
11
  import time
12
  from random import choice
13
 
 
14
  from pyUltroid import *
 
 
 
15
  from pyUltroid.dB import DEVLIST, ULTROID_IMAGES
16
  from pyUltroid.functions.helper import *
17
  from pyUltroid.functions.info import *
18
  from pyUltroid.functions.misc import *
19
  from pyUltroid.functions.tools import *
20
- from pyUltroid.misc._assistant import asst_cmd, callback, in_pattern
21
- from pyUltroid.misc._decorators import ultroid_cmd
22
- from pyUltroid.misc._wrappers import eod, eor
23
  from pyUltroid.version import __version__, ultroid_version
24
  from telethon import Button, events
25
  from telethon.tl import functions, types
@@ -28,6 +29,7 @@ from strings import get_string
28
 
29
  Redis = udB.get_key
30
  con = TgConverter
 
31
  OWNER_NAME = ultroid_bot.full_name
32
  OWNER_ID = ultroid_bot.uid
33
 
 
11
  import time
12
  from random import choice
13
 
14
+ import requests
15
  from pyUltroid import *
16
+ from pyUltroid._misc._assistant import asst_cmd, callback, in_pattern
17
+ from pyUltroid._misc._decorators import ultroid_cmd
18
+ from pyUltroid._misc._wrappers import eod, eor
19
  from pyUltroid.dB import DEVLIST, ULTROID_IMAGES
20
  from pyUltroid.functions.helper import *
21
  from pyUltroid.functions.info import *
22
  from pyUltroid.functions.misc import *
23
  from pyUltroid.functions.tools import *
 
 
 
24
  from pyUltroid.version import __version__, ultroid_version
25
  from telethon import Button, events
26
  from telethon.tl import functions, types
 
29
 
30
  Redis = udB.get_key
31
  con = TgConverter
32
+ quotly = Quotly()
33
  OWNER_NAME = ultroid_bot.full_name
34
  OWNER_ID = ultroid_bot.uid
35
 
plugins/_chatactions.py CHANGED
@@ -36,7 +36,7 @@ async def Function(event):
36
 
37
 
38
  async def DummyHandler(ult):
39
- # clean chat actions
40
  key = udB.get_key("CLEANCHAT") or []
41
  if ult.chat_id in key:
42
  try:
 
36
 
37
 
38
  async def DummyHandler(ult):
39
+ # clean chat actions
40
  key = udB.get_key("CLEANCHAT") or []
41
  if ult.chat_id in key:
42
  try:
plugins/_help.py CHANGED
@@ -5,8 +5,10 @@
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
-
9
- from fuzzywuzzy.process import extractOne
 
 
10
  from pyUltroid.dB._core import HELP, LIST
11
  from pyUltroid.functions.tools import cmd_regex_replace
12
  from telethon.errors.rpcerrorlist import (
@@ -83,12 +85,11 @@ async def _help(ult):
83
  break
84
  if not file:
85
  # the enter command/plugin name is not found
86
- best_match = extractOne(plug, compare_strings)
87
- return await ult.eor(
88
- "`{}` is not a valid plugin!\nDid you mean `{}`?".format(
89
- plug, best_match[0]
90
- ),
91
- )
92
  output = f"**Command** `{plug}` **found in plugin** - `{file}`\n"
93
  if file in HELP["Official"]:
94
  for i in HELP["Official"][file]:
 
5
  # PLease read the GNU Affero General Public License in
6
  # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
 
8
+ try:
9
+ from fuzzywuzzy.process import extractOne
10
+ except ImportError:
11
+ extractOne = None
12
  from pyUltroid.dB._core import HELP, LIST
13
  from pyUltroid.functions.tools import cmd_regex_replace
14
  from telethon.errors.rpcerrorlist import (
 
85
  break
86
  if not file:
87
  # the enter command/plugin name is not found
88
+ text = f"`{plug}` is not a valid plugin!"
89
+ if extractOne:
90
+ best_match = extractOne(plug, compare_strings)
91
+ text += "\nDid you mean `{}`?".format(best_match[0])
92
+ return await ult.eor(text)
 
93
  output = f"**Command** `{plug}` **found in plugin** - `{file}`\n"
94
  if file in HELP["Official"]:
95
  for i in HELP["Official"][file]:
plugins/_inline.py CHANGED
@@ -11,10 +11,10 @@ from datetime import datetime
11
  from os import remove
12
 
13
  from git import Repo
 
14
  from pyUltroid.dB._core import HELP, LIST
15
  from pyUltroid.functions.helper import gen_chlog, time_formatter, updater
16
  from pyUltroid.functions.misc import split_list
17
- from pyUltroid.misc._assistant import callback, in_pattern
18
  from telethon import Button
19
  from telethon.tl.types import InputWebDocument, Message
20
  from telethon.utils import resolve_bot_file_id
@@ -332,9 +332,14 @@ async def _(e):
332
  [
333
  Button.switch_inline(
334
  "Fᴅʀᴏɪᴅ Sᴇᴀʀᴄʜ", query="fdroid telegram", same_peer=True
335
- )
 
 
 
 
 
336
  ],
337
- [Button.switch_inline("Sᴀᴀᴠɴ sᴇᴀʀᴄʜ", query="saavn", same_peer=True)],
338
  [
339
  Button.inline(
340
  "« Bᴀᴄᴋ",
 
11
  from os import remove
12
 
13
  from git import Repo
14
+ from pyUltroid._misc._assistant import callback, in_pattern
15
  from pyUltroid.dB._core import HELP, LIST
16
  from pyUltroid.functions.helper import gen_chlog, time_formatter, updater
17
  from pyUltroid.functions.misc import split_list
 
18
  from telethon import Button
19
  from telethon.tl.types import InputWebDocument, Message
20
  from telethon.utils import resolve_bot_file_id
 
332
  [
333
  Button.switch_inline(
334
  "Fᴅʀᴏɪᴅ Sᴇᴀʀᴄʜ", query="fdroid telegram", same_peer=True
335
+ ),
336
+ Button.switch_inline("Sᴀᴀᴠɴ sᴇᴀʀᴄʜ", query="saavn", same_peer=True),
337
+ ],
338
+ [
339
+ Button.switch_inline("Tʟ Sᴇᴀʀᴄʜ", query="tl", same_peer=True),
340
+ Button.switch_inline("GɪᴛHᴜʙ ғᴇᴇᴅs", query="gh", same_peer=True),
341
  ],
342
+ [Button.switch_inline("OᴍɢUʙᴜɴᴛᴜ", query="omgu cutefish", same_peer=True)],
343
  [
344
  Button.inline(
345
  "« Bᴀᴄᴋ",
plugins/_userlogs.py CHANGED
@@ -21,7 +21,18 @@ from telethon.errors.rpcerrorlist import (
21
  from telethon.tl.types import MessageEntityMention, MessageEntityMentionName, User
22
  from telethon.utils import get_display_name
23
 
24
- from . import ultroid_bot, asst, udB, inline_mention, Button, LOGS, get_string, LOG_CHANNEL, callback, events
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  CACHE_SPAM = {}
27
  TAG_EDITS = {}
 
21
  from telethon.tl.types import MessageEntityMention, MessageEntityMentionName, User
22
  from telethon.utils import get_display_name
23
 
24
+ from . import (
25
+ LOG_CHANNEL,
26
+ LOGS,
27
+ Button,
28
+ asst,
29
+ callback,
30
+ events,
31
+ get_string,
32
+ inline_mention,
33
+ udB,
34
+ ultroid_bot,
35
+ )
36
 
37
  CACHE_SPAM = {}
38
  TAG_EDITS = {}
plugins/_wspr.py CHANGED
@@ -90,7 +90,7 @@ async def _(e):
90
  ]
91
  us = logi.username or logi.first_name
92
  sur = e.builder.article(
93
- title=f"{logi.first_name}",
94
  description=desc,
95
  text=get_string("wspr_1").format(us),
96
  buttons=button,
@@ -141,9 +141,11 @@ async def _(e):
141
  same_peer=True,
142
  ),
143
  ]
144
- sur = e.builder.article(
145
  title=user.first_name,
146
  description=desc,
 
 
147
  text=text,
148
  buttons=button,
149
  )
 
90
  ]
91
  us = logi.username or logi.first_name
92
  sur = e.builder.article(
93
+ title=logi.first_name,
94
  description=desc,
95
  text=get_string("wspr_1").format(us),
96
  buttons=button,
 
141
  same_peer=True,
142
  ),
143
  ]
144
+ sur = e.builder.document(
145
  title=user.first_name,
146
  description=desc,
147
+ file=logi.full_user.profile_photo,
148
+ include_media=False,
149
  text=text,
150
  buttons=button,
151
  )
plugins/admintools.py CHANGED
@@ -68,7 +68,11 @@ from . import (
68
 
69
 
70
  @ultroid_cmd(
71
- pattern="promote( (.*)|$)", admins_only=True, manager=True, require="add_admins"
 
 
 
 
72
  )
73
  async def prmte(ult):
74
  xx = await ult.eor(get_string("com_1"))
@@ -96,7 +100,11 @@ async def prmte(ult):
96
 
97
 
98
  @ultroid_cmd(
99
- pattern="demote( (.*)|$)", admins_only=True, manager=True, require="add_admins"
 
 
 
 
100
  )
101
  async def dmote(ult):
102
  xx = await ult.eor(get_string("com_1"))
@@ -127,6 +135,7 @@ async def dmote(ult):
127
  admins_only=True,
128
  manager=True,
129
  require="ban_users",
 
130
  )
131
  async def bban(ult):
132
  something = await get_uinfo(ult)
@@ -152,7 +161,11 @@ async def bban(ult):
152
 
153
 
154
  @ultroid_cmd(
155
- pattern="unban( (.*)|$)", admins_only=True, manager=True, require="ban_users"
 
 
 
 
156
  )
157
  async def uunban(ult):
158
  xx = await ult.eor(get_string("com_1"))
@@ -181,6 +194,7 @@ async def uunban(ult):
181
  pattern="kick( (.*)|$)",
182
  manager=True,
183
  require="ban_users",
 
184
  )
185
  async def kck(ult):
186
  if "kickme" in ult.text:
@@ -215,7 +229,11 @@ async def kck(ult):
215
 
216
 
217
  @ultroid_cmd(
218
- pattern="tban( (.*)|$)", admins_only=True, manager=True, require="ban_users"
 
 
 
 
219
  )
220
  async def tkicki(e):
221
  huh = e.text.split()
@@ -235,9 +253,9 @@ async def tkicki(e):
235
  try:
236
  user = await e.client.get_entity(userid)
237
  except Exception as ex:
238
- return await eor(d, f"`{ex}`")
239
  try:
240
- bun = await ban_time(e, tme)
241
  await e.client.edit_permissions(
242
  e.chat_id, user.id, until_date=bun, view_messages=False
243
  )
@@ -250,7 +268,13 @@ async def tkicki(e):
250
  return await e.eor(str(m))
251
 
252
 
253
- @ultroid_cmd(pattern="pin$", manager=True, require="pin_messages")
 
 
 
 
 
 
254
  async def pin(msg):
255
  if not msg.is_reply:
256
  return await eor(msg, get_string("pin_1"))
@@ -273,6 +297,7 @@ async def pin(msg):
273
  admins_only=True,
274
  manager=True,
275
  require="pin_messages",
 
276
  )
277
  async def unp(ult):
278
  xx = await ult.eor(get_string("com_1"))
@@ -292,7 +317,11 @@ async def unp(ult):
292
 
293
 
294
  @ultroid_cmd(
295
- pattern="tpin( (.*)|$)", admins_only=True, manager=True, require="pin_messages"
 
 
 
 
296
  )
297
  async def pin_message(ult):
298
  match = ult.pattern_match.group(1).strip()
@@ -301,7 +330,7 @@ async def pin_message(ult):
301
  if not match:
302
  return await ult.eor("`Please provide time..`", time=8)
303
  msg = await ult.eor(get_string("com_1"))
304
- time = await ban_time(msg, match)
305
  if not time:
306
  return
307
  msg_id = ult.reply_to_msg_id
 
68
 
69
 
70
  @ultroid_cmd(
71
+ pattern="promote( (.*)|$)",
72
+ admins_only=True,
73
+ manager=True,
74
+ require="add_admins",
75
+ fullsudo=True,
76
  )
77
  async def prmte(ult):
78
  xx = await ult.eor(get_string("com_1"))
 
100
 
101
 
102
  @ultroid_cmd(
103
+ pattern="demote( (.*)|$)",
104
+ admins_only=True,
105
+ manager=True,
106
+ require="add_admins",
107
+ fullsudo=True,
108
  )
109
  async def dmote(ult):
110
  xx = await ult.eor(get_string("com_1"))
 
135
  admins_only=True,
136
  manager=True,
137
  require="ban_users",
138
+ fullsudo=True,
139
  )
140
  async def bban(ult):
141
  something = await get_uinfo(ult)
 
161
 
162
 
163
  @ultroid_cmd(
164
+ pattern="unban( (.*)|$)",
165
+ admins_only=True,
166
+ manager=True,
167
+ require="ban_users",
168
+ fullsudo=True,
169
  )
170
  async def uunban(ult):
171
  xx = await ult.eor(get_string("com_1"))
 
194
  pattern="kick( (.*)|$)",
195
  manager=True,
196
  require="ban_users",
197
+ fullsudo=True,
198
  )
199
  async def kck(ult):
200
  if "kickme" in ult.text:
 
229
 
230
 
231
  @ultroid_cmd(
232
+ pattern="tban( (.*)|$)",
233
+ admins_only=True,
234
+ manager=True,
235
+ require="ban_users",
236
+ fullsudo=True,
237
  )
238
  async def tkicki(e):
239
  huh = e.text.split()
 
253
  try:
254
  user = await e.client.get_entity(userid)
255
  except Exception as ex:
256
+ return await eor(e, f"`{ex}`")
257
  try:
258
+ bun = ban_time(e, tme)
259
  await e.client.edit_permissions(
260
  e.chat_id, user.id, until_date=bun, view_messages=False
261
  )
 
268
  return await e.eor(str(m))
269
 
270
 
271
+ @ultroid_cmd(
272
+ pattern="pin$",
273
+ admins_only=True,
274
+ manager=True,
275
+ require="pin_messages",
276
+ fullsudo=True,
277
+ )
278
  async def pin(msg):
279
  if not msg.is_reply:
280
  return await eor(msg, get_string("pin_1"))
 
297
  admins_only=True,
298
  manager=True,
299
  require="pin_messages",
300
+ fullsudo=True,
301
  )
302
  async def unp(ult):
303
  xx = await ult.eor(get_string("com_1"))
 
317
 
318
 
319
  @ultroid_cmd(
320
+ pattern="tpin( (.*)|$)",
321
+ admins_only=True,
322
+ manager=True,
323
+ require="pin_messages",
324
+ fullsudo=True,
325
  )
326
  async def pin_message(ult):
327
  match = ult.pattern_match.group(1).strip()
 
330
  if not match:
331
  return await ult.eor("`Please provide time..`", time=8)
332
  msg = await ult.eor(get_string("com_1"))
333
+ time = ban_time(msg, match)
334
  if not time:
335
  return
336
  msg_id = ult.reply_to_msg_id
plugins/afk.py CHANGED
@@ -37,7 +37,7 @@ from . import (
37
  old_afk_msg = []
38
 
39
 
40
- @ultroid_cmd(pattern="afk( (.*)|$)", fullsudo=True)
41
  async def set_afk(event):
42
  if event.client._bot or is_afk():
43
  return
 
37
  old_afk_msg = []
38
 
39
 
40
+ @ultroid_cmd(pattern="afk( (.*)|$)", owner_only=True)
41
  async def set_afk(event):
42
  if event.client._bot or is_afk():
43
  return
plugins/asstcmd.py CHANGED
@@ -18,12 +18,16 @@
18
  """
19
  import os
20
 
21
- from pyUltroid.dB.asstcmd_db import *
22
  from pyUltroid.functions.tools import create_tl_btn, format_btn, get_msg_button
23
- from telegraph import upload_file as uf
 
 
 
 
24
  from telethon import events, utils
25
 
26
- from . import asst, get_string, mediainfo, ultroid_cmd
27
 
28
 
29
  @ultroid_cmd(pattern="addcmd( (.*)|$)")
 
18
  """
19
  import os
20
 
21
+ from pyUltroid.dB.asstcmd_db import add_cmd, cmd_reply, list_cmds, rem_cmd
22
  from pyUltroid.functions.tools import create_tl_btn, format_btn, get_msg_button
23
+
24
+ try:
25
+ from telegraph import upload_file as uf
26
+ except ImportError:
27
+ uf = None
28
  from telethon import events, utils
29
 
30
+ from . import asst, get_string, mediainfo, udB, ultroid_cmd
31
 
32
 
33
  @ultroid_cmd(pattern="addcmd( (.*)|$)")
plugins/audiotools.py CHANGED
@@ -26,6 +26,7 @@ from datetime import datetime as dt
26
  from pyUltroid.functions.tools import set_attributes
27
 
28
  from . import (
 
29
  bash,
30
  downloader,
31
  eod,
 
26
  from pyUltroid.functions.tools import set_attributes
27
 
28
  from . import (
29
+ LOGS,
30
  bash,
31
  downloader,
32
  eod,
plugins/autoban.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2021-2022 TeamUltroid
3
+ #
4
+ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5
+ # PLease read the GNU Affero General Public License in
6
+ # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
+
8
+ """
9
+ ✘ Commands Available
10
+
11
+ • `{i}autokick <on/off>`
12
+ on - To enable.
13
+ off - To disable.
14
+ Automatically kick new joined users from the group.
15
+
16
+ • `{i}cban`
17
+ Enable/Disable autobanning send as channel in used chat.
18
+
19
+ • `{i}addwl <Username>`
20
+ Add Channel to channelban whitelist.
21
+
22
+ • `{i}remwl <Username>`
23
+ Remove Channel from channelban whitelist.
24
+
25
+ • `{i}listwl` : List all whitelist channels.
26
+ """
27
+
28
+
29
+ from pyUltroid.dB import autoban_db, dnd_db
30
+ from pyUltroid.functions.admins import get_update_linked_chat
31
+ from telethon import events
32
+ from telethon.tl.types import Channel
33
+
34
+ from . import LOGS, asst, get_string, inline_mention, ultroid_bot, ultroid_cmd
35
+
36
+
37
+ async def dnd_func(event):
38
+ if event.chat_id in dnd_db.get_dnd_chats():
39
+ for user in event.users:
40
+ try:
41
+ await (
42
+ await event.client.kick_participant(event.chat_id, user)
43
+ ).delete()
44
+ except Exception as ex:
45
+ LOGS.error("Error in DND:")
46
+ LOGS.exception(ex)
47
+ await event.delete()
48
+
49
+
50
+ async def channel_del(event):
51
+ if not autoban_db.is_autoban_enabled(event.chat_id):
52
+ return
53
+ if autoban_db.is_whitelisted(event.chat_id, event.sender_id):
54
+ return
55
+ linked = await get_update_linked_chat(event)
56
+ if linked == event.sender.id:
57
+ return
58
+ if event.chat.creator or event.chat.admin_rights.ban_users:
59
+ try:
60
+ await event.client.edit_permissions(
61
+ event.chat_id, event.sender_id, view_messages=False
62
+ )
63
+ except Exception as er:
64
+ LOGS.exception(er)
65
+ await event.try_delete()
66
+
67
+
68
+ @ultroid_cmd(
69
+ pattern="autokick (on|off)$",
70
+ admins_only=True,
71
+ manager=True,
72
+ require="ban_users",
73
+ fullsudo=True,
74
+ )
75
+ async def _(event):
76
+ match = event.pattern_match.group(1)
77
+ if match == "on":
78
+ if dnd_db.chat_in_dnd(event.chat_id):
79
+ return await event.eor("`Chat already in do not disturb mode.`", time=3)
80
+ dnd_db.add_dnd(event.chat_id)
81
+ event.client.add_handler(
82
+ dnd_func, events.ChatAction(func=lambda x: x.user_joined)
83
+ )
84
+ await event.eor("`Do not disturb mode activated for this chat.`", time=3)
85
+ elif match == "off":
86
+ if not dnd_db.chat_in_dnd(event.chat_id):
87
+ return await event.eor("`Chat is not in do not disturb mode.`", time=3)
88
+ dnd_db.del_dnd(event.chat_id)
89
+ await event.eor("`Do not disturb mode deactivated for this chat.`", time=3)
90
+
91
+
92
+ @ultroid_cmd(pattern="cban$", admins_only=True)
93
+ async def ban_cha(ult):
94
+ if autoban_db.is_autoban_enabled(ult.chat_id):
95
+ autoban_db.del_channel(ult.chat_id)
96
+ return await ult.eor("`Disabled Auto ChannelBan...`")
97
+ if not (
98
+ ult.chat.creator
99
+ or (ult.chat.admin_rights.delete_messages or ult.chat.admin_rights.ban_users)
100
+ ):
101
+ return await ult.eor(
102
+ "You are missing required admin rights!\nYou can't use ChannelBan without Ban/del privilege..`"
103
+ )
104
+ autoban_db.add_channel(ult.chat_id)
105
+ await ult.eor("`Enabled Auto ChannelBan Successfully!`")
106
+ ult.client.add_handler(
107
+ channel_del,
108
+ events.NewMessage(
109
+ func=lambda x: not x.is_private and isinstance(x.sender, Channel)
110
+ ),
111
+ )
112
+
113
+
114
+ @ultroid_cmd(pattern="(list|add|rem)wl( (.*)|$)")
115
+ async def do_magic(event):
116
+ match = event.pattern_match.group(1)
117
+ msg = await event.eor(get_string("com_1"))
118
+ if match == "list":
119
+ cha = autoban_db.get_whitelisted_channels(event.chat_id)
120
+ if not cha:
121
+ return await msg.edit("`No Whitelisted channels for current chat.`")
122
+ Msg = "**Whitelist Channels in Current Chat**\n\n"
123
+ for ch in cha:
124
+ Msg += f"(`{ch}`) "
125
+ try:
126
+ Msg += inline_mention(await event.client.get_entity(ch))
127
+ except Exception:
128
+ Msg += "\n"
129
+ return await msg.edit(Msg)
130
+ usea = event.pattern_match.group(2).strip()
131
+ if not usea:
132
+ return await Msg.edit(
133
+ "`Please provide a channel username/id to add/remove to/from whitelist..`"
134
+ )
135
+ try:
136
+ u_id = await event.client.parse_id(usea)
137
+ cha = await event.client.get_entity(u_id)
138
+ except Exception as er:
139
+ LOGS.exception(er)
140
+ return await msg.edit(f"Error Broke Out!\n`{er}`")
141
+ if match == "add":
142
+ autoban_db.add_to_whitelist(event.chat_id, u_id)
143
+ return await msg.edit(f"`Added` {inline_mention(cha)} `to WhiteList..`")
144
+ autoban_db.del_from_whitelist(event.chat_id, u_id)
145
+ await msg.edit(f"`Removed` {inline_mention(cha)} `from WhiteList.`")
146
+
147
+
148
+ if dnd_db.get_dnd_chats():
149
+ ultroid_bot.add_handler(dnd_func, events.ChatAction(func=lambda x: x.user_joined))
150
+ asst.add_handler(dnd_func, events.ChatAction(func=lambda x: x.user_joined))
151
+
152
+ if autoban_db.get_all_channels():
153
+ ultroid_bot.add_handler(
154
+ channel_del,
155
+ events.NewMessage(
156
+ func=lambda x: not x.is_private and isinstance(x.sender, Channel)
157
+ ),
158
+ )
plugins/autocorrect.py CHANGED
@@ -13,13 +13,14 @@
13
 
14
  import string
15
 
16
- from . import udB # ignore: pylint
17
- from . import HNDLR, get_string, ultroid_bot, ultroid_cmd
18
 
19
  try:
20
  from gingerit.gingerit import GingerIt
21
  except ImportError:
22
  LOGS.info("GingerIt not found")
 
 
23
  from google_trans_new import google_translator
24
  from telethon import events
25
 
@@ -54,7 +55,7 @@ async def gramme(event):
54
  pass
55
 
56
 
57
- if udB.get_key("AUTOCORRECT"):
58
  ultroid_bot.add_handler(
59
  gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
60
  )
 
13
 
14
  import string
15
 
16
+ from . import HNDLR, LOGS, get_string, udB, ultroid_bot, ultroid_cmd # ignore: pylint
 
17
 
18
  try:
19
  from gingerit.gingerit import GingerIt
20
  except ImportError:
21
  LOGS.info("GingerIt not found")
22
+ GingerIt = None
23
+
24
  from google_trans_new import google_translator
25
  from telethon import events
26
 
 
55
  pass
56
 
57
 
58
+ if GingerIt and udB.get_key("AUTOCORRECT"):
59
  ultroid_bot.add_handler(
60
  gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
61
  )
plugins/autopic.py CHANGED
@@ -92,8 +92,11 @@ if search := udB.get_key("AUTOPIC"):
92
  await ultroid_bot(UploadProfilePhotoRequest(file))
93
  shuffle(ok)
94
 
95
- from apscheduler.schedulers.asyncio import AsyncIOScheduler
 
96
 
97
- schedule = AsyncIOScheduler()
98
- schedule.add_job(autopic_func, "interval", seconds=sleep)
99
- schedule.start()
 
 
 
92
  await ultroid_bot(UploadProfilePhotoRequest(file))
93
  shuffle(ok)
94
 
95
+ try:
96
+ from apscheduler.schedulers.asyncio import AsyncIOScheduler
97
 
98
+ schedule = AsyncIOScheduler()
99
+ schedule.add_job(autopic_func, "interval", seconds=sleep)
100
+ schedule.start()
101
+ except ModuleNotFoundError as er:
102
+ LOGS.error(f"autopic: '{er.name}' not installed.")
plugins/bot.py CHANGED
@@ -38,13 +38,21 @@ import time
38
  from platform import python_version as pyver
39
  from random import choice
40
 
41
- from git import Repo
42
  from pyUltroid.version import __version__ as UltVer
43
  from telethon import __version__
44
  from telethon.errors.rpcerrorlist import (
45
  BotMethodInvalidError,
46
  ChatSendMediaForbiddenError,
47
  )
 
 
 
 
 
 
 
 
 
48
  from telethon.utils import resolve_bot_file_id
49
 
50
  from . import (
@@ -132,7 +140,7 @@ async def lol(ult):
132
  parse = "html"
133
  als = in_alive.format(
134
  header,
135
- ultroid_version,
136
  UltVer,
137
  pyver(),
138
  uptime,
@@ -145,7 +153,7 @@ async def lol(ult):
145
  als = (get_string("alive_1")).format(
146
  header,
147
  OWNER_NAME,
148
- ultroid_version,
149
  UltVer,
150
  uptime,
151
  pyver(),
@@ -272,7 +280,7 @@ async def inline_alive(ult):
272
  kk = f"<a href={rep}>{y}</a>"
273
  als = in_alive.format(
274
  header,
275
- ultroid_version,
276
  UltVer,
277
  pyver(),
278
  uptime,
@@ -319,9 +327,12 @@ async def inline_alive(ult):
319
  @ultroid_cmd(pattern="update( (.*)|$)")
320
  async def _(e):
321
  xx = await e.eor(get_string("upd_1"))
322
- if e.pattern_match.group(1).strip() and (
323
- "fast" in e.pattern_match.group(1).strip()
324
- or "soft" in e.pattern_match.group(1).strip()
 
 
 
325
  ):
326
  await bash("git pull -f && pip3 install -r requirements.txt")
327
  call_back()
 
38
  from platform import python_version as pyver
39
  from random import choice
40
 
 
41
  from pyUltroid.version import __version__ as UltVer
42
  from telethon import __version__
43
  from telethon.errors.rpcerrorlist import (
44
  BotMethodInvalidError,
45
  ChatSendMediaForbiddenError,
46
  )
47
+
48
+ from . import HOSTED_ON, LOGS
49
+
50
+ try:
51
+ from git import Repo
52
+ except ImportError:
53
+ LOGS.error("bot: 'gitpython' module not found!")
54
+ Repo = None
55
+
56
  from telethon.utils import resolve_bot_file_id
57
 
58
  from . import (
 
140
  parse = "html"
141
  als = in_alive.format(
142
  header,
143
+ ultroid_version + f" [{HOSTED_ON}]",
144
  UltVer,
145
  pyver(),
146
  uptime,
 
153
  als = (get_string("alive_1")).format(
154
  header,
155
  OWNER_NAME,
156
+ ultroid_version + f" [{HOSTED_ON}]",
157
  UltVer,
158
  uptime,
159
  pyver(),
 
280
  kk = f"<a href={rep}>{y}</a>"
281
  als = in_alive.format(
282
  header,
283
+ ultroid_version + f" [{HOSTED_ON}]",
284
  UltVer,
285
  pyver(),
286
  uptime,
 
327
  @ultroid_cmd(pattern="update( (.*)|$)")
328
  async def _(e):
329
  xx = await e.eor(get_string("upd_1"))
330
+ if HOSTED_ON == "heroku" or (
331
+ e.pattern_match.group(1).strip()
332
+ and (
333
+ "fast" in e.pattern_match.group(1).strip()
334
+ or "soft" in e.pattern_match.group(1).strip()
335
+ )
336
  ):
337
  await bash("git pull -f && pip3 install -r requirements.txt")
338
  call_back()
plugins/button.py CHANGED
@@ -15,11 +15,12 @@ Format:- `{i}button Hey There! @UseUltroid 😎.
15
  [TeamUltroid | t.me/TeamUltroid]`
16
  """
17
  import os
 
18
  from pyUltroid.functions.tools import create_tl_btn, get_msg_button
19
  from telegraph import upload_file as uf
20
  from telethon.utils import pack_bot_file_id
21
 
22
- from . import HNDLR, ultroid_cmd, mediainfo, get_string
23
  from ._inline import something
24
 
25
 
 
15
  [TeamUltroid | t.me/TeamUltroid]`
16
  """
17
  import os
18
+
19
  from pyUltroid.functions.tools import create_tl_btn, get_msg_button
20
  from telegraph import upload_file as uf
21
  from telethon.utils import pack_bot_file_id
22
 
23
+ from . import HNDLR, get_string, mediainfo, ultroid_cmd
24
  from ._inline import something
25
 
26
 
plugins/chats.py CHANGED
@@ -11,6 +11,9 @@
11
  Delete the group this cmd is used in.
12
 
13
  • `{i}getlink`
 
 
 
14
  Get link of group this cmd is used in.
15
 
16
  • `{i}create (g|b|c) <group_name> ; <optional-username>`
@@ -80,8 +83,9 @@ async def _(e):
80
  int(udB.get_key("LOG_CHANNEL")), get_string("chats_6").format(e.chat_id)
81
  )
82
 
 
83
  @ultroid_cmd(
84
- pattern="getlink",
85
  groups_only=True,
86
  manager=True,
87
  )
@@ -94,16 +98,34 @@ async def _(e):
94
  chat = await e.get_chat()
95
  if hasattr(chat, "username") and chat.username:
96
  return await e.eor(f"Username: @{chat.username}")
97
- request, usage = None, None
98
  if match:
99
- split = match.split()
100
  request = bool(split[0] in ["r", "request"])
101
- if len(split) > 1 and split[1].isdigit():
102
- usage = int(split[1])
103
- if request:
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  try:
105
  r = await e.client(
106
- ExportChatInviteRequest(e.chat_id, request_needed=request, usage_limit=usage, title="Create via Ultroid"),
 
 
 
 
 
107
  )
108
  except no_admin:
109
  return await e.eor(get_string("chats_2"), time=10)
 
11
  Delete the group this cmd is used in.
12
 
13
  • `{i}getlink`
14
+ • `{i}getlink r` - `create link with admin approval`
15
+ • `{i}getlink r title_here` - `admin approval with link title`
16
+ • `{i}getlink 10` - `usage limit in new link`
17
  Get link of group this cmd is used in.
18
 
19
  • `{i}create (g|b|c) <group_name> ; <optional-username>`
 
83
  int(udB.get_key("LOG_CHANNEL")), get_string("chats_6").format(e.chat_id)
84
  )
85
 
86
+
87
  @ultroid_cmd(
88
+ pattern="getlink( (.*)|$)",
89
  groups_only=True,
90
  manager=True,
91
  )
 
98
  chat = await e.get_chat()
99
  if hasattr(chat, "username") and chat.username:
100
  return await e.eor(f"Username: @{chat.username}")
101
+ request, usage, title = None, None, None
102
  if match:
103
+ split = match.split(maxsplit=1)
104
  request = bool(split[0] in ["r", "request"])
105
+ title = "Created by Ultroid"
106
+ if len(split) > 1:
107
+ match = split[1]
108
+ spli = match.split(maxsplit=1)
109
+ if spli[0].isdigit():
110
+ usage = int(spli[0])
111
+ if len(spli) > 1:
112
+ title = spli[1]
113
+ elif not request:
114
+ if match.isdigit():
115
+ usage = int(match)
116
+ else:
117
+ title = match
118
+ if request and usage:
119
+ usage = 0
120
+ if request or title:
121
  try:
122
  r = await e.client(
123
+ ExportChatInviteRequest(
124
+ e.chat_id,
125
+ request_needed=request,
126
+ usage_limit=usage,
127
+ title=title,
128
+ ),
129
  )
130
  except no_admin:
131
  return await e.eor(get_string("chats_2"), time=10)
plugins/database.py CHANGED
@@ -14,6 +14,7 @@
14
  e.g :
15
  `{i}setdb hi there`
16
  `{i}setdb hi there | ultroid here`
 
17
 
18
  • `{i}deldb key`
19
  Delete Key from DB.
 
14
  e.g :
15
  `{i}setdb hi there`
16
  `{i}setdb hi there | ultroid here`
17
+ `{i}setdb --extend variable value` or `{i}setdb -e variable value` to add the value to the exiting values in db.
18
 
19
  • `{i}deldb key`
20
  Delete Key from DB.
plugins/devtools.py CHANGED
@@ -9,6 +9,7 @@
9
  ✘ Commands Available -
10
 
11
  • `{i}bash <cmds>`
 
12
  Run linux commands on telegram.
13
 
14
  • `{i}eval <code>`
@@ -26,7 +27,6 @@
26
  • `{i}sysinfo`
27
  Shows System Info.
28
  """
29
- from __future__ import print_function
30
 
31
  import sys
32
  import traceback
@@ -41,9 +41,16 @@ try:
41
  import black
42
  except ImportError:
43
  black = None
 
44
 
 
 
 
 
45
  from . import *
46
 
 
 
47
 
48
  @ultroid_cmd(
49
  pattern="sysinfo$",
@@ -53,7 +60,7 @@ async def _(e):
53
  x, y = await bash("neofetch|sed 's/\x1B\\[[0-9;\\?]*[a-zA-Z]//g' >> neo.txt")
54
  with open("neo.txt", "r") as neo:
55
  p = (neo.read()).replace("\n\n", "")
56
- haa = await Carbon(code=p, file_name="neofetch")
57
  await e.reply(file=haa)
58
  await xx.delete()
59
  remove("neo.txt")
@@ -61,11 +68,19 @@ async def _(e):
61
 
62
  @ultroid_cmd(pattern="bash", fullsudo=True, only_devs=True)
63
  async def _(event):
 
64
  try:
65
  cmd = event.text.split(" ", maxsplit=1)[1]
 
 
 
66
  except IndexError:
67
  return await event.eor(get_string("devs_1"), time=10)
68
  xx = await event.eor(get_string("com_1"))
 
 
 
 
69
  reply_to_id = event.reply_to_msg_id or event.id
70
  stdout, stderr = await bash(cmd)
71
  OUT = f"**☞ BASH\n\n• COMMAND:**\n`{cmd}` \n\n"
@@ -73,9 +88,23 @@ async def _(event):
73
  if stderr:
74
  err = f"**• ERROR:** \n`{stderr}`\n\n"
75
  if stdout:
76
- _o = stdout.split("\n")
77
- o = "\n".join(_o)
78
- out = f"**• OUTPUT:**\n`{o}`"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  if not stderr and not stdout:
80
  out = "**• OUTPUT:**\n`Success`"
81
  OUT += err + out
@@ -95,7 +124,7 @@ async def _(event):
95
 
96
  await xx.delete()
97
  else:
98
- await xx.edit(OUT)
99
 
100
 
101
  pp = pprint # ignore: pylint
@@ -118,9 +147,6 @@ def _parse_eval(value=None):
118
  return str(value)
119
 
120
 
121
- _ignore_eval = []
122
-
123
-
124
  @ultroid_cmd(pattern="eval", fullsudo=True, only_devs=True)
125
  async def _(event):
126
  try:
@@ -150,13 +176,13 @@ async def _(event):
150
  # Consider it as Code Error, and move on to be shown ahead.
151
  pass
152
  reply_to_id = event.reply_to_msg_id or event
 
 
 
 
153
  if any(item in cmd for item in KEEP_SAFE().All) and (
154
  not (event.out or event.sender_id == ultroid_bot.uid)
155
  ):
156
- if event.sender_id in _ignore_eval:
157
- return await xx.edit(
158
- "`You cannot use this command now. Contact owner of this bot!`"
159
- )
160
  warning = await event.forward_to(udB.get_key("LOG_CHANNEL"))
161
  await warning.reply(
162
  f"Malicious Activities suspected by {inline_mention(await event.get_sender())}"
@@ -259,7 +285,7 @@ async def doie(e):
259
  open("cpp-ultroid.cpp", "w").write(match)
260
  m = await bash("g++ -o CppUltroid cpp-ultroid.cpp")
261
  o_cpp = f"• **Eval-Cpp**\n`{match}`"
262
- if m[1] != "":
263
  o_cpp += f"\n\n**• Error :**\n`{m[1]}`"
264
  if len(o_cpp) > 3000:
265
  os.remove("cpp-ultroid.cpp")
@@ -272,7 +298,7 @@ async def doie(e):
272
  m = await bash("./CppUltroid")
273
  if m[0] != "":
274
  o_cpp += f"\n\n**• Output :**\n`{m[0]}`"
275
- if m[1] != "":
276
  o_cpp += f"\n\n**• Error :**\n`{m[1]}`"
277
  if len(o_cpp) > 3000:
278
  with BytesIO(str.encode(o_cpp)) as out_file:
 
9
  ✘ Commands Available -
10
 
11
  • `{i}bash <cmds>`
12
+ • `{i}bash -c <cmds>` Carbon image as command output.
13
  Run linux commands on telegram.
14
 
15
  • `{i}eval <code>`
 
27
  • `{i}sysinfo`
28
  Shows System Info.
29
  """
 
30
 
31
  import sys
32
  import traceback
 
41
  import black
42
  except ImportError:
43
  black = None
44
+ from random import choice
45
 
46
+ try:
47
+ from telegraph import upload_file as uf
48
+ except ImportError:
49
+ uf = None
50
  from . import *
51
 
52
+ _ignore_eval = []
53
+
54
 
55
  @ultroid_cmd(
56
  pattern="sysinfo$",
 
60
  x, y = await bash("neofetch|sed 's/\x1B\\[[0-9;\\?]*[a-zA-Z]//g' >> neo.txt")
61
  with open("neo.txt", "r") as neo:
62
  p = (neo.read()).replace("\n\n", "")
63
+ haa = await Carbon(code=p, file_name="neofetch", backgroundColor=choice(ATRA_COL))
64
  await e.reply(file=haa)
65
  await xx.delete()
66
  remove("neo.txt")
 
68
 
69
  @ultroid_cmd(pattern="bash", fullsudo=True, only_devs=True)
70
  async def _(event):
71
+ carb = None
72
  try:
73
  cmd = event.text.split(" ", maxsplit=1)[1]
74
+ if cmd.split()[0] in ["-c", "--carbon"]:
75
+ cmd = cmd.split(maxsplit=1)[1]
76
+ carb = True
77
  except IndexError:
78
  return await event.eor(get_string("devs_1"), time=10)
79
  xx = await event.eor(get_string("com_1"))
80
+ if event.sender_id in _ignore_eval:
81
+ return await xx.edit(
82
+ "`You cannot use this command now. Contact owner of this bot!`"
83
+ )
84
  reply_to_id = event.reply_to_msg_id or event.id
85
  stdout, stderr = await bash(cmd)
86
  OUT = f"**☞ BASH\n\n• COMMAND:**\n`{cmd}` \n\n"
 
88
  if stderr:
89
  err = f"**• ERROR:** \n`{stderr}`\n\n"
90
  if stdout:
91
+ if (carb or udB.get_key("CARBON_ON_BASH")) and (
92
+ event.chat.admin_rights
93
+ or event.chat.creator
94
+ or event.chat.default_banned_rights.embed_links
95
+ ):
96
+ li = await Carbon(
97
+ code=stdout,
98
+ file_name="bash",
99
+ download=True,
100
+ backgroundColor=choice(ATRA_COL),
101
+ )
102
+ url = "https://telegra.ph" + uf(li)[-1]
103
+ OUT = f"[\xad]({url})" + OUT
104
+ out = "**• OUTPUT:**"
105
+ remove(li)
106
+ else:
107
+ out = f"**• OUTPUT:**\n`{stdout}`"
108
  if not stderr and not stdout:
109
  out = "**• OUTPUT:**\n`Success`"
110
  OUT += err + out
 
124
 
125
  await xx.delete()
126
  else:
127
+ await xx.edit(OUT, link_preview=True)
128
 
129
 
130
  pp = pprint # ignore: pylint
 
147
  return str(value)
148
 
149
 
 
 
 
150
  @ultroid_cmd(pattern="eval", fullsudo=True, only_devs=True)
151
  async def _(event):
152
  try:
 
176
  # Consider it as Code Error, and move on to be shown ahead.
177
  pass
178
  reply_to_id = event.reply_to_msg_id or event
179
+ if event.sender_id in _ignore_eval:
180
+ return await xx.edit(
181
+ "`You cannot use this command now. Contact owner of this bot!`"
182
+ )
183
  if any(item in cmd for item in KEEP_SAFE().All) and (
184
  not (event.out or event.sender_id == ultroid_bot.uid)
185
  ):
 
 
 
 
186
  warning = await event.forward_to(udB.get_key("LOG_CHANNEL"))
187
  await warning.reply(
188
  f"Malicious Activities suspected by {inline_mention(await event.get_sender())}"
 
285
  open("cpp-ultroid.cpp", "w").write(match)
286
  m = await bash("g++ -o CppUltroid cpp-ultroid.cpp")
287
  o_cpp = f"• **Eval-Cpp**\n`{match}`"
288
+ if m[1]:
289
  o_cpp += f"\n\n**• Error :**\n`{m[1]}`"
290
  if len(o_cpp) > 3000:
291
  os.remove("cpp-ultroid.cpp")
 
298
  m = await bash("./CppUltroid")
299
  if m[0] != "":
300
  o_cpp += f"\n\n**• Output :**\n`{m[0]}`"
301
+ if m[1]:
302
  o_cpp += f"\n\n**• Error :**\n`{m[1]}`"
303
  if len(o_cpp) > 3000:
304
  with BytesIO(str.encode(o_cpp)) as out_file:
plugins/dnd.py DELETED
@@ -1,59 +0,0 @@
1
- # Ultroid - UserBot
2
- # Copyright (C) 2021-2022 TeamUltroid
3
- #
4
- # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5
- # PLease read the GNU Affero General Public License in
6
- # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
-
8
- """
9
- ✘ Commands Available
10
-
11
- Do Not Disturb - As it says, activating this in your group will kick new users who joins the group.
12
-
13
- • `{i}dnd`
14
- To activate.
15
-
16
- • `{i}deldnd`
17
- To deactivate.
18
- """
19
-
20
-
21
- from pyUltroid.dB.dnd_db import add_dnd, chat_in_dnd, del_dnd, get_dnd_chats
22
- from telethon import events
23
-
24
- from . import LOGS, asst, ultroid_bot, ultroid_cmd
25
-
26
-
27
- async def dnd_func(event):
28
- if event.chat_id in get_dnd_chats():
29
- for user in event.users:
30
- try:
31
- await (
32
- await event.client.kick_participant(event.chat_id, user)
33
- ).delete()
34
- except Exception as ex:
35
- LOGS.error("Error in DND:")
36
- LOGS.exception(ex)
37
- await event.delete()
38
-
39
-
40
- @ultroid_cmd(pattern="dnd$", manager=True, admins_only=True, groups_only=True)
41
- async def _(event):
42
- if chat_in_dnd(event.chat_id):
43
- return await event.eor("`Chat already in do not disturb mode.`", time=3)
44
- add_dnd(event.chat_id)
45
- event.client.add_handler(dnd_func, events.ChatAction(func=lambda x: x.user_joined))
46
- await event.eor("`Do not disturb mode activated for this chat.`", time=3)
47
-
48
-
49
- @ultroid_cmd(pattern="deldnd$", manager=True, admins_only=True, groups_only=True)
50
- async def _(event):
51
- if not chat_in_dnd(event.chat_id):
52
- return await event.eor("`Chat is not in do not disturb mode.`", time=3)
53
- del_dnd(event.chat_id)
54
- await event.eor("`Do not disturb mode deactivated for this chat.`", time=3)
55
-
56
-
57
- if get_dnd_chats():
58
- ultroid_bot.add_handler(dnd_func, events.ChatAction(func=lambda x: x.user_joined))
59
- asst.add_handler(dnd_func, events.ChatAction(func=lambda x: x.user_joined))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugins/downloadupload.py CHANGED
@@ -23,6 +23,7 @@
23
  """
24
 
25
  import asyncio
 
26
  import os
27
  import time
28
  from datetime import datetime as dt
@@ -135,13 +136,12 @@ async def download(event):
135
  pattern="ul( (.*)|$)",
136
  )
137
  async def _(event):
138
- if len(event.text) >= 8:
139
- if "ultroid" in event.text[:7]:
140
- return
141
  msg = await event.eor(get_string("com_1"))
142
  match = event.pattern_match.group(1)
143
  if match:
144
  match = match.strip()
 
 
145
  stream, force_doc, delete, thumb = (
146
  False,
147
  True,
@@ -163,57 +163,63 @@ async def _(event):
163
  .replace("--no-thumb", "")
164
  .strip()
165
  )
166
- if not os.path.exists(match):
 
 
 
 
 
167
  try:
168
  await event.reply(file=match)
169
- await event.try_delete()
170
  except Exception as er:
171
  LOGS.exception(er)
172
  return await msg.eor("`File doesn't exist or path is incorrect!`")
173
- if os.path.isdir(match):
174
- c, s = 0, 0
175
- for files in sorted(os.listdir(match)):
176
- attributes = None
177
- if stream:
 
 
 
 
 
178
  try:
179
- attributes = await set_attributes(files)
180
- except KeyError as er:
181
- LOGS.exception(er)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  try:
183
- file, _ = await event.client.fast_uploader(
184
- match + "/" + files, show_progress=True, event=msg, to_delete=delete
185
- )
186
- await event.client.send_file(
187
- event.chat_id,
188
- file,
189
- supports_streaming=stream,
190
- force_document=force_doc,
191
- thumb=thumb,
192
- attributes=attributes,
193
- caption=f"`Uploaded` `{match}/{files}` `in {time_formatter(_*1000)}`",
194
- reply_to=event.reply_to_msg_id or event,
195
- )
196
- s += 1
197
- except (ValueError, IsADirectoryError):
198
- c += 1
199
- return await msg.eor(f"`Uploaded {s} files, failed to upload {c}.`")
200
- attributes = None
201
- if stream:
202
- try:
203
- attributes = await set_attributes(match)
204
- except KeyError as er:
205
- LOGS.exception(er)
206
- file, _ = await event.client.fast_uploader(
207
- match, show_progress=True, event=msg, to_delete=delete
208
- )
209
- await event.client.send_file(
210
- event.chat_id,
211
- file,
212
- supports_streaming=stream,
213
- force_document=force_doc,
214
- thumb=thumb,
215
- attributes=attributes,
216
- caption=f"`Uploaded` `{match}` `in {time_formatter(_*1000)}`",
217
- reply_to=event.reply_to_msg_id or event,
218
- )
219
  await msg.try_delete()
 
23
  """
24
 
25
  import asyncio
26
+ import glob
27
  import os
28
  import time
29
  from datetime import datetime as dt
 
136
  pattern="ul( (.*)|$)",
137
  )
138
  async def _(event):
 
 
 
139
  msg = await event.eor(get_string("com_1"))
140
  match = event.pattern_match.group(1)
141
  if match:
142
  match = match.strip()
143
+ if not event.out and match == ".env":
144
+ return await event.reply("`You can't do this...`")
145
  stream, force_doc, delete, thumb = (
146
  False,
147
  True,
 
163
  .replace("--no-thumb", "")
164
  .strip()
165
  )
166
+ if match.endswith("/"):
167
+ match += "*"
168
+ results = glob.glob(match)
169
+ if not results and os.path.exists(match):
170
+ results = [match]
171
+ if not results:
172
  try:
173
  await event.reply(file=match)
174
+ return await event.try_delete()
175
  except Exception as er:
176
  LOGS.exception(er)
177
  return await msg.eor("`File doesn't exist or path is incorrect!`")
178
+ for result in results:
179
+ if os.path.isdir(result):
180
+ c, s = 0, 0
181
+ for files in sorted(glob.glob(result + "/*")):
182
+ attributes = None
183
+ if stream:
184
+ try:
185
+ attributes = await set_attributes(files)
186
+ except KeyError as er:
187
+ LOGS.exception(er)
188
  try:
189
+ file, _ = await event.client.fast_uploader(
190
+ files, show_progress=True, event=msg, to_delete=delete
191
+ )
192
+ await event.client.send_file(
193
+ event.chat_id,
194
+ file,
195
+ supports_streaming=stream,
196
+ force_document=force_doc,
197
+ thumb=thumb,
198
+ attributes=attributes,
199
+ caption=f"`Uploaded` `{files}` `in {time_formatter(_*1000)}`",
200
+ reply_to=event.reply_to_msg_id or event,
201
+ )
202
+ s += 1
203
+ except (ValueError, IsADirectoryError):
204
+ c += 1
205
+ break
206
+ attributes = None
207
+ if stream:
208
  try:
209
+ attributes = await set_attributes(result)
210
+ except KeyError as er:
211
+ LOGS.exception(er)
212
+ file, _ = await event.client.fast_uploader(
213
+ result, show_progress=True, event=msg, to_delete=delete
214
+ )
215
+ await event.client.send_file(
216
+ event.chat_id,
217
+ file,
218
+ supports_streaming=stream,
219
+ force_document=force_doc,
220
+ thumb=thumb,
221
+ attributes=attributes,
222
+ caption=f"`Uploaded` `{result}` `in {time_formatter(_*1000)}`",
223
+ reply_to=event.reply_to_msg_id or event,
224
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  await msg.try_delete()
plugins/fakeaction.py CHANGED
@@ -56,7 +56,7 @@ async def _(e):
56
  if t.isdigit():
57
  t = int(t)
58
  elif t.endswith(("s", "h", "d", "m")):
59
- t = math.ceil((await ban_time(e, t)) - time.time())
60
  else:
61
  t = 60
62
  await e.eor(get_string("fka_1").format(str(t)), time=5)
 
56
  if t.isdigit():
57
  t = int(t)
58
  elif t.endswith(("s", "h", "d", "m")):
59
+ t = math.ceil((ban_time(e, t)) - time.time())
60
  else:
61
  t = 60
62
  await e.eor(get_string("fka_1").format(str(t)), time=5)
plugins/fileshare.py CHANGED
@@ -24,7 +24,7 @@ import os
24
  from pyUltroid.dB.filestore_db import del_stored, get_stored_msg, list_all_stored_msgs
25
  from pyUltroid.functions.tools import get_file_link
26
 
27
- from . import asst, get_string, in_pattern, udB, ultroid_bot, ultroid_cmd, HNDLR
28
 
29
 
30
  @ultroid_cmd(pattern="store$")
 
24
  from pyUltroid.dB.filestore_db import del_stored, get_stored_msg, list_all_stored_msgs
25
  from pyUltroid.functions.tools import get_file_link
26
 
27
+ from . import HNDLR, asst, get_string, in_pattern, udB, ultroid_bot, ultroid_cmd
28
 
29
 
30
  @ultroid_cmd(pattern="store$")
plugins/forcesubscribe.py CHANGED
@@ -87,7 +87,7 @@ async def fcall(e):
87
  spli = match.split("_")
88
  user = await ultroid_bot.get_entity(int(spli[0]))
89
  cl = await ultroid_bot.get_entity(int(spli[1]))
90
- text = f"Hi [{inline_mention(user)}), You Need to Join"
91
  text += f" {cl.title} in order to Chat in this Group."
92
  if not cl.username:
93
  el = (await ultroid_bot(ExportChatInviteRequest(cl))).link
@@ -131,7 +131,6 @@ async def diesoon(e):
131
  async def force_sub(ult):
132
  if not udB.get_key("FORCESUB"):
133
  return
134
-
135
  user = await ult.get_sender()
136
  joinchat = get_forcesetting(ult.chat_id)
137
  if (not joinchat) or (isinstance(user, User) and user.bot):
@@ -145,7 +144,7 @@ async def force_sub(ult):
145
  CACHE.update({ult.chat_id: {user.id: 1}})
146
  count = CACHE[ult.chat_id][user.id]
147
  if count == 11:
148
- CACHE[ult.chat_id][user.id].update(1)
149
  return
150
  if count in range(2, 11):
151
  return
@@ -167,6 +166,7 @@ async def force_sub(ult):
167
  except ChatAdminRequiredError:
168
  return
169
  except Exception as e:
 
170
  LOGS.info(e)
171
  res = await ultroid_bot.inline_query(asst.me.username, f"fsub {user.id}_{joinchat}")
172
  await res[0].click(ult.chat_id, reply_to=ult.id)
 
87
  spli = match.split("_")
88
  user = await ultroid_bot.get_entity(int(spli[0]))
89
  cl = await ultroid_bot.get_entity(int(spli[1]))
90
+ text = f"Hi {inline_mention(user)}, You Need to Join"
91
  text += f" {cl.title} in order to Chat in this Group."
92
  if not cl.username:
93
  el = (await ultroid_bot(ExportChatInviteRequest(cl))).link
 
131
  async def force_sub(ult):
132
  if not udB.get_key("FORCESUB"):
133
  return
 
134
  user = await ult.get_sender()
135
  joinchat = get_forcesetting(ult.chat_id)
136
  if (not joinchat) or (isinstance(user, User) and user.bot):
 
144
  CACHE.update({ult.chat_id: {user.id: 1}})
145
  count = CACHE[ult.chat_id][user.id]
146
  if count == 11:
147
+ CACHE[ult.chat_id][user.id] = 1
148
  return
149
  if count in range(2, 11):
150
  return
 
166
  except ChatAdminRequiredError:
167
  return
168
  except Exception as e:
169
+ await ult.delete()
170
  LOGS.info(e)
171
  res = await ultroid_bot.inline_query(asst.me.username, f"fsub {user.id}_{joinchat}")
172
  await res[0].click(ult.chat_id, reply_to=ult.id)
plugins/globaltools.py CHANGED
@@ -291,7 +291,9 @@ async def _(e):
291
  xx = await e.eor("`UnGbanning...`")
292
  match = e.pattern_match.group(1).strip()
293
  peer = None
294
- if match:
 
 
295
  try:
296
  userid = int(match)
297
  except ValueError:
@@ -300,8 +302,6 @@ async def _(e):
300
  userid = (await e.client.get_entity(userid)).id
301
  except (ValueError, Exception) as er:
302
  return await xx.edit(f"Failed to get User...\nError: {er}")
303
- elif e.reply_to_msg_id:
304
- userid = (await e.get_reply_message()).sender_id
305
  elif e.is_private:
306
  userid = e.chat_id
307
  else:
@@ -354,7 +354,13 @@ async def _(e):
354
  async def _(e):
355
  xx = await e.eor("`Gbanning...`")
356
  reason = ""
357
- if e.pattern_match.group(1).strip():
 
 
 
 
 
 
358
  usr = e.text.split(maxsplit=2)[1]
359
  try:
360
  userid = await e.client.parse_id(usr)
@@ -364,12 +370,6 @@ async def _(e):
364
  reason = e.text.split(maxsplit=2)[2]
365
  except IndexError:
366
  pass
367
- elif e.reply_to_msg_id:
368
- userid = (await e.get_reply_message()).sender_id
369
- try:
370
- reason = e.text.split(" ", maxsplit=1)[1]
371
- except IndexError:
372
- pass
373
  elif e.is_private:
374
  userid = e.chat_id
375
  try:
@@ -503,8 +503,8 @@ async def gcast(event):
503
  chat, msg, file=reply.media if reply else None
504
  )
505
  done += 1
506
- except Exception as er:
507
- err += f"• {er}\n"
508
  er += 1
509
  except BaseException as h:
510
  err += "• " + str(h) + "\n"
 
291
  xx = await e.eor("`UnGbanning...`")
292
  match = e.pattern_match.group(1).strip()
293
  peer = None
294
+ if e.reply_to_msg_id:
295
+ userid = (await e.get_reply_message()).sender_id
296
+ elif match:
297
  try:
298
  userid = int(match)
299
  except ValueError:
 
302
  userid = (await e.client.get_entity(userid)).id
303
  except (ValueError, Exception) as er:
304
  return await xx.edit(f"Failed to get User...\nError: {er}")
 
 
305
  elif e.is_private:
306
  userid = e.chat_id
307
  else:
 
354
  async def _(e):
355
  xx = await e.eor("`Gbanning...`")
356
  reason = ""
357
+ if e.reply_to_msg_id:
358
+ userid = (await e.get_reply_message()).sender_id
359
+ try:
360
+ reason = e.text.split(" ", maxsplit=1)[1]
361
+ except IndexError:
362
+ pass
363
+ elif e.pattern_match.group(1).strip():
364
  usr = e.text.split(maxsplit=2)[1]
365
  try:
366
  userid = await e.client.parse_id(usr)
 
370
  reason = e.text.split(maxsplit=2)[2]
371
  except IndexError:
372
  pass
 
 
 
 
 
 
373
  elif e.is_private:
374
  userid = e.chat_id
375
  try:
 
503
  chat, msg, file=reply.media if reply else None
504
  )
505
  done += 1
506
+ except Exception as rr:
507
+ err += f"• {rr}\n"
508
  er += 1
509
  except BaseException as h:
510
  err += "• " + str(h) + "\n"
plugins/imagetools.py CHANGED
@@ -52,13 +52,16 @@
52
  • `{i}pixelator <reply image>`
53
  Create a Pixelated Image..
54
  """
55
- import asyncio
56
  import os
57
 
58
- import cv2
59
- import numpy as np
60
 
61
- from . import LOGS
 
 
 
 
 
62
 
63
  try:
64
  from PIL import Image
@@ -94,22 +97,7 @@ async def sketch(e):
94
  ultt = await ureply.download_media()
95
  if ultt.endswith(".tgs"):
96
  await xx.edit(get_string("sts_9"))
97
- cmd = ["lottie_convert.py", ultt, "ult.png"]
98
- file = "ult.png"
99
- process = await asyncio.create_subprocess_exec(
100
- *cmd,
101
- stdout=asyncio.subprocess.PIPE,
102
- stderr=asyncio.subprocess.PIPE,
103
- )
104
- stdout, stderr = await process.communicate()
105
- stderr.decode().strip()
106
- stdout.decode().strip()
107
- else:
108
- await xx.edit(get_string("com_1"))
109
- img = cv2.VideoCapture(ultt)
110
- heh, lol = img.read()
111
- cv2.imwrite("ult.png", lol)
112
- file = "ult.png"
113
  img = cv2.imread(file)
114
  gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
115
  inverted_gray_image = 255 - gray_image
@@ -164,22 +152,7 @@ async def ultd(event):
164
  ultt = await ureply.download_media()
165
  if ultt.endswith(".tgs"):
166
  xx = await event.eor(get_string("sts_9"))
167
- cmd = ["lottie_convert.py", ultt, "ult.png"]
168
- file = "ult.png"
169
- process = await asyncio.create_subprocess_exec(
170
- *cmd,
171
- stdout=asyncio.subprocess.PIPE,
172
- stderr=asyncio.subprocess.PIPE,
173
- )
174
- stdout, stderr = await process.communicate()
175
- stderr.decode().strip()
176
- stdout.decode().strip()
177
- else:
178
- xx = await event.eor(get_string("com_1"))
179
- img = cv2.VideoCapture(ultt)
180
- heh, lol = img.read()
181
- cv2.imwrite("ult.png", lol)
182
- file = "ult.png"
183
  ult = cv2.imread(file)
184
  ultroid = cv2.cvtColor(ult, cv2.COLOR_BGR2GRAY)
185
  cv2.imwrite("ult.jpg", ultroid)
@@ -206,22 +179,7 @@ async def ultd(event):
206
  ultt = await ureply.download_media()
207
  if ultt.endswith(".tgs"):
208
  xx = await event.eor(get_string("sts_9"))
209
- cmd = ["lottie_convert.py", ultt, "ult.png"]
210
- file = "ult.png"
211
- process = await asyncio.create_subprocess_exec(
212
- *cmd,
213
- stdout=asyncio.subprocess.PIPE,
214
- stderr=asyncio.subprocess.PIPE,
215
- )
216
- stdout, stderr = await process.communicate()
217
- stderr.decode().strip()
218
- stdout.decode().strip()
219
- else:
220
- xx = await event.eor(get_string("com_1"))
221
- img = cv2.VideoCapture(ultt)
222
- heh, lol = img.read()
223
- cv2.imwrite("ult.png", lol)
224
- file = "ult.png"
225
  ult = cv2.imread(file)
226
  ultroid = cv2.GaussianBlur(ult, (35, 35), 0)
227
  cv2.imwrite("ult.jpg", ultroid)
@@ -249,22 +207,7 @@ async def ultd(event):
249
  ultt = await ureply.download_media()
250
  if ultt.endswith(".tgs"):
251
  await xx.edit(get_string("sts_9"))
252
- cmd = ["lottie_convert.py", ultt, "ult.png"]
253
- file = "ult.png"
254
- process = await asyncio.create_subprocess_exec(
255
- *cmd,
256
- stdout=asyncio.subprocess.PIPE,
257
- stderr=asyncio.subprocess.PIPE,
258
- )
259
- stdout, stderr = await process.communicate()
260
- stderr.decode().strip()
261
- stdout.decode().strip()
262
- else:
263
- await xx.edit(get_string("com_1"))
264
- img = cv2.VideoCapture(ultt)
265
- heh, lol = img.read()
266
- cv2.imwrite("ult.png", lol)
267
- file = "ult.png"
268
  ult = cv2.imread(file)
269
  ultroid = cv2.bitwise_not(ult)
270
  cv2.imwrite("ult.jpg", ultroid)
@@ -290,24 +233,7 @@ async def ultd(event):
290
  await xx.edit(get_string("cvt_3"))
291
  return
292
  ultt = await ureply.download_media()
293
- if ultt.endswith(".tgs"):
294
- await xx.edit(get_string("sts_9"))
295
- cmd = ["lottie_convert.py", ultt, "ult.png"]
296
- file = "ult.png"
297
- process = await asyncio.create_subprocess_exec(
298
- *cmd,
299
- stdout=asyncio.subprocess.PIPE,
300
- stderr=asyncio.subprocess.PIPE,
301
- )
302
- stdout, stderr = await process.communicate()
303
- stderr.decode().strip()
304
- stdout.decode().strip()
305
- else:
306
- await xx.edit(get_string("com_1"))
307
- img = cv2.VideoCapture(ultt)
308
- heh, lol = img.read()
309
- cv2.imwrite("ult.png", lol)
310
- file = "ult.png"
311
  ult = cv2.imread(file)
312
  ish = cv2.flip(ult, 1)
313
  ultroid = cv2.hconcat([ult, ish])
@@ -336,22 +262,7 @@ async def ultd(event):
336
  ultt = await ureply.download_media()
337
  if ultt.endswith(".tgs"):
338
  await xx.edit(get_string("sts_9"))
339
- cmd = ["lottie_convert.py", ultt, "ult.png"]
340
- file = "ult.png"
341
- process = await asyncio.create_subprocess_exec(
342
- *cmd,
343
- stdout=asyncio.subprocess.PIPE,
344
- stderr=asyncio.subprocess.PIPE,
345
- )
346
- stdout, stderr = await process.communicate()
347
- stderr.decode().strip()
348
- stdout.decode().strip()
349
- else:
350
- await xx.edit(get_string("com_1"))
351
- img = cv2.VideoCapture(ultt)
352
- heh, lol = img.read()
353
- cv2.imwrite("ult.png", lol)
354
- file = "ult.png"
355
  ult = cv2.imread(file)
356
  trn = cv2.flip(ult, 1)
357
  ish = cv2.rotate(trn, cv2.ROTATE_180)
@@ -381,22 +292,7 @@ async def ultd(event):
381
  ultt = await ureply.download_media()
382
  if ultt.endswith(".tgs"):
383
  await xx.edit(get_string("sts_9"))
384
- cmd = ["lottie_convert.py", ultt, "ult.png"]
385
- file = "ult.png"
386
- process = await asyncio.create_subprocess_exec(
387
- *cmd,
388
- stdout=asyncio.subprocess.PIPE,
389
- stderr=asyncio.subprocess.PIPE,
390
- )
391
- stdout, stderr = await process.communicate()
392
- stderr.decode().strip()
393
- stdout.decode().strip()
394
- else:
395
- await xx.edit(get_string("com_1"))
396
- img = cv2.VideoCapture(ultt)
397
- heh, lol = img.read()
398
- cv2.imwrite("ult.png", lol)
399
- file = "ult.png"
400
  ult = cv2.imread(file)
401
  roid = cv2.flip(ult, 1)
402
  mici = cv2.hconcat([ult, roid])
@@ -428,22 +324,7 @@ async def ultd(event):
428
  ultt = await ureply.download_media()
429
  if ultt.endswith(".tgs"):
430
  await xx.edit(get_string("sts_9"))
431
- cmd = ["lottie_convert.py", ultt, "ult.png"]
432
- file = "ult.png"
433
- process = await asyncio.create_subprocess_exec(
434
- *cmd,
435
- stdout=asyncio.subprocess.PIPE,
436
- stderr=asyncio.subprocess.PIPE,
437
- )
438
- stdout, stderr = await process.communicate()
439
- stderr.decode().strip()
440
- stdout.decode().strip()
441
- else:
442
- await xx.edit(get_string("com_1"))
443
- img = cv2.VideoCapture(ultt)
444
- heh, lol = img.read()
445
- cv2.imwrite("ult.png", lol)
446
- file = "ult.png"
447
  ult = cv2.imread(file)
448
  height, width, channels = ult.shape
449
  samples = np.zeros([height * width, 3], dtype=np.float32)
@@ -488,22 +369,7 @@ async def ultd(event):
488
  ultt = await ureply.download_media()
489
  if ultt.endswith(".tgs"):
490
  await xx.edit(get_string("sts_9"))
491
- cmd = ["lottie_convert.py", ultt, "ult.png"]
492
- file = "ult.png"
493
- process = await asyncio.create_subprocess_exec(
494
- *cmd,
495
- stdout=asyncio.subprocess.PIPE,
496
- stderr=asyncio.subprocess.PIPE,
497
- )
498
- stdout, stderr = await process.communicate()
499
- stderr.decode().strip()
500
- stdout.decode().strip()
501
- else:
502
- await xx.edit(get_string("com_1"))
503
- img = cv2.VideoCapture(ultt)
504
- heh, lol = img.read()
505
- cv2.imwrite("ult.png", lol)
506
- file = "ult.png"
507
  ult = cv2.imread(file)
508
  dan = cv2.cvtColor(ult, cv2.COLOR_BGR2RGB)
509
  ultroid = cv2.cvtColor(dan, cv2.COLOR_HSV2BGR)
@@ -553,22 +419,7 @@ async def ultd(event):
553
  ultt = await ureply.download_media()
554
  if ultt.endswith(".tgs"):
555
  await xx.edit(get_string("sts_9"))
556
- cmd = ["lottie_convert.py", ultt, "ult.png"]
557
- file = "ult.png"
558
- process = await asyncio.create_subprocess_exec(
559
- *cmd,
560
- stdout=asyncio.subprocess.PIPE,
561
- stderr=asyncio.subprocess.PIPE,
562
- )
563
- stdout, stderr = await process.communicate()
564
- stderr.decode().strip()
565
- stdout.decode().strip()
566
- else:
567
- await xx.edit(get_string("com_1"))
568
- img = cv2.VideoCapture(ultt)
569
- heh, lol = img.read()
570
- cv2.imwrite("ult.png", lol)
571
- file = "ult.png"
572
  got = upf(file)
573
  lnk = f"https://telegra.ph{got[0]}"
574
  r = await async_searcher(
 
52
  • `{i}pixelator <reply image>`
53
  Create a Pixelated Image..
54
  """
 
55
  import os
56
 
57
+ from . import LOGS, con
 
58
 
59
+ try:
60
+ import cv2
61
+ except ImportError:
62
+ LOGS.error(f"{__file__}: OpenCv not Installed.")
63
+
64
+ import numpy as np
65
 
66
  try:
67
  from PIL import Image
 
97
  ultt = await ureply.download_media()
98
  if ultt.endswith(".tgs"):
99
  await xx.edit(get_string("sts_9"))
100
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  img = cv2.imread(file)
102
  gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
103
  inverted_gray_image = 255 - gray_image
 
152
  ultt = await ureply.download_media()
153
  if ultt.endswith(".tgs"):
154
  xx = await event.eor(get_string("sts_9"))
155
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  ult = cv2.imread(file)
157
  ultroid = cv2.cvtColor(ult, cv2.COLOR_BGR2GRAY)
158
  cv2.imwrite("ult.jpg", ultroid)
 
179
  ultt = await ureply.download_media()
180
  if ultt.endswith(".tgs"):
181
  xx = await event.eor(get_string("sts_9"))
182
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  ult = cv2.imread(file)
184
  ultroid = cv2.GaussianBlur(ult, (35, 35), 0)
185
  cv2.imwrite("ult.jpg", ultroid)
 
207
  ultt = await ureply.download_media()
208
  if ultt.endswith(".tgs"):
209
  await xx.edit(get_string("sts_9"))
210
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  ult = cv2.imread(file)
212
  ultroid = cv2.bitwise_not(ult)
213
  cv2.imwrite("ult.jpg", ultroid)
 
233
  await xx.edit(get_string("cvt_3"))
234
  return
235
  ultt = await ureply.download_media()
236
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  ult = cv2.imread(file)
238
  ish = cv2.flip(ult, 1)
239
  ultroid = cv2.hconcat([ult, ish])
 
262
  ultt = await ureply.download_media()
263
  if ultt.endswith(".tgs"):
264
  await xx.edit(get_string("sts_9"))
265
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  ult = cv2.imread(file)
267
  trn = cv2.flip(ult, 1)
268
  ish = cv2.rotate(trn, cv2.ROTATE_180)
 
292
  ultt = await ureply.download_media()
293
  if ultt.endswith(".tgs"):
294
  await xx.edit(get_string("sts_9"))
295
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  ult = cv2.imread(file)
297
  roid = cv2.flip(ult, 1)
298
  mici = cv2.hconcat([ult, roid])
 
324
  ultt = await ureply.download_media()
325
  if ultt.endswith(".tgs"):
326
  await xx.edit(get_string("sts_9"))
327
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  ult = cv2.imread(file)
329
  height, width, channels = ult.shape
330
  samples = np.zeros([height * width, 3], dtype=np.float32)
 
369
  ultt = await ureply.download_media()
370
  if ultt.endswith(".tgs"):
371
  await xx.edit(get_string("sts_9"))
372
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  ult = cv2.imread(file)
374
  dan = cv2.cvtColor(ult, cv2.COLOR_BGR2RGB)
375
  ultroid = cv2.cvtColor(dan, cv2.COLOR_HSV2BGR)
 
419
  ultt = await ureply.download_media()
420
  if ultt.endswith(".tgs"):
421
  await xx.edit(get_string("sts_9"))
422
+ file = await con.convert(ultt, convert_to="png", outname="ult")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  got = upf(file)
424
  lnk = f"https://telegra.ph{got[0]}"
425
  r = await async_searcher(
plugins/instagram.py CHANGED
@@ -103,17 +103,13 @@ async def insta_dl(e):
103
  e.media.webpage, WebPage
104
  ):
105
  photo = e.media.webpage.photo or e.media.webpage.document
106
- if not photo:
107
- return await eor(
108
- tt,
109
- "Please Fill `INSTA_USERNAME` and `INSTA_PASSWORD` to Use This Comamand!",
 
110
  )
111
- await tt.delete()
112
- return await e.reply(
113
- f"**Link** :{text}\n\nIf This Wasnt Excepted Result, Please Fill `INSTA_USERNAME` and `INSTA_PASSWORD`...",
114
- file=photo,
115
- )
116
- await eor(tt, "Please Fill Instagram Credential to Use this Command...")
117
 
118
 
119
  @ultroid_cmd(pattern="instadata( (.*)|$)")
@@ -156,7 +152,7 @@ async def soon_(e):
156
  async def insta_karbon(event):
157
  cl = await create_instagram_client(event)
158
  if not cl:
159
- return await event.eor("`Please Fill Instagram Credentials to Use This...`")
160
  msg = await event.eor(get_string("com_1"))
161
  replied = await event.get_reply_message()
162
  type_ = event.pattern_match.group(1).strip()
 
103
  e.media.webpage, WebPage
104
  ):
105
  photo = e.media.webpage.photo or e.media.webpage.document
106
+ if photo:
107
+ await tt.delete()
108
+ return await e.reply(
109
+ f"**Link** :{text}\n\nIf This Wasnt Excepted Result, Please Fill `INSTA_USERNAME` and `INSTA_PASSWORD`...",
110
+ file=photo,
111
  )
112
+ # await eor(tt, "Please Fill Instagram Credential to Use this Command...")
 
 
 
 
 
113
 
114
 
115
  @ultroid_cmd(pattern="instadata( (.*)|$)")
 
152
  async def insta_karbon(event):
153
  cl = await create_instagram_client(event)
154
  if not cl:
155
+ return
156
  msg = await event.eor(get_string("com_1"))
157
  replied = await event.get_reply_message()
158
  type_ = event.pattern_match.group(1).strip()
plugins/misc.py CHANGED
@@ -22,13 +22,19 @@
22
  Convert replied image into html.
23
  """
24
 
25
- import calendar
26
  import os
27
  from datetime import datetime as dt
28
 
29
  from bs4 import BeautifulSoup as bs
30
- from htmlwebshot import WebShot
31
- from img2html.converter import Img2HTMLConverter
 
 
 
 
 
 
 
32
 
33
  from . import async_searcher, get_random_user_data, get_string, re, ultroid_cmd
34
 
@@ -120,6 +126,8 @@ async def _gen_data(event):
120
  pattern="ascii( (.*)|$)",
121
  )
122
  async def _(e):
 
 
123
  if not e.reply_to_msg_id:
124
  return await e.eor(get_string("ascii_1"))
125
  m = await e.eor(get_string("ascii_2"))
 
22
  Convert replied image into html.
23
  """
24
 
 
25
  import os
26
  from datetime import datetime as dt
27
 
28
  from bs4 import BeautifulSoup as bs
29
+
30
+ try:
31
+ from htmlwebshot import WebShot
32
+ except ImportError:
33
+ WebShot = None
34
+ try:
35
+ from img2html.converter import Img2HTMLConverter
36
+ except ImportError:
37
+ Img2HTMLConverter = None
38
 
39
  from . import async_searcher, get_random_user_data, get_string, re, ultroid_cmd
40
 
 
126
  pattern="ascii( (.*)|$)",
127
  )
128
  async def _(e):
129
+ if not Img2HTMLConverter:
130
+ return await e.eor("'img2html-converter' not installed!")
131
  if not e.reply_to_msg_id:
132
  return await e.eor(get_string("ascii_1"))
133
  m = await e.eor(get_string("ascii_2"))
plugins/mute.py CHANGED
@@ -31,7 +31,7 @@ from pyUltroid.functions.admins import ban_time
31
  from telethon import events
32
  from telethon.utils import get_display_name
33
 
34
- from . import eod, get_string, inline_mention, ultroid_bot, ultroid_cmd
35
 
36
 
37
  @ultroid_bot.on(events.NewMessage(incoming=True))
@@ -54,14 +54,17 @@ async def startmute(event):
54
  except Exception as x:
55
  return await xx.edit(str(x))
56
  elif event.reply_to_msg_id:
57
- userid = (await event.get_reply_message()).sender_id
 
 
 
58
  elif event.is_private:
59
  userid = event.chat_id
60
  else:
61
  return await xx.eor("`Reply to a user or add their userid.`", time=5)
62
  chat = await event.get_chat()
63
  if "admin_rights" in vars(chat) and vars(chat)["admin_rights"] is not None:
64
- if chat.admin_rights.delete_messages is not True:
65
  return await xx.eor("`No proper admin rights...`", time=5)
66
  elif "creator" not in vars(chat) and not event.is_private:
67
  return await xx.eor("`No proper admin rights...`", time=5)
@@ -88,10 +91,9 @@ async def endmute(event):
88
  userid = event.chat_id
89
  else:
90
  return await xx.eor("`Reply to a user or add their userid.`", time=5)
91
- chat_id = event.chat_id
92
- if not is_muted(chat_id, userid):
93
  return await xx.eor("`This user is not muted in this chat.`", time=3)
94
- unmute(chat_id, userid)
95
  await xx.eor("`Successfully unmuted...`", time=3)
96
 
97
 
@@ -124,7 +126,7 @@ async def _(e):
124
  if userid == ultroid_bot.uid:
125
  return await xx.eor("`I can't mute myself.`", time=3)
126
  try:
127
- bun = await ban_time(xx, tme)
128
  await e.client.edit_permissions(
129
  chat.id,
130
  userid,
 
31
  from telethon import events
32
  from telethon.utils import get_display_name
33
 
34
+ from . import asst, eod, get_string, inline_mention, ultroid_bot, ultroid_cmd
35
 
36
 
37
  @ultroid_bot.on(events.NewMessage(incoming=True))
 
54
  except Exception as x:
55
  return await xx.edit(str(x))
56
  elif event.reply_to_msg_id:
57
+ reply = await event.get_reply_message()
58
+ userid = reply.sender_id
59
+ if reply.out or userid in [ultroid_bot.me.id, asst.me.id]:
60
+ return await xx.eor("`You cannot mute yourself or your assistant bot.`")
61
  elif event.is_private:
62
  userid = event.chat_id
63
  else:
64
  return await xx.eor("`Reply to a user or add their userid.`", time=5)
65
  chat = await event.get_chat()
66
  if "admin_rights" in vars(chat) and vars(chat)["admin_rights"] is not None:
67
+ if not chat.admin_rights.delete_messages:
68
  return await xx.eor("`No proper admin rights...`", time=5)
69
  elif "creator" not in vars(chat) and not event.is_private:
70
  return await xx.eor("`No proper admin rights...`", time=5)
 
91
  userid = event.chat_id
92
  else:
93
  return await xx.eor("`Reply to a user or add their userid.`", time=5)
94
+ if not is_muted(event.chat_id, userid):
 
95
  return await xx.eor("`This user is not muted in this chat.`", time=3)
96
+ unmute(event.chat_id, userid)
97
  await xx.eor("`Successfully unmuted...`", time=3)
98
 
99
 
 
126
  if userid == ultroid_bot.uid:
127
  return await xx.eor("`I can't mute myself.`", time=3)
128
  try:
129
+ bun = ban_time(xx, tme)
130
  await e.client.edit_permissions(
131
  chat.id,
132
  userid,
plugins/nightmode.py CHANGED
@@ -29,12 +29,19 @@ And Turn On auto at morning
29
  Ex- `nmtime 01 00 06 30`
30
  """
31
 
32
- from apscheduler.schedulers.asyncio import AsyncIOScheduler
 
 
 
 
 
 
 
33
  from pyUltroid.dB.night_db import *
34
  from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest
35
  from telethon.tl.types import ChatBannedRights
36
 
37
- from . import LOGS, get_string, ultroid_bot, ultroid_cmd, udB
38
 
39
 
40
  @ultroid_cmd(pattern="nmtime( (.*)|$)")
@@ -138,7 +145,7 @@ async def close_grp():
138
  LOGS.info(er)
139
 
140
 
141
- if night_grps():
142
  try:
143
  h1, m1, h2, m2 = 0, 0, 7, 0
144
  if udB.get_key("NIGHT_TIME"):
 
29
  Ex- `nmtime 01 00 06 30`
30
  """
31
 
32
+ from . import LOGS
33
+
34
+ try:
35
+ from apscheduler.schedulers.asyncio import AsyncIOScheduler
36
+ except ImportError:
37
+ LOGS.error("nightmode: 'apscheduler' not Installed!")
38
+ AsyncIOScheduler = None
39
+
40
  from pyUltroid.dB.night_db import *
41
  from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest
42
  from telethon.tl.types import ChatBannedRights
43
 
44
+ from . import get_string, udB, ultroid_bot, ultroid_cmd
45
 
46
 
47
  @ultroid_cmd(pattern="nmtime( (.*)|$)")
 
145
  LOGS.info(er)
146
 
147
 
148
+ if AsyncIOScheduler and night_grps():
149
  try:
150
  h1, m1, h2, m2 = 0, 0, 7, 0
151
  if udB.get_key("NIGHT_TIME"):
plugins/nsfwfilter.py CHANGED
@@ -16,10 +16,16 @@
16
 
17
  import os
18
 
19
- from ProfanityDetector import detector
 
 
 
 
 
 
20
  from pyUltroid.dB.nsfw_db import is_nsfw, nsfw_chat, rem_nsfw
21
 
22
- from . import HNDLR, LOGS, async_searcher, eor, events, udB, ultroid_bot, ultroid_cmd
23
 
24
 
25
  @ultroid_cmd(pattern="addnsfw( (.*)|$)", admins_only=True)
@@ -56,7 +62,7 @@ async def nsfw_check(e):
56
  pass
57
  if e.file:
58
  name = e.file.name
59
- if name:
60
  x, y = detector(name)
61
  if y:
62
  nsfw += 1
 
16
 
17
  import os
18
 
19
+ from . import LOGS
20
+
21
+ try:
22
+ from ProfanityDetector import detector
23
+ except ImportError:
24
+ detector = None
25
+ LOGS.error("nsfwfilter: 'Profanitydetector' not installed!")
26
  from pyUltroid.dB.nsfw_db import is_nsfw, nsfw_chat, rem_nsfw
27
 
28
+ from . import HNDLR, async_searcher, eor, events, udB, ultroid_bot, ultroid_cmd
29
 
30
 
31
  @ultroid_cmd(pattern="addnsfw( (.*)|$)", admins_only=True)
 
62
  pass
63
  if e.file:
64
  name = e.file.name
65
+ if detector and name:
66
  x, y = detector(name)
67
  if y:
68
  nsfw += 1
plugins/pmpermit.py CHANGED
@@ -8,28 +8,28 @@
8
  ✘ Commands Available -
9
 
10
  • `{i}a` or `{i}approve`
11
- To Approve Someone In PM.
12
 
13
  • `{i}da` or `{i}disapprove`
14
- To Disapprove Someone In PM.
15
 
16
  • `{i}block`
17
- To Block Someone in PM.
18
 
19
  • `{i}unblock` | `{i}unblock all`
20
- To Unblock Someone in PM.
21
 
22
  • `{i}nologpm`
23
- To stop logging from that user.
24
 
25
  • `{i}logpm`
26
- Start logging again from that user.
27
 
28
  • `{i}startarchive`
29
- Will start adding new PMs to archive.
30
 
31
  • `{i}stoparchive`
32
- Will stop adding new PMs to archive.
33
 
34
  • `{i}cleararchive`
35
  Unarchive all chats.
@@ -45,7 +45,11 @@ from os import remove
45
  from pyUltroid.dB import DEVLIST
46
  from pyUltroid.dB.logusers_db import *
47
  from pyUltroid.dB.pmpermit_db import *
48
- from tabulate import tabulate
 
 
 
 
49
  from telethon import events
50
  from telethon.errors import MessageNotModifiedError
51
  from telethon.tl.functions.contacts import (
@@ -155,7 +159,7 @@ if udB.get_key("PMLOG"):
155
 
156
 
157
  if udB.get_key("PMSETTING"):
158
- if udB.get_key("AUTOAPPROVE") in [True, None]:
159
 
160
  @ultroid_bot.on(
161
  events.NewMessage(
@@ -353,7 +357,7 @@ if udB.get_key("PMSETTING"):
353
  COUNT_PM[user.id] = COUNT_PM[user.id] + 1
354
  if COUNT_PM[user.id] >= WARNS:
355
  await delete_pm_warn_msgs(user.id)
356
- await event.respond(UNS)
357
  try:
358
  del COUNT_PM[user.id]
359
  del LASTMSG[user.id]
@@ -516,7 +520,7 @@ async def blockpm(block):
516
  )
517
  await block.client(BlockRequest(user))
518
  aname = await block.client.get_entity(user)
519
- await block.eor(f"`{aname.first_name} has been blocked!`")
520
  try:
521
  disapprove_user(user)
522
  except AttributeError:
@@ -525,7 +529,7 @@ async def blockpm(block):
525
  await asst.edit_message(
526
  int(udB.get_key("LOG_CHANNEL")),
527
  _not_approved[user],
528
- f"#BLOCKED\n\n[{aname.first_name}](tg://user?id={user}) [`{user}`] has been **blocked**.",
529
  buttons=[
530
  Button.inline("UnBlock", data=f"unblock_{user}"),
531
  ],
@@ -533,7 +537,7 @@ async def blockpm(block):
533
  except KeyError:
534
  _not_approved[user] = await asst.send_message(
535
  int(udB.get_key("LOG_CHANNEL")),
536
- f"#BLOCKED\n\n[{aname.first_name}](tg://user?id={user}) [`{user}`] has been **blocked**.",
537
  buttons=[
538
  Button.inline("UnBlock", data=f"unblock_{user}"),
539
  ],
@@ -544,31 +548,38 @@ async def blockpm(block):
544
 
545
  @ultroid_cmd(pattern="unblock( (.*)|$)")
546
  async def unblockpm(event):
547
- match = (
548
- event.pattern_match.group(1).strip()
549
- or (await event.get_reply_message()).sender_id
550
- )
551
- if not match:
552
- return await event.eor(NO_REPLY + "`Or give it's username/id`", time=5)
553
- if match == "all":
554
- msg = await event.eor(get_string("com_1"))
555
- u_s = await event.client(GetBlockedRequest(0, 0))
556
- count = len(u_s.users)
557
- if not count:
558
- return await eor(msg, "__You have not blocked Anyone...__")
559
- for user in u_s.users:
560
- await asyncio.sleep(1)
561
- await event.client(UnblockRequest(user.id))
562
- # GetBlockedRequest return 20 users at most.
563
- if count < 20:
564
- return await eor(msg, f"__Unblocked {count} Users!__")
565
- while u_s.users:
566
  u_s = await event.client(GetBlockedRequest(0, 0))
 
 
 
567
  for user in u_s.users:
568
- await asyncio.sleep(3)
569
  await event.client(UnblockRequest(user.id))
570
- count += len(u_s.users)
571
- return await eor(msg, f"__Unblocked {count} users.__")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  try:
573
  user = await event.client.parse_id(match)
574
  except Exception as er:
@@ -576,7 +587,7 @@ async def unblockpm(event):
576
  try:
577
  await event.client(UnblockRequest(user))
578
  aname = await event.client.get_entity(user)
579
- await event.eor(f"{inline_mention(aname)} [`user`] `has been UnBlocked!`")
580
  except Exception as et:
581
  return await event.eor(f"ERROR - {et}")
582
  try:
@@ -614,9 +625,15 @@ async def list_approved(event):
614
  name = ""
615
  users.append([name.strip(), str(i)])
616
  with open("approved_pms.txt", "w") as list_appr:
617
- list_appr.write(
618
- tabulate(users, headers=["UserName", "UserID"], showindex="always")
619
- )
 
 
 
 
 
 
620
  await event.reply(
621
  "List of users approved by [{}](tg://user?id={})".format(OWNER_NAME, OWNER_ID),
622
  file="approved_pms.txt",
 
8
  ✘ Commands Available -
9
 
10
  • `{i}a` or `{i}approve`
11
+ Approve someone to PM.
12
 
13
  • `{i}da` or `{i}disapprove`
14
+ Disapprove someone to PM.
15
 
16
  • `{i}block`
17
+ Block someone.
18
 
19
  • `{i}unblock` | `{i}unblock all`
20
+ Unblock someone.
21
 
22
  • `{i}nologpm`
23
+ Stop logging messages from the user.
24
 
25
  • `{i}logpm`
26
+ Start logging messages from the user.
27
 
28
  • `{i}startarchive`
29
+ Archive new PMs.
30
 
31
  • `{i}stoparchive`
32
+ Don't archive new PMs.
33
 
34
  • `{i}cleararchive`
35
  Unarchive all chats.
 
45
  from pyUltroid.dB import DEVLIST
46
  from pyUltroid.dB.logusers_db import *
47
  from pyUltroid.dB.pmpermit_db import *
48
+
49
+ try:
50
+ from tabulate import tabulate
51
+ except ImportError:
52
+ tabulate = None
53
  from telethon import events
54
  from telethon.errors import MessageNotModifiedError
55
  from telethon.tl.functions.contacts import (
 
159
 
160
 
161
  if udB.get_key("PMSETTING"):
162
+ if udB.get_key("AUTOAPPROVE"):
163
 
164
  @ultroid_bot.on(
165
  events.NewMessage(
 
357
  COUNT_PM[user.id] = COUNT_PM[user.id] + 1
358
  if COUNT_PM[user.id] >= WARNS:
359
  await delete_pm_warn_msgs(user.id)
360
+ _to_delete[user.id] = await event.respond(UNS)
361
  try:
362
  del COUNT_PM[user.id]
363
  del LASTMSG[user.id]
 
520
  )
521
  await block.client(BlockRequest(user))
522
  aname = await block.client.get_entity(user)
523
+ await block.eor(f"{inline_mention(aname)} `has been blocked!`")
524
  try:
525
  disapprove_user(user)
526
  except AttributeError:
 
529
  await asst.edit_message(
530
  int(udB.get_key("LOG_CHANNEL")),
531
  _not_approved[user],
532
+ f"#BLOCKED\n\n{inline_mention(aname)} [`{user}`] has been **blocked**.",
533
  buttons=[
534
  Button.inline("UnBlock", data=f"unblock_{user}"),
535
  ],
 
537
  except KeyError:
538
  _not_approved[user] = await asst.send_message(
539
  int(udB.get_key("LOG_CHANNEL")),
540
+ f"#BLOCKED\n\n{inline_mention(aname)} [`{user}`] has been **blocked**.",
541
  buttons=[
542
  Button.inline("UnBlock", data=f"unblock_{user}"),
543
  ],
 
548
 
549
  @ultroid_cmd(pattern="unblock( (.*)|$)")
550
  async def unblockpm(event):
551
+ match = event.pattern_match.group(1).strip()
552
+ if event.reply_to_msg_id:
553
+ user = (await event.get_reply_message()).sender_id
554
+ elif match:
555
+ if match == "all":
556
+ msg = await event.eor(get_string("com_1"))
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  u_s = await event.client(GetBlockedRequest(0, 0))
558
+ count = len(u_s.users)
559
+ if not count:
560
+ return await eor(msg, "__You have not blocked Anyone...__")
561
  for user in u_s.users:
562
+ await asyncio.sleep(1)
563
  await event.client(UnblockRequest(user.id))
564
+ # GetBlockedRequest return 20 users at most.
565
+ if count < 20:
566
+ return await eor(msg, f"__Unblocked {count} Users!__")
567
+ while u_s.users:
568
+ u_s = await event.client(GetBlockedRequest(0, 0))
569
+ for user in u_s.users:
570
+ await asyncio.sleep(3)
571
+ await event.client(UnblockRequest(user.id))
572
+ count += len(u_s.users)
573
+ return await eor(msg, f"__Unblocked {count} users.__")
574
+
575
+ try:
576
+ user = await event.client.parse_id(match)
577
+ except Exception as er:
578
+ return await event.eor(str(er))
579
+ elif block.is_private:
580
+ user = (await event.get_chat()).id
581
+ else:
582
+ return await event.eor(NO_REPLY, time=10)
583
  try:
584
  user = await event.client.parse_id(match)
585
  except Exception as er:
 
587
  try:
588
  await event.client(UnblockRequest(user))
589
  aname = await event.client.get_entity(user)
590
+ await event.eor(f"{inline_mention(aname)} [`{user}`] `has been UnBlocked!`")
591
  except Exception as et:
592
  return await event.eor(f"ERROR - {et}")
593
  try:
 
625
  name = ""
626
  users.append([name.strip(), str(i)])
627
  with open("approved_pms.txt", "w") as list_appr:
628
+ if tabulate:
629
+ list_appr.write(
630
+ tabulate(users, headers=["UserName", "UserID"], showindex="always")
631
+ )
632
+ else:
633
+ text = ""
634
+ for user in users:
635
+ text += f"[{user[-1]}] - {user[0]}"
636
+ list_appr.write(text)
637
  await event.reply(
638
  "List of users approved by [{}](tg://user?id={})".format(OWNER_NAME, OWNER_ID),
639
  file="approved_pms.txt",
plugins/qrcode.py CHANGED
@@ -18,7 +18,11 @@
18
  """
19
  import os
20
 
21
- import cv2
 
 
 
 
22
  import qrcode
23
  from PIL import Image
24
  from telethon.tl.types import MessageMediaDocument as doc
 
18
  """
19
  import os
20
 
21
+ try:
22
+ import cv2
23
+ except ImportError:
24
+ cv2 = None
25
+
26
  import qrcode
27
  from PIL import Image
28
  from telethon.tl.types import MessageMediaDocument as doc
plugins/schedulemsg.py CHANGED
@@ -33,7 +33,7 @@ async def _(e):
33
  await e.eor(get_string("schdl_1"), time=5)
34
  else:
35
  try:
36
- z = await ban_time(e, y)
37
  await e.client.send_message(e.chat_id, k, schedule=z)
38
  await e.eor(get_string("schdl_1"), time=5)
39
  except BaseException:
@@ -46,7 +46,7 @@ async def _(e):
46
  await e.eor(get_string("schdl_1"), time=5)
47
  else:
48
  try:
49
- z = await ban_time(e, x)
50
  await e.client.send_message(e.chat_id, xx, schedule=z)
51
  await e.eor(get_string("schdl_1"), time=5)
52
  except BaseException:
 
33
  await e.eor(get_string("schdl_1"), time=5)
34
  else:
35
  try:
36
+ z = ban_time(e, y)
37
  await e.client.send_message(e.chat_id, k, schedule=z)
38
  await e.eor(get_string("schdl_1"), time=5)
39
  except BaseException:
 
46
  await e.eor(get_string("schdl_1"), time=5)
47
  else:
48
  try:
49
+ z = ban_time(e, x)
50
  await e.client.send_message(e.chat_id, xx, schedule=z)
51
  await e.eor(get_string("schdl_1"), time=5)
52
  except BaseException:
plugins/search.py CHANGED
@@ -42,7 +42,7 @@ from pyUltroid.functions.misc import google_search
42
  from pyUltroid.functions.tools import saavn_search
43
  from telethon.tl.types import DocumentAttributeAudio
44
 
45
- from . import async_searcher, eod, fast_download, get_string, ultroid_cmd
46
 
47
 
48
  @ultroid_cmd(
@@ -145,18 +145,13 @@ async def reverse(event):
145
  return await event.eor("`Reply to an Image`")
146
  ult = await event.eor(get_string("com_1"))
147
  dl = await reply.download_media()
148
- if reply.video:
149
- img = cv2.VideoCapture(dl)
150
- ult, roid = img.read()
151
- os.remove(dl)
152
- dl = "file.png"
153
- cv2.imwrite(dl, roid)
154
- img = Image.open(dl)
155
  x, y = img.size
156
- file = {"encoded_image": (dl, open(dl, "rb"))}
157
  grs = requests.post(
158
  "https://www.google.com/searchbyimage/upload",
159
- files=file,
160
  allow_redirects=False,
161
  )
162
  loc = grs.headers.get("Location")
@@ -188,7 +183,7 @@ async def reverse(event):
188
  caption="Similar Images Realted to Search",
189
  )
190
  rmtree(f"./resources/downloads/{text}/")
191
- os.remove(dl)
192
 
193
 
194
  @ultroid_cmd(
@@ -214,9 +209,9 @@ async def siesace(e):
214
  song, _ = await fast_download(url, filename=title + ".m4a")
215
  thumb, _ = await fast_download(img, filename=title + ".jpg")
216
  song, _ = await e.client.fast_uploader(song, to_delete=True)
217
- await e.reply(
218
  file=song,
219
- message=f"`{title}`\n`From Saavn`",
220
  attributes=[
221
  DocumentAttributeAudio(
222
  duration=int(duration),
 
42
  from pyUltroid.functions.tools import saavn_search
43
  from telethon.tl.types import DocumentAttributeAudio
44
 
45
+ from . import async_searcher, con, eod, fast_download, get_string, ultroid_cmd
46
 
47
 
48
  @ultroid_cmd(
 
145
  return await event.eor("`Reply to an Image`")
146
  ult = await event.eor(get_string("com_1"))
147
  dl = await reply.download_media()
148
+ file = await con.convert(dl, convert_to="png")
149
+ img = Image.open(file)
 
 
 
 
 
150
  x, y = img.size
151
+ files = {"encoded_image": (file, open(file, "rb"))}
152
  grs = requests.post(
153
  "https://www.google.com/searchbyimage/upload",
154
+ files=files,
155
  allow_redirects=False,
156
  )
157
  loc = grs.headers.get("Location")
 
183
  caption="Similar Images Realted to Search",
184
  )
185
  rmtree(f"./resources/downloads/{text}/")
186
+ os.remove(file)
187
 
188
 
189
  @ultroid_cmd(
 
209
  song, _ = await fast_download(url, filename=title + ".m4a")
210
  thumb, _ = await fast_download(img, filename=title + ".jpg")
211
  song, _ = await e.client.fast_uploader(song, to_delete=True)
212
+ await eve.eor(
213
  file=song,
214
+ text=f"`{title}`\n`From Saavn`",
215
  attributes=[
216
  DocumentAttributeAudio(
217
  duration=int(duration),
plugins/snips.py CHANGED
@@ -21,9 +21,9 @@
21
  """
22
  import os
23
 
 
24
  from pyUltroid.dB.snips_db import add_snip, get_snips, list_snip, rem_snip
25
  from pyUltroid.functions.tools import create_tl_btn, format_btn, get_msg_button
26
- from pyUltroid.misc import sudoers
27
  from telegraph import upload_file as uf
28
  from telethon.utils import pack_bot_file_id
29
 
 
21
  """
22
  import os
23
 
24
+ from pyUltroid._misc import sudoers
25
  from pyUltroid.dB.snips_db import add_snip, get_snips, list_snip, rem_snip
26
  from pyUltroid.functions.tools import create_tl_btn, format_btn, get_msg_button
 
27
  from telegraph import upload_file as uf
28
  from telethon.utils import pack_bot_file_id
29
 
plugins/specialtools.py CHANGED
@@ -40,17 +40,18 @@ from shutil import rmtree
40
  import pytz
41
  from bs4 import BeautifulSoup as bs
42
  from pyUltroid.functions.google_image import googleimagesdownload
43
- from pyUltroid.functions.misc import create_quotly
44
  from pyUltroid.functions.tools import metadata
45
  from telethon.tl.types import DocumentAttributeVideo
46
 
47
  from . import (
 
48
  async_searcher,
49
  bash,
50
  downloader,
51
  eod,
52
  get_string,
53
  mediainfo,
 
54
  ultroid_bot,
55
  ultroid_cmd,
56
  uploader,
@@ -161,9 +162,8 @@ async def hbd(event):
161
  s = kk[2]
162
  day = int(p)
163
  month = r
164
- paida = q
165
  try:
166
- jn = dt.strptime(paida, "%d/%m/%Y")
167
  except BaseException:
168
  return await event.eor(get_string("spcltool_6"))
169
  jnm = zn.localize(jn)
@@ -234,7 +234,7 @@ async def hbd(event):
234
  f"""
235
  Name -: {name}
236
 
237
- D.O.B -: {paida}
238
 
239
  Lived -: {saal}yr, {mahina}m, {din}d, {ghanta}hr, {mi}min, {slive}sec
240
 
@@ -351,7 +351,9 @@ async def quott_(event):
351
  if match == "random":
352
  match = choice(all_col)
353
  try:
354
- file = await create_quotly(reply_, bg=match, reply=replied_to, sender=user)
 
 
355
  except Exception as er:
356
  return await msg.edit(str(er))
357
  message = await reply.reply("Quotly by Ultroid", file=file)
 
40
  import pytz
41
  from bs4 import BeautifulSoup as bs
42
  from pyUltroid.functions.google_image import googleimagesdownload
 
43
  from pyUltroid.functions.tools import metadata
44
  from telethon.tl.types import DocumentAttributeVideo
45
 
46
  from . import (
47
+ HNDLR,
48
  async_searcher,
49
  bash,
50
  downloader,
51
  eod,
52
  get_string,
53
  mediainfo,
54
+ quotly,
55
  ultroid_bot,
56
  ultroid_cmd,
57
  uploader,
 
162
  s = kk[2]
163
  day = int(p)
164
  month = r
 
165
  try:
166
+ jn = dt.strptime(match, "%d/%m/%Y")
167
  except BaseException:
168
  return await event.eor(get_string("spcltool_6"))
169
  jnm = zn.localize(jn)
 
234
  f"""
235
  Name -: {name}
236
 
237
+ D.O.B -: {match}
238
 
239
  Lived -: {saal}yr, {mahina}m, {din}d, {ghanta}hr, {mi}min, {slive}sec
240
 
 
351
  if match == "random":
352
  match = choice(all_col)
353
  try:
354
+ file = await quotly.create_quotly(
355
+ reply_, bg=match, reply=replied_to, sender=user
356
+ )
357
  except Exception as er:
358
  return await msg.edit(str(er))
359
  message = await reply.reply("Quotly by Ultroid", file=file)
plugins/stickertools.py CHANGED
@@ -27,12 +27,19 @@ import os
27
  import random
28
  from os import remove
29
 
30
- import cv2
31
- import numpy as np
32
- import requests
33
- from PIL import Image, ImageDraw
34
- from pyUltroid.functions.misc import create_quotly
35
- from pyUltroid.functions.tools import TgConverter
 
 
 
 
 
 
 
36
  from telethon.errors import PeerIdInvalidError, YouBlockedUserError
37
  from telethon.tl.types import DocumentAttributeFilename, DocumentAttributeSticker
38
  from telethon.utils import get_input_document
@@ -41,12 +48,14 @@ from . import (
41
  KANGING_STR,
42
  LOGS,
43
  asst,
 
44
  bash,
45
  con,
46
  functions,
47
  get_string,
48
  inline_mention,
49
  mediainfo,
 
50
  types,
51
  udB,
52
  ultroid_cmd,
@@ -134,7 +143,7 @@ async def hehe(args):
134
  xy = await message.download_media()
135
  if (message.file.duration or 0) <= 10:
136
  is_vid = True
137
- photo = await TgConverter.create_webm(xy)
138
  else:
139
  y = cv2.VideoCapture(xy)
140
  heh, lol = y.read()
@@ -152,7 +161,7 @@ async def hehe(args):
152
  is_anim = True
153
  photo = 1
154
  elif message.message:
155
- photo = await create_quotly(message)
156
  else:
157
  return await xx.edit(get_string("com_4"))
158
  if not udB.get_key("language") or udB.get_key("language") == "en":
@@ -192,8 +201,8 @@ async def hehe(args):
192
  file.name = "sticker.png"
193
  image.save(file, "PNG")
194
 
195
- response = requests.get(f"http://t.me/addstickers/{packname}")
196
- htmlstr = response.text.split("\n")
197
 
198
  if (
199
  " A <strong>Telegram</strong> user has created the <strong>Sticker&nbsp;Set</strong>."
@@ -477,4 +486,4 @@ async def ultiny(event):
477
  )
478
  os.remove(file)
479
  await xx.delete()
480
- os.remove(ik)
 
27
  import random
28
  from os import remove
29
 
30
+ try:
31
+ import cv2
32
+ except ImportError:
33
+ cv2 = None
34
+ try:
35
+ import numpy as np
36
+ except ImportError:
37
+ np = None
38
+ try:
39
+ from PIL import Image, ImageDraw
40
+ except ImportError:
41
+ pass
42
+
43
  from telethon.errors import PeerIdInvalidError, YouBlockedUserError
44
  from telethon.tl.types import DocumentAttributeFilename, DocumentAttributeSticker
45
  from telethon.utils import get_input_document
 
48
  KANGING_STR,
49
  LOGS,
50
  asst,
51
+ async_searcher,
52
  bash,
53
  con,
54
  functions,
55
  get_string,
56
  inline_mention,
57
  mediainfo,
58
+ quotly,
59
  types,
60
  udB,
61
  ultroid_cmd,
 
143
  xy = await message.download_media()
144
  if (message.file.duration or 0) <= 10:
145
  is_vid = True
146
+ photo = await con.create_webm(xy)
147
  else:
148
  y = cv2.VideoCapture(xy)
149
  heh, lol = y.read()
 
161
  is_anim = True
162
  photo = 1
163
  elif message.message:
164
+ photo = await quotly.create_quotly(message)
165
  else:
166
  return await xx.edit(get_string("com_4"))
167
  if not udB.get_key("language") or udB.get_key("language") == "en":
 
201
  file.name = "sticker.png"
202
  image.save(file, "PNG")
203
 
204
+ response = await async_searcher(f"http://t.me/addstickers/{packname}")
205
+ htmlstr = response.split("\n")
206
 
207
  if (
208
  " A <strong>Telegram</strong> user has created the <strong>Sticker&nbsp;Set</strong>."
 
486
  )
487
  os.remove(file)
488
  await xx.delete()
489
+ os.remove(ik)
plugins/sudo.py CHANGED
@@ -17,7 +17,7 @@
17
  List all sudo users.
18
  """
19
 
20
- from pyUltroid.misc import sudoers
21
  from telethon.tl.types import User
22
 
23
  from . import get_string, inline_mention, udB, ultroid_bot, ultroid_cmd
 
17
  List all sudo users.
18
  """
19
 
20
+ from pyUltroid._misc import sudoers
21
  from telethon.tl.types import User
22
 
23
  from . import get_string, inline_mention, udB, ultroid_bot, ultroid_cmd