Spaces:
Paused
Paused
Devesh Pal
Amit Sharma
Danish
Mahesh Chauhan
Aditya
CyrusXD
commited on
Commit
·
be3098f
1
Parent(s):
e64a586
Ultroid v0.4 updates
Browse filesCo-authored-by: Amit Sharma <[email protected]>
Co-authored-by: Danish <[email protected]>
Co-authored-by: Mahesh Chauhan <[email protected]>
Co-authored-by: Aditya <[email protected]>
Co-authored-by: CyrusXD <[email protected]>
This view is limited to 50 files because it contains too many changes.
See raw diff
- Dockerfile +3 -0
- README.md +16 -9
- assistant/callbackstuffs.py +1 -1
- assistant/games.py +3 -2
- assistant/inlinestuff.py +16 -11
- assistant/manager/_help.py +1 -1
- assistant/manager/admins.py +1 -1
- assistant/manager/misc.py +2 -2
- assistant/manager/stickermanager.py +2 -2
- assistant/start.py +7 -3
- assistant/ytdl.py +32 -21
- plugins/__init__.py +2 -1
- plugins/_chatactions.py +25 -2
- plugins/_help.py +35 -3
- plugins/_inline.py +11 -4
- plugins/_ultroid.py +2 -1
- plugins/_userlogs.py +23 -9
- plugins/_wspr.py +4 -4
- plugins/admintools.py +51 -18
- plugins/afk.py +4 -4
- plugins/antiflood.py +2 -2
- plugins/asstcmd.py +4 -4
- plugins/audiotools.py +15 -38
- plugins/autocorrect.py +3 -3
- plugins/autopic.py +2 -2
- plugins/blacklist.py +4 -4
- plugins/bot.py +15 -8
- plugins/broadcast.py +24 -32
- plugins/carbon.py +2 -2
- plugins/channelhacks.py +8 -8
- plugins/chats.py +20 -12
- plugins/compressor.py +3 -3
- plugins/converter.py +37 -55
- plugins/core.py +37 -12
- plugins/database.py +6 -6
- plugins/devtools.py +24 -21
- plugins/dnd.py +59 -0
- plugins/downloadupload.py +90 -181
- plugins/echo.py +2 -2
- plugins/fakeaction.py +2 -2
- plugins/fedutils.py +9 -9
- plugins/fileshare.py +62 -13
- plugins/filter.py +4 -4
- plugins/fontgen.py +2 -2
- plugins/forcesubscribe.py +16 -15
- plugins/gdrive.py +30 -55
- plugins/giftools.py +3 -3
- plugins/globaltools.py +32 -32
- plugins/greetings.py +1 -1
- plugins/imagetools.py +5 -5
Dockerfile
CHANGED
@@ -14,6 +14,9 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
|
|
14 |
&& pip3 install --no-cache-dir -r root/TeamUltroid/requirements.txt \
|
15 |
&& pip3 install av --no-binary av
|
16 |
|
|
|
|
|
|
|
17 |
# changing workdir
|
18 |
WORKDIR /root/TeamUltroid/
|
19 |
|
|
|
14 |
&& pip3 install --no-cache-dir -r root/TeamUltroid/requirements.txt \
|
15 |
&& pip3 install av --no-binary av
|
16 |
|
17 |
+
# Railway's banned dependency
|
18 |
+
RUN if [ ! $RAILWAY_STATIC_URL ]; then pip3 install --no-cache-dir yt-dlp; fi
|
19 |
+
|
20 |
# changing workdir
|
21 |
WORKDIR /root/TeamUltroid/
|
22 |
|
README.md
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
[](https://github.com/TeamUltroid/Ultroid/stargazers)
|
12 |
[](https://github.com/TeamUltroid/Ultroid/fork)
|
13 |
[](https://github.com/TeamUltroid/Ultroid/)
|
14 |
-
[](https://www.codefactor.io/repository/github/teamultroid/ultroid/overview/main)
|
16 |
[](https://github.com/TeamUltroid/Ultroid/graphs/commit-activity)
|
17 |
[](https://img.shields.io/docker/pulls/theteamultroid/ultroid?style=flat-square)
|
@@ -46,9 +46,9 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
|
|
46 |
- [Ultroid CLI](#Ultroid-CLI)
|
47 |
|
48 |
### Local Deploy - Easy Method
|
49 |
-
- Linux - `
|
50 |
- Windows - `cd desktop ; wget https://git.io/JY9UM -o locals.py ; python locals.py`
|
51 |
-
- Termux - `
|
52 |
|
53 |
### Local Deploy - Traditional Method
|
54 |
- Get your [Necessary Variables](#Necessary-Variables)
|
@@ -66,9 +66,9 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
|
|
66 |
- For Linux users:
|
67 |
`bash sessiongen`
|
68 |
or
|
69 |
-
`
|
70 |
- For Termux users:
|
71 |
-
`
|
72 |
- For Windows Users:
|
73 |
`cd desktop ; wget https://git.io/JY9JI -o ultroid.py ; python ultroid.py`
|
74 |
- Fill your details in a `.env` file, as given in [`.env.sample`](https://github.com/TeamUltroid/Ultroid/blob/main/.env.sample).
|
@@ -94,15 +94,22 @@ Take a look at the [`docs`](https://blue-devil1134.github.io/UltroidCli/) for mo
|
|
94 |
---
|
95 |
## Necessary Variables
|
96 |
- `SESSION` - SessionString for your accounts login session. Get it from [here](#Session-String)
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
## Session String
|
101 |
Different ways to get your `SESSION`:
|
102 |
* [](https://replit.com/@TeamUltroid/UltroidStringSession)
|
103 |
-
* Linux : `
|
104 |
* PowerShell : `cd desktop ; wget https://git.io/JY9JI ; python ultroid.py`
|
105 |
-
* Termux : `
|
106 |
* TelegramBot : [@SessionGeneratorBot](https://t.me/SessionGeneratorBot)
|
107 |
|
108 |
---
|
|
|
11 |
[](https://github.com/TeamUltroid/Ultroid/stargazers)
|
12 |
[](https://github.com/TeamUltroid/Ultroid/fork)
|
13 |
[](https://github.com/TeamUltroid/Ultroid/)
|
14 |
+
[](https://www.python.org/)
|
15 |
[](https://www.codefactor.io/repository/github/teamultroid/ultroid/overview/main)
|
16 |
[](https://github.com/TeamUltroid/Ultroid/graphs/commit-activity)
|
17 |
[](https://img.shields.io/docker/pulls/theteamultroid/ultroid?style=flat-square)
|
|
|
46 |
- [Ultroid CLI](#Ultroid-CLI)
|
47 |
|
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)
|
|
|
66 |
- For Linux users:
|
67 |
`bash sessiongen`
|
68 |
or
|
69 |
+
`wget -O session.py https://git.io/JY9JI && python3 session.py`
|
70 |
- For Termux users:
|
71 |
+
`wget -O session.py https://git.io/JY9JI && python session.py`
|
72 |
- For Windows Users:
|
73 |
`cd desktop ; wget https://git.io/JY9JI -o ultroid.py ; python ultroid.py`
|
74 |
- Fill your details in a `.env` file, as given in [`.env.sample`](https://github.com/TeamUltroid/Ultroid/blob/main/.env.sample).
|
|
|
94 |
---
|
95 |
## Necessary Variables
|
96 |
- `SESSION` - SessionString for your accounts login session. Get it from [here](#Session-String)
|
97 |
+
|
98 |
+
One of the following databases:
|
99 |
+
- For **Redis** (tutorial [here](./resources/extras/redistut.md))
|
100 |
+
- `REDIS_URI` - Redis endpoint URL, from [redislabs](http://redislabs.com/).
|
101 |
+
- `REDIS_PASSWORD` - Redis endpoint Password, from [redislabs](http://redislabs.com/).
|
102 |
+
- For **MONGODB**
|
103 |
+
- `MONGO_URI` - Get it from [mongodb](https://mongodb.com/atlas).
|
104 |
+
- For **SQLDB**
|
105 |
+
- `DATABASE_URL`- Get it from [elephantsql](https://elephantsql.com).
|
106 |
|
107 |
## Session String
|
108 |
Different ways to get your `SESSION`:
|
109 |
* [](https://replit.com/@TeamUltroid/UltroidStringSession)
|
110 |
+
* Linux : `wget -O session.py https://git.io/JY9JI && python3 session.py`
|
111 |
* PowerShell : `cd desktop ; wget https://git.io/JY9JI ; python ultroid.py`
|
112 |
+
* Termux : `wget -O session.py https://git.io/JY9JI && python session.py`
|
113 |
* TelegramBot : [@SessionGeneratorBot](https://t.me/SessionGeneratorBot)
|
114 |
|
115 |
---
|
assistant/callbackstuffs.py
CHANGED
@@ -92,7 +92,7 @@ _buttons = {
|
|
92 |
[Button.inline("« Bᴀᴄᴋ", data="cbs_pmcstm")],
|
93 |
],
|
94 |
},
|
95 |
-
"
|
96 |
"text": f"Customise your {HNDLR}alive. Choose from the below options -",
|
97 |
"buttons": [
|
98 |
[Button.inline("Aʟɪᴠᴇ Tᴇxᴛ", data="abs_alvtx")],
|
|
|
92 |
[Button.inline("« Bᴀᴄᴋ", data="cbs_pmcstm")],
|
93 |
],
|
94 |
},
|
95 |
+
"alvcstm": {
|
96 |
"text": f"Customise your {HNDLR}alive. Choose from the below options -",
|
97 |
"buttons": [
|
98 |
[Button.inline("Aʟɪᴠᴇ Tᴇxᴛ", data="abs_alvtx")],
|
assistant/games.py
CHANGED
@@ -65,7 +65,7 @@ async def _akokk(e):
|
|
65 |
|
66 |
@callback(re.compile("aki_(.*)"), owner=True)
|
67 |
async def doai(e):
|
68 |
-
adt = e.pattern_match.group(1).decode("utf-8")
|
69 |
dt = adt.split("_")
|
70 |
ch = int(dt[0])
|
71 |
mid = int(dt[1])
|
@@ -156,10 +156,11 @@ CONGO_STICKER = [
|
|
156 |
"CAADAgADjAADECECEFZM-SrKO9GgAg",
|
157 |
"CAADAgADSwIAAj-VzArAzNCDiGWAHAI",
|
158 |
"CAADAgADhQADwZxgDIuMHR9IU10iAg",
|
|
|
159 |
]
|
160 |
|
161 |
|
162 |
-
@callback("delit")
|
163 |
async def delete_it(event):
|
164 |
await event.delete()
|
165 |
|
|
|
65 |
|
66 |
@callback(re.compile("aki_(.*)"), owner=True)
|
67 |
async def doai(e):
|
68 |
+
adt = e.pattern_match.group(1).strip().decode("utf-8")
|
69 |
dt = adt.split("_")
|
70 |
ch = int(dt[0])
|
71 |
mid = int(dt[1])
|
|
|
156 |
"CAADAgADjAADECECEFZM-SrKO9GgAg",
|
157 |
"CAADAgADSwIAAj-VzArAzNCDiGWAHAI",
|
158 |
"CAADAgADhQADwZxgDIuMHR9IU10iAg",
|
159 |
+
"CAADAgADiwMAAsSraAuoe2BwYu1sdQI",
|
160 |
]
|
161 |
|
162 |
|
163 |
+
@callback("delit", owner=True)
|
164 |
async def delete_it(event):
|
165 |
await event.delete()
|
166 |
|
assistant/inlinestuff.py
CHANGED
@@ -124,17 +124,22 @@ async def _(e):
|
|
124 |
],
|
125 |
]
|
126 |
try:
|
127 |
-
lnk =
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
|
140 |
@callback(
|
|
|
124 |
],
|
125 |
]
|
126 |
try:
|
127 |
+
lnk = [
|
128 |
+
await e.builder.article(
|
129 |
+
title=f"Upload {filename}",
|
130 |
+
text=f"**File:**\n{filename}",
|
131 |
+
buttons=buttons,
|
132 |
+
)
|
133 |
+
]
|
134 |
+
except BaseException as er:
|
135 |
+
LOGS.exception(er)
|
136 |
+
lnk = [
|
137 |
+
await e.builder.article(
|
138 |
+
title="fl2lnk",
|
139 |
+
text="File not found",
|
140 |
+
)
|
141 |
+
]
|
142 |
+
await e.answer(lnk, switch_pm="File to Link.", switch_pm_param="start")
|
143 |
|
144 |
|
145 |
@callback(
|
assistant/manager/_help.py
CHANGED
@@ -130,5 +130,5 @@ async def home_aja(e):
|
|
130 |
|
131 |
@callback(re.compile("hlp_(.*)"))
|
132 |
async def do_something(event):
|
133 |
-
match = event.pattern_match.group(1).decode("utf-8")
|
134 |
await event.edit(STRINGS[match], buttons=Button.inline("<< Back", "mnghome"))
|
|
|
130 |
|
131 |
@callback(re.compile("hlp_(.*)"))
|
132 |
async def do_something(event):
|
133 |
+
match = event.pattern_match.group(1).strip().decode("utf-8")
|
134 |
await event.edit(STRINGS[match], buttons=Button.inline("<< Back", "mnghome"))
|
assistant/manager/admins.py
CHANGED
@@ -22,7 +22,7 @@ async def dowj(e):
|
|
22 |
return await e.eor("Reply to a message...")
|
23 |
try:
|
24 |
await replied.delete()
|
25 |
-
if e.pattern_match.group(1) == "kick":
|
26 |
await e.client.kick_participant(e.chat_id, user)
|
27 |
te = "Kicked"
|
28 |
else:
|
|
|
22 |
return await e.eor("Reply to a message...")
|
23 |
try:
|
24 |
await replied.delete()
|
25 |
+
if e.pattern_match.group(1).strip() == "kick":
|
26 |
await e.client.kick_participant(e.chat_id, user)
|
27 |
te = "Kicked"
|
28 |
else:
|
assistant/manager/misc.py
CHANGED
@@ -22,9 +22,9 @@ async def dheh(e):
|
|
22 |
await e.client.send_message(e.chat_id, text, reply_to=ri)
|
23 |
|
24 |
|
25 |
-
@asst_cmd(pattern="echo
|
26 |
async def oqha(e):
|
27 |
-
match = e.pattern_match.group(1)
|
28 |
if match:
|
29 |
text = match
|
30 |
reply_to = e
|
|
|
22 |
await e.client.send_message(e.chat_id, text, reply_to=ri)
|
23 |
|
24 |
|
25 |
+
@asst_cmd(pattern="echo( (.*)|$)")
|
26 |
async def oqha(e):
|
27 |
+
match = e.pattern_match.group(1).strip()
|
28 |
if match:
|
29 |
text = match
|
30 |
reply_to = e
|
assistant/manager/stickermanager.py
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
import random
|
9 |
|
10 |
from pyUltroid.functions.misc import create_quotly
|
11 |
-
from pyUltroid.functions.tools import
|
12 |
from telethon import errors
|
13 |
from telethon.errors.rpcerrorlist import StickersetInvalidError
|
14 |
from telethon.tl.functions.messages import GetStickerSetRequest as GetSticker
|
@@ -51,7 +51,7 @@ async def kang_cmd(ult):
|
|
51 |
elif reply.photo:
|
52 |
dl = await reply.download_media()
|
53 |
name = "sticker.webp"
|
54 |
-
image =
|
55 |
image.save(name, "WEBP")
|
56 |
elif reply.text:
|
57 |
dl = await create_quotly(reply)
|
|
|
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
|
14 |
from telethon.tl.functions.messages import GetStickerSetRequest as GetSticker
|
|
|
51 |
elif reply.photo:
|
52 |
dl = await reply.download_media()
|
53 |
name = "sticker.webp"
|
54 |
+
image = TgConverter.resize_photo_sticker(dl)
|
55 |
image.save(name, "WEBP")
|
56 |
elif reply.text:
|
57 |
dl = await create_quotly(reply)
|
assistant/start.py
CHANGED
@@ -12,6 +12,7 @@ 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.utils import get_display_name
|
16 |
|
17 |
from strings.strings import get_string
|
@@ -77,12 +78,15 @@ async def own(event):
|
|
77 |
|
78 |
@callback("closeit")
|
79 |
async def closet(lol):
|
80 |
-
|
|
|
|
|
|
|
81 |
|
82 |
|
83 |
-
@asst_cmd(pattern="start
|
84 |
async def ultroid(event):
|
85 |
-
args = event.pattern_match.group(1)
|
86 |
if not is_added(event.sender_id) and event.sender_id not in owner_and_sudos():
|
87 |
add_user(event.sender_id)
|
88 |
kak_uiw = udB.get_key("OFF_START_LOG")
|
|
|
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
|
17 |
|
18 |
from strings.strings import get_string
|
|
|
78 |
|
79 |
@callback("closeit")
|
80 |
async def closet(lol):
|
81 |
+
try:
|
82 |
+
await lol.delete()
|
83 |
+
except MessageDeleteForbiddenError:
|
84 |
+
await lol.answer("MESSAGE_TOO_OLD", alert=True)
|
85 |
|
86 |
|
87 |
+
@asst_cmd(pattern="start( (.*)|$)", forwards=False, func=lambda x: not x.is_group)
|
88 |
async def ultroid(event):
|
89 |
+
args = event.pattern_match.group(1).strip()
|
90 |
if not is_added(event.sender_id) and event.sender_id not in owner_and_sudos():
|
91 |
add_user(event.sender_id)
|
92 |
kak_uiw = udB.get_key("OFF_START_LOG")
|
assistant/ytdl.py
CHANGED
@@ -13,7 +13,13 @@ try:
|
|
13 |
from PIL import Image
|
14 |
except ImportError:
|
15 |
Image = None
|
16 |
-
from pyUltroid.functions.helper import
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
from pyUltroid.functions.ytdl import dler, get_buttons, get_formats
|
18 |
from telethon import Button
|
19 |
from telethon.errors.rpcerrorlist import FilePartLengthInvalidError, MediaEmptyError
|
@@ -52,7 +58,7 @@ async def _(event):
|
|
52 |
await event.answer([fuk])
|
53 |
return
|
54 |
results = []
|
55 |
-
search = VideosSearch(string, limit=
|
56 |
nub = search.result()
|
57 |
nibba = nub["result"]
|
58 |
for v in nibba:
|
@@ -70,12 +76,12 @@ async def _(event):
|
|
70 |
else "None"
|
71 |
)
|
72 |
thumb = f"https://i.ytimg.com/vi/{ids}/hqdefault.jpg"
|
73 |
-
text = f"
|
74 |
-
text += f"
|
75 |
-
text += f"
|
76 |
-
text += f"
|
77 |
-
text += f"
|
78 |
-
text += f"
|
79 |
desc = f"{title}\n{duration}"
|
80 |
file = wb(thumb, 0, "image/jpeg", [])
|
81 |
buttons = [
|
@@ -96,9 +102,7 @@ async def _(event):
|
|
96 |
),
|
97 |
],
|
98 |
]
|
99 |
-
BACK_BUTTON.update(
|
100 |
-
{ids: {"text": text, "buttons": buttons, "parse_mode": "html"}}
|
101 |
-
)
|
102 |
results.append(
|
103 |
await event.builder.article(
|
104 |
type="photo",
|
@@ -108,7 +112,6 @@ async def _(event):
|
|
108 |
content=file,
|
109 |
text=text,
|
110 |
include_media=True,
|
111 |
-
parse_mode="html",
|
112 |
buttons=buttons,
|
113 |
),
|
114 |
)
|
@@ -122,7 +125,7 @@ async def _(event):
|
|
122 |
owner=True,
|
123 |
)
|
124 |
async def _(e):
|
125 |
-
_e = e.pattern_match.group(1).decode("UTF-8")
|
126 |
_lets_split = _e.split(":")
|
127 |
_ytdl_data = await dler(e, _yt_base_url + _lets_split[1])
|
128 |
_data = get_formats(_lets_split[0], _lets_split[1], _ytdl_data)
|
@@ -140,7 +143,7 @@ async def _(e):
|
|
140 |
owner=True,
|
141 |
)
|
142 |
async def _(event):
|
143 |
-
url = event.pattern_match.group(1).decode("UTF-8")
|
144 |
lets_split = url.split(":")
|
145 |
vid_id = lets_split[2]
|
146 |
link = _yt_base_url + vid_id
|
@@ -151,6 +154,7 @@ async def _(event):
|
|
151 |
ext = "mp3"
|
152 |
if lets_split[0] == "audio":
|
153 |
opts = {
|
|
|
154 |
"addmetadata": True,
|
155 |
"key": "FFmpegMetadata",
|
156 |
"prefer_ffmpeg": True,
|
@@ -184,8 +188,12 @@ async def _(event):
|
|
184 |
else ytdl_data["description"][:100]
|
185 |
)
|
186 |
description = description or "None"
|
|
|
|
|
|
|
|
|
187 |
file, _ = await event.client.fast_uploader(
|
188 |
-
|
189 |
filename=title + "." + ext,
|
190 |
show_progress=True,
|
191 |
event=event,
|
@@ -235,6 +243,7 @@ async def _(event):
|
|
235 |
filepath = vid_id + ".mkv"
|
236 |
if not os.path.exists(filepath):
|
237 |
filepath = filepath + ".webm"
|
|
|
238 |
file, _ = await event.client.fast_uploader(
|
239 |
filepath,
|
240 |
filename=title + ".mkv",
|
@@ -250,12 +259,14 @@ async def _(event):
|
|
250 |
supports_streaming=True,
|
251 |
),
|
252 |
]
|
253 |
-
|
254 |
-
text
|
255 |
-
text += f"
|
256 |
-
text += f"
|
257 |
-
text += f"
|
258 |
-
text += f"
|
|
|
|
|
259 |
button = Button.switch_inline("Search More", query="yt ", same_peer=True)
|
260 |
try:
|
261 |
await event.edit(
|
|
|
13 |
from PIL import Image
|
14 |
except ImportError:
|
15 |
Image = None
|
16 |
+
from pyUltroid.functions.helper import (
|
17 |
+
bash,
|
18 |
+
fast_download,
|
19 |
+
humanbytes,
|
20 |
+
numerize,
|
21 |
+
time_formatter,
|
22 |
+
)
|
23 |
from pyUltroid.functions.ytdl import dler, get_buttons, get_formats
|
24 |
from telethon import Button
|
25 |
from telethon.errors.rpcerrorlist import FilePartLengthInvalidError, MediaEmptyError
|
|
|
58 |
await event.answer([fuk])
|
59 |
return
|
60 |
results = []
|
61 |
+
search = VideosSearch(string, limit=50)
|
62 |
nub = search.result()
|
63 |
nibba = nub["result"]
|
64 |
for v in nibba:
|
|
|
76 |
else "None"
|
77 |
)
|
78 |
thumb = f"https://i.ytimg.com/vi/{ids}/hqdefault.jpg"
|
79 |
+
text = f"**Title: [{title}]({link})**\n\n"
|
80 |
+
text += f"`Description: {description}\n\n"
|
81 |
+
text += f"「 Duration: {duration} 」\n"
|
82 |
+
text += f"「 Views: {views} 」\n"
|
83 |
+
text += f"「 Publisher: {publisher} 」\n"
|
84 |
+
text += f"「 Published on: {published_on} 」`"
|
85 |
desc = f"{title}\n{duration}"
|
86 |
file = wb(thumb, 0, "image/jpeg", [])
|
87 |
buttons = [
|
|
|
102 |
),
|
103 |
],
|
104 |
]
|
105 |
+
BACK_BUTTON.update({ids: {"text": text, "buttons": buttons}})
|
|
|
|
|
106 |
results.append(
|
107 |
await event.builder.article(
|
108 |
type="photo",
|
|
|
112 |
content=file,
|
113 |
text=text,
|
114 |
include_media=True,
|
|
|
115 |
buttons=buttons,
|
116 |
),
|
117 |
)
|
|
|
125 |
owner=True,
|
126 |
)
|
127 |
async def _(e):
|
128 |
+
_e = e.pattern_match.group(1).strip().decode("UTF-8")
|
129 |
_lets_split = _e.split(":")
|
130 |
_ytdl_data = await dler(e, _yt_base_url + _lets_split[1])
|
131 |
_data = get_formats(_lets_split[0], _lets_split[1], _ytdl_data)
|
|
|
143 |
owner=True,
|
144 |
)
|
145 |
async def _(event):
|
146 |
+
url = event.pattern_match.group(1).strip().decode("UTF-8")
|
147 |
lets_split = url.split(":")
|
148 |
vid_id = lets_split[2]
|
149 |
link = _yt_base_url + vid_id
|
|
|
154 |
ext = "mp3"
|
155 |
if lets_split[0] == "audio":
|
156 |
opts = {
|
157 |
+
"format": "bestaudio",
|
158 |
"addmetadata": True,
|
159 |
"key": "FFmpegMetadata",
|
160 |
"prefer_ffmpeg": True,
|
|
|
188 |
else ytdl_data["description"][:100]
|
189 |
)
|
190 |
description = description or "None"
|
191 |
+
filepath = vid_id + f".{ext}"
|
192 |
+
if not os.path.exists(filepath):
|
193 |
+
filepath = filepath + f".{ext}"
|
194 |
+
size = os.path.getsize(filepath)
|
195 |
file, _ = await event.client.fast_uploader(
|
196 |
+
filepath,
|
197 |
filename=title + "." + ext,
|
198 |
show_progress=True,
|
199 |
event=event,
|
|
|
243 |
filepath = vid_id + ".mkv"
|
244 |
if not os.path.exists(filepath):
|
245 |
filepath = filepath + ".webm"
|
246 |
+
size = os.path.getsize(filepath)
|
247 |
file, _ = await event.client.fast_uploader(
|
248 |
filepath,
|
249 |
filename=title + ".mkv",
|
|
|
259 |
supports_streaming=True,
|
260 |
),
|
261 |
]
|
262 |
+
description = description if description != "" else "None"
|
263 |
+
text = f"**Title: [{title}]({_yt_base_url}{vid_id})**\n\n"
|
264 |
+
text += f"`📝 Description: {description}\n\n"
|
265 |
+
text += f"「 Duration: {time_formatter(int(duration)*1000)} 」\n"
|
266 |
+
text += f"「 Artist: {artist} 」\n"
|
267 |
+
text += f"「 Views: {views} 」\n"
|
268 |
+
text += f"「 Likes: {likes} 」\n"
|
269 |
+
text += f"「 Size: {humanbytes(size)} 」`"
|
270 |
button = Button.switch_inline("Search More", query="yt ", same_peer=True)
|
271 |
try:
|
272 |
await event.edit(
|
plugins/__init__.py
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
|
|
8 |
import asyncio
|
9 |
import os
|
10 |
import time
|
@@ -26,7 +27,7 @@ from telethon.tl import functions, types
|
|
26 |
from strings import get_string
|
27 |
|
28 |
Redis = udB.get_key
|
29 |
-
|
30 |
OWNER_NAME = ultroid_bot.full_name
|
31 |
OWNER_ID = ultroid_bot.uid
|
32 |
|
|
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
+
|
9 |
import asyncio
|
10 |
import os
|
11 |
import time
|
|
|
27 |
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 |
|
plugins/_chatactions.py
CHANGED
@@ -13,7 +13,7 @@ from pyUltroid.dB.gban_mute_db import is_gbanned
|
|
13 |
from pyUltroid.dB.greetings_db import get_goodbye, get_welcome, must_thank
|
14 |
from pyUltroid.dB.nsfw_db import is_profan
|
15 |
from pyUltroid.functions.helper import inline_mention
|
16 |
-
from pyUltroid.functions.tools import create_tl_btn, get_chatbot_reply
|
17 |
from telethon import events
|
18 |
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
19 |
from telethon.tl.functions.channels import GetParticipantRequest
|
@@ -64,10 +64,33 @@ async def ChatActionsHandler(ult): # sourcery no-metrics
|
|
64 |
)
|
65 |
await res[0].click(ult.chat_id, reply_to=ult.action_message.id)
|
66 |
|
67 |
-
# gban checks
|
68 |
if ult.user_joined or ult.added_by:
|
69 |
user = await ult.get_user()
|
70 |
chat = await ult.get_chat()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
reason = is_gbanned(user.id)
|
72 |
if reason and chat.admin_rights:
|
73 |
try:
|
|
|
13 |
from pyUltroid.dB.greetings_db import get_goodbye, get_welcome, must_thank
|
14 |
from pyUltroid.dB.nsfw_db import is_profan
|
15 |
from pyUltroid.functions.helper import inline_mention
|
16 |
+
from pyUltroid.functions.tools import async_searcher, create_tl_btn, get_chatbot_reply
|
17 |
from telethon import events
|
18 |
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
19 |
from telethon.tl.functions.channels import GetParticipantRequest
|
|
|
64 |
)
|
65 |
await res[0].click(ult.chat_id, reply_to=ult.action_message.id)
|
66 |
|
|
|
67 |
if ult.user_joined or ult.added_by:
|
68 |
user = await ult.get_user()
|
69 |
chat = await ult.get_chat()
|
70 |
+
# gbans and @UltroidBans checks
|
71 |
+
if udB.get_key("ULTROID_BANS"):
|
72 |
+
try:
|
73 |
+
is_banned = await async_searcher(
|
74 |
+
"https://bans.ultroid.tech/api/status",
|
75 |
+
json={"userId": user.id},
|
76 |
+
post=True,
|
77 |
+
re_json=True,
|
78 |
+
)
|
79 |
+
if is_banned["is_banned"]:
|
80 |
+
await ult.client.edit_permissions(
|
81 |
+
chat.id,
|
82 |
+
user.id,
|
83 |
+
view_messages=False,
|
84 |
+
)
|
85 |
+
await ult.client.send_message(
|
86 |
+
chat.id,
|
87 |
+
"**@UltroidBans:** Banned user detected and banned!\n`{}`.\nBan reason: {}".format(
|
88 |
+
str(is_banned),
|
89 |
+
is_banned["reason"],
|
90 |
+
),
|
91 |
+
)
|
92 |
+
except BaseException:
|
93 |
+
pass
|
94 |
reason = is_gbanned(user.id)
|
95 |
if reason and chat.admin_rights:
|
96 |
try:
|
plugins/_help.py
CHANGED
@@ -6,7 +6,9 @@
|
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
|
|
|
9 |
from pyUltroid.dB._core import HELP, LIST
|
|
|
10 |
from telethon.errors.rpcerrorlist import (
|
11 |
BotInlineDisabledError,
|
12 |
BotMethodInvalidError,
|
@@ -35,9 +37,9 @@ _main_help_menu = [
|
|
35 |
]
|
36 |
|
37 |
|
38 |
-
@ultroid_cmd(pattern="help
|
39 |
async def _help(ult):
|
40 |
-
plug = ult.pattern_match.group(1)
|
41 |
chat = await ult.get_chat()
|
42 |
if plug:
|
43 |
try:
|
@@ -68,7 +70,37 @@ async def _help(ult):
|
|
68 |
x += "\n© @TeamUltroid"
|
69 |
await ult.eor(x)
|
70 |
except BaseException:
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
except BaseException as er:
|
73 |
LOGS.exception(er)
|
74 |
await ult.eor("Error 🤔 occured.")
|
|
|
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 (
|
13 |
BotInlineDisabledError,
|
14 |
BotMethodInvalidError,
|
|
|
37 |
]
|
38 |
|
39 |
|
40 |
+
@ultroid_cmd(pattern="help( (.*)|$)")
|
41 |
async def _help(ult):
|
42 |
+
plug = ult.pattern_match.group(1).strip()
|
43 |
chat = await ult.get_chat()
|
44 |
if plug:
|
45 |
try:
|
|
|
70 |
x += "\n© @TeamUltroid"
|
71 |
await ult.eor(x)
|
72 |
except BaseException:
|
73 |
+
file = None
|
74 |
+
compare_strings = []
|
75 |
+
for file_name in LIST:
|
76 |
+
compare_strings.append(file_name)
|
77 |
+
value = LIST[file_name]
|
78 |
+
for j in value:
|
79 |
+
j = cmd_regex_replace(j)
|
80 |
+
compare_strings.append(j)
|
81 |
+
if j.strip() == plug:
|
82 |
+
file = file_name
|
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]:
|
95 |
+
output += i
|
96 |
+
elif HELP.get("Addons") and file in HELP["Addons"]:
|
97 |
+
for i in HELP["Addons"][file]:
|
98 |
+
output += i
|
99 |
+
elif HELP.get("VCBot") and file in HELP["VCBot"]:
|
100 |
+
for i in HELP["VCBot"][file]:
|
101 |
+
output += i
|
102 |
+
output += "\n© @TeamUltroid"
|
103 |
+
await ult.eor(output)
|
104 |
except BaseException as er:
|
105 |
LOGS.exception(er)
|
106 |
await ult.eor("Error 🤔 occured.")
|
plugins/_inline.py
CHANGED
@@ -70,7 +70,13 @@ async def inline_alive(o):
|
|
70 |
content=InputWebDocument(TLINK, 0, "image/jpg", []),
|
71 |
)
|
72 |
]
|
73 |
-
await o.answer(
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
|
76 |
@in_pattern("ultd", owner=True)
|
@@ -95,7 +101,7 @@ async def inline_handler(event):
|
|
95 |
result = await event.builder.article(
|
96 |
title="Ultroid Help Menu", text=text, buttons=_main_help_menu
|
97 |
)
|
98 |
-
await event.answer([result], gallery=True)
|
99 |
|
100 |
|
101 |
@in_pattern("pasta", owner=True)
|
@@ -183,7 +189,7 @@ async def uptd_plugin(event):
|
|
183 |
help_ += "\n"
|
184 |
if not help_:
|
185 |
help_ = f"{file} has no Detailed Help!"
|
186 |
-
help_ += "\n©
|
187 |
buttons = []
|
188 |
if INLINE_PIC:
|
189 |
data = f"sndplug_{key}_{file}"
|
@@ -328,6 +334,7 @@ async def _(e):
|
|
328 |
"Fᴅʀᴏɪᴅ Sᴇᴀʀᴄʜ", query="fdroid telegram", same_peer=True
|
329 |
)
|
330 |
],
|
|
|
331 |
[
|
332 |
Button.inline(
|
333 |
"« Bᴀᴄᴋ",
|
@@ -406,7 +413,7 @@ STUFF = {}
|
|
406 |
|
407 |
@in_pattern("stf(.*)", owner=True)
|
408 |
async def ibuild(e):
|
409 |
-
n = e.pattern_match.group(1)
|
410 |
builder = e.builder
|
411 |
if not (n and n.isdigit()):
|
412 |
return
|
|
|
70 |
content=InputWebDocument(TLINK, 0, "image/jpg", []),
|
71 |
)
|
72 |
]
|
73 |
+
await o.answer(
|
74 |
+
RES,
|
75 |
+
private=True,
|
76 |
+
cache_time=300,
|
77 |
+
switch_pm="👥 ULTROID PORTAL",
|
78 |
+
switch_pm_param="start",
|
79 |
+
)
|
80 |
|
81 |
|
82 |
@in_pattern("ultd", owner=True)
|
|
|
101 |
result = await event.builder.article(
|
102 |
title="Ultroid Help Menu", text=text, buttons=_main_help_menu
|
103 |
)
|
104 |
+
await event.answer([result], private=True, cache_time=300, gallery=True)
|
105 |
|
106 |
|
107 |
@in_pattern("pasta", owner=True)
|
|
|
189 |
help_ += "\n"
|
190 |
if not help_:
|
191 |
help_ = f"{file} has no Detailed Help!"
|
192 |
+
help_ += "\n© @TeamUltroid"
|
193 |
buttons = []
|
194 |
if INLINE_PIC:
|
195 |
data = f"sndplug_{key}_{file}"
|
|
|
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ᴀᴄᴋ",
|
|
|
413 |
|
414 |
@in_pattern("stf(.*)", owner=True)
|
415 |
async def ibuild(e):
|
416 |
+
n = e.pattern_match.group(1).strip()
|
417 |
builder = e.builder
|
418 |
if not (n and n.isdigit()):
|
419 |
return
|
plugins/_ultroid.py
CHANGED
@@ -62,4 +62,5 @@ async def useUltroid(rs):
|
|
62 |
file="https://telegra.ph/file/54a917cc9dbb94733ea5f.jpg",
|
63 |
buttons=button,
|
64 |
)
|
65 |
-
|
|
|
|
62 |
file="https://telegra.ph/file/54a917cc9dbb94733ea5f.jpg",
|
63 |
buttons=button,
|
64 |
)
|
65 |
+
if not (rs.chat_id == LOG_CHANNEL and rs.client._bot):
|
66 |
+
await eor(rs, f"**[Click Here]({msg.message_link})**")
|
plugins/_userlogs.py
CHANGED
@@ -10,6 +10,7 @@ import re
|
|
10 |
|
11 |
from pyUltroid.dB.botchat_db import tag_add, who_tag
|
12 |
from telethon.errors.rpcerrorlist import (
|
|
|
13 |
ChatWriteForbiddenError,
|
14 |
MediaCaptionTooLongError,
|
15 |
MediaEmptyError,
|
@@ -46,18 +47,18 @@ async def all_messages_catcher(e):
|
|
46 |
try:
|
47 |
sent = await asst.send_message(NEEDTOLOG, e.message, buttons=buttons)
|
48 |
if TAG_EDITS.get(e.chat_id):
|
49 |
-
TAG_EDITS[e.chat_id].update({e.id: {"id": sent.id}})
|
50 |
else:
|
51 |
-
TAG_EDITS.update({e.chat_id: {e.id: {"id": sent.id}}})
|
52 |
tag_add(sent.id, e.chat_id, e.id)
|
53 |
except MediaEmptyError:
|
54 |
try:
|
55 |
msg = await asst.get_messages(e.chat_id, ids=e.id)
|
56 |
sent = await asst.send_message(NEEDTOLOG, msg, buttons=buttons)
|
57 |
if TAG_EDITS.get(e.chat_id):
|
58 |
-
TAG_EDITS[e.chat_id].update({e.id: {"id": sent.id}})
|
59 |
else:
|
60 |
-
TAG_EDITS.update({e.chat_id: {e.id: {"id": sent.id}}})
|
61 |
tag_add(sent.id, e.chat_id, e.id)
|
62 |
except Exception as me:
|
63 |
if not isinstance(me, (PeerIdInvalidError, ValueError)):
|
@@ -69,9 +70,9 @@ async def all_messages_catcher(e):
|
|
69 |
NEEDTOLOG, e.message.text, file=media, buttons=buttons
|
70 |
)
|
71 |
if TAG_EDITS.get(e.chat_id):
|
72 |
-
TAG_EDITS[e.chat_id].update({e.id: {"id": sent.id}})
|
73 |
else:
|
74 |
-
TAG_EDITS.update({e.chat_id: {e.id: {"id": sent.id}}})
|
75 |
return os.remove(media)
|
76 |
except Exception as er:
|
77 |
LOGS.exception(er)
|
@@ -141,6 +142,8 @@ if udB.get_key("TAG_LOG"):
|
|
141 |
if not d_.get(event.id):
|
142 |
return
|
143 |
d_ = d_[event.id]
|
|
|
|
|
144 |
msg = None
|
145 |
if d_.get("count"):
|
146 |
d_["count"] += 1
|
@@ -164,7 +167,8 @@ if udB.get_key("TAG_LOG"):
|
|
164 |
if d_["count"] == 10:
|
165 |
TEXT += "\n\n• __Only the first 10 Edits are shown.__"
|
166 |
try:
|
167 |
-
await MSG.edit(TEXT, buttons=await parse_buttons(event))
|
|
|
168 |
except (MessageTooLongError, MediaCaptionTooLongError):
|
169 |
del TAG_EDITS[event.chat_id][event.id]
|
170 |
except Exception as er:
|
@@ -237,8 +241,18 @@ async def leave_ch_at(event):
|
|
237 |
client = _client[client]
|
238 |
except KeyError:
|
239 |
return
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
await event.edit(get_string("userlogs_5").format(name))
|
243 |
|
244 |
|
|
|
10 |
|
11 |
from pyUltroid.dB.botchat_db import tag_add, who_tag
|
12 |
from telethon.errors.rpcerrorlist import (
|
13 |
+
ChannelPrivateError,
|
14 |
ChatWriteForbiddenError,
|
15 |
MediaCaptionTooLongError,
|
16 |
MediaEmptyError,
|
|
|
47 |
try:
|
48 |
sent = await asst.send_message(NEEDTOLOG, e.message, buttons=buttons)
|
49 |
if TAG_EDITS.get(e.chat_id):
|
50 |
+
TAG_EDITS[e.chat_id].update({e.id: {"id": sent.id, "msg": e}})
|
51 |
else:
|
52 |
+
TAG_EDITS.update({e.chat_id: {e.id: {"id": sent.id, "msg": e}}})
|
53 |
tag_add(sent.id, e.chat_id, e.id)
|
54 |
except MediaEmptyError:
|
55 |
try:
|
56 |
msg = await asst.get_messages(e.chat_id, ids=e.id)
|
57 |
sent = await asst.send_message(NEEDTOLOG, msg, buttons=buttons)
|
58 |
if TAG_EDITS.get(e.chat_id):
|
59 |
+
TAG_EDITS[e.chat_id].update({e.id: {"id": sent.id, "msg": e}})
|
60 |
else:
|
61 |
+
TAG_EDITS.update({e.chat_id: {e.id: {"id": sent.id, "msg": e}}})
|
62 |
tag_add(sent.id, e.chat_id, e.id)
|
63 |
except Exception as me:
|
64 |
if not isinstance(me, (PeerIdInvalidError, ValueError)):
|
|
|
70 |
NEEDTOLOG, e.message.text, file=media, buttons=buttons
|
71 |
)
|
72 |
if TAG_EDITS.get(e.chat_id):
|
73 |
+
TAG_EDITS[e.chat_id].update({e.id: {"id": sent.id, "msg": e}})
|
74 |
else:
|
75 |
+
TAG_EDITS.update({e.chat_id: {e.id: {"id": sent.id, "msg": e}}})
|
76 |
return os.remove(media)
|
77 |
except Exception as er:
|
78 |
LOGS.exception(er)
|
|
|
142 |
if not d_.get(event.id):
|
143 |
return
|
144 |
d_ = d_[event.id]
|
145 |
+
if d_["msg"].text == event.text:
|
146 |
+
return
|
147 |
msg = None
|
148 |
if d_.get("count"):
|
149 |
d_["count"] += 1
|
|
|
167 |
if d_["count"] == 10:
|
168 |
TEXT += "\n\n• __Only the first 10 Edits are shown.__"
|
169 |
try:
|
170 |
+
msg = await MSG.edit(TEXT, buttons=await parse_buttons(event))
|
171 |
+
d_["msg"] = msg
|
172 |
except (MessageTooLongError, MediaCaptionTooLongError):
|
173 |
del TAG_EDITS[event.chat_id][event.id]
|
174 |
except Exception as er:
|
|
|
241 |
client = _client[client]
|
242 |
except KeyError:
|
243 |
return
|
244 |
+
try:
|
245 |
+
name = (await client.get_entity(int(ch_id))).title
|
246 |
+
await client.delete_dialog(int(ch_id))
|
247 |
+
except UserNotParticipantError:
|
248 |
+
pass
|
249 |
+
except ChannelPrivateError:
|
250 |
+
return await event.edit(
|
251 |
+
"`[CANT_ACCESS_CHAT]` `Maybe already left or got banned.`"
|
252 |
+
)
|
253 |
+
except Exception as er:
|
254 |
+
LOGS.exception(er)
|
255 |
+
return await event.answer(str(er))
|
256 |
await event.edit(get_string("userlogs_5").format(name))
|
257 |
|
258 |
|
plugins/_wspr.py
CHANGED
@@ -32,7 +32,7 @@ buddhhu = {}
|
|
32 |
|
33 |
|
34 |
@ultroid_cmd(
|
35 |
-
pattern="wspr
|
36 |
)
|
37 |
async def _(e):
|
38 |
if e.reply_to_msg_id:
|
@@ -41,7 +41,7 @@ async def _(e):
|
|
41 |
put = f"@{okk.sender.username}"
|
42 |
put = okk.sender_id
|
43 |
else:
|
44 |
-
put = e.pattern_match.group(1)
|
45 |
if put:
|
46 |
try:
|
47 |
results = await e.client.inline_query(asst.me.username, f"msg {put}")
|
@@ -170,7 +170,7 @@ async def _(e):
|
|
170 |
),
|
171 |
)
|
172 |
async def _(e):
|
173 |
-
ids = int(e.pattern_match.group(1).decode("UTF-8"))
|
174 |
if buddhhu.get(ids):
|
175 |
if e.sender_id in buddhhu[ids]:
|
176 |
await e.answer(buddhhu[ids][-1], alert=True)
|
@@ -182,7 +182,7 @@ async def _(e):
|
|
182 |
|
183 |
@callback(re.compile("del_(.*)"))
|
184 |
async def _(e):
|
185 |
-
ids = int(e.pattern_match.group(1).decode("UTF-8"))
|
186 |
if buddhhu.get(ids):
|
187 |
if e.sender_id in buddhhu[ids]:
|
188 |
buddhhu.pop(ids)
|
|
|
32 |
|
33 |
|
34 |
@ultroid_cmd(
|
35 |
+
pattern="wspr( (.*)|$)",
|
36 |
)
|
37 |
async def _(e):
|
38 |
if e.reply_to_msg_id:
|
|
|
41 |
put = f"@{okk.sender.username}"
|
42 |
put = okk.sender_id
|
43 |
else:
|
44 |
+
put = e.pattern_match.group(1).strip()
|
45 |
if put:
|
46 |
try:
|
47 |
results = await e.client.inline_query(asst.me.username, f"msg {put}")
|
|
|
170 |
),
|
171 |
)
|
172 |
async def _(e):
|
173 |
+
ids = int(e.pattern_match.group(1).strip().decode("UTF-8"))
|
174 |
if buddhhu.get(ids):
|
175 |
if e.sender_id in buddhhu[ids]:
|
176 |
await e.answer(buddhhu[ids][-1], alert=True)
|
|
|
182 |
|
183 |
@callback(re.compile("del_(.*)"))
|
184 |
async def _(e):
|
185 |
+
ids = int(e.pattern_match.group(1).strip().decode("UTF-8"))
|
186 |
if buddhhu.get(ids):
|
187 |
if e.sender_id in buddhhu[ids]:
|
188 |
buddhhu.pop(ids)
|
plugins/admintools.py
CHANGED
@@ -20,6 +20,7 @@
|
|
20 |
|
21 |
• `{i}pin <reply to message>`
|
22 |
Pin the message in the chat
|
|
|
23 |
• `{i}unpin (all) <reply to message>`
|
24 |
Unpin the messages in the chat.
|
25 |
|
@@ -41,6 +42,8 @@
|
|
41 |
Delete all msgs of replied user.
|
42 |
"""
|
43 |
|
|
|
|
|
44 |
from pyUltroid.dB import DEVLIST
|
45 |
from pyUltroid.functions.admins import ban_time
|
46 |
from telethon.errors import BadRequestError
|
@@ -64,7 +67,7 @@ from . import (
|
|
64 |
|
65 |
|
66 |
@ultroid_cmd(
|
67 |
-
pattern="promote
|
68 |
)
|
69 |
async def prmte(ult):
|
70 |
xx = await ult.eor(get_string("com_1"))
|
@@ -92,7 +95,7 @@ async def prmte(ult):
|
|
92 |
|
93 |
|
94 |
@ultroid_cmd(
|
95 |
-
pattern="demote
|
96 |
)
|
97 |
async def dmote(ult):
|
98 |
xx = await ult.eor(get_string("com_1"))
|
@@ -119,7 +122,7 @@ async def dmote(ult):
|
|
119 |
|
120 |
|
121 |
@ultroid_cmd(
|
122 |
-
pattern="ban
|
123 |
admins_only=True,
|
124 |
manager=True,
|
125 |
require="ban_users",
|
@@ -135,10 +138,10 @@ async def bban(ult):
|
|
135 |
return await eod(ult, get_string("ban_2"))
|
136 |
try:
|
137 |
await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=False)
|
138 |
-
except BadRequestError:
|
139 |
-
return await eod(ult, get_string("ban_3"))
|
140 |
except UserIdInvalidError:
|
141 |
return await eod(ult, get_string("adm_1"))
|
|
|
|
|
142 |
senderme = inline_mention(await ult.get_sender())
|
143 |
userme = inline_mention(user)
|
144 |
text = get_string("ban_4").format(userme, senderme, ult.chat.title)
|
@@ -147,7 +150,9 @@ async def bban(ult):
|
|
147 |
await eod(ult, text)
|
148 |
|
149 |
|
150 |
-
@ultroid_cmd(
|
|
|
|
|
151 |
async def uunban(ult):
|
152 |
xx = await ult.eor(get_string("com_1"))
|
153 |
if ult.text[1:].startswith("unbanall"):
|
@@ -160,10 +165,10 @@ async def uunban(ult):
|
|
160 |
return await xx.edit(get_string("unban_1"))
|
161 |
try:
|
162 |
await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=True)
|
|
|
|
|
163 |
except BadRequestError:
|
164 |
return await xx.edit(get_string("adm_2"))
|
165 |
-
except UserIdInvalidError:
|
166 |
-
await xx.edit(get_string("adm_1"))
|
167 |
sender = inline_mention(await ult.get_sender())
|
168 |
text = get_string("unban_3").format(inline_mention(user), sender, ult.chat.title)
|
169 |
if reason:
|
@@ -172,7 +177,7 @@ async def uunban(ult):
|
|
172 |
|
173 |
|
174 |
@ultroid_cmd(
|
175 |
-
pattern="kick
|
176 |
manager=True,
|
177 |
require="ban_users",
|
178 |
)
|
@@ -208,7 +213,9 @@ async def kck(ult):
|
|
208 |
await xx.edit(text)
|
209 |
|
210 |
|
211 |
-
@ultroid_cmd(
|
|
|
|
|
212 |
async def tkicki(e):
|
213 |
huh = e.text.split()
|
214 |
inputt = None
|
@@ -242,7 +249,7 @@ async def tkicki(e):
|
|
242 |
return await e.eor(str(m))
|
243 |
|
244 |
|
245 |
-
@ultroid_cmd(pattern="pin$",
|
246 |
async def pin(msg):
|
247 |
if not msg.is_reply:
|
248 |
return await eor(msg, get_string("pin_1"))
|
@@ -268,7 +275,7 @@ async def pin(msg):
|
|
268 |
)
|
269 |
async def unp(ult):
|
270 |
xx = await ult.eor(get_string("com_1"))
|
271 |
-
ch = (ult.pattern_match.group(1)).strip()
|
272 |
msg = None
|
273 |
if ult.is_reply:
|
274 |
msg = ult.reply_to_msg_id
|
@@ -283,9 +290,35 @@ async def unp(ult):
|
|
283 |
await xx.edit("`Unpinned!`")
|
284 |
|
285 |
|
286 |
-
@ultroid_cmd(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
async def fastpurger(purg):
|
288 |
-
match = purg.pattern_match.group(1)
|
289 |
try:
|
290 |
ABC = purg.text[6]
|
291 |
except IndexError:
|
@@ -320,10 +353,10 @@ async def fastpurger(purg):
|
|
320 |
|
321 |
|
322 |
@ultroid_cmd(
|
323 |
-
pattern="purgeme
|
324 |
)
|
325 |
async def fastpurgerme(purg):
|
326 |
-
num = purg.pattern_match.group(1)
|
327 |
if num and not purg.is_reply:
|
328 |
try:
|
329 |
nnt = int(num)
|
@@ -435,11 +468,11 @@ async def get_all_pinned(event):
|
|
435 |
|
436 |
|
437 |
@ultroid_cmd(
|
438 |
-
pattern="autodelete
|
439 |
admins_only=True,
|
440 |
)
|
441 |
async def autodelte(ult):
|
442 |
-
match = ult.pattern_match.group(1)
|
443 |
if not match or match not in ["24h", "7d", "1m", "off"]:
|
444 |
return await ult.eor("`Please Use in Proper Format..`", time=5)
|
445 |
if match == "24h":
|
|
|
20 |
|
21 |
• `{i}pin <reply to message>`
|
22 |
Pin the message in the chat
|
23 |
+
• `{i}tpin <time> <temp pin message>`
|
24 |
• `{i}unpin (all) <reply to message>`
|
25 |
Unpin the messages in the chat.
|
26 |
|
|
|
42 |
Delete all msgs of replied user.
|
43 |
"""
|
44 |
|
45 |
+
import asyncio
|
46 |
+
|
47 |
from pyUltroid.dB import DEVLIST
|
48 |
from pyUltroid.functions.admins import ban_time
|
49 |
from telethon.errors import BadRequestError
|
|
|
67 |
|
68 |
|
69 |
@ultroid_cmd(
|
70 |
+
pattern="promote( (.*)|$)", admins_only=True, manager=True, require="add_admins"
|
71 |
)
|
72 |
async def prmte(ult):
|
73 |
xx = await ult.eor(get_string("com_1"))
|
|
|
95 |
|
96 |
|
97 |
@ultroid_cmd(
|
98 |
+
pattern="demote( (.*)|$)", admins_only=True, manager=True, require="add_admins"
|
99 |
)
|
100 |
async def dmote(ult):
|
101 |
xx = await ult.eor(get_string("com_1"))
|
|
|
122 |
|
123 |
|
124 |
@ultroid_cmd(
|
125 |
+
pattern="ban( (.*)|$)",
|
126 |
admins_only=True,
|
127 |
manager=True,
|
128 |
require="ban_users",
|
|
|
138 |
return await eod(ult, get_string("ban_2"))
|
139 |
try:
|
140 |
await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=False)
|
|
|
|
|
141 |
except UserIdInvalidError:
|
142 |
return await eod(ult, get_string("adm_1"))
|
143 |
+
except BadRequestError:
|
144 |
+
return await eod(ult, get_string("ban_3"))
|
145 |
senderme = inline_mention(await ult.get_sender())
|
146 |
userme = inline_mention(user)
|
147 |
text = get_string("ban_4").format(userme, senderme, ult.chat.title)
|
|
|
150 |
await eod(ult, text)
|
151 |
|
152 |
|
153 |
+
@ultroid_cmd(
|
154 |
+
pattern="unban( (.*)|$)", admins_only=True, manager=True, require="ban_users"
|
155 |
+
)
|
156 |
async def uunban(ult):
|
157 |
xx = await ult.eor(get_string("com_1"))
|
158 |
if ult.text[1:].startswith("unbanall"):
|
|
|
165 |
return await xx.edit(get_string("unban_1"))
|
166 |
try:
|
167 |
await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=True)
|
168 |
+
except UserIdInvalidError:
|
169 |
+
return await eod(ult, get_string("adm_1"))
|
170 |
except BadRequestError:
|
171 |
return await xx.edit(get_string("adm_2"))
|
|
|
|
|
172 |
sender = inline_mention(await ult.get_sender())
|
173 |
text = get_string("unban_3").format(inline_mention(user), sender, ult.chat.title)
|
174 |
if reason:
|
|
|
177 |
|
178 |
|
179 |
@ultroid_cmd(
|
180 |
+
pattern="kick( (.*)|$)",
|
181 |
manager=True,
|
182 |
require="ban_users",
|
183 |
)
|
|
|
213 |
await xx.edit(text)
|
214 |
|
215 |
|
216 |
+
@ultroid_cmd(
|
217 |
+
pattern="tban( (.*)|$)", admins_only=True, manager=True, require="ban_users"
|
218 |
+
)
|
219 |
async def tkicki(e):
|
220 |
huh = e.text.split()
|
221 |
inputt = None
|
|
|
249 |
return await e.eor(str(m))
|
250 |
|
251 |
|
252 |
+
@ultroid_cmd(pattern="pin$", manager=True, require="pin_messages")
|
253 |
async def pin(msg):
|
254 |
if not msg.is_reply:
|
255 |
return await eor(msg, get_string("pin_1"))
|
|
|
275 |
)
|
276 |
async def unp(ult):
|
277 |
xx = await ult.eor(get_string("com_1"))
|
278 |
+
ch = (ult.pattern_match.group(1).strip()).strip()
|
279 |
msg = None
|
280 |
if ult.is_reply:
|
281 |
msg = ult.reply_to_msg_id
|
|
|
290 |
await xx.edit("`Unpinned!`")
|
291 |
|
292 |
|
293 |
+
@ultroid_cmd(
|
294 |
+
pattern="tpin( (.*)|$)", admins_only=True, manager=True, require="pin_messages"
|
295 |
+
)
|
296 |
+
async def pin_message(ult):
|
297 |
+
match = ult.pattern_match.group(1).strip()
|
298 |
+
if not ult.is_reply:
|
299 |
+
return await ult.eor("`Reply to message..`", time=6)
|
300 |
+
if not match:
|
301 |
+
return await ult.eor("`Please provide time..`", time=8)
|
302 |
+
msg = await ult.eor(get_string("com_1"))
|
303 |
+
time = await ban_time(msg, match)
|
304 |
+
if not time:
|
305 |
+
return
|
306 |
+
msg_id = ult.reply_to_msg_id
|
307 |
+
try:
|
308 |
+
await ult.client.pin_message(ult.chat_id, msg_id)
|
309 |
+
await msg.eor(f"`pinned for time` `{time}`", time=8)
|
310 |
+
except Exception as er:
|
311 |
+
return await msg.edit(str(er))
|
312 |
+
await asyncio.sleep(time)
|
313 |
+
try:
|
314 |
+
await ult.client.unpin_message(ult.chat_id, msg_id)
|
315 |
+
except Exception as er:
|
316 |
+
LOGS.exception(er)
|
317 |
+
|
318 |
+
|
319 |
+
@ultroid_cmd(pattern="purge( (.*)|$)", manager=True, require="delete_messages")
|
320 |
async def fastpurger(purg):
|
321 |
+
match = purg.pattern_match.group(1).strip()
|
322 |
try:
|
323 |
ABC = purg.text[6]
|
324 |
except IndexError:
|
|
|
353 |
|
354 |
|
355 |
@ultroid_cmd(
|
356 |
+
pattern="purgeme( (.*)|$)",
|
357 |
)
|
358 |
async def fastpurgerme(purg):
|
359 |
+
num = purg.pattern_match.group(1).strip()
|
360 |
if num and not purg.is_reply:
|
361 |
try:
|
362 |
nnt = int(num)
|
|
|
468 |
|
469 |
|
470 |
@ultroid_cmd(
|
471 |
+
pattern="autodelete( (.*)|$)",
|
472 |
admins_only=True,
|
473 |
)
|
474 |
async def autodelte(ult):
|
475 |
+
match = ult.pattern_match.group(1).strip()
|
476 |
if not match or match not in ["24h", "7d", "1m", "off"]:
|
477 |
return await ult.eor("`Please Use in Proper Format..`", time=5)
|
478 |
if match == "24h":
|
plugins/afk.py
CHANGED
@@ -9,9 +9,9 @@
|
|
9 |
|
10 |
• `{i}afk <optional reason>`
|
11 |
AFK means away from keyboard,
|
12 |
-
After
|
13 |
|
14 |
-
(Note :
|
15 |
|
16 |
"""
|
17 |
|
@@ -37,12 +37,12 @@ from . import (
|
|
37 |
old_afk_msg = []
|
38 |
|
39 |
|
40 |
-
@ultroid_cmd(pattern="afk
|
41 |
async def set_afk(event):
|
42 |
if event.client._bot or is_afk():
|
43 |
return
|
44 |
text, media, media_type = None, None, None
|
45 |
-
if event.pattern_match.group(1):
|
46 |
text = event.text.split(maxsplit=1)[1]
|
47 |
reply = await event.get_reply_message()
|
48 |
if reply:
|
|
|
9 |
|
10 |
• `{i}afk <optional reason>`
|
11 |
AFK means away from keyboard,
|
12 |
+
After this is activated, if someone tags or messages you, he/she would get an automated reply from the bot.
|
13 |
|
14 |
+
(Note : Set a media file in afk messages by replying to any media with `{i}afk <reason>`).
|
15 |
|
16 |
"""
|
17 |
|
|
|
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
|
44 |
text, media, media_type = None, None, None
|
45 |
+
if event.pattern_match.group(1).strip():
|
46 |
text = event.text.split(maxsplit=1)[1]
|
47 |
reply = await event.get_reply_message()
|
48 |
if reply:
|
plugins/antiflood.py
CHANGED
@@ -46,7 +46,7 @@ if Redis("ANTIFLOOD"):
|
|
46 |
_check_flood[event.chat_id] = {event.sender_id: count}
|
47 |
else:
|
48 |
_check_flood[event.chat_id] = {event.sender_id: count}
|
49 |
-
if await admin_check(event, silent=True) or event.sender
|
50 |
return
|
51 |
if event.sender_id in DEVLIST:
|
52 |
return
|
@@ -93,7 +93,7 @@ async def unmuting(e):
|
|
93 |
admins_only=True,
|
94 |
)
|
95 |
async def setflood(e):
|
96 |
-
input_ = e.pattern_match.group(1)
|
97 |
if not input_:
|
98 |
return await e.eor("`What?`", time=5)
|
99 |
if not input_.isdigit():
|
|
|
46 |
_check_flood[event.chat_id] = {event.sender_id: count}
|
47 |
else:
|
48 |
_check_flood[event.chat_id] = {event.sender_id: count}
|
49 |
+
if await admin_check(event, silent=True) or getattr(event.sender, "bot", None):
|
50 |
return
|
51 |
if event.sender_id in DEVLIST:
|
52 |
return
|
|
|
93 |
admins_only=True,
|
94 |
)
|
95 |
async def setflood(e):
|
96 |
+
input_ = e.pattern_match.group(1).strip()
|
97 |
if not input_:
|
98 |
return await e.eor("`What?`", time=5)
|
99 |
if not input_.isdigit():
|
plugins/asstcmd.py
CHANGED
@@ -26,9 +26,9 @@ from telethon import events, utils
|
|
26 |
from . import asst, get_string, mediainfo, ultroid_cmd
|
27 |
|
28 |
|
29 |
-
@ultroid_cmd(pattern="addcmd
|
30 |
async def ac(e):
|
31 |
-
wrd = (e.pattern_match.group(1)).lower()
|
32 |
wt = await e.get_reply_message()
|
33 |
if not (wt and wrd):
|
34 |
return await e.eor(get_string("asstcmd_1"), time=5)
|
@@ -72,9 +72,9 @@ async def ac(e):
|
|
72 |
await e.eor(get_string("asstcmd_4").format(wrd))
|
73 |
|
74 |
|
75 |
-
@ultroid_cmd(pattern="remcmd
|
76 |
async def rc(e):
|
77 |
-
wrd = (e.pattern_match.group(1)).lower()
|
78 |
if not wrd:
|
79 |
return await e.eor(get_string("asstcmd_2"), time=5)
|
80 |
wrd = wrd.replace("/", "")
|
|
|
26 |
from . import asst, get_string, mediainfo, ultroid_cmd
|
27 |
|
28 |
|
29 |
+
@ultroid_cmd(pattern="addcmd( (.*)|$)")
|
30 |
async def ac(e):
|
31 |
+
wrd = (e.pattern_match.group(1).strip()).lower()
|
32 |
wt = await e.get_reply_message()
|
33 |
if not (wt and wrd):
|
34 |
return await e.eor(get_string("asstcmd_1"), time=5)
|
|
|
72 |
await e.eor(get_string("asstcmd_4").format(wrd))
|
73 |
|
74 |
|
75 |
+
@ultroid_cmd(pattern="remcmd( (.*)|$)")
|
76 |
async def rc(e):
|
77 |
+
wrd = (e.pattern_match.group(1).strip()).lower()
|
78 |
if not wrd:
|
79 |
return await e.eor(get_string("asstcmd_2"), time=5)
|
80 |
wrd = wrd.replace("/", "")
|
plugins/audiotools.py
CHANGED
@@ -23,8 +23,7 @@ import os
|
|
23 |
import time
|
24 |
from datetime import datetime as dt
|
25 |
|
26 |
-
from pyUltroid.functions.tools import
|
27 |
-
from telethon.tl.types import DocumentAttributeAudio
|
28 |
|
29 |
from . import (
|
30 |
bash,
|
@@ -50,30 +49,28 @@ async def vnc(e):
|
|
50 |
if not mediainfo(r.media).startswith(("audio", "video")):
|
51 |
return await eod(e, get_string("spcltool_1"))
|
52 |
xxx = await e.eor(get_string("com_1"))
|
53 |
-
|
54 |
-
|
55 |
-
file = await downloader(
|
56 |
-
"resources/downloads/" + dl,
|
57 |
-
r.media.document,
|
58 |
-
xxx,
|
59 |
-
c_time,
|
60 |
-
"Downloading " + dl + "...",
|
61 |
)
|
62 |
await xxx.edit(get_string("audiotools_2"))
|
63 |
await bash(
|
64 |
f"ffmpeg -i '{file.name}' -map 0:a -codec:a libopus -b:a 100k -vbr on out.opus"
|
65 |
)
|
66 |
-
|
67 |
-
e.
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
await xxx.delete()
|
70 |
os.remove(file.name)
|
71 |
os.remove("out.opus")
|
72 |
|
73 |
|
74 |
-
@ultroid_cmd(pattern="atrim
|
75 |
async def trim_aud(e):
|
76 |
-
sec = e.pattern_match.group(1)
|
77 |
if not sec or "-" not in sec:
|
78 |
return await eod(e, get_string("audiotools_3"))
|
79 |
a, b = sec.split("-")
|
@@ -103,7 +100,7 @@ async def trim_aud(e):
|
|
103 |
diff = time_formatter((d_time - c_time) * 1000)
|
104 |
file_name = (file.name).split("/")[-1]
|
105 |
out = file_name.replace(file_name.split(".")[-1], "_trimmed.aac")
|
106 |
-
if int(b) > int(genss(file.name)):
|
107 |
os.remove(file.name)
|
108 |
return await eod(xxx, get_string("audiotools_6"))
|
109 |
ss, dd = stdr(int(a)), stdr(int(b))
|
@@ -121,16 +118,7 @@ async def trim_aud(e):
|
|
121 |
xxx,
|
122 |
"Uploading " + out + "...",
|
123 |
)
|
124 |
-
|
125 |
-
artist = data["performer"]
|
126 |
-
duration = data["duration"]
|
127 |
-
attributes = [
|
128 |
-
DocumentAttributeAudio(
|
129 |
-
duration=duration,
|
130 |
-
title=out.split(".")[0],
|
131 |
-
performer=vido.file.performer or artist,
|
132 |
-
)
|
133 |
-
]
|
134 |
|
135 |
caption = get_string("audiotools_7").format(ss, dd)
|
136 |
await e.client.send_file(
|
@@ -167,18 +155,7 @@ async def ex_aud(e):
|
|
167 |
cmd = f"ffmpeg -i {file.name} -vn -acodec copy {out_file}"
|
168 |
o, err = await bash(cmd)
|
169 |
os.remove(file.name)
|
170 |
-
|
171 |
-
artist = data["performer"]
|
172 |
-
duration = data["duration"]
|
173 |
-
attributes = [
|
174 |
-
DocumentAttributeAudio(
|
175 |
-
duration=reply.file.duration or duration,
|
176 |
-
title=reply.file.name.split(".")[0]
|
177 |
-
if reply.file.name
|
178 |
-
else "Extracted Audio",
|
179 |
-
performer=reply.file.performer or artist,
|
180 |
-
)
|
181 |
-
]
|
182 |
|
183 |
f_time = time.time()
|
184 |
try:
|
|
|
23 |
import time
|
24 |
from datetime import datetime as dt
|
25 |
|
26 |
+
from pyUltroid.functions.tools import set_attributes
|
|
|
27 |
|
28 |
from . import (
|
29 |
bash,
|
|
|
49 |
if not mediainfo(r.media).startswith(("audio", "video")):
|
50 |
return await eod(e, get_string("spcltool_1"))
|
51 |
xxx = await e.eor(get_string("com_1"))
|
52 |
+
file, _ = await e.client.fast_downloader(
|
53 |
+
r.document,
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
)
|
55 |
await xxx.edit(get_string("audiotools_2"))
|
56 |
await bash(
|
57 |
f"ffmpeg -i '{file.name}' -map 0:a -codec:a libopus -b:a 100k -vbr on out.opus"
|
58 |
)
|
59 |
+
try:
|
60 |
+
await e.client.send_message(
|
61 |
+
e.chat_id, file="out.opus", force_document=False, reply_to=r
|
62 |
+
)
|
63 |
+
except Exception as er:
|
64 |
+
LOGS.exception(er)
|
65 |
+
return await xxx.edit("`Failed to convert in Voice...`")
|
66 |
await xxx.delete()
|
67 |
os.remove(file.name)
|
68 |
os.remove("out.opus")
|
69 |
|
70 |
|
71 |
+
@ultroid_cmd(pattern="atrim( (.*)|$)")
|
72 |
async def trim_aud(e):
|
73 |
+
sec = e.pattern_match.group(1).strip()
|
74 |
if not sec or "-" not in sec:
|
75 |
return await eod(e, get_string("audiotools_3"))
|
76 |
a, b = sec.split("-")
|
|
|
100 |
diff = time_formatter((d_time - c_time) * 1000)
|
101 |
file_name = (file.name).split("/")[-1]
|
102 |
out = file_name.replace(file_name.split(".")[-1], "_trimmed.aac")
|
103 |
+
if int(b) > int(await genss(file.name)):
|
104 |
os.remove(file.name)
|
105 |
return await eod(xxx, get_string("audiotools_6"))
|
106 |
ss, dd = stdr(int(a)), stdr(int(b))
|
|
|
118 |
xxx,
|
119 |
"Uploading " + out + "...",
|
120 |
)
|
121 |
+
attributes = await set_attributes(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
caption = get_string("audiotools_7").format(ss, dd)
|
124 |
await e.client.send_file(
|
|
|
155 |
cmd = f"ffmpeg -i {file.name} -vn -acodec copy {out_file}"
|
156 |
o, err = await bash(cmd)
|
157 |
os.remove(file.name)
|
158 |
+
attributes = await set_attributes(out_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
f_time = time.time()
|
161 |
try:
|
plugins/autocorrect.py
CHANGED
@@ -9,12 +9,12 @@
|
|
9 |
|
10 |
• `{i}autocorrect`
|
11 |
To on/off Autocorrect Feature.
|
12 |
-
|
13 |
"""
|
14 |
|
15 |
import string
|
16 |
|
17 |
-
from . import
|
|
|
18 |
|
19 |
try:
|
20 |
from gingerit.gingerit import GingerIt
|
@@ -26,7 +26,7 @@ from telethon import events
|
|
26 |
|
27 |
@ultroid_cmd(pattern="autocorrect", fullsudo=True)
|
28 |
async def acc(e):
|
29 |
-
if
|
30 |
udB.set_key("AUTOCORRECT", "True")
|
31 |
ultroid_bot.add_handler(
|
32 |
gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
|
|
|
9 |
|
10 |
• `{i}autocorrect`
|
11 |
To on/off Autocorrect Feature.
|
|
|
12 |
"""
|
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
|
|
|
26 |
|
27 |
@ultroid_cmd(pattern="autocorrect", fullsudo=True)
|
28 |
async def acc(e):
|
29 |
+
if udB.get_key("AUTOCORRECT"):
|
30 |
udB.set_key("AUTOCORRECT", "True")
|
31 |
ultroid_bot.add_handler(
|
32 |
gramme, events.NewMessage(outgoing=True, func=lambda x: x.text)
|
plugins/autopic.py
CHANGED
@@ -24,9 +24,9 @@ from telethon.tl.functions.photos import UploadProfilePhotoRequest
|
|
24 |
from . import LOGS, get_string, udB, ultroid_bot, ultroid_cmd
|
25 |
|
26 |
|
27 |
-
@ultroid_cmd(pattern="autopic
|
28 |
async def autopic(e):
|
29 |
-
search = e.pattern_match.group(1)
|
30 |
if udB.get_key("AUTOPIC") and not search:
|
31 |
udB.del_key("AUTOPIC")
|
32 |
return await e.eor(get_string("autopic_5"))
|
|
|
24 |
from . import LOGS, get_string, udB, ultroid_bot, ultroid_cmd
|
25 |
|
26 |
|
27 |
+
@ultroid_cmd(pattern="autopic( (.*)|$)")
|
28 |
async def autopic(e):
|
29 |
+
search = e.pattern_match.group(1).strip()
|
30 |
if udB.get_key("AUTOPIC") and not search:
|
31 |
udB.del_key("AUTOPIC")
|
32 |
return await e.eor(get_string("autopic_5"))
|
plugins/blacklist.py
CHANGED
@@ -30,9 +30,9 @@ from pyUltroid.dB.blacklist_db import (
|
|
30 |
from . import events, get_string, udB, ultroid_bot, ultroid_cmd
|
31 |
|
32 |
|
33 |
-
@ultroid_cmd(pattern="blacklist
|
34 |
async def af(e):
|
35 |
-
wrd = e.pattern_match.group(1)
|
36 |
chat = e.chat_id
|
37 |
if not (wrd):
|
38 |
return await e.eor(get_string("blk_1"), time=5)
|
@@ -44,9 +44,9 @@ async def af(e):
|
|
44 |
await e.eor(get_string("blk_2").format(wrd))
|
45 |
|
46 |
|
47 |
-
@ultroid_cmd(pattern="remblacklist
|
48 |
async def rf(e):
|
49 |
-
wrd = e.pattern_match.group(1)
|
50 |
chat = e.chat_id
|
51 |
if not wrd:
|
52 |
return await e.eor(get_string("blk_3"), time=5)
|
|
|
30 |
from . import events, get_string, udB, ultroid_bot, ultroid_cmd
|
31 |
|
32 |
|
33 |
+
@ultroid_cmd(pattern="blacklist( (.*)|$)", admins_only=True)
|
34 |
async def af(e):
|
35 |
+
wrd = e.pattern_match.group(1).strip()
|
36 |
chat = e.chat_id
|
37 |
if not (wrd):
|
38 |
return await e.eor(get_string("blk_1"), time=5)
|
|
|
44 |
await e.eor(get_string("blk_2").format(wrd))
|
45 |
|
46 |
|
47 |
+
@ultroid_cmd(pattern="remblacklist( (.*)|$)", admins_only=True)
|
48 |
async def rf(e):
|
49 |
+
wrd = e.pattern_match.group(1).strip()
|
50 |
chat = e.chat_id
|
51 |
if not wrd:
|
52 |
return await e.eor(get_string("blk_3"), time=5)
|
plugins/bot.py
CHANGED
@@ -104,10 +104,10 @@ async def alive(event):
|
|
104 |
|
105 |
|
106 |
@ultroid_cmd(
|
107 |
-
pattern="alive
|
108 |
)
|
109 |
async def lol(ult):
|
110 |
-
match = ult.pattern_match.group(1)
|
111 |
inline = None
|
112 |
if match in ["inline", "i"]:
|
113 |
try:
|
@@ -119,6 +119,8 @@ async def lol(ult):
|
|
119 |
LOGS.exception(er)
|
120 |
inline = True
|
121 |
pic = udB.get_key("ALIVE_PIC")
|
|
|
|
|
122 |
uptime = time_formatter((time.time() - start_time) * 1000)
|
123 |
header = udB.get_key("ALIVE_TEXT") or get_string("bot_1")
|
124 |
y = Repo().active_branch
|
@@ -161,7 +163,7 @@ async def lol(ult):
|
|
161 |
link_preview=False,
|
162 |
buttons=buttons if inline else None,
|
163 |
)
|
164 |
-
await ult.try_delete()
|
165 |
except ChatSendMediaForbiddenError:
|
166 |
pass
|
167 |
except BaseException as er:
|
@@ -212,6 +214,8 @@ heroku_api = Var.HEROKU_API
|
|
212 |
async def restartbt(ult):
|
213 |
ok = await ult.eor(get_string("bot_5"))
|
214 |
call_back()
|
|
|
|
|
215 |
if heroku_api:
|
216 |
return await restart(ok)
|
217 |
await bash("git pull && pip3 install -r requirements.txt")
|
@@ -230,11 +234,11 @@ async def shutdownbot(ult):
|
|
230 |
|
231 |
|
232 |
@ultroid_cmd(
|
233 |
-
pattern="logs
|
234 |
chats=[],
|
235 |
)
|
236 |
async def _(event):
|
237 |
-
opt = event.pattern_match.group(1)
|
238 |
file = f"ultroid{sys.argv[-1]}.log" if len(sys.argv) > 1 else "ultroid.log"
|
239 |
if opt == "heroku":
|
240 |
await heroku_logs(event)
|
@@ -258,6 +262,8 @@ async def _(event):
|
|
258 |
@in_pattern("alive", owner=True)
|
259 |
async def inline_alive(ult):
|
260 |
pic = udB.get_key("ALIVE_PIC")
|
|
|
|
|
261 |
uptime = time_formatter((time.time() - start_time) * 1000)
|
262 |
header = udB.get_key("ALIVE_TEXT") or get_string("bot_1")
|
263 |
y = Repo().active_branch
|
@@ -310,11 +316,12 @@ async def inline_alive(ult):
|
|
310 |
await ult.answer(result)
|
311 |
|
312 |
|
313 |
-
@ultroid_cmd(pattern="update
|
314 |
async def _(e):
|
315 |
xx = await e.eor(get_string("upd_1"))
|
316 |
-
if e.pattern_match.group(1) and (
|
317 |
-
"fast" in e.pattern_match.group(1)
|
|
|
318 |
):
|
319 |
await bash("git pull -f && pip3 install -r requirements.txt")
|
320 |
call_back()
|
|
|
104 |
|
105 |
|
106 |
@ultroid_cmd(
|
107 |
+
pattern="alive( (.*)|$)",
|
108 |
)
|
109 |
async def lol(ult):
|
110 |
+
match = ult.pattern_match.group(1).strip()
|
111 |
inline = None
|
112 |
if match in ["inline", "i"]:
|
113 |
try:
|
|
|
119 |
LOGS.exception(er)
|
120 |
inline = True
|
121 |
pic = udB.get_key("ALIVE_PIC")
|
122 |
+
if isinstance(pic, list):
|
123 |
+
pic = choice(pic)
|
124 |
uptime = time_formatter((time.time() - start_time) * 1000)
|
125 |
header = udB.get_key("ALIVE_TEXT") or get_string("bot_1")
|
126 |
y = Repo().active_branch
|
|
|
163 |
link_preview=False,
|
164 |
buttons=buttons if inline else None,
|
165 |
)
|
166 |
+
return await ult.try_delete()
|
167 |
except ChatSendMediaForbiddenError:
|
168 |
pass
|
169 |
except BaseException as er:
|
|
|
214 |
async def restartbt(ult):
|
215 |
ok = await ult.eor(get_string("bot_5"))
|
216 |
call_back()
|
217 |
+
who = "bot" if ult.client._bot else "user"
|
218 |
+
udB.set_key("_RESTART", f"{who}_{ult.chat_id}_{ok.id}")
|
219 |
if heroku_api:
|
220 |
return await restart(ok)
|
221 |
await bash("git pull && pip3 install -r requirements.txt")
|
|
|
234 |
|
235 |
|
236 |
@ultroid_cmd(
|
237 |
+
pattern="logs( (.*)|$)",
|
238 |
chats=[],
|
239 |
)
|
240 |
async def _(event):
|
241 |
+
opt = event.pattern_match.group(1).strip()
|
242 |
file = f"ultroid{sys.argv[-1]}.log" if len(sys.argv) > 1 else "ultroid.log"
|
243 |
if opt == "heroku":
|
244 |
await heroku_logs(event)
|
|
|
262 |
@in_pattern("alive", owner=True)
|
263 |
async def inline_alive(ult):
|
264 |
pic = udB.get_key("ALIVE_PIC")
|
265 |
+
if isinstance(pic, list):
|
266 |
+
pic = choice(pic)
|
267 |
uptime = time_formatter((time.time() - start_time) * 1000)
|
268 |
header = udB.get_key("ALIVE_TEXT") or get_string("bot_1")
|
269 |
y = Repo().active_branch
|
|
|
316 |
await ult.answer(result)
|
317 |
|
318 |
|
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()
|
plugins/broadcast.py
CHANGED
@@ -26,16 +26,17 @@ import asyncio
|
|
26 |
import io
|
27 |
|
28 |
from pyUltroid.dB.broadcast_db import *
|
|
|
29 |
|
30 |
from . import HNDLR, LOGS, eor, get_string, udB, ultroid_bot, ultroid_cmd
|
31 |
|
32 |
|
33 |
@ultroid_cmd(
|
34 |
-
pattern="addch
|
35 |
allow_sudo=False,
|
36 |
)
|
37 |
async def broadcast_adder(event):
|
38 |
-
msgg = event.pattern_match.group(1)
|
39 |
x = await event.eor(get_string("bd_1"))
|
40 |
if msgg == "all":
|
41 |
await x.edit(get_string("bd_2"))
|
@@ -56,7 +57,7 @@ async def broadcast_adder(event):
|
|
56 |
cid = f"-100{i.id}"
|
57 |
add_channel(int(cid))
|
58 |
except Exception as Ex:
|
59 |
-
LOGS.
|
60 |
await x.edit(get_string("bd_3").format(get_no_channels(), new))
|
61 |
return
|
62 |
if event.reply_to_msg_id:
|
@@ -73,7 +74,7 @@ async def broadcast_adder(event):
|
|
73 |
await event.delete()
|
74 |
return
|
75 |
chat_id = event.chat_id
|
76 |
-
if
|
77 |
return
|
78 |
if not is_channel_added(chat_id):
|
79 |
xx = add_channel(chat_id)
|
@@ -81,20 +82,18 @@ async def broadcast_adder(event):
|
|
81 |
await x.edit(get_string("bd_5"))
|
82 |
else:
|
83 |
await x.edit(get_string("sf_8"))
|
84 |
-
|
85 |
-
await event.delete()
|
86 |
-
elif is_channel_added(chat_id):
|
87 |
await x.edit(get_string("bd_6"))
|
88 |
-
|
89 |
-
|
90 |
|
91 |
|
92 |
@ultroid_cmd(
|
93 |
-
pattern="remch
|
94 |
allow_sudo=False,
|
95 |
)
|
96 |
async def broadcast_remover(event):
|
97 |
-
chat_id = event.pattern_match.group(1)
|
98 |
x = await event.eor(get_string("com_1"))
|
99 |
if chat_id == "all":
|
100 |
await x.edit(get_string("bd_8"))
|
@@ -104,17 +103,10 @@ async def broadcast_remover(event):
|
|
104 |
if is_channel_added(chat_id):
|
105 |
rem_channel(chat_id)
|
106 |
await x.edit(get_string("bd_7"))
|
107 |
-
|
108 |
-
await x.delete()
|
109 |
-
elif is_channel_added(event.chat_id):
|
110 |
-
rem_channel(event.chat_id)
|
111 |
-
await x.edit(get_string("bd_7"))
|
112 |
-
await asyncio.sleep(3)
|
113 |
-
await x.delete()
|
114 |
-
elif not is_channel_added(event.chat_id):
|
115 |
await x.edit(get_string("bd_9"))
|
116 |
-
|
117 |
-
|
118 |
|
119 |
|
120 |
@ultroid_cmd(
|
@@ -123,18 +115,18 @@ async def broadcast_remover(event):
|
|
123 |
async def list_all(event):
|
124 |
x = await event.eor(get_string("com_1"))
|
125 |
channels = get_channels()
|
126 |
-
num =
|
127 |
-
if
|
128 |
return await eor(x, "No chats were added.", time=5)
|
129 |
msg = "Channels in database:\n"
|
130 |
for channel in channels:
|
131 |
name = ""
|
132 |
try:
|
133 |
-
name = (await event.client.get_entity(
|
134 |
-
except
|
135 |
name = ""
|
136 |
msg += f"=> **{name}** [`{channel}`]\n"
|
137 |
-
msg += f"\nTotal {
|
138 |
if len(msg) > 4096:
|
139 |
MSG = msg.replace("*", "").replace("`", "")
|
140 |
with io.BytesIO(str.encode(MSG)) as out_file:
|
@@ -160,7 +152,7 @@ async def forw(event):
|
|
160 |
ultroid_bot = event.client
|
161 |
channels = get_channels()
|
162 |
x = await event.eor("Sending...")
|
163 |
-
if
|
164 |
return await x.edit(f"Please add channels by using `{HNDLR}add` in them.")
|
165 |
error_count = 0
|
166 |
sent_count = 0
|
@@ -169,7 +161,7 @@ async def forw(event):
|
|
169 |
error_count = 0
|
170 |
for channel in channels:
|
171 |
try:
|
172 |
-
await ultroid_bot.forward_messages(
|
173 |
sent_count += 1
|
174 |
await x.edit(
|
175 |
f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
|
@@ -194,7 +186,7 @@ async def forw(event):
|
|
194 |
|
195 |
|
196 |
@ultroid_cmd(
|
197 |
-
pattern="broadcast
|
198 |
allow_sudo=False,
|
199 |
)
|
200 |
async def sending(event):
|
@@ -202,7 +194,7 @@ async def sending(event):
|
|
202 |
if not event.is_reply:
|
203 |
return await x.edit(get_string("ex_1"))
|
204 |
channels = get_channels()
|
205 |
-
if
|
206 |
return await x.edit(f"Please add channels by using `{HNDLR}add` in them.")
|
207 |
await x.edit("Sending....")
|
208 |
if event.reply_to_msg_id:
|
@@ -214,7 +206,7 @@ async def sending(event):
|
|
214 |
sent_count = 0
|
215 |
for channel in channels:
|
216 |
try:
|
217 |
-
await ultroid_bot.send_message(
|
218 |
sent_count += 1
|
219 |
await x.edit(
|
220 |
f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
|
@@ -222,7 +214,7 @@ async def sending(event):
|
|
222 |
except Exception as error:
|
223 |
|
224 |
await ultroid_bot.send_message(
|
225 |
-
|
226 |
f"Error in sending at {channel}.\n\n{error}",
|
227 |
)
|
228 |
error_count += 1
|
|
|
26 |
import io
|
27 |
|
28 |
from pyUltroid.dB.broadcast_db import *
|
29 |
+
from telethon.utils import get_display_name
|
30 |
|
31 |
from . import HNDLR, LOGS, eor, get_string, udB, ultroid_bot, ultroid_cmd
|
32 |
|
33 |
|
34 |
@ultroid_cmd(
|
35 |
+
pattern="addch( (.*)|$)",
|
36 |
allow_sudo=False,
|
37 |
)
|
38 |
async def broadcast_adder(event):
|
39 |
+
msgg = event.pattern_match.group(1).strip()
|
40 |
x = await event.eor(get_string("bd_1"))
|
41 |
if msgg == "all":
|
42 |
await x.edit(get_string("bd_2"))
|
|
|
57 |
cid = f"-100{i.id}"
|
58 |
add_channel(int(cid))
|
59 |
except Exception as Ex:
|
60 |
+
LOGS.exception(Ex)
|
61 |
await x.edit(get_string("bd_3").format(get_no_channels(), new))
|
62 |
return
|
63 |
if event.reply_to_msg_id:
|
|
|
74 |
await event.delete()
|
75 |
return
|
76 |
chat_id = event.chat_id
|
77 |
+
if chat_id == udB.get_key("LOG_CHANNEL"):
|
78 |
return
|
79 |
if not is_channel_added(chat_id):
|
80 |
xx = add_channel(chat_id)
|
|
|
82 |
await x.edit(get_string("bd_5"))
|
83 |
else:
|
84 |
await x.edit(get_string("sf_8"))
|
85 |
+
else:
|
|
|
|
|
86 |
await x.edit(get_string("bd_6"))
|
87 |
+
await asyncio.sleep(3)
|
88 |
+
await x.delete()
|
89 |
|
90 |
|
91 |
@ultroid_cmd(
|
92 |
+
pattern="remch( (.*)|$)",
|
93 |
allow_sudo=False,
|
94 |
)
|
95 |
async def broadcast_remover(event):
|
96 |
+
chat_id = event.pattern_match.group(1).strip() or event.chat_id
|
97 |
x = await event.eor(get_string("com_1"))
|
98 |
if chat_id == "all":
|
99 |
await x.edit(get_string("bd_8"))
|
|
|
103 |
if is_channel_added(chat_id):
|
104 |
rem_channel(chat_id)
|
105 |
await x.edit(get_string("bd_7"))
|
106 |
+
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
await x.edit(get_string("bd_9"))
|
108 |
+
await asyncio.sleep(3)
|
109 |
+
await x.delete()
|
110 |
|
111 |
|
112 |
@ultroid_cmd(
|
|
|
115 |
async def list_all(event):
|
116 |
x = await event.eor(get_string("com_1"))
|
117 |
channels = get_channels()
|
118 |
+
num = len(channels)
|
119 |
+
if not channels:
|
120 |
return await eor(x, "No chats were added.", time=5)
|
121 |
msg = "Channels in database:\n"
|
122 |
for channel in channels:
|
123 |
name = ""
|
124 |
try:
|
125 |
+
name = get_display_name(await event.client.get_entity(channel))
|
126 |
+
except ValueError:
|
127 |
name = ""
|
128 |
msg += f"=> **{name}** [`{channel}`]\n"
|
129 |
+
msg += f"\nTotal {num} channels."
|
130 |
if len(msg) > 4096:
|
131 |
MSG = msg.replace("*", "").replace("`", "")
|
132 |
with io.BytesIO(str.encode(MSG)) as out_file:
|
|
|
152 |
ultroid_bot = event.client
|
153 |
channels = get_channels()
|
154 |
x = await event.eor("Sending...")
|
155 |
+
if not channels:
|
156 |
return await x.edit(f"Please add channels by using `{HNDLR}add` in them.")
|
157 |
error_count = 0
|
158 |
sent_count = 0
|
|
|
161 |
error_count = 0
|
162 |
for channel in channels:
|
163 |
try:
|
164 |
+
await ultroid_bot.forward_messages(channel, previous_message)
|
165 |
sent_count += 1
|
166 |
await x.edit(
|
167 |
f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
|
|
|
186 |
|
187 |
|
188 |
@ultroid_cmd(
|
189 |
+
pattern="broadcast( (.*)|$)",
|
190 |
allow_sudo=False,
|
191 |
)
|
192 |
async def sending(event):
|
|
|
194 |
if not event.is_reply:
|
195 |
return await x.edit(get_string("ex_1"))
|
196 |
channels = get_channels()
|
197 |
+
if not channels:
|
198 |
return await x.edit(f"Please add channels by using `{HNDLR}add` in them.")
|
199 |
await x.edit("Sending....")
|
200 |
if event.reply_to_msg_id:
|
|
|
206 |
sent_count = 0
|
207 |
for channel in channels:
|
208 |
try:
|
209 |
+
await ultroid_bot.send_message(channel, previous_message)
|
210 |
sent_count += 1
|
211 |
await x.edit(
|
212 |
f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
|
|
|
214 |
except Exception as error:
|
215 |
|
216 |
await ultroid_bot.send_message(
|
217 |
+
udB.get_key("LOG_CHANNEL"),
|
218 |
f"Error in sending at {channel}.\n\n{error}",
|
219 |
)
|
220 |
error_count += 1
|
plugins/carbon.py
CHANGED
@@ -202,10 +202,10 @@ async def crbn(event):
|
|
202 |
|
203 |
|
204 |
@ultroid_cmd(
|
205 |
-
pattern="ccarbon
|
206 |
)
|
207 |
async def crbn(event):
|
208 |
-
match = event.pattern_match.group(1)
|
209 |
if not match:
|
210 |
return await event.eor(get_string("carbon_3"))
|
211 |
msg = await event.eor(get_string("com_1"))
|
|
|
202 |
|
203 |
|
204 |
@ultroid_cmd(
|
205 |
+
pattern="ccarbon( (.*)|$)",
|
206 |
)
|
207 |
async def crbn(event):
|
208 |
+
match = event.pattern_match.group(1).strip()
|
209 |
if not match:
|
210 |
return await event.eor(get_string("carbon_3"))
|
211 |
msg = await event.eor(get_string("com_1"))
|
plugins/channelhacks.py
CHANGED
@@ -79,7 +79,7 @@ async def autopost_func(e):
|
|
79 |
|
80 |
@ultroid_cmd(pattern="shift (.*)")
|
81 |
async def _(e):
|
82 |
-
x = e.pattern_match.group(1)
|
83 |
z = await e.eor(get_string("com_1"))
|
84 |
a, b = x.split("|")
|
85 |
try:
|
@@ -107,7 +107,7 @@ async def _(e):
|
|
107 |
|
108 |
@ultroid_cmd(pattern="asource (.*)")
|
109 |
async def source(e):
|
110 |
-
x = e.pattern_match.group(1)
|
111 |
if not x:
|
112 |
y = e.chat_id
|
113 |
else:
|
@@ -124,9 +124,9 @@ async def source(e):
|
|
124 |
await e.eor(get_string("cha_3"))
|
125 |
|
126 |
|
127 |
-
@ultroid_cmd(pattern="dsource
|
128 |
async def dd(event):
|
129 |
-
chat_id = event.pattern_match.group(1)
|
130 |
x = await event.eor(get_string("com_1"))
|
131 |
if chat_id == "all":
|
132 |
await x.edit(get_string("bd_8"))
|
@@ -135,7 +135,7 @@ async def dd(event):
|
|
135 |
return
|
136 |
if chat_id:
|
137 |
try:
|
138 |
-
y = await
|
139 |
except Exception as er:
|
140 |
LOGS.exception(er)
|
141 |
return
|
@@ -186,7 +186,7 @@ async def list_all(event):
|
|
186 |
|
187 |
@ultroid_cmd(pattern="adest (.*)")
|
188 |
async def destination(e):
|
189 |
-
x = e.pattern_match.group(1)
|
190 |
if x:
|
191 |
try:
|
192 |
y = await e.client.parse_id(x)
|
@@ -202,9 +202,9 @@ async def destination(e):
|
|
202 |
await e.eor("Destination channel already added")
|
203 |
|
204 |
|
205 |
-
@ultroid_cmd(pattern="ddest
|
206 |
async def dd(event):
|
207 |
-
chat_id = event.pattern_match.group(1)
|
208 |
x = await event.eor(get_string("com_1"))
|
209 |
if chat_id == "all":
|
210 |
await x.edit(get_string("bd_8"))
|
|
|
79 |
|
80 |
@ultroid_cmd(pattern="shift (.*)")
|
81 |
async def _(e):
|
82 |
+
x = e.pattern_match.group(1).strip()
|
83 |
z = await e.eor(get_string("com_1"))
|
84 |
a, b = x.split("|")
|
85 |
try:
|
|
|
107 |
|
108 |
@ultroid_cmd(pattern="asource (.*)")
|
109 |
async def source(e):
|
110 |
+
x = e.pattern_match.group(1).strip()
|
111 |
if not x:
|
112 |
y = e.chat_id
|
113 |
else:
|
|
|
124 |
await e.eor(get_string("cha_3"))
|
125 |
|
126 |
|
127 |
+
@ultroid_cmd(pattern="dsource( (.*)|$)")
|
128 |
async def dd(event):
|
129 |
+
chat_id = event.pattern_match.group(1).strip()
|
130 |
x = await event.eor(get_string("com_1"))
|
131 |
if chat_id == "all":
|
132 |
await x.edit(get_string("bd_8"))
|
|
|
135 |
return
|
136 |
if chat_id:
|
137 |
try:
|
138 |
+
y = await event.client.parse_id(chat_id)
|
139 |
except Exception as er:
|
140 |
LOGS.exception(er)
|
141 |
return
|
|
|
186 |
|
187 |
@ultroid_cmd(pattern="adest (.*)")
|
188 |
async def destination(e):
|
189 |
+
x = e.pattern_match.group(1).strip()
|
190 |
if x:
|
191 |
try:
|
192 |
y = await e.client.parse_id(x)
|
|
|
202 |
await e.eor("Destination channel already added")
|
203 |
|
204 |
|
205 |
+
@ultroid_cmd(pattern="ddest( (.*)|$)")
|
206 |
async def dd(event):
|
207 |
+
chat_id = event.pattern_match.group(1).strip()
|
208 |
x = await event.eor(get_string("com_1"))
|
209 |
if chat_id == "all":
|
210 |
await x.edit(get_string("bd_8"))
|
plugins/chats.py
CHANGED
@@ -56,7 +56,7 @@ from telethon.tl.types import (
|
|
56 |
UserStatusRecently,
|
57 |
)
|
58 |
|
59 |
-
from . import HNDLR, LOGS, asst, get_string, mediainfo, os, types, udB, ultroid_cmd
|
60 |
|
61 |
|
62 |
@ultroid_cmd(
|
@@ -116,7 +116,7 @@ async def _(e):
|
|
116 |
pattern="create (b|g|c)(?: |$)(.*)",
|
117 |
)
|
118 |
async def _(e):
|
119 |
-
type_of_group = e.pattern_match.group(1)
|
120 |
group_name = e.pattern_match.group(2)
|
121 |
username = None
|
122 |
if " ; " in group_name:
|
@@ -178,12 +178,12 @@ async def _(e):
|
|
178 |
|
179 |
|
180 |
@ultroid_cmd(
|
181 |
-
pattern="setgpic
|
182 |
)
|
183 |
async def _(ult):
|
184 |
if not ult.is_reply:
|
185 |
return await ult.eor("`Reply to a Media..`", time=5)
|
186 |
-
match = ult.pattern_match.group(1)
|
187 |
if not ult.client._bot and match:
|
188 |
try:
|
189 |
chat = await ult.client.parse_id(match)
|
@@ -191,13 +191,21 @@ async def _(ult):
|
|
191 |
return await ult.eor(str(ok))
|
192 |
else:
|
193 |
chat = ult.chat_id
|
194 |
-
|
195 |
-
if
|
196 |
-
replfile = await
|
|
|
|
|
197 |
else:
|
198 |
return await ult.eor("Reply to a Photo or Video..")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
file = await ult.client.upload_file(replfile)
|
200 |
-
mediain = mediainfo(reply_message.media)
|
201 |
try:
|
202 |
if "pic" not in mediain:
|
203 |
file = types.InputChatUploadedPhoto(video=file)
|
@@ -209,10 +217,10 @@ async def _(ult):
|
|
209 |
|
210 |
|
211 |
@ultroid_cmd(
|
212 |
-
pattern="delgpic
|
213 |
)
|
214 |
async def _(ult):
|
215 |
-
match = ult.pattern_match.group(1)
|
216 |
chat = ult.chat_id
|
217 |
if not ult.client._bot and match:
|
218 |
chat = match
|
@@ -245,14 +253,14 @@ async def _(event):
|
|
245 |
|
246 |
|
247 |
@ultroid_cmd(
|
248 |
-
pattern="rmusers
|
249 |
groups_only=True,
|
250 |
admins_only=True,
|
251 |
fullsudo=True,
|
252 |
)
|
253 |
async def _(event):
|
254 |
xx = await event.eor(get_string("com_1"))
|
255 |
-
input_str = event.pattern_match.group(1)
|
256 |
p, a, b, c, d, m, n, y, w, o, q, r = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
257 |
async for i in event.client.iter_participants(event.chat_id):
|
258 |
p += 1 # Total Count
|
|
|
56 |
UserStatusRecently,
|
57 |
)
|
58 |
|
59 |
+
from . import HNDLR, LOGS, asst, con, get_string, mediainfo, os, types, udB, ultroid_cmd
|
60 |
|
61 |
|
62 |
@ultroid_cmd(
|
|
|
116 |
pattern="create (b|g|c)(?: |$)(.*)",
|
117 |
)
|
118 |
async def _(e):
|
119 |
+
type_of_group = e.pattern_match.group(1).strip()
|
120 |
group_name = e.pattern_match.group(2)
|
121 |
username = None
|
122 |
if " ; " in group_name:
|
|
|
178 |
|
179 |
|
180 |
@ultroid_cmd(
|
181 |
+
pattern="setgpic( (.*)|$)", admins_only=True, manager=True, require="change_info"
|
182 |
)
|
183 |
async def _(ult):
|
184 |
if not ult.is_reply:
|
185 |
return await ult.eor("`Reply to a Media..`", time=5)
|
186 |
+
match = ult.pattern_match.group(1).strip()
|
187 |
if not ult.client._bot and match:
|
188 |
try:
|
189 |
chat = await ult.client.parse_id(match)
|
|
|
191 |
return await ult.eor(str(ok))
|
192 |
else:
|
193 |
chat = ult.chat_id
|
194 |
+
reply = await ult.get_reply_message()
|
195 |
+
if reply.photo or reply.sticker or reply.video:
|
196 |
+
replfile = await reply.download_media()
|
197 |
+
elif reply.document and reply.document.thumbs:
|
198 |
+
replfile = await reply.download_media(thumb=-1)
|
199 |
else:
|
200 |
return await ult.eor("Reply to a Photo or Video..")
|
201 |
+
mediain = mediainfo(reply.media)
|
202 |
+
if "animated" in mediain:
|
203 |
+
replfile = await con.convert(replfile, convert_to="mp4")
|
204 |
+
else:
|
205 |
+
replfile = await con.convert(
|
206 |
+
replfile, outname="chatphoto", allowed_formats=["jpg", "png", "mp4"]
|
207 |
+
)
|
208 |
file = await ult.client.upload_file(replfile)
|
|
|
209 |
try:
|
210 |
if "pic" not in mediain:
|
211 |
file = types.InputChatUploadedPhoto(video=file)
|
|
|
217 |
|
218 |
|
219 |
@ultroid_cmd(
|
220 |
+
pattern="delgpic( (.*)|$)", admins_only=True, manager=True, require="change_info"
|
221 |
)
|
222 |
async def _(ult):
|
223 |
+
match = ult.pattern_match.group(1).strip()
|
224 |
chat = ult.chat_id
|
225 |
if not ult.client._bot and match:
|
226 |
chat = match
|
|
|
253 |
|
254 |
|
255 |
@ultroid_cmd(
|
256 |
+
pattern="rmusers( (.*)|$)",
|
257 |
groups_only=True,
|
258 |
admins_only=True,
|
259 |
fullsudo=True,
|
260 |
)
|
261 |
async def _(event):
|
262 |
xx = await event.eor(get_string("com_1"))
|
263 |
+
input_str = event.pattern_match.group(1).strip()
|
264 |
p, a, b, c, d, m, n, y, w, o, q, r = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
265 |
async for i in event.client.iter_participants(event.chat_id):
|
266 |
p += 1 # Total Count
|
plugins/compressor.py
CHANGED
@@ -41,9 +41,9 @@ from . import (
|
|
41 |
)
|
42 |
|
43 |
|
44 |
-
@ultroid_cmd(pattern="compress
|
45 |
async def _(e):
|
46 |
-
cr = e.pattern_match.group(1)
|
47 |
crf = 27
|
48 |
to_stream = False
|
49 |
if cr:
|
@@ -88,7 +88,7 @@ async def _(e):
|
|
88 |
with open(progress, "w") as fk:
|
89 |
pass
|
90 |
proce = await asyncio.create_subprocess_shell(
|
91 |
-
f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -vcodec libx265 -crf {crf} """{out}""" -y',
|
92 |
stdout=asyncio.subprocess.PIPE,
|
93 |
stderr=asyncio.subprocess.PIPE,
|
94 |
)
|
|
|
41 |
)
|
42 |
|
43 |
|
44 |
+
@ultroid_cmd(pattern="compress( (.*)|$)")
|
45 |
async def _(e):
|
46 |
+
cr = e.pattern_match.group(1).strip()
|
47 |
crf = 27
|
48 |
to_stream = False
|
49 |
if cr:
|
|
|
88 |
with open(progress, "w") as fk:
|
89 |
pass
|
90 |
proce = await asyncio.create_subprocess_shell(
|
91 |
+
f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -vcodec libx265 -crf {crf} -c:a copy """{out}""" -y',
|
92 |
stdout=asyncio.subprocess.PIPE,
|
93 |
stderr=asyncio.subprocess.PIPE,
|
94 |
)
|
plugins/converter.py
CHANGED
@@ -7,11 +7,8 @@
|
|
7 |
"""
|
8 |
✘ Commands Available -
|
9 |
|
10 |
-
• `{i}
|
11 |
-
|
12 |
-
|
13 |
-
• `{i}mtos <reply to media>`
|
14 |
-
Convert media to sticker.
|
15 |
|
16 |
• `{i}doc <filename.ext>`
|
17 |
Reply to a text msg to save it in a file.
|
@@ -43,7 +40,7 @@ except ImportError:
|
|
43 |
|
44 |
from telegraph import upload_file as uf
|
45 |
|
46 |
-
from . import bash, downloader, get_paste, get_string, udB, ultroid_cmd, uploader
|
47 |
|
48 |
opn = []
|
49 |
|
@@ -68,14 +65,14 @@ async def _(e):
|
|
68 |
|
69 |
|
70 |
@ultroid_cmd(
|
71 |
-
pattern="rename
|
72 |
)
|
73 |
async def imak(event):
|
74 |
reply = await event.get_reply_message()
|
75 |
t = time.time()
|
76 |
if not reply:
|
77 |
return await event.eor(get_string("cvt_1"))
|
78 |
-
inp = event.pattern_match.group(1)
|
79 |
if not inp:
|
80 |
return await event.eor(get_string("cvt_2"))
|
81 |
xx = await event.eor(get_string("com_1"))
|
@@ -95,7 +92,7 @@ async def imak(event):
|
|
95 |
file = await event.client.download_media(reply.media)
|
96 |
if os.path.exists(inp):
|
97 |
os.remove(inp)
|
98 |
-
await bash(f"""
|
99 |
if not os.path.exists(inp) or os.path.exists(inp) and not os.path.getsize(inp):
|
100 |
os.rename(file, inp)
|
101 |
k = time.time()
|
@@ -110,61 +107,46 @@ async def imak(event):
|
|
110 |
await xx.delete()
|
111 |
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
xx = await event.eor(get_string("com_1"))
|
122 |
-
image = await reply.download_media()
|
123 |
-
file = "ult.png"
|
124 |
-
if image.endswith((".webp", ".png")):
|
125 |
-
c = Image.open(image)
|
126 |
-
c.save(file)
|
127 |
-
elif image.endswith(".tgs"):
|
128 |
-
await bash(f"lottie_convert.py '{image}' {file}")
|
129 |
-
else:
|
130 |
-
img = cv2.VideoCapture(image)
|
131 |
-
ult, roid = img.read()
|
132 |
-
cv2.imwrite(file, roid)
|
133 |
-
await event.reply(file=file)
|
134 |
-
await xx.delete()
|
135 |
-
os.remove(file)
|
136 |
-
os.remove(image)
|
137 |
|
138 |
|
139 |
@ultroid_cmd(
|
140 |
-
pattern="
|
141 |
)
|
142 |
-
async def
|
143 |
-
reply = await event.get_reply_message()
|
144 |
-
if not (reply and (reply.media)):
|
145 |
-
await event.eor(get_string("cvt_3"))
|
146 |
-
return
|
147 |
xx = await event.eor(get_string("com_1"))
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
await xx.delete()
|
159 |
-
os.remove(file)
|
160 |
-
os.remove(image)
|
161 |
|
162 |
|
163 |
@ultroid_cmd(
|
164 |
-
pattern="doc
|
165 |
)
|
166 |
async def _(event):
|
167 |
-
input_str = event.pattern_match.group(1)
|
168 |
if not (input_str and event.is_reply):
|
169 |
return await event.eor(get_string("cvt_1"), time=5)
|
170 |
xx = await event.eor(get_string("com_1"))
|
@@ -180,11 +162,11 @@ async def _(event):
|
|
180 |
|
181 |
|
182 |
@ultroid_cmd(
|
183 |
-
pattern="open
|
184 |
)
|
185 |
async def _(event):
|
186 |
a = await event.get_reply_message()
|
187 |
-
b = event.pattern_match.group(1)
|
188 |
if not ((a and a.media) or (b and os.path.exists(b))):
|
189 |
return await event.eor(get_string("cvt_7"), time=5)
|
190 |
xx = await event.eor(get_string("com_1"))
|
|
|
7 |
"""
|
8 |
✘ Commands Available -
|
9 |
|
10 |
+
• `{i}convert <gif/img/sticker/webm>`
|
11 |
+
Reply to media to convert it into gif / image / webm / normal sticker.
|
|
|
|
|
|
|
12 |
|
13 |
• `{i}doc <filename.ext>`
|
14 |
Reply to a text msg to save it in a file.
|
|
|
40 |
|
41 |
from telegraph import upload_file as uf
|
42 |
|
43 |
+
from . import bash, con, downloader, get_paste, get_string, udB, ultroid_cmd, uploader
|
44 |
|
45 |
opn = []
|
46 |
|
|
|
65 |
|
66 |
|
67 |
@ultroid_cmd(
|
68 |
+
pattern="rename( (.*)|$)",
|
69 |
)
|
70 |
async def imak(event):
|
71 |
reply = await event.get_reply_message()
|
72 |
t = time.time()
|
73 |
if not reply:
|
74 |
return await event.eor(get_string("cvt_1"))
|
75 |
+
inp = event.pattern_match.group(1).strip()
|
76 |
if not inp:
|
77 |
return await event.eor(get_string("cvt_2"))
|
78 |
xx = await event.eor(get_string("com_1"))
|
|
|
92 |
file = await event.client.download_media(reply.media)
|
93 |
if os.path.exists(inp):
|
94 |
os.remove(inp)
|
95 |
+
await bash(f'mv """{file}""" """{inp}"""')
|
96 |
if not os.path.exists(inp) or os.path.exists(inp) and not os.path.getsize(inp):
|
97 |
os.rename(file, inp)
|
98 |
k = time.time()
|
|
|
107 |
await xx.delete()
|
108 |
|
109 |
|
110 |
+
conv_keys = {
|
111 |
+
"img": "png",
|
112 |
+
"sticker": "webp",
|
113 |
+
"webp": "webp",
|
114 |
+
"image": "png",
|
115 |
+
"webm": "webm",
|
116 |
+
"gif": "gif",
|
117 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
|
120 |
@ultroid_cmd(
|
121 |
+
pattern="convert( (.*)|$)",
|
122 |
)
|
123 |
+
async def uconverter(event):
|
|
|
|
|
|
|
|
|
124 |
xx = await event.eor(get_string("com_1"))
|
125 |
+
a = await event.get_reply_message()
|
126 |
+
input_ = event.pattern_match.group(1).strip()
|
127 |
+
b = await a.download_media("resources/downloads/")
|
128 |
+
if not b and (a.document and a.document.thumbs):
|
129 |
+
b = await a.download_media(thumb=-1)
|
130 |
+
if not b:
|
131 |
+
return await xx.edit(get_string("cvt_3"))
|
132 |
+
try:
|
133 |
+
convert = conv_keys[input_]
|
134 |
+
except KeyError:
|
135 |
+
return await xx.edit(get_string("sts_3").format("gif/img/sticker/webm"))
|
136 |
+
file = await con.convert(b, outname="ultroid", convert_to=convert)
|
137 |
+
if file:
|
138 |
+
await event.client.send_file(
|
139 |
+
event.chat_id, file, reply_to=event.reply_to_msg_id or event.id
|
140 |
+
)
|
141 |
+
os.remove(file)
|
142 |
await xx.delete()
|
|
|
|
|
143 |
|
144 |
|
145 |
@ultroid_cmd(
|
146 |
+
pattern="doc( (.*)|$)",
|
147 |
)
|
148 |
async def _(event):
|
149 |
+
input_str = event.pattern_match.group(1).strip()
|
150 |
if not (input_str and event.is_reply):
|
151 |
return await event.eor(get_string("cvt_1"), time=5)
|
152 |
xx = await event.eor(get_string("com_1"))
|
|
|
162 |
|
163 |
|
164 |
@ultroid_cmd(
|
165 |
+
pattern="open( (.*)|$)",
|
166 |
)
|
167 |
async def _(event):
|
168 |
a = await event.get_reply_message()
|
169 |
+
b = event.pattern_match.group(1).strip()
|
170 |
if not ((a and a.media) or (b and os.path.exists(b))):
|
171 |
return await event.eor(get_string("cvt_7"), time=5)
|
172 |
xx = await event.eor(get_string("com_1"))
|
plugins/core.py
CHANGED
@@ -24,15 +24,19 @@
|
|
24 |
• `{i}help <plugin name>`
|
25 |
Shows you a help menu (like this) for every plugin.
|
26 |
|
|
|
|
|
|
|
|
|
27 |
• `{i}getaddons <raw link to code>`
|
28 |
Load Plugins from the given raw link.
|
29 |
"""
|
30 |
|
31 |
import os
|
32 |
|
33 |
-
from pyUltroid.startup.loader import load_addons
|
34 |
|
35 |
-
from . import eod, get_string,
|
36 |
|
37 |
|
38 |
@ultroid_cmd(pattern="install", fullsudo=True)
|
@@ -41,10 +45,10 @@ async def install(event):
|
|
41 |
|
42 |
|
43 |
@ultroid_cmd(
|
44 |
-
pattern=r"unload
|
45 |
)
|
46 |
async def unload(event):
|
47 |
-
shortname = event.pattern_match.group(1)
|
48 |
if not shortname:
|
49 |
await event.eor(get_string("core_9"))
|
50 |
return
|
@@ -64,10 +68,10 @@ async def unload(event):
|
|
64 |
|
65 |
|
66 |
@ultroid_cmd(
|
67 |
-
pattern=r"uninstall
|
68 |
)
|
69 |
async def uninstall(event):
|
70 |
-
shortname = event.pattern_match.group(1)
|
71 |
if not shortname:
|
72 |
await event.eor(get_string("core_13"))
|
73 |
return
|
@@ -88,11 +92,11 @@ async def uninstall(event):
|
|
88 |
|
89 |
|
90 |
@ultroid_cmd(
|
91 |
-
pattern=r"load
|
92 |
fullsudo=True,
|
93 |
)
|
94 |
async def load(event):
|
95 |
-
shortname = event.pattern_match.group(1)
|
96 |
if not shortname:
|
97 |
await event.eor(get_string("core_16"))
|
98 |
return
|
@@ -111,9 +115,30 @@ async def load(event):
|
|
111 |
)
|
112 |
|
113 |
|
114 |
-
@ultroid_cmd(pattern="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
async def get_the_addons_lol(event):
|
116 |
-
thelink = event.pattern_match.group(1)
|
117 |
xx = await event.eor(get_string("com_1"))
|
118 |
fool = get_string("gas_1")
|
119 |
if thelink is None:
|
@@ -121,8 +146,8 @@ async def get_the_addons_lol(event):
|
|
121 |
split_thelink = thelink.split("/")
|
122 |
if "raw" not in thelink:
|
123 |
return await xx.eor(fool, time=10)
|
124 |
-
name_of_it = split_thelink[
|
125 |
-
plug =
|
126 |
fil = f"addons/{name_of_it}"
|
127 |
await xx.edit("Packing the codes...")
|
128 |
with open(fil, "w", encoding="utf-8") as uult:
|
|
|
24 |
• `{i}help <plugin name>`
|
25 |
Shows you a help menu (like this) for every plugin.
|
26 |
|
27 |
+
• `{i}pick addons`
|
28 |
+
`{i}pick vcbot`
|
29 |
+
Instantly load 'Addons' or 'VcBot'.
|
30 |
+
|
31 |
• `{i}getaddons <raw link to code>`
|
32 |
Load Plugins from the given raw link.
|
33 |
"""
|
34 |
|
35 |
import os
|
36 |
|
37 |
+
from pyUltroid.startup.loader import Loader, load_addons
|
38 |
|
39 |
+
from . import async_searcher, eod, get_string, safeinstall, udB, ultroid_cmd, un_plug
|
40 |
|
41 |
|
42 |
@ultroid_cmd(pattern="install", fullsudo=True)
|
|
|
45 |
|
46 |
|
47 |
@ultroid_cmd(
|
48 |
+
pattern=r"unload( (.*)|$)",
|
49 |
)
|
50 |
async def unload(event):
|
51 |
+
shortname = event.pattern_match.group(1).strip()
|
52 |
if not shortname:
|
53 |
await event.eor(get_string("core_9"))
|
54 |
return
|
|
|
68 |
|
69 |
|
70 |
@ultroid_cmd(
|
71 |
+
pattern=r"uninstall( (.*)|$)",
|
72 |
)
|
73 |
async def uninstall(event):
|
74 |
+
shortname = event.pattern_match.group(1).strip()
|
75 |
if not shortname:
|
76 |
await event.eor(get_string("core_13"))
|
77 |
return
|
|
|
92 |
|
93 |
|
94 |
@ultroid_cmd(
|
95 |
+
pattern=r"load( (.*)|$)",
|
96 |
fullsudo=True,
|
97 |
)
|
98 |
async def load(event):
|
99 |
+
shortname = event.pattern_match.group(1).strip()
|
100 |
if not shortname:
|
101 |
await event.eor(get_string("core_16"))
|
102 |
return
|
|
|
115 |
)
|
116 |
|
117 |
|
118 |
+
@ultroid_cmd(pattern="pick( (.*)|$)", fullsudo=True)
|
119 |
+
async def pickup_call(ult):
|
120 |
+
match_ = ult.pattern_match.group(1).strip()
|
121 |
+
match = match_.lower()
|
122 |
+
proc = await ult.eor(get_string("com_1"))
|
123 |
+
if match == "addons":
|
124 |
+
if udB.get_key("ADDONS"):
|
125 |
+
return await proc.eor("`Addons are Already Enabled!`", time=8)
|
126 |
+
udB.set_key("ADDONS", True)
|
127 |
+
Loader(path="addons", key="Addons").load(func=load_addons)
|
128 |
+
elif match == "vcbot":
|
129 |
+
if udB.get_key("VCBOT"):
|
130 |
+
return await proc.eor("`VcBot is Already Active!`", time=8)
|
131 |
+
Loader(path="vcbot", key="VCBot").load()
|
132 |
+
else:
|
133 |
+
return await proc.eor(
|
134 |
+
"`Found Nothing to pick!\nSpecify what to pick..`", time=8
|
135 |
+
)
|
136 |
+
await proc.eor(f"`Successfully Activated {match_}`", time=8)
|
137 |
+
|
138 |
+
|
139 |
+
@ultroid_cmd(pattern="getaddons( (.*)|$)", fullsudo=True)
|
140 |
async def get_the_addons_lol(event):
|
141 |
+
thelink = event.pattern_match.group(1).strip()
|
142 |
xx = await event.eor(get_string("com_1"))
|
143 |
fool = get_string("gas_1")
|
144 |
if thelink is None:
|
|
|
146 |
split_thelink = thelink.split("/")
|
147 |
if "raw" not in thelink:
|
148 |
return await xx.eor(fool, time=10)
|
149 |
+
name_of_it = split_thelink[-1]
|
150 |
+
plug = await async_searcher(thelink)
|
151 |
fil = f"addons/{name_of_it}"
|
152 |
await xx.edit("Packing the codes...")
|
153 |
with open(fil, "w", encoding="utf-8") as uult:
|
plugins/database.py
CHANGED
@@ -27,9 +27,9 @@ import re
|
|
27 |
from . import Redis, eor, get_string, udB, ultroid_cmd
|
28 |
|
29 |
|
30 |
-
@ultroid_cmd(pattern="setdb
|
31 |
async def _(ult):
|
32 |
-
match = ult.pattern_match.group(1)
|
33 |
if not match:
|
34 |
return await ult.eor("Provide key and value to set!")
|
35 |
try:
|
@@ -50,9 +50,9 @@ async def _(ult):
|
|
50 |
await ult.eor(get_string("com_7"))
|
51 |
|
52 |
|
53 |
-
@ultroid_cmd(pattern="deldb
|
54 |
async def _(ult):
|
55 |
-
key = ult.pattern_match.group(1)
|
56 |
if not key:
|
57 |
return await ult.eor("Give me a key name to delete!", time=5)
|
58 |
_ = key.split(maxsplit=1)
|
@@ -70,9 +70,9 @@ async def _(ult):
|
|
70 |
await ult.eor(get_string("com_7"))
|
71 |
|
72 |
|
73 |
-
@ultroid_cmd(pattern="rendb
|
74 |
async def _(ult):
|
75 |
-
match = ult.pattern_match.group(1)
|
76 |
if not match:
|
77 |
return await ult.eor("`Provide Keys name to rename..`")
|
78 |
delim = " " if re.search("[|]", match) is None else " | "
|
|
|
27 |
from . import Redis, eor, get_string, udB, ultroid_cmd
|
28 |
|
29 |
|
30 |
+
@ultroid_cmd(pattern="setdb( (.*)|$)", fullsudo=True)
|
31 |
async def _(ult):
|
32 |
+
match = ult.pattern_match.group(1).strip()
|
33 |
if not match:
|
34 |
return await ult.eor("Provide key and value to set!")
|
35 |
try:
|
|
|
50 |
await ult.eor(get_string("com_7"))
|
51 |
|
52 |
|
53 |
+
@ultroid_cmd(pattern="deldb( (.*)|$)", fullsudo=True)
|
54 |
async def _(ult):
|
55 |
+
key = ult.pattern_match.group(1).strip()
|
56 |
if not key:
|
57 |
return await ult.eor("Give me a key name to delete!", time=5)
|
58 |
_ = key.split(maxsplit=1)
|
|
|
70 |
await ult.eor(get_string("com_7"))
|
71 |
|
72 |
|
73 |
+
@ultroid_cmd(pattern="rendb( (.*)|$)", fullsudo=True)
|
74 |
async def _(ult):
|
75 |
+
match = ult.pattern_match.group(1).strip()
|
76 |
if not match:
|
77 |
return await ult.eor("`Provide Keys name to rename..`")
|
78 |
delim = " " if re.search("[|]", match) is None else " | "
|
plugins/devtools.py
CHANGED
@@ -26,6 +26,7 @@
|
|
26 |
• `{i}sysinfo`
|
27 |
Shows System Info.
|
28 |
"""
|
|
|
29 |
|
30 |
import sys
|
31 |
import traceback
|
@@ -68,16 +69,18 @@ async def _(event):
|
|
68 |
reply_to_id = event.reply_to_msg_id or event.id
|
69 |
stdout, stderr = await bash(cmd)
|
70 |
OUT = f"**☞ BASH\n\n• COMMAND:**\n`{cmd}` \n\n"
|
|
|
71 |
if stderr:
|
72 |
-
|
73 |
if stdout:
|
74 |
_o = stdout.split("\n")
|
75 |
o = "\n".join(_o)
|
76 |
-
|
77 |
if not stderr and not stdout:
|
78 |
-
|
|
|
79 |
if len(OUT) > 4096:
|
80 |
-
ultd =
|
81 |
with BytesIO(str.encode(ultd)) as out_file:
|
82 |
out_file.name = "bash.txt"
|
83 |
await event.client.send_file(
|
@@ -98,12 +101,10 @@ async def _(event):
|
|
98 |
pp = pprint # ignore: pylint
|
99 |
bot = ultroid = ultroid_bot
|
100 |
|
101 |
-
_ignore_eval = []
|
102 |
-
|
103 |
|
104 |
-
def _parse_eval(value):
|
105 |
-
if value
|
106 |
-
return
|
107 |
if hasattr(value, "stringify"):
|
108 |
try:
|
109 |
return value.stringify()
|
@@ -114,10 +115,12 @@ def _parse_eval(value):
|
|
114 |
return json_parser(value, indent=1)
|
115 |
except BaseException:
|
116 |
pass
|
117 |
-
# is to_dict is also Good option to format?
|
118 |
return str(value)
|
119 |
|
120 |
|
|
|
|
|
|
|
121 |
@ultroid_cmd(pattern="eval", fullsudo=True, only_devs=True)
|
122 |
async def _(event):
|
123 |
try:
|
@@ -146,7 +149,7 @@ async def _(event):
|
|
146 |
except BaseException:
|
147 |
# Consider it as Code Error, and move on to be shown ahead.
|
148 |
pass
|
149 |
-
reply_to_id = event.reply_to_msg_id or event
|
150 |
if any(item in cmd for item in KEEP_SAFE().All) and (
|
151 |
not (event.out or event.sender_id == ultroid_bot.uid)
|
152 |
):
|
@@ -196,8 +199,8 @@ async def _(event):
|
|
196 |
)
|
197 |
)
|
198 |
if len(final_output) > 4096:
|
199 |
-
|
200 |
-
with BytesIO(str.encode(
|
201 |
out_file.name = "eval.txt"
|
202 |
await event.client.send_file(
|
203 |
event.chat_id,
|
@@ -212,20 +215,20 @@ async def _(event):
|
|
212 |
await xx.edit(final_output)
|
213 |
|
214 |
|
215 |
-
def
|
216 |
-
|
217 |
-
|
|
|
218 |
|
219 |
|
220 |
async def aexec(code, event):
|
221 |
exec(
|
222 |
(
|
223 |
-
(
|
224 |
-
|
225 |
-
|
226 |
-
)
|
227 |
+ "\n chat = event.chat_id"
|
228 |
-
+ "\n print = p = _stringified"
|
229 |
)
|
230 |
+ "".join(f"\n {l}" for l in code.split("\n"))
|
231 |
)
|
|
|
26 |
• `{i}sysinfo`
|
27 |
Shows System Info.
|
28 |
"""
|
29 |
+
from __future__ import print_function
|
30 |
|
31 |
import sys
|
32 |
import traceback
|
|
|
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"
|
72 |
+
err, out = "", ""
|
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
|
82 |
if len(OUT) > 4096:
|
83 |
+
ultd = err + out
|
84 |
with BytesIO(str.encode(ultd)) as out_file:
|
85 |
out_file.name = "bash.txt"
|
86 |
await event.client.send_file(
|
|
|
101 |
pp = pprint # ignore: pylint
|
102 |
bot = ultroid = ultroid_bot
|
103 |
|
|
|
|
|
104 |
|
105 |
+
def _parse_eval(value=None):
|
106 |
+
if not value:
|
107 |
+
return value
|
108 |
if hasattr(value, "stringify"):
|
109 |
try:
|
110 |
return value.stringify()
|
|
|
115 |
return json_parser(value, indent=1)
|
116 |
except BaseException:
|
117 |
pass
|
|
|
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:
|
|
|
149 |
except BaseException:
|
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 |
):
|
|
|
199 |
)
|
200 |
)
|
201 |
if len(final_output) > 4096:
|
202 |
+
final_output = evaluation
|
203 |
+
with BytesIO(str.encode(final_output)) as out_file:
|
204 |
out_file.name = "eval.txt"
|
205 |
await event.client.send_file(
|
206 |
event.chat_id,
|
|
|
215 |
await xx.edit(final_output)
|
216 |
|
217 |
|
218 |
+
def _stringify(text=None, *args, **kwargs):
|
219 |
+
if text:
|
220 |
+
text = _parse_eval(text)
|
221 |
+
return print(text, *args, **kwargs)
|
222 |
|
223 |
|
224 |
async def aexec(code, event):
|
225 |
exec(
|
226 |
(
|
227 |
+
"async def __aexec(e, client): "
|
228 |
+
+ "\n print = p = _stringify"
|
229 |
+
+ "\n message = event = e"
|
230 |
+
+ "\n reply = await event.get_reply_message()"
|
231 |
+ "\n chat = event.chat_id"
|
|
|
232 |
)
|
233 |
+ "".join(f"\n {l}" for l in code.split("\n"))
|
234 |
)
|
plugins/dnd.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
@@ -4,15 +4,16 @@
|
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
|
7 |
"""
|
8 |
✘ Commands Available -
|
9 |
|
10 |
• `{i}ul <path/to/file>`
|
11 |
-
Upload
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
• `{i}dl <filename(optional)>`
|
18 |
Reply to file to download.
|
@@ -20,16 +21,16 @@
|
|
20 |
• `{i}download <DDL> (| filename)`
|
21 |
Download using DDL. Will autogenerate filename if not given.
|
22 |
"""
|
|
|
23 |
import asyncio
|
24 |
-
import glob
|
25 |
import os
|
26 |
import time
|
27 |
from datetime import datetime as dt
|
28 |
|
29 |
from aiohttp.client_exceptions import InvalidURL
|
30 |
-
from pyUltroid.functions.
|
|
|
31 |
from telethon.errors.rpcerrorlist import MessageNotModifiedError
|
32 |
-
from telethon.tl.types import DocumentAttributeAudio, DocumentAttributeVideo
|
33 |
|
34 |
from . import (
|
35 |
LOGS,
|
@@ -37,19 +38,17 @@ from . import (
|
|
37 |
eor,
|
38 |
fast_download,
|
39 |
get_string,
|
40 |
-
humanbytes,
|
41 |
progress,
|
42 |
time_formatter,
|
43 |
ultroid_cmd,
|
44 |
-
uploader,
|
45 |
)
|
46 |
|
47 |
|
48 |
@ultroid_cmd(
|
49 |
-
pattern="download
|
50 |
)
|
51 |
async def down(event):
|
52 |
-
matched = event.pattern_match.group(1)
|
53 |
msg = await event.eor(get_string("udl_4"))
|
54 |
if not matched:
|
55 |
return await eor(msg, get_string("udl_5"), time=5)
|
@@ -80,11 +79,11 @@ async def down(event):
|
|
80 |
|
81 |
|
82 |
@ultroid_cmd(
|
83 |
-
pattern="dl
|
84 |
)
|
85 |
async def download(event):
|
86 |
if not event.reply_to_msg_id:
|
87 |
-
return await event.eor(get_string("cvt_3"))
|
88 |
xx = await event.eor(get_string("com_1"))
|
89 |
s = dt.now()
|
90 |
k = time.time()
|
@@ -95,7 +94,7 @@ async def download(event):
|
|
95 |
if hasattr(ok.media, "document"):
|
96 |
file = ok.media.document
|
97 |
mime_type = file.mime_type
|
98 |
-
filename = event.pattern_match.group(1) or ok.file.name
|
99 |
if not filename:
|
100 |
if "audio" in mime_type:
|
101 |
filename = "audio_" + dt.now().isoformat("_", "seconds") + ".ogg"
|
@@ -133,178 +132,88 @@ async def download(event):
|
|
133 |
|
134 |
|
135 |
@ultroid_cmd(
|
136 |
-
pattern="ul
|
137 |
)
|
138 |
-
async def
|
139 |
-
if event.text
|
140 |
-
|
141 |
-
xx = await event.eor(get_string("com_1"))
|
142 |
-
hmm = event.pattern_match.group(1)
|
143 |
-
try:
|
144 |
-
kk = hmm.split(" | stream")[0]
|
145 |
-
except BaseException:
|
146 |
-
pass
|
147 |
-
try:
|
148 |
-
title = kk.split("/")[-1]
|
149 |
-
except BaseException:
|
150 |
-
title = hmm
|
151 |
-
s = dt.now()
|
152 |
-
tt = time.time()
|
153 |
-
ko = kk
|
154 |
-
if not kk:
|
155 |
-
return await xx.eor(get_string("udl_3"), time=5)
|
156 |
-
if kk == ".env" or ".session" in kk:
|
157 |
-
return await eod(xx, get_string("udl_7"), time=5)
|
158 |
-
if not os.path.exists(kk):
|
159 |
-
try:
|
160 |
-
await event.client.send_file(
|
161 |
-
event.chat_id, file=kk, reply_to=event.reply_to_msg_id
|
162 |
-
)
|
163 |
-
await xx.try_delete()
|
164 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
except Exception as er:
|
166 |
LOGS.exception(er)
|
167 |
-
|
168 |
-
if os.path.isdir(
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
for kk in kk:
|
174 |
-
tt = time.time()
|
175 |
-
try:
|
176 |
try:
|
177 |
-
|
178 |
-
except
|
179 |
-
return await xx.edit(str(err))
|
180 |
-
title = kk.split("/")[-1]
|
181 |
-
if " | stream" in hmm:
|
182 |
-
data = await metadata(res.name)
|
183 |
-
wi = data["width"]
|
184 |
-
hi = data["height"]
|
185 |
-
duration = data["duration"]
|
186 |
-
artist = data["performer"]
|
187 |
-
if res.name.endswith((".mkv", ".mp4", ".avi", "webm")):
|
188 |
-
attributes = [
|
189 |
-
DocumentAttributeVideo(
|
190 |
-
w=wi, h=hi, duration=duration, supports_streaming=True
|
191 |
-
)
|
192 |
-
]
|
193 |
-
elif res.name.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
|
194 |
-
attributes = [
|
195 |
-
DocumentAttributeAudio(
|
196 |
-
duration=duration,
|
197 |
-
title=".".join(title.split(".")[:-1]),
|
198 |
-
performer=artist,
|
199 |
-
)
|
200 |
-
]
|
201 |
-
|
202 |
-
else:
|
203 |
-
attributes = []
|
204 |
-
try:
|
205 |
-
await event.client.send_file(
|
206 |
-
event.chat_id,
|
207 |
-
res,
|
208 |
-
caption=f"`{title}`",
|
209 |
-
reply_to=event.reply_to_msg_id,
|
210 |
-
attributes=attributes,
|
211 |
-
supports_streaming=True,
|
212 |
-
thumb="resources/extras/ultroid.jpg",
|
213 |
-
)
|
214 |
-
except BaseException as er:
|
215 |
-
LOGS.exception(er)
|
216 |
-
await event.client.send_file(
|
217 |
-
event.chat_id,
|
218 |
-
res,
|
219 |
-
caption=f"`{title}`",
|
220 |
-
reply_to=event.reply_to_msg_id,
|
221 |
-
thumb="resources/extras/ultroid.jpg",
|
222 |
-
)
|
223 |
-
else:
|
224 |
-
await event.client.send_file(
|
225 |
-
event.chat_id,
|
226 |
-
res,
|
227 |
-
caption=f"`{title}`",
|
228 |
-
reply_to=event.reply_to_msg_id,
|
229 |
-
force_document=True,
|
230 |
-
thumb="resources/extras/ultroid.jpg",
|
231 |
-
)
|
232 |
-
except Exception as ve:
|
233 |
-
return await xx.eor(str(ve))
|
234 |
-
else:
|
235 |
-
try:
|
236 |
-
try:
|
237 |
-
res = await uploader(kk, kk, tt, xx, f"Uploading {kk}...")
|
238 |
-
except MessageNotModifiedError as err:
|
239 |
-
return await xx.edit(str(err))
|
240 |
-
if title.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
|
241 |
-
hmm = " | stream"
|
242 |
-
if " | stream" in hmm:
|
243 |
-
data = await metadata(res.name)
|
244 |
-
wi = data["width"]
|
245 |
-
hi = data["height"]
|
246 |
-
duration = data["duration"]
|
247 |
-
artist = data["performer"]
|
248 |
-
if res.name.endswith((".mkv", ".mp4", ".avi", "webm")):
|
249 |
-
attributes = [
|
250 |
-
DocumentAttributeVideo(
|
251 |
-
w=wi, h=hi, duration=duration, supports_streaming=True
|
252 |
-
)
|
253 |
-
]
|
254 |
-
elif res.name.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
|
255 |
-
attributes = [
|
256 |
-
DocumentAttributeAudio(
|
257 |
-
duration=duration,
|
258 |
-
title=title.split(".")[0],
|
259 |
-
performer=artist,
|
260 |
-
)
|
261 |
-
]
|
262 |
-
else:
|
263 |
-
attributes = None
|
264 |
-
try:
|
265 |
-
await event.client.send_file(
|
266 |
-
event.chat_id,
|
267 |
-
res,
|
268 |
-
caption=f"`{title}`",
|
269 |
-
attributes=attributes,
|
270 |
-
reply_to=event.reply_to_msg_id,
|
271 |
-
supports_streaming=True,
|
272 |
-
thumb="resources/extras/ultroid.jpg",
|
273 |
-
)
|
274 |
-
except BaseException as er:
|
275 |
LOGS.exception(er)
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
reply_to=event.reply_to_msg_id,
|
281 |
-
force_document=True,
|
282 |
-
thumb="resources/extras/ultroid.jpg",
|
283 |
-
)
|
284 |
-
else:
|
285 |
await event.client.send_file(
|
286 |
event.chat_id,
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
292 |
)
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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}ul <path/to/file>`
|
12 |
+
Upload files on telegram.
|
13 |
+
Use following arguments before or after filename as per requirement:
|
14 |
+
`--stream` to upload as stream.
|
15 |
+
`--delete` to delete file after uploading.
|
16 |
+
`--no-thumb` to upload without thumbnail.
|
17 |
|
18 |
• `{i}dl <filename(optional)>`
|
19 |
Reply to file to download.
|
|
|
21 |
• `{i}download <DDL> (| filename)`
|
22 |
Download using DDL. Will autogenerate filename if not given.
|
23 |
"""
|
24 |
+
|
25 |
import asyncio
|
|
|
26 |
import os
|
27 |
import time
|
28 |
from datetime import datetime as dt
|
29 |
|
30 |
from aiohttp.client_exceptions import InvalidURL
|
31 |
+
from pyUltroid.functions.helper import time_formatter
|
32 |
+
from pyUltroid.functions.tools import set_attributes
|
33 |
from telethon.errors.rpcerrorlist import MessageNotModifiedError
|
|
|
34 |
|
35 |
from . import (
|
36 |
LOGS,
|
|
|
38 |
eor,
|
39 |
fast_download,
|
40 |
get_string,
|
|
|
41 |
progress,
|
42 |
time_formatter,
|
43 |
ultroid_cmd,
|
|
|
44 |
)
|
45 |
|
46 |
|
47 |
@ultroid_cmd(
|
48 |
+
pattern="download( (.*)|$)",
|
49 |
)
|
50 |
async def down(event):
|
51 |
+
matched = event.pattern_match.group(1).strip()
|
52 |
msg = await event.eor(get_string("udl_4"))
|
53 |
if not matched:
|
54 |
return await eor(msg, get_string("udl_5"), time=5)
|
|
|
79 |
|
80 |
|
81 |
@ultroid_cmd(
|
82 |
+
pattern="dl( (.*)|$)",
|
83 |
)
|
84 |
async def download(event):
|
85 |
if not event.reply_to_msg_id:
|
86 |
+
return await event.eor(get_string("cvt_3"), time=8)
|
87 |
xx = await event.eor(get_string("com_1"))
|
88 |
s = dt.now()
|
89 |
k = time.time()
|
|
|
94 |
if hasattr(ok.media, "document"):
|
95 |
file = ok.media.document
|
96 |
mime_type = file.mime_type
|
97 |
+
filename = event.pattern_match.group(1).strip() or ok.file.name
|
98 |
if not filename:
|
99 |
if "audio" in mime_type:
|
100 |
filename = "audio_" + dt.now().isoformat("_", "seconds") + ".ogg"
|
|
|
132 |
|
133 |
|
134 |
@ultroid_cmd(
|
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,
|
148 |
+
False,
|
149 |
+
"resources/extras/ultroid.jpg",
|
150 |
+
)
|
151 |
+
if "--stream" in match:
|
152 |
+
stream = True
|
153 |
+
force_doc = False
|
154 |
+
if "--delete" in match:
|
155 |
+
delete = True
|
156 |
+
if "--no-thumb" in match:
|
157 |
+
thumb = None
|
158 |
+
arguments = ["--stream", "--delete", "--no-thumb"]
|
159 |
+
if any(item in match for item in arguments):
|
160 |
+
match = (
|
161 |
+
match.replace("--stream", "")
|
162 |
+
.replace("--delete", "")
|
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()
|
plugins/echo.py
CHANGED
@@ -23,7 +23,7 @@ from telethon.utils import get_display_name
|
|
23 |
from . import LOGS, events, ultroid_bot, ultroid_cmd
|
24 |
|
25 |
|
26 |
-
@ultroid_cmd(pattern="addecho
|
27 |
async def echo(e):
|
28 |
r = await e.get_reply_message()
|
29 |
if r:
|
@@ -46,7 +46,7 @@ async def echo(e):
|
|
46 |
await e.eor(f"Activated Echo For {user}.")
|
47 |
|
48 |
|
49 |
-
@ultroid_cmd(pattern="remecho
|
50 |
async def rm(e):
|
51 |
r = await e.get_reply_message()
|
52 |
if r:
|
|
|
23 |
from . import LOGS, events, ultroid_bot, ultroid_cmd
|
24 |
|
25 |
|
26 |
+
@ultroid_cmd(pattern="addecho( (.*)|$)")
|
27 |
async def echo(e):
|
28 |
r = await e.get_reply_message()
|
29 |
if r:
|
|
|
46 |
await e.eor(f"Activated Echo For {user}.")
|
47 |
|
48 |
|
49 |
+
@ultroid_cmd(pattern="remecho( (.*)|$)")
|
50 |
async def rm(e):
|
51 |
r = await e.get_reply_message()
|
52 |
if r:
|
plugins/fakeaction.py
CHANGED
@@ -46,10 +46,10 @@ from . import asyncio, get_string, ultroid_cmd
|
|
46 |
|
47 |
|
48 |
@ultroid_cmd(
|
49 |
-
pattern="f(typing|audio|contact|document|game|location|sticker|photo|round|video)
|
50 |
)
|
51 |
async def _(e):
|
52 |
-
act = e.pattern_match.group(1)
|
53 |
t = e.pattern_match.group(2)
|
54 |
if act in ["audio", "round", "video"]:
|
55 |
act = "record-" + act
|
|
|
46 |
|
47 |
|
48 |
@ultroid_cmd(
|
49 |
+
pattern="f(typing|audio|contact|document|game|location|sticker|photo|round|video)( (.*)|$)"
|
50 |
)
|
51 |
async def _(e):
|
52 |
+
act = e.pattern_match.group(1).strip()
|
53 |
t = e.pattern_match.group(2)
|
54 |
if act in ["audio", "round", "video"]:
|
55 |
act = "record-" + act
|
plugins/fedutils.py
CHANGED
@@ -33,11 +33,11 @@ bot = "@MissRose_bot"
|
|
33 |
|
34 |
|
35 |
@ultroid_cmd(
|
36 |
-
pattern="superfban
|
37 |
)
|
38 |
async def _(event):
|
39 |
msg = await event.eor(get_string("sf_1"))
|
40 |
-
inputt = event.pattern_match.group(1)
|
41 |
if event.reply_to_msg_id:
|
42 |
FBAN = (await event.get_reply_message()).sender_id
|
43 |
if inputt:
|
@@ -148,7 +148,7 @@ async def _(event):
|
|
148 |
|
149 |
|
150 |
@ultroid_cmd(
|
151 |
-
pattern="superunfban
|
152 |
)
|
153 |
async def _(event):
|
154 |
msg = await event.eor(get_string("sf_15"))
|
@@ -282,7 +282,7 @@ async def _(event):
|
|
282 |
|
283 |
|
284 |
@ultroid_cmd(
|
285 |
-
pattern="fstat
|
286 |
)
|
287 |
async def _(event):
|
288 |
ok = await event.eor("`Checking...`")
|
@@ -290,10 +290,10 @@ async def _(event):
|
|
290 |
previous_message = await event.get_reply_message()
|
291 |
sysarg = str(previous_message.sender_id)
|
292 |
user = f"[user](tg://user?id={sysarg})"
|
293 |
-
if event.pattern_match.group(1):
|
294 |
-
sysarg += f" {event.pattern_match.group(1)}"
|
295 |
else:
|
296 |
-
sysarg = event.pattern_match.group(1)
|
297 |
user = sysarg
|
298 |
if sysarg == "":
|
299 |
await ok.edit(
|
@@ -330,11 +330,11 @@ async def _(event):
|
|
330 |
|
331 |
|
332 |
@ultroid_cmd(
|
333 |
-
pattern="fedinfo
|
334 |
)
|
335 |
async def _(event):
|
336 |
ok = await event.edit(get_string("sf_20"))
|
337 |
-
sysarg = event.pattern_match.group(1)
|
338 |
async with event.client.conversation(bot) as conv:
|
339 |
try:
|
340 |
await conv.send_message("/start")
|
|
|
33 |
|
34 |
|
35 |
@ultroid_cmd(
|
36 |
+
pattern="superfban( (.*)|$)",
|
37 |
)
|
38 |
async def _(event):
|
39 |
msg = await event.eor(get_string("sf_1"))
|
40 |
+
inputt = event.pattern_match.group(1).strip()
|
41 |
if event.reply_to_msg_id:
|
42 |
FBAN = (await event.get_reply_message()).sender_id
|
43 |
if inputt:
|
|
|
148 |
|
149 |
|
150 |
@ultroid_cmd(
|
151 |
+
pattern="superunfban( (.*)|$)",
|
152 |
)
|
153 |
async def _(event):
|
154 |
msg = await event.eor(get_string("sf_15"))
|
|
|
282 |
|
283 |
|
284 |
@ultroid_cmd(
|
285 |
+
pattern="fstat( (.*)|$)",
|
286 |
)
|
287 |
async def _(event):
|
288 |
ok = await event.eor("`Checking...`")
|
|
|
290 |
previous_message = await event.get_reply_message()
|
291 |
sysarg = str(previous_message.sender_id)
|
292 |
user = f"[user](tg://user?id={sysarg})"
|
293 |
+
if event.pattern_match.group(1).strip():
|
294 |
+
sysarg += f" {event.pattern_match.group(1).strip()}"
|
295 |
else:
|
296 |
+
sysarg = event.pattern_match.group(1).strip()
|
297 |
user = sysarg
|
298 |
if sysarg == "":
|
299 |
await ok.edit(
|
|
|
330 |
|
331 |
|
332 |
@ultroid_cmd(
|
333 |
+
pattern="fedinfo( (.*)|$)",
|
334 |
)
|
335 |
async def _(event):
|
336 |
ok = await event.edit(get_string("sf_20"))
|
337 |
+
sysarg = event.pattern_match.group(1).strip()
|
338 |
async with event.client.conversation(bot) as conv:
|
339 |
try:
|
340 |
await conv.send_message("/start")
|
plugins/fileshare.py
CHANGED
@@ -10,42 +10,65 @@
|
|
10 |
• `{i}store <reply_to_message>`
|
11 |
Store the replied message/media and generate a shareable link to that file, to be accessed via your assistant bot!
|
12 |
|
|
|
|
|
|
|
13 |
• `{i}liststored`
|
14 |
Get all stored messages.
|
|
|
|
|
15 |
"""
|
16 |
|
17 |
import os
|
18 |
|
|
|
19 |
from pyUltroid.functions.tools import get_file_link
|
20 |
|
21 |
-
from . import asst,
|
22 |
|
23 |
|
24 |
-
@ultroid_cmd(pattern="store")
|
25 |
async def filestoreplg(event):
|
26 |
msg = await event.get_reply_message()
|
27 |
-
if msg
|
28 |
-
await event.eor(get_string("fsh_3"), time=10)
|
29 |
-
return
|
30 |
# allow storing both messages and media.
|
31 |
filehash = await get_file_link(msg)
|
32 |
link_to_file = "https://t.me/{}?start={}".format(asst.me.username, filehash)
|
33 |
-
await eor(
|
34 |
-
event,
|
35 |
get_string("fsh_2").format(link_to_file),
|
36 |
link_preview=False,
|
37 |
)
|
38 |
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
@ultroid_cmd("liststored$")
|
41 |
async def liststored(event):
|
42 |
-
|
43 |
-
if not
|
44 |
-
await event.eor(get_string("fsh_4"), time=5)
|
45 |
-
return
|
46 |
msg = "**Stored files:**\n"
|
47 |
-
for c, i in enumerate(
|
48 |
-
c += 1
|
49 |
msg += f"`{c}`. https://t.me/{asst.me.username}?start={i}\n"
|
50 |
if len(msg) > 4095:
|
51 |
with open("liststored.txt", "w") as f:
|
@@ -54,3 +77,29 @@ async def liststored(event):
|
|
54 |
os.remove("liststored.txt")
|
55 |
return
|
56 |
await event.eor(msg, link_preview=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
• `{i}store <reply_to_message>`
|
11 |
Store the replied message/media and generate a shareable link to that file, to be accessed via your assistant bot!
|
12 |
|
13 |
+
• `{i}delstored <link of stored file>`
|
14 |
+
Delete stored file.
|
15 |
+
|
16 |
• `{i}liststored`
|
17 |
Get all stored messages.
|
18 |
+
|
19 |
+
• Go Inline with your assistant bot with `filestore` to see stored files in inline.
|
20 |
"""
|
21 |
|
22 |
import os
|
23 |
|
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
|
28 |
|
29 |
|
30 |
+
@ultroid_cmd(pattern="store$")
|
31 |
async def filestoreplg(event):
|
32 |
msg = await event.get_reply_message()
|
33 |
+
if not msg:
|
34 |
+
return await event.eor(get_string("fsh_3"), time=10)
|
|
|
35 |
# allow storing both messages and media.
|
36 |
filehash = await get_file_link(msg)
|
37 |
link_to_file = "https://t.me/{}?start={}".format(asst.me.username, filehash)
|
38 |
+
await event.eor(
|
|
|
39 |
get_string("fsh_2").format(link_to_file),
|
40 |
link_preview=False,
|
41 |
)
|
42 |
|
43 |
|
44 |
+
@ultroid_cmd("delstored ?(.*)")
|
45 |
+
async def _(event):
|
46 |
+
match = event.pattern_match.group(1)
|
47 |
+
if not match:
|
48 |
+
return await event.eor("`Give stored film's link to delete.`", time=5)
|
49 |
+
match = match.split("?start=")
|
50 |
+
botusername = match[0].split("/")[-1]
|
51 |
+
if botusername != asst.me.username:
|
52 |
+
return await event.eor(
|
53 |
+
"`Message/Media of provided link was not stored by this bot.`", time=5
|
54 |
+
)
|
55 |
+
msg_id = get_stored_msg(match[1])
|
56 |
+
if not msg_id:
|
57 |
+
return await event.eor(
|
58 |
+
"`Message/Media of provided link was already deleted.`", time=5
|
59 |
+
)
|
60 |
+
del_stored(match[1])
|
61 |
+
await ultroid_bot.delete_messages(udB.get_key("LOG_CHANNEL"), int(msg_id))
|
62 |
+
await event.eor("__Deleted__")
|
63 |
+
|
64 |
+
|
65 |
@ultroid_cmd("liststored$")
|
66 |
async def liststored(event):
|
67 |
+
files = list_all_stored_msgs()
|
68 |
+
if not files:
|
69 |
+
return await event.eor(get_string("fsh_4"), time=5)
|
|
|
70 |
msg = "**Stored files:**\n"
|
71 |
+
for c, i in enumerate(files, start=1):
|
|
|
72 |
msg += f"`{c}`. https://t.me/{asst.me.username}?start={i}\n"
|
73 |
if len(msg) > 4095:
|
74 |
with open("liststored.txt", "w") as f:
|
|
|
77 |
os.remove("liststored.txt")
|
78 |
return
|
79 |
await event.eor(msg, link_preview=False)
|
80 |
+
|
81 |
+
|
82 |
+
@in_pattern("filestore", owner=True)
|
83 |
+
async def file_short(event):
|
84 |
+
all_ = list_all_stored_msgs()
|
85 |
+
res = []
|
86 |
+
if all_:
|
87 |
+
LOG_CHA = udB.get_key("LOG_CHANNEL")
|
88 |
+
for msg in all_[:50]:
|
89 |
+
m_id = get_stored_msg(msg)
|
90 |
+
if not m_id:
|
91 |
+
continue
|
92 |
+
message = await asst.get_messages(LOG_CHA, ids=m_id)
|
93 |
+
if not message:
|
94 |
+
continue
|
95 |
+
if message.media:
|
96 |
+
res.append(await event.builder.document(title=msg, file=message.media))
|
97 |
+
elif message.text:
|
98 |
+
res.append(
|
99 |
+
await event.builder.article(title=message.text, text=message.text)
|
100 |
+
)
|
101 |
+
if not res:
|
102 |
+
title = "You have no stored file :("
|
103 |
+
text = title + "\n\nRead `{HNDLR}help fileshare` to know how to store."
|
104 |
+
return await event.answer([await event.builder.article(title=title, text=text)])
|
105 |
+
await event.answer(res, switch_pm="• File Store •", switch_pm_param="start")
|
plugins/filter.py
CHANGED
@@ -30,9 +30,9 @@ from . import events, get_string, mediainfo, udB, ultroid_bot, ultroid_cmd
|
|
30 |
from ._inline import something
|
31 |
|
32 |
|
33 |
-
@ultroid_cmd(pattern="addfilter
|
34 |
async def af(e):
|
35 |
-
wrd = (e.pattern_match.group(1)).lower()
|
36 |
wt = await e.get_reply_message()
|
37 |
chat = e.chat_id
|
38 |
if not (wt and wrd):
|
@@ -69,9 +69,9 @@ async def af(e):
|
|
69 |
ultroid_bot.add_handler(filter_func, events.NewMessage())
|
70 |
|
71 |
|
72 |
-
@ultroid_cmd(pattern="remfilter
|
73 |
async def rf(e):
|
74 |
-
wrd = (e.pattern_match.group(1)).lower()
|
75 |
chat = e.chat_id
|
76 |
if not wrd:
|
77 |
return await e.eor(get_string("flr_3"))
|
|
|
30 |
from ._inline import something
|
31 |
|
32 |
|
33 |
+
@ultroid_cmd(pattern="addfilter( (.*)|$)")
|
34 |
async def af(e):
|
35 |
+
wrd = (e.pattern_match.group(1).strip()).lower()
|
36 |
wt = await e.get_reply_message()
|
37 |
chat = e.chat_id
|
38 |
if not (wt and wrd):
|
|
|
69 |
ultroid_bot.add_handler(filter_func, events.NewMessage())
|
70 |
|
71 |
|
72 |
+
@ultroid_cmd(pattern="remfilter( (.*)|$)")
|
73 |
async def rf(e):
|
74 |
+
wrd = (e.pattern_match.group(1).strip()).lower()
|
75 |
chat = e.chat_id
|
76 |
if not wrd:
|
77 |
return await e.eor(get_string("flr_3"))
|
plugins/fontgen.py
CHANGED
@@ -24,10 +24,10 @@ _script_royal = "𝒶𝒷𝒸𝒹𝑒𝒻𝑔𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝑜
|
|
24 |
|
25 |
|
26 |
@ultroid_cmd(
|
27 |
-
pattern="font
|
28 |
)
|
29 |
async def _(e):
|
30 |
-
input = e.pattern_match.group(1)
|
31 |
reply = await e.get_reply_message()
|
32 |
help = __doc__.format(i=HNDLR)
|
33 |
if not input:
|
|
|
24 |
|
25 |
|
26 |
@ultroid_cmd(
|
27 |
+
pattern="font( (.*)|$)",
|
28 |
)
|
29 |
async def _(e):
|
30 |
+
input = e.pattern_match.group(1).strip()
|
31 |
reply = await e.get_reply_message()
|
32 |
help = __doc__.format(i=HNDLR)
|
33 |
if not input:
|
plugins/forcesubscribe.py
CHANGED
@@ -27,8 +27,12 @@ from telethon.errors.rpcerrorlist import ChatAdminRequiredError, UserNotParticip
|
|
27 |
from telethon.tl.custom import Button
|
28 |
from telethon.tl.functions.channels import GetParticipantRequest
|
29 |
from telethon.tl.functions.messages import ExportChatInviteRequest
|
30 |
-
from telethon.tl.types import
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
from . import (
|
34 |
LOGS,
|
@@ -46,20 +50,13 @@ from . import (
|
|
46 |
CACHE = {}
|
47 |
|
48 |
|
49 |
-
@ultroid_cmd(pattern="fsub
|
50 |
async def addfor(e):
|
51 |
-
match = e.pattern_match.group(1)
|
52 |
if not match:
|
53 |
return await e.eor(get_string("fsub_1"), time=5)
|
54 |
-
if match.startswith("@"):
|
55 |
-
ch = match
|
56 |
-
else:
|
57 |
-
try:
|
58 |
-
ch = int(match)
|
59 |
-
except BaseException:
|
60 |
-
return await e.eor(get_string("fsub_2"), time=5)
|
61 |
try:
|
62 |
-
match =
|
63 |
except BaseException:
|
64 |
return await e.eor(get_string("fsub_2"), time=5)
|
65 |
add_forcesub(e.chat_id, match)
|
@@ -84,9 +81,9 @@ async def getfsr(e):
|
|
84 |
await e.eor(f"**ForceSub Status** : `Active`\n- **{cha.title}** `({res})`")
|
85 |
|
86 |
|
87 |
-
@in_pattern("fsub
|
88 |
async def fcall(e):
|
89 |
-
match = e.pattern_match.group(1)
|
90 |
spli = match.split("_")
|
91 |
user = await ultroid_bot.get_entity(int(spli[0]))
|
92 |
cl = await ultroid_bot.get_entity(int(spli[1]))
|
@@ -116,7 +113,11 @@ async def diesoon(e):
|
|
116 |
if e.sender_id != int(spli[0]):
|
117 |
return await e.answer(get_string("fsub_7"), alert=True)
|
118 |
try:
|
119 |
-
await ultroid_bot(GetParticipantRequest(int(spli[1]), int(spli[0])))
|
|
|
|
|
|
|
|
|
120 |
except UserNotParticipantError:
|
121 |
return await e.answer(
|
122 |
"Please Join That Channel !\nThen Click This Button !", alert=True
|
|
|
27 |
from telethon.tl.custom import Button
|
28 |
from telethon.tl.functions.channels import GetParticipantRequest
|
29 |
from telethon.tl.functions.messages import ExportChatInviteRequest
|
30 |
+
from telethon.tl.types import (
|
31 |
+
Channel,
|
32 |
+
ChannelParticipantBanned,
|
33 |
+
ChannelParticipantLeft,
|
34 |
+
User,
|
35 |
+
)
|
36 |
|
37 |
from . import (
|
38 |
LOGS,
|
|
|
50 |
CACHE = {}
|
51 |
|
52 |
|
53 |
+
@ultroid_cmd(pattern="fsub( (.*)|$)", admins_only=True, groups_only=True)
|
54 |
async def addfor(e):
|
55 |
+
match = e.pattern_match.group(1).strip()
|
56 |
if not match:
|
57 |
return await e.eor(get_string("fsub_1"), time=5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
try:
|
59 |
+
match = await e.client.parse_id(match)
|
60 |
except BaseException:
|
61 |
return await e.eor(get_string("fsub_2"), time=5)
|
62 |
add_forcesub(e.chat_id, match)
|
|
|
81 |
await e.eor(f"**ForceSub Status** : `Active`\n- **{cha.title}** `({res})`")
|
82 |
|
83 |
|
84 |
+
@in_pattern("fsub( (.*)|$)", owner=True)
|
85 |
async def fcall(e):
|
86 |
+
match = e.pattern_match.group(1).strip()
|
87 |
spli = match.split("_")
|
88 |
user = await ultroid_bot.get_entity(int(spli[0]))
|
89 |
cl = await ultroid_bot.get_entity(int(spli[1]))
|
|
|
113 |
if e.sender_id != int(spli[0]):
|
114 |
return await e.answer(get_string("fsub_7"), alert=True)
|
115 |
try:
|
116 |
+
values = await ultroid_bot(GetParticipantRequest(int(spli[1]), int(spli[0])))
|
117 |
+
if isinstance(values.participant, ChannelParticipantLeft) or (
|
118 |
+
isinstance(values.participant, ChannelParticipantBanned) and values.left
|
119 |
+
):
|
120 |
+
raise UserNotParticipantError("")
|
121 |
except UserNotParticipantError:
|
122 |
return await e.answer(
|
123 |
"Please Join That Channel !\nThen Click This Button !", alert=True
|
plugins/gdrive.py
CHANGED
@@ -34,15 +34,14 @@ from telethon.tl.types import Message
|
|
34 |
|
35 |
from . import asst, eod, eor, get_string, ultroid_cmd
|
36 |
|
37 |
-
GDrive = GDriveManager()
|
38 |
-
|
39 |
|
40 |
@ultroid_cmd(
|
41 |
-
pattern="gdown
|
42 |
fullsudo=True,
|
43 |
)
|
44 |
async def gdown(event):
|
45 |
-
|
|
|
46 |
if not match:
|
47 |
return await eod(event, "`Give file id or Gdrive link to download from!`")
|
48 |
filename = match.split(" | ")[1].strip() if " | " in match else None
|
@@ -61,6 +60,7 @@ async def gdown(event):
|
|
61 |
fullsudo=True,
|
62 |
)
|
63 |
async def files(event):
|
|
|
64 |
if not os.path.exists(GDrive.token_file):
|
65 |
return await event.eor(get_string("gdrive_6").format(asst.me.username))
|
66 |
eve = await event.eor(get_string("com_1"))
|
@@ -95,39 +95,39 @@ async def files(event):
|
|
95 |
|
96 |
|
97 |
@ultroid_cmd(
|
98 |
-
pattern="gdul
|
99 |
fullsudo=True,
|
100 |
)
|
101 |
async def _(event):
|
|
|
102 |
if not os.path.exists(GDrive.token_file):
|
103 |
return await eod(event, get_string("gdrive_6").format(asst.me.username))
|
104 |
-
input_file = event.pattern_match.group(1) or await event.get_reply_message()
|
105 |
if not input_file:
|
106 |
return await eod(event, "`Reply to file or give its location.`")
|
107 |
mone = await event.eor(get_string("com_1"))
|
108 |
if isinstance(input_file, Message):
|
109 |
location = "resources/downloads"
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
return await eor(mone, str(e), time=10)
|
129 |
await mone.edit(
|
130 |
-
f"`Downloaded to ``{filename}
|
131 |
)
|
132 |
else:
|
133 |
filename = input_file.strip()
|
@@ -172,13 +172,14 @@ async def _(event):
|
|
172 |
|
173 |
|
174 |
@ultroid_cmd(
|
175 |
-
pattern="gdsearch
|
176 |
fullsudo=True,
|
177 |
)
|
178 |
async def _(event):
|
|
|
179 |
if not os.path.exists(GDrive.token_file):
|
180 |
return await event.eor(get_string("gdrive_6").format(asst.me.username))
|
181 |
-
input_str = event.pattern_match.group(1)
|
182 |
if not input_str:
|
183 |
return await event.eor("`Give filename to search on GDrive...`")
|
184 |
eve = await event.eor(f"`Searching for {input_str} in G-Drive...`")
|
@@ -214,31 +215,6 @@ async def _(event):
|
|
214 |
os.remove(f"{input_str}.txt")
|
215 |
|
216 |
|
217 |
-
"""
|
218 |
-
@ultroid_cmd(
|
219 |
-
pattern="udir ?(.*)",
|
220 |
-
fullsudo=True,
|
221 |
-
)
|
222 |
-
async def _(event):
|
223 |
-
if not os.path.exists(TOKEN_FILE):
|
224 |
-
return await event.eor(get_string("gdrive_6").format(asst.me.username), time=5)
|
225 |
-
input_str = event.pattern_match.group(1)
|
226 |
-
if not os.path.isdir(input_str):
|
227 |
-
return await event.eor(f"Directory {input_str} does not seem to exist", time=5)
|
228 |
-
|
229 |
-
http = authorize(TOKEN_FILE, None)
|
230 |
-
a = await event.eor(f"Uploading `{input_str}` to G-Drive...")
|
231 |
-
dir_id = await create_directory(
|
232 |
-
http,
|
233 |
-
os.path.basename(os.path.abspath(input_str)),
|
234 |
-
Redis("GDRIVE_FOLDER_ID"),
|
235 |
-
)
|
236 |
-
await DoTeskWithDir(http, input_str, event, dir_id)
|
237 |
-
dir_link = f"https://drive.google.com/folderview?id={dir_id}"
|
238 |
-
await eor(a, get_string("gdrive_7").format(input_str, dir_link), time=5)
|
239 |
-
"""
|
240 |
-
|
241 |
-
|
242 |
@ultroid_cmd(
|
243 |
pattern="gdfolder$",
|
244 |
fullsudo=True,
|
@@ -250,8 +226,7 @@ async def _(event):
|
|
250 |
if GDrive.folder_id:
|
251 |
await event.eor(
|
252 |
"`Your G-Drive Folder link : `\n"
|
253 |
-
+
|
254 |
-
+ GDrive.folder_id,
|
255 |
)
|
256 |
else:
|
257 |
await eod(event, "Set FOLDERID from your Assistant bot's Settings ")
|
|
|
34 |
|
35 |
from . import asst, eod, eor, get_string, ultroid_cmd
|
36 |
|
|
|
|
|
37 |
|
38 |
@ultroid_cmd(
|
39 |
+
pattern="gdown( (.*)|$)",
|
40 |
fullsudo=True,
|
41 |
)
|
42 |
async def gdown(event):
|
43 |
+
GDrive = GDriveManager()
|
44 |
+
match = event.pattern_match.group(1).strip()
|
45 |
if not match:
|
46 |
return await eod(event, "`Give file id or Gdrive link to download from!`")
|
47 |
filename = match.split(" | ")[1].strip() if " | " in match else None
|
|
|
60 |
fullsudo=True,
|
61 |
)
|
62 |
async def files(event):
|
63 |
+
GDrive = GDriveManager()
|
64 |
if not os.path.exists(GDrive.token_file):
|
65 |
return await event.eor(get_string("gdrive_6").format(asst.me.username))
|
66 |
eve = await event.eor(get_string("com_1"))
|
|
|
95 |
|
96 |
|
97 |
@ultroid_cmd(
|
98 |
+
pattern="gdul( (.*)|$)",
|
99 |
fullsudo=True,
|
100 |
)
|
101 |
async def _(event):
|
102 |
+
GDrive = GDriveManager()
|
103 |
if not os.path.exists(GDrive.token_file):
|
104 |
return await eod(event, get_string("gdrive_6").format(asst.me.username))
|
105 |
+
input_file = event.pattern_match.group(1).strip() or await event.get_reply_message()
|
106 |
if not input_file:
|
107 |
return await eod(event, "`Reply to file or give its location.`")
|
108 |
mone = await event.eor(get_string("com_1"))
|
109 |
if isinstance(input_file, Message):
|
110 |
location = "resources/downloads"
|
111 |
+
if input_file.photo:
|
112 |
+
filename = await input_file.download_media(location)
|
113 |
+
else:
|
114 |
+
filename = input_file.file.name
|
115 |
+
if not filename:
|
116 |
+
filename = str(round(time.time()))
|
117 |
+
filename = location + "/" + filename
|
118 |
+
try:
|
119 |
+
filename, downloaded_in = await event.client.fast_downloader(
|
120 |
+
file=input_file.media.document,
|
121 |
+
filename=filename,
|
122 |
+
show_progress=True,
|
123 |
+
event=mone,
|
124 |
+
message=get_string("com_5"),
|
125 |
+
)
|
126 |
+
filename = filename.name
|
127 |
+
except Exception as e:
|
128 |
+
return await eor(mone, str(e), time=10)
|
|
|
129 |
await mone.edit(
|
130 |
+
f"`Downloaded to ``{filename}`.`",
|
131 |
)
|
132 |
else:
|
133 |
filename = input_file.strip()
|
|
|
172 |
|
173 |
|
174 |
@ultroid_cmd(
|
175 |
+
pattern="gdsearch( (.*)|$)",
|
176 |
fullsudo=True,
|
177 |
)
|
178 |
async def _(event):
|
179 |
+
GDrive = GDriveManager()
|
180 |
if not os.path.exists(GDrive.token_file):
|
181 |
return await event.eor(get_string("gdrive_6").format(asst.me.username))
|
182 |
+
input_str = event.pattern_match.group(1).strip()
|
183 |
if not input_str:
|
184 |
return await event.eor("`Give filename to search on GDrive...`")
|
185 |
eve = await event.eor(f"`Searching for {input_str} in G-Drive...`")
|
|
|
215 |
os.remove(f"{input_str}.txt")
|
216 |
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
@ultroid_cmd(
|
219 |
pattern="gdfolder$",
|
220 |
fullsudo=True,
|
|
|
226 |
if GDrive.folder_id:
|
227 |
await event.eor(
|
228 |
"`Your G-Drive Folder link : `\n"
|
229 |
+
+ GDrive._create_folder_link(GDrive.folder_id)
|
|
|
230 |
)
|
231 |
else:
|
232 |
await eod(event, "Set FOLDERID from your Assistant bot's Settings ")
|
plugins/giftools.py
CHANGED
@@ -33,7 +33,7 @@ from . import HNDLR, LOGS, bash, downloader, get_string, mediainfo, ultroid_cmd
|
|
33 |
|
34 |
@ultroid_cmd(pattern="(bw|invert)gif$")
|
35 |
async def igif(e):
|
36 |
-
match = e.pattern_match.group(1)
|
37 |
a = await e.get_reply_message()
|
38 |
if not (a and a.media):
|
39 |
return await e.eor("`Reply To gif only`", time=5)
|
@@ -70,9 +70,9 @@ async def reverse_gif(event):
|
|
70 |
os.remove("reversed.mp4")
|
71 |
|
72 |
|
73 |
-
@ultroid_cmd(pattern="gif
|
74 |
async def gifs(ult):
|
75 |
-
get = ult.pattern_match.group(1)
|
76 |
xx = random.randint(0, 5)
|
77 |
n = 0
|
78 |
if ";" in get:
|
|
|
33 |
|
34 |
@ultroid_cmd(pattern="(bw|invert)gif$")
|
35 |
async def igif(e):
|
36 |
+
match = e.pattern_match.group(1).strip()
|
37 |
a = await e.get_reply_message()
|
38 |
if not (a and a.media):
|
39 |
return await e.eor("`Reply To gif only`", time=5)
|
|
|
70 |
os.remove("reversed.mp4")
|
71 |
|
72 |
|
73 |
+
@ultroid_cmd(pattern="gif( (.*)|$)")
|
74 |
async def gifs(ult):
|
75 |
+
get = ult.pattern_match.group(1).strip()
|
76 |
xx = random.randint(0, 5)
|
77 |
n = 0
|
78 |
if ";" in get:
|
plugins/globaltools.py
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
|
17 |
• `{i}listgban` : List all GBanned users.
|
18 |
|
19 |
-
• `{i}gmute` | `{i}ungmute` <reply user/ username
|
20 |
Mute/UnMute Globally.
|
21 |
|
22 |
• `{i}gkick <reply/username>` `Globally Kick User`
|
@@ -29,12 +29,12 @@
|
|
29 |
Add chat to blacklist and ignores global broadcast.
|
30 |
• `{i}ungblacklist` `Remove the chat from blacklist.`
|
31 |
|
32 |
-
|
33 |
globally promote user where you are admin
|
34 |
- Set whether To promote only in groups/channels/all.
|
35 |
-
`
|
36 |
`gpromote @username all sar` ~ promote the user in all group & channel
|
37 |
-
|
38 |
"""
|
39 |
import asyncio
|
40 |
import os
|
@@ -93,9 +93,9 @@ _gdemote_rights = ChatAdminRights(
|
|
93 |
)
|
94 |
|
95 |
|
96 |
-
@ultroid_cmd(pattern="gpromote
|
97 |
async def _(e):
|
98 |
-
x = e.pattern_match.group(1)
|
99 |
ultroid_bot = e.client
|
100 |
if not x:
|
101 |
return await e.eor(get_string("schdl_2"), time=5)
|
@@ -201,9 +201,9 @@ async def _(e):
|
|
201 |
await eor(ev, f"Promoted {name.first_name} in Total : {c} {key} chats.")
|
202 |
|
203 |
|
204 |
-
@ultroid_cmd(pattern="gdemote
|
205 |
async def _(e):
|
206 |
-
x = e.pattern_match.group(1)
|
207 |
ultroid_bot = e.client
|
208 |
if not x:
|
209 |
return await e.eor(get_string("schdl_2"), time=5)
|
@@ -286,10 +286,10 @@ async def _(e):
|
|
286 |
await eor(ev, f"Demoted {name.first_name} in Total : {c} {key} chats.")
|
287 |
|
288 |
|
289 |
-
@ultroid_cmd(pattern="ungban
|
290 |
async def _(e):
|
291 |
xx = await e.eor("`UnGbanning...`")
|
292 |
-
match = e.pattern_match.group(1)
|
293 |
peer = None
|
294 |
if match:
|
295 |
try:
|
@@ -338,7 +338,7 @@ async def _(e):
|
|
338 |
chats += 1
|
339 |
except BaseException as er:
|
340 |
LOGS.exception(er)
|
341 |
-
except ChatAdminRequiredError:
|
342 |
pass
|
343 |
except BaseException as er:
|
344 |
LOGS.exception(er)
|
@@ -350,18 +350,18 @@ async def _(e):
|
|
350 |
)
|
351 |
|
352 |
|
353 |
-
@ultroid_cmd(pattern="gban
|
354 |
async def _(e):
|
355 |
xx = await e.eor("`Gbanning...`")
|
356 |
reason = ""
|
357 |
-
if e.pattern_match.group(1):
|
358 |
-
usr = e.text.split(
|
359 |
try:
|
360 |
userid = await e.client.parse_id(usr)
|
361 |
except ValueError:
|
362 |
userid = usr
|
363 |
try:
|
364 |
-
reason = e.text.split(
|
365 |
except IndexError:
|
366 |
pass
|
367 |
elif e.reply_to_msg_id:
|
@@ -377,7 +377,7 @@ async def _(e):
|
|
377 |
except IndexError:
|
378 |
pass
|
379 |
else:
|
380 |
-
return await xx.eor("`Reply to some msg or add their id.`",
|
381 |
user = None
|
382 |
try:
|
383 |
user = await e.client.get_entity(userid)
|
@@ -418,7 +418,7 @@ async def _(e):
|
|
418 |
chats += 1
|
419 |
except BaseException as er:
|
420 |
LOGS.exception(er)
|
421 |
-
except ChatAdminRequiredError:
|
422 |
pass
|
423 |
except BaseException as er:
|
424 |
LOGS.exception(er)
|
@@ -431,7 +431,7 @@ async def _(e):
|
|
431 |
await xx.edit(gb_msg)
|
432 |
|
433 |
|
434 |
-
@ultroid_cmd(pattern="g(admin|)cast
|
435 |
async def gcast(event):
|
436 |
text, btn, reply = "", None, None
|
437 |
xx = event.pattern_match.group(2)
|
@@ -516,10 +516,10 @@ async def gcast(event):
|
|
516 |
await kk.edit(text)
|
517 |
|
518 |
|
519 |
-
@ultroid_cmd(pattern="gucast
|
520 |
async def gucast(event):
|
521 |
msg, btn, reply = "", None, None
|
522 |
-
xx = event.pattern_match.group(1)
|
523 |
if xx:
|
524 |
msg, btn = get_msg_button(event.text.split(maxsplit=1)[1])
|
525 |
elif event.is_reply:
|
@@ -566,13 +566,13 @@ async def gucast(event):
|
|
566 |
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
567 |
|
568 |
|
569 |
-
@ultroid_cmd(pattern="gkick
|
570 |
async def gkick(e):
|
571 |
xx = await e.eor("`Gkicking...`")
|
572 |
if e.reply_to_msg_id:
|
573 |
userid = (await e.get_reply_message()).sender_id
|
574 |
-
elif e.pattern_match.group(1):
|
575 |
-
userid = await e.client.parse_id(e.pattern_match.group(1))
|
576 |
elif e.is_private:
|
577 |
userid = e.chat_id
|
578 |
else:
|
@@ -598,13 +598,13 @@ async def gkick(e):
|
|
598 |
await xx.edit(f"`Gkicked` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
599 |
|
600 |
|
601 |
-
@ultroid_cmd(pattern="gmute
|
602 |
async def _(e):
|
603 |
xx = await e.eor("`Gmuting...`")
|
604 |
if e.reply_to_msg_id:
|
605 |
userid = (await e.get_reply_message()).sender_id
|
606 |
-
elif e.pattern_match.group(1):
|
607 |
-
userid = await e.client.parse_id(e.pattern_match.group(1))
|
608 |
elif e.is_private:
|
609 |
userid = e.chat_id
|
610 |
else:
|
@@ -633,13 +633,13 @@ async def _(e):
|
|
633 |
await xx.edit(f"`Gmuted` {inline_mention(name)} `in {chats} chats.`")
|
634 |
|
635 |
|
636 |
-
@ultroid_cmd(pattern="ungmute
|
637 |
async def _(e):
|
638 |
xx = await e.eor("`UnGmuting...`")
|
639 |
if e.reply_to_msg_id:
|
640 |
userid = (await e.get_reply_message()).sender_id
|
641 |
-
elif e.pattern_match.group(1):
|
642 |
-
userid = await e.client.parse_id(e.pattern_match.group(1))
|
643 |
elif e.is_private:
|
644 |
userid = e.chat_id
|
645 |
else:
|
@@ -701,7 +701,7 @@ async def list_gengbanned(event):
|
|
701 |
|
702 |
|
703 |
@ultroid_cmd(
|
704 |
-
pattern="gstat
|
705 |
)
|
706 |
async def gstat_(e):
|
707 |
xx = await e.eor(get_string("com_1"))
|
@@ -709,9 +709,9 @@ async def gstat_(e):
|
|
709 |
userid = (await e.get_chat()).id
|
710 |
elif e.reply_to_msg_id:
|
711 |
userid = (await e.get_reply_message()).sender_id
|
712 |
-
elif e.pattern_match.group(1):
|
713 |
try:
|
714 |
-
userid = await e.client.parse_id(e.pattern_match.group(1))
|
715 |
except Exception as err:
|
716 |
return await xx.eor(f"{err}", time=10)
|
717 |
else:
|
|
|
16 |
|
17 |
• `{i}listgban` : List all GBanned users.
|
18 |
|
19 |
+
• `{i}gmute` | `{i}ungmute` <reply user/ username>
|
20 |
Mute/UnMute Globally.
|
21 |
|
22 |
• `{i}gkick <reply/username>` `Globally Kick User`
|
|
|
29 |
Add chat to blacklist and ignores global broadcast.
|
30 |
• `{i}ungblacklist` `Remove the chat from blacklist.`
|
31 |
|
32 |
+
• `{i}gpromote <reply to user> <channel/group/all> <rank>`
|
33 |
globally promote user where you are admin
|
34 |
- Set whether To promote only in groups/channels/all.
|
35 |
+
Eg- `gpromote group boss` ~ promotes user in all grps.
|
36 |
`gpromote @username all sar` ~ promote the user in all group & channel
|
37 |
+
• `{i}gdemote` - `demote user globally`
|
38 |
"""
|
39 |
import asyncio
|
40 |
import os
|
|
|
93 |
)
|
94 |
|
95 |
|
96 |
+
@ultroid_cmd(pattern="gpromote( (.*)|$)", fullsudo=True)
|
97 |
async def _(e):
|
98 |
+
x = e.pattern_match.group(1).strip()
|
99 |
ultroid_bot = e.client
|
100 |
if not x:
|
101 |
return await e.eor(get_string("schdl_2"), time=5)
|
|
|
201 |
await eor(ev, f"Promoted {name.first_name} in Total : {c} {key} chats.")
|
202 |
|
203 |
|
204 |
+
@ultroid_cmd(pattern="gdemote( (.*)|$)", fullsudo=True)
|
205 |
async def _(e):
|
206 |
+
x = e.pattern_match.group(1).strip()
|
207 |
ultroid_bot = e.client
|
208 |
if not x:
|
209 |
return await e.eor(get_string("schdl_2"), time=5)
|
|
|
286 |
await eor(ev, f"Demoted {name.first_name} in Total : {c} {key} chats.")
|
287 |
|
288 |
|
289 |
+
@ultroid_cmd(pattern="ungban( (.*)|$)", fullsudo=True)
|
290 |
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:
|
|
|
338 |
chats += 1
|
339 |
except BaseException as er:
|
340 |
LOGS.exception(er)
|
341 |
+
except (ChatAdminRequiredError, ValueError):
|
342 |
pass
|
343 |
except BaseException as er:
|
344 |
LOGS.exception(er)
|
|
|
350 |
)
|
351 |
|
352 |
|
353 |
+
@ultroid_cmd(pattern="gban( (.*)|$)", fullsudo=True)
|
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)
|
361 |
except ValueError:
|
362 |
userid = usr
|
363 |
try:
|
364 |
+
reason = e.text.split(maxsplit=2)[2]
|
365 |
except IndexError:
|
366 |
pass
|
367 |
elif e.reply_to_msg_id:
|
|
|
377 |
except IndexError:
|
378 |
pass
|
379 |
else:
|
380 |
+
return await xx.eor("`Reply to some msg or add their id.`", time=5)
|
381 |
user = None
|
382 |
try:
|
383 |
user = await e.client.get_entity(userid)
|
|
|
418 |
chats += 1
|
419 |
except BaseException as er:
|
420 |
LOGS.exception(er)
|
421 |
+
except (ChatAdminRequiredError, ValueError):
|
422 |
pass
|
423 |
except BaseException as er:
|
424 |
LOGS.exception(er)
|
|
|
431 |
await xx.edit(gb_msg)
|
432 |
|
433 |
|
434 |
+
@ultroid_cmd(pattern="g(admin|)cast( (.*)|$)", fullsudo=True)
|
435 |
async def gcast(event):
|
436 |
text, btn, reply = "", None, None
|
437 |
xx = event.pattern_match.group(2)
|
|
|
516 |
await kk.edit(text)
|
517 |
|
518 |
|
519 |
+
@ultroid_cmd(pattern="gucast( (.*)|$)", fullsudo=True)
|
520 |
async def gucast(event):
|
521 |
msg, btn, reply = "", None, None
|
522 |
+
xx = event.pattern_match.group(1).strip()
|
523 |
if xx:
|
524 |
msg, btn = get_msg_button(event.text.split(maxsplit=1)[1])
|
525 |
elif event.is_reply:
|
|
|
566 |
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
567 |
|
568 |
|
569 |
+
@ultroid_cmd(pattern="gkick( (.*)|$)", fullsudo=True)
|
570 |
async def gkick(e):
|
571 |
xx = await e.eor("`Gkicking...`")
|
572 |
if e.reply_to_msg_id:
|
573 |
userid = (await e.get_reply_message()).sender_id
|
574 |
+
elif e.pattern_match.group(1).strip():
|
575 |
+
userid = await e.client.parse_id(e.pattern_match.group(1).strip())
|
576 |
elif e.is_private:
|
577 |
userid = e.chat_id
|
578 |
else:
|
|
|
598 |
await xx.edit(f"`Gkicked` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
599 |
|
600 |
|
601 |
+
@ultroid_cmd(pattern="gmute( (.*)|$)", fullsudo=True)
|
602 |
async def _(e):
|
603 |
xx = await e.eor("`Gmuting...`")
|
604 |
if e.reply_to_msg_id:
|
605 |
userid = (await e.get_reply_message()).sender_id
|
606 |
+
elif e.pattern_match.group(1).strip():
|
607 |
+
userid = await e.client.parse_id(e.pattern_match.group(1).strip())
|
608 |
elif e.is_private:
|
609 |
userid = e.chat_id
|
610 |
else:
|
|
|
633 |
await xx.edit(f"`Gmuted` {inline_mention(name)} `in {chats} chats.`")
|
634 |
|
635 |
|
636 |
+
@ultroid_cmd(pattern="ungmute( (.*)|$)", fullsudo=True)
|
637 |
async def _(e):
|
638 |
xx = await e.eor("`UnGmuting...`")
|
639 |
if e.reply_to_msg_id:
|
640 |
userid = (await e.get_reply_message()).sender_id
|
641 |
+
elif e.pattern_match.group(1).strip():
|
642 |
+
userid = await e.client.parse_id(e.pattern_match.group(1).strip())
|
643 |
elif e.is_private:
|
644 |
userid = e.chat_id
|
645 |
else:
|
|
|
701 |
|
702 |
|
703 |
@ultroid_cmd(
|
704 |
+
pattern="gstat( (.*)|$)",
|
705 |
)
|
706 |
async def gstat_(e):
|
707 |
xx = await e.eor(get_string("com_1"))
|
|
|
709 |
userid = (await e.get_chat()).id
|
710 |
elif e.reply_to_msg_id:
|
711 |
userid = (await e.get_reply_message()).sender_id
|
712 |
+
elif e.pattern_match.group(1).strip():
|
713 |
try:
|
714 |
+
userid = await e.client.parse_id(e.pattern_match.group(1).strip())
|
715 |
except Exception as err:
|
716 |
return await xx.eor(f"{err}", time=10)
|
717 |
else:
|
plugins/greetings.py
CHANGED
@@ -186,7 +186,7 @@ async def listgd(event):
|
|
186 |
|
187 |
@ultroid_cmd(pattern="thankmembers (on|off)", groups_only=True)
|
188 |
async def thank_set(event):
|
189 |
-
type_ = event.pattern_match.group(1)
|
190 |
if not type_ or type_ == "":
|
191 |
await eor(
|
192 |
event,
|
|
|
186 |
|
187 |
@ultroid_cmd(pattern="thankmembers (on|off)", groups_only=True)
|
188 |
async def thank_set(event):
|
189 |
+
type_ = event.pattern_match.group(1).strip()
|
190 |
if not type_ or type_ == "":
|
191 |
await eor(
|
192 |
event,
|
plugins/imagetools.py
CHANGED
@@ -522,7 +522,7 @@ async def ultd(event):
|
|
522 |
|
523 |
@ultroid_cmd(pattern="csample (.*)")
|
524 |
async def sampl(ult):
|
525 |
-
color = ult.pattern_match.group(1)
|
526 |
if color:
|
527 |
img = Image.new("RGB", (200, 100), f"{color}")
|
528 |
img.save("csample.png")
|
@@ -592,12 +592,12 @@ async def ultd(event):
|
|
592 |
os.remove(ultt)
|
593 |
|
594 |
|
595 |
-
@ultroid_cmd(pattern="border
|
596 |
async def ok(event):
|
597 |
hm = await event.get_reply_message()
|
598 |
if not (hm and (hm.photo or hm.sticker)):
|
599 |
return await event.eor("`Reply to Sticker or Photo..`")
|
600 |
-
col = event.pattern_match.group(1)
|
601 |
wh = 20
|
602 |
if not col:
|
603 |
col = [255, 255, 255]
|
@@ -620,14 +620,14 @@ async def ok(event):
|
|
620 |
await event.delete()
|
621 |
|
622 |
|
623 |
-
@ultroid_cmd(pattern="pixelator
|
624 |
async def pixelator(event):
|
625 |
reply_message = await event.get_reply_message()
|
626 |
if not (reply_message and reply_message.photo):
|
627 |
return await event.eor("`Reply to a photo`")
|
628 |
hw = 50
|
629 |
try:
|
630 |
-
hw = int(event.pattern_match.group(1))
|
631 |
except (ValueError, TypeError):
|
632 |
pass
|
633 |
msg = await event.eor(get_string("com_1"))
|
|
|
522 |
|
523 |
@ultroid_cmd(pattern="csample (.*)")
|
524 |
async def sampl(ult):
|
525 |
+
color = ult.pattern_match.group(1).strip()
|
526 |
if color:
|
527 |
img = Image.new("RGB", (200, 100), f"{color}")
|
528 |
img.save("csample.png")
|
|
|
592 |
os.remove(ultt)
|
593 |
|
594 |
|
595 |
+
@ultroid_cmd(pattern="border( (.*)|$)")
|
596 |
async def ok(event):
|
597 |
hm = await event.get_reply_message()
|
598 |
if not (hm and (hm.photo or hm.sticker)):
|
599 |
return await event.eor("`Reply to Sticker or Photo..`")
|
600 |
+
col = event.pattern_match.group(1).strip()
|
601 |
wh = 20
|
602 |
if not col:
|
603 |
col = [255, 255, 255]
|
|
|
620 |
await event.delete()
|
621 |
|
622 |
|
623 |
+
@ultroid_cmd(pattern="pixelator( (.*)|$)")
|
624 |
async def pixelator(event):
|
625 |
reply_message = await event.get_reply_message()
|
626 |
if not (reply_message and reply_message.photo):
|
627 |
return await event.eor("`Reply to a photo`")
|
628 |
hw = 50
|
629 |
try:
|
630 |
+
hw = int(event.pattern_match.group(1).strip())
|
631 |
except (ValueError, TypeError):
|
632 |
pass
|
633 |
msg = await event.eor(get_string("com_1"))
|