diff --git a/.env.sample b/.env.sample
index 78e4771d71..4fc517fc99 100644
--- a/.env.sample
+++ b/.env.sample
@@ -3,7 +3,5 @@
API_ID=
API_HASH=
SESSION=
-BOT_TOKEN=
REDIS_URI=
REDIS_PASSWORD=
-LOG_CHANNEL=
diff --git a/.gitignore b/.gitignore
index 9505c4f5f5..c71fb251cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,23 +1,21 @@
.env
venv/
__pycache__
-BOT_TOKEN.session-journal
-BOT_TOKEN.session
+ultroid.session-journal
+ultroid.session
*.mp3
*.webm
*.webp
*.mp4
*.tgs
-logs-ultroid.txt
.vscode/*
-ultroid-log.txt
/*.jpg
/*.png
/*.mp4
addons/
ultroid.log
target/npmlist.json
-node_modules
+node_modules/
glitch_me/
.idea
venv/
diff --git a/Dockerfile b/Dockerfile
index 578ae7aa0c..9426aba95f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,14 +3,17 @@
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in .
-FROM programmingerror/ultroid:v0.0.1
+FROM programmingerror/ultroid:v0.0.2
+
+ENV TZ=Asia/Kolkata
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+RUN apt-get autoremove --purge
RUN git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/
-RUN git clone https://github.com/1Danish-00/glitch_me.git && pip install -e ./glitch_me
WORKDIR /root/TeamUltroid/
RUN pip3 install -r requirements.txt
-RUN npm install -g npm@7.11.2 -g
+RUN npm install -g npm@7.12.1 -g
RUN npm install
RUN npm run build
diff --git a/README.md b/README.md
index 899d8b413c..0e6a7940f8 100644
--- a/README.md
+++ b/README.md
@@ -79,9 +79,6 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
- `API_ID` - Your API_ID from [my.telegram.org](https://my.telegram.org/)
- `API_HASH` - Your API_HASH from [my.telegram.org](https://my.telegram.org/)
- `SESSION` - SessionString for your accounts login session. Get it from [here](#Session-String)
-- `BOT_TOKEN` - The token of your bot from [@BotFather](https://t.me/BotFather)
-- `BOT_USERNAME` - The username of your bot from [@BotFather](https://t.me/BotFather)
-- `LOG_CHANNEL` - A private group/channel id.
- `REDIS_URI` - Redis endpoint URL, from [redislabs](http://redislabs.com/), tutorial [here.](./resources/extras/redistut.md)
- `REDIS_PASSWORD ` - Redis endpoint Password, from [redislabs](http://redislabs.com/), tutorial [here.](./resources/extras/redistut.md)
@@ -102,5 +99,5 @@ Ultroid is licensed under [GNU Affero General Public License](https://www.gnu.or
# Credits
* [![TeamUltroid-Devs](https://img.shields.io/static/v1?label=Teamultroid&message=devs&color=critical)](https://t.me/UltroidDevs)
* [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon)
-* [AndrewLaneX](https://github.com/AndrewLaneX) for [tgcalls.](http://github.com/tgcallsjs/tgcalls)
+* [AndrewLaneX](https://github.com/AndrewLaneX) for [tgcalls-base.](http://github.com/tgcallsjs/tgcalls)
diff --git a/app.json b/app.json
index 0166204dbd..0a3b0a700e 100644
--- a/app.json
+++ b/app.json
@@ -22,10 +22,6 @@
"description": "You api hash, from my.telegram.org or @ScrapperRoBot.",
"value": ""
},
- "BOT_TOKEN": {
- "description": "Make a bot from @BotFather, and enter it's api token here.",
- "value": ""
- },
"SESSION": {
"description": "Your session string. Can be added now, or after deploy. (The bot will NOT work without a session string!!)",
"value": ""
@@ -47,10 +43,6 @@
"description": "Name of your heroku app, given in the first blank on this page. To be added if deploying to heroku ONLY.",
"value": "",
"required": false
- },
- "LOG_CHANNEL": {
- "description": "Create a private group. Add @missrose_bot and your BOT_USERNAME bot. Do /id. Paste that here",
- "value": ""
}
},
"formation": {
diff --git a/assistant/inlinestuff.py b/assistant/inlinestuff.py
index 86a8543bc4..c08921ed02 100644
--- a/assistant/inlinestuff.py
+++ b/assistant/inlinestuff.py
@@ -5,7 +5,8 @@
# PLease read the GNU Affero General Public License in
# .
-from random import randrange
+import base64
+from random import choice
from re import compile as re_compile
from re import findall
from urllib.request import urlopen
@@ -29,6 +30,16 @@
ofox_api = OrangeFoxAPI()
+api1 = base64.b64decode("QUl6YVN5QXlEQnNZM1dSdEI1WVBDNmFCX3c4SkF5NlpkWE5jNkZV").decode(
+ "ascii"
+)
+api2 = base64.b64decode("QUl6YVN5QkYwenhMbFlsUE1wOXh3TVFxVktDUVJxOERnZHJMWHNn").decode(
+ "ascii"
+)
+api3 = base64.b64decode("QUl6YVN5RGRPS253blB3VklRX2xiSDVzWUU0Rm9YakFLSVFWMERR").decode(
+ "ascii"
+)
+
@in_pattern("ofox")
@in_owner
@@ -75,15 +86,13 @@ async def _(e):
],
)
)
- await e.answer(fox)
+ await e.answer(
+ fox, switch_pm="OrangeFox Recovery Search.", switch_pm_param="start"
+ )
else:
- sed = e.builder.article(
- title="Not Found",
- description="Wrong Codename",
- text="OʀᴀɴɢFᴏx Rᴇᴄᴏᴠᴇʀʏ Fᴏʀ Yᴏᴜʀ Pʜᴏɴᴇ Is Eɪᴛʜᴇʀ Nᴏᴛ Oғғɪᴄɪᴀʟʟʏ Bᴜɪʟᴛ Oʀ Yᴏᴜ Hᴀᴠᴇ Eɴᴛᴇʀᴇᴅ Wʀᴏɴɢ Cᴏᴅᴇɴᴀᴍᴇ",
- buttons=Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="ofox ", same_peer=True),
+ await e.answer(
+ [], switch_pm="OrangeFox Recovery Search.", switch_pm_param="start"
)
- await e.answer([sed])
@in_pattern("fl2lnk ?(.*)")
@@ -116,7 +125,7 @@ async def _(e):
title="fl2lnk",
text="File not found",
)
- await e.answer([lnk])
+ await e.answer([lnk], switch_pm="File to Link.", switch_pm_param="start")
@callback(
@@ -145,17 +154,17 @@ async def repo(e):
thumb=wb(ultpic, 0, "image/jpeg", []),
text="• **ULTROID USERBOT** •",
buttons=[
- [Button.url("Repo", url="https://github.com/TeamUltroid/Ultroid")],
[
+ Button.url("Repo", url="https://github.com/TeamUltroid/Ultroid"),
Button.url(
"Addons", url="https://github.com/TeamUltroid/UltroidAddons"
- )
+ ),
],
[Button.url("Support", url="t.me/UltroidSupport")],
],
),
]
- await e.answer(res)
+ await e.answer(res, switch_pm="Ultroid Repo.", switch_pm_param="start")
@in_pattern("go")
@@ -164,13 +173,9 @@ async def gsearch(q_event):
try:
match = q_event.text.split(" ", maxsplit=1)[1]
except IndexError:
- kkkk = q_event.builder.article(
- title="Search Something",
- thumb=wb(gugirl, 0, "image/jpeg", []),
- text="**Gᴏᴏɢʟᴇ Sᴇᴀʀᴄʜ**\n\nYou didn't search anything",
- buttons=Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="go ", same_peer=True),
+ await q_event.answer(
+ [], switch_pm="Google Search. Enter a query!", switch_pm_param="start"
)
- await q_event.answer([kkkk])
searcher = []
page = findall(r"page=\d+", match)
cache = False
@@ -216,7 +221,7 @@ async def gsearch(q_event):
)
except IndexError:
break
- await q_event.answer(searcher)
+ await q_event.answer(searcher, switch_pm="Google Search.", switch_pm_param="start")
@in_pattern("rex")
@@ -251,33 +256,29 @@ async def rextester(event):
description=f"Language-`{lang}` & Code-`{code}`",
text=f"Language:\n`{lang}`\n\nCode:\n`{code}`\n\nResult:\n`{outputt}`\n\nStats:\n`{stats}`",
)
- await event.answer([resultm])
+ await event.answer(
+ [resultm], switch_pm="RexTester.", switch_pm_param="start"
+ )
except UnknownLanguage:
resultm = builder.article(
title="Error", # By @ProgrammingError
description="Invalid language choosen",
text=f"The list of valid languages are\n\n{rex_langs}\n\n\nFormat to use Rextester is `@Yourassistantusername rex langcode|code`",
)
- await event.answer([resultm])
+ await event.answer(
+ [resultm], switch_pm="RexTester. Invalid Language!", switch_pm_param="start"
+ )
@in_pattern("yahoo")
@in_owner
-async def gsearch(q_event):
+async def yahoosearch(q_event):
try:
match = q_event.text.split(" ", maxsplit=1)[1]
except IndexError:
- kkkk = q_event.builder.article(
- title="Search Something",
- thumb=wb(yeah, 0, "image/jpeg", []),
- text="**Yᴀʜᴏᴏ Sᴇᴀʀᴄʜ**\n\nYou didn't search anything",
- buttons=Button.switch_inline(
- "Sᴇᴀʀᴄʜ Aɢᴀɪɴ",
- query="yahoo ",
- same_peer=True,
- ),
+ await q_event.answer(
+ [], switch_pm="Yahoo Search. Enter a query!", switch_pm_param="start"
)
- await q_event.answer([kkkk])
searcher = []
page = findall(r"page=\d+", match)
cache = False
@@ -323,7 +324,7 @@ async def gsearch(q_event):
)
except IndexError:
break
- await q_event.answer(searcher)
+ await q_event.answer(searcher, switch_pm="Yahoo Search.", switch_pm_param="start")
@in_pattern("app")
@@ -332,13 +333,9 @@ async def _(e):
try:
f = e.text.split(" ", maxsplit=1)[1]
except IndexError:
- kkkk = e.builder.article(
- title="Search Something",
- thumb=wb(ps, 0, "image/jpeg", []),
- text="**Pʟᴀʏ Sᴛᴏʀᴇ**\n\nYou didn't search anything",
- buttons=Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="app ", same_peer=True),
+ await e.answer(
+ [], switch_pm="App search. Enter app name!", switch_pm_param="start"
)
- await e.answer([kkkk])
foles = []
aap = search(f)
for z in aap:
@@ -377,7 +374,7 @@ async def _(e):
],
),
)
- await e.answer(foles)
+ await e.answer(foles, switch_pm="Application Searcher.", switch_pm_param="start")
@in_pattern("mods")
@@ -386,21 +383,12 @@ async def _(e):
try:
quer = e.text.split(" ", maxsplit=1)[1]
except IndexError:
- kkkk = e.builder.article(
- title="Search Something",
- text="**Mᴏᴅᴅᴇᴅ Aᴘᴘs**\n\nYou didn't search anything",
- buttons=Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="mods ", same_peer=True),
+ await e.answer(
+ [], switch_pm="Mod Apps Search. Enter app name!", switch_pm_param="start"
)
- await e.answer([kkkk])
page = 1
start = (page - 1) * 3 + 1
- urd = randrange(1, 3)
- if urd == 1:
- da = "AIzaSyAyDBsY3WRtB5YPC6aB_w8JAy6ZdXNc6FU"
- if urd == 2:
- da = "AIzaSyBF0zxLlYlPMp9xwMQqVKCQRq8DgdrLXsg"
- if urd == 3:
- da = "AIzaSyDdOKnwnPwVIQ_lbH5sYE4FoXjAKIQV0DQ"
+ da = choice([api1, api2, api3])
url = f"https://www.googleapis.com/customsearch/v1?key={da}&cx=25b3b50edb928435b&q={quer}&start={start}"
data = requests.get(url).json()
search_items = data.get("items")
@@ -435,7 +423,7 @@ async def _(e):
],
),
)
- await e.answer(modss)
+ await e.answer(modss, switch_pm="Search Mod Applications.", switch_pm_param="start")
@in_pattern("clipart")
@@ -444,16 +432,7 @@ async def clip(e):
try:
quer = e.text.split(" ", maxsplit=1)[1]
except IndexError:
- kkkk = e.builder.article(
- title="Search Something",
- text="**Cʟɪᴘᴀʀᴛ Sᴇᴀʀᴄʜ**\n\nYou didn't search anything",
- buttons=Button.switch_inline(
- "Sᴇᴀʀᴄʜ Aɢᴀɪɴ",
- query="clipart ",
- same_peer=True,
- ),
- )
- await e.answer([kkkk])
+ await e.answer([], switch_pm="ClipArt Search.", switch_pm_param="start")
quer = quer.replace(" ", "+")
sear = f"https://clipartix.com/search/{quer}"
html = urlopen(sear)
@@ -463,4 +442,6 @@ async def clip(e):
hm = []
for res in resul:
hm += [buil.photo(include_media=True, file=res["src"])]
- await e.answer(hm, gallery=True)
+ await e.answer(
+ hm, gallery=True, switch_pm="Clipart Searcher.", switch_pm_param="start"
+ )
diff --git a/assistant/othervars.py b/assistant/othervars.py
index 6dc5ae705d..ebeacf422e 100644
--- a/assistant/othervars.py
+++ b/assistant/othervars.py
@@ -6,7 +6,7 @@
# .
import re
-from os import execl, remove
+from os import remove
import requests
from telegraph import Telegraph
@@ -24,6 +24,42 @@
TOKEN_FILE = "resources/auths/auth_token.txt"
+@callback(re.compile("sndplug_(.*)"))
+async def send(eve):
+ name = (eve.data_match.group(1)).decode("UTF-8")
+ if name.startswith("def"):
+ plug_name = name.replace(f"def_plugin_", "")
+ plugin = f"plugins/{plug_name}.py"
+ buttons = [
+ [
+ Button.inline(
+ "« Pᴀsᴛᴇ »",
+ data=f"pasta-{plugin}",
+ )
+ ],
+ [
+ Button.inline("« Bᴀᴄᴋ", data="back"),
+ Button.inline("••Cʟᴏꜱᴇ••", data="close"),
+ ],
+ ]
+ else:
+ plug_name = name.replace(f"add_plugin_", "")
+ plugin = f"addons/{plug_name}.py"
+ buttons = [
+ [
+ Button.inline(
+ "« Pᴀsᴛᴇ »",
+ data=f"pasta-{plugin}",
+ )
+ ],
+ [
+ Button.inline("« Bᴀᴄᴋ", data="buck"),
+ Button.inline("••Cʟᴏꜱᴇ••", data="close"),
+ ],
+ ]
+ await eve.edit(file=plugin, buttons=buttons)
+
+
@callback("updatenow")
@owner
async def update(eve):
@@ -63,6 +99,18 @@ async def update(eve):
repo.__del__()
return
await eve.edit("`Successfully Updated!\nRestarting, please wait...`")
+ elif Var.HEROKU_API is None:
+ try:
+ ups_rem.pull(ac_br)
+ except GitCommandError:
+ repo.git.reset("--hard", "FETCH_HEAD")
+ await updateme_requirements()
+ await eve.edit(
+ "`Successfully Updated!\nBot is restarting... Wait for a second!`"
+ )
+ os.system("git pull"), os.system(
+ "pip3.9 install -U -r requirements.txt"
+ ), os.execl(sys.executable, sys.executable, "-m", "pyUltroid")
else:
try:
ups_rem.pull(ac_br)
@@ -82,11 +130,10 @@ async def changes(okk):
ac_br = repo.active_branch
changelog, tl_chnglog = await gen_chlog(repo, f"HEAD..upstream/{ac_br}")
changelog_str = changelog + f"\n\nClick the below button to update!"
- tldr_str = tl_chnglog + f"\n\nClick the below button to update!"
if len(changelog_str) > 1024:
await okk.edit(get_string("upd_4"))
file = open(f"ultroid_updates.txt", "w+")
- file.write(tldr_str)
+ file.write(tl_chnglog)
file.close()
await okk.edit(
get_string("upd_5"),
@@ -106,7 +153,7 @@ async def changes(okk):
@callback(re.compile("pasta-(.*)"))
@owner
async def _(e):
- ok = e.data_match.group(1)
+ ok = (e.data_match.group(1)).decode("UTF-8")
hmm = open(ok)
hmmm = hmm.read()
hmm.close()
@@ -116,13 +163,19 @@ async def _(e):
.get("result")
.get("key")
)
+ if ok.startswith("plugins"):
+ buttons = [
+ Button.inline("« Bᴀᴄᴋ", data="back"),
+ Button.inline("••Cʟᴏꜱᴇ••", data="close"),
+ ]
+ else:
+ buttons = [
+ Button.inline("« Bᴀᴄᴋ", data="buck"),
+ Button.inline("••Cʟᴏꜱᴇ••", data="close"),
+ ]
await e.edit(
f"Pasted to Nekobin\n 👉[Link](https://nekobin.com/{key})\n 👉[Raw Link](https://nekobin.com/raw/{key})",
- buttons=Button.switch_inline(
- "Search Again..?",
- query="send ",
- same_peer=True,
- ),
+ buttons=buttons,
link_preview=False,
)
@@ -959,7 +1012,6 @@ async def vcb(event):
f"From This Feature U can play songs in group voice chat\n\n[moreinfo](https://t.me/UltroidUpdates/4)",
buttons=[
[Button.inline("VC Sᴇssɪᴏɴ", data="vcs")],
- [Button.inline("WEBSOCKET", data="vcw")],
[Button.inline("« Bᴀᴄᴋ", data="setter")],
],
link_preview=False,
@@ -994,33 +1046,3 @@ async def name(event):
),
buttons=get_back_button("vcb"),
)
-
-
-@callback("vcw")
-@owner
-async def name(event):
- await event.delete()
- pru = event.sender_id
- var = "WEBSOCKET_URL"
- name = "WEBSOCKET URL"
- async with event.client.conversation(pru) as conv:
- await conv.send_message(
- "**WEBSOCKET URL**\nEnter your websocket url means\n`https://{HEROKU_APP_NAME}.herokuapp.com`\nIn place of HEROKU_APP_NAME put ur heroku app name\n\nUse /cancel to terminate the operation.",
- )
- response = conv.wait_event(events.NewMessage(chats=pru))
- response = await response
- themssg = response.message.message
- if themssg == "/cancel":
- return await conv.send_message(
- "Cancelled!!",
- buttons=get_back_button("vcb"),
- )
- else:
- await setit(event, var, themssg)
- await conv.send_message(
- "{} changed to {}\n\nAfter Setting All Things Do restart".format(
- name,
- themssg,
- ),
- buttons=get_back_button("vcb"),
- )
diff --git a/assistant/pmbot/__init__.py b/assistant/pmbot/__init__.py
index b8e9749d48..1030b843e7 100644
--- a/assistant/pmbot/__init__.py
+++ b/assistant/pmbot/__init__.py
@@ -1,5 +1,5 @@
from pyUltroid.functions.asst_fns import *
-
+from pyUltroid.functions.botchat_db import *
from .. import *
OWNER_NAME = ultroid_bot.me.first_name
diff --git a/assistant/pmbot/banuser.py b/assistant/pmbot/banuser.py
index 4fd8f6ad0e..cc491578d1 100644
--- a/assistant/pmbot/banuser.py
+++ b/assistant/pmbot/banuser.py
@@ -1,12 +1,18 @@
-from . import *
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+from . import *
@asst_cmd("ban")
async def banhammer(event):
x = await event.get_reply_message()
if x is None:
return await event.edit("Please reply to someone to ban him.")
- target = int(udB.get(str(x.id)))
+ target = get_who(x.id)
if not is_blacklisted(target):
blacklist_user(target)
await asst.send_message(event.chat_id, f"#BAN\nUser - {target}")
@@ -23,7 +29,7 @@ async def banhammer(event):
x = await event.get_reply_message()
if x is None:
return await event.edit("Please reply to someone to ban him.")
- target = int(udB.get(str(x.id)))
+ target = get_who(x.id)
if is_blacklisted(target):
rem_blacklist(target)
await asst.send_message(event.chat_id, f"#UNBAN\nUser - {target}")
diff --git a/assistant/pmbot/incoming.py b/assistant/pmbot/incoming.py
index 82899c0faf..ea56e28727 100644
--- a/assistant/pmbot/incoming.py
+++ b/assistant/pmbot/incoming.py
@@ -30,4 +30,4 @@ async def on_new_mssg(event):
return
else:
xx = await event.forward_to(OWNER_ID)
- udB.set(str(xx.id), str(who))
+ add_stuff(xx.id, who)
diff --git a/assistant/pmbot/outgoing.py b/assistant/pmbot/outgoing.py
index e6b30fcd2c..aa1b4ff2bf 100644
--- a/assistant/pmbot/outgoing.py
+++ b/assistant/pmbot/outgoing.py
@@ -23,7 +23,7 @@ async def on_out_mssg(event):
if who == OWNER_ID:
if event.text.startswith("/"):
return
- to_user = udB.get(str(x.id))
+ to_user = get_who(x.id)
if event.media:
if event.text:
await asst.send_file(int(to_user), event.media, caption=event.text)
diff --git a/plugins/__init__.py b/plugins/__init__.py
index b3c6573581..c916626b65 100644
--- a/plugins/__init__.py
+++ b/plugins/__init__.py
@@ -16,6 +16,7 @@
from pyUltroid.functions.google_image import googleimagesdownload
from pyUltroid.functions.sudos import *
from pyUltroid.functions.welcome_db import *
+from pyUltroid.functions.ytdl import *
from pyUltroid.utils import *
from strings import get_string
@@ -29,7 +30,7 @@
start_time = time.time()
-ultroid_version = "v0.0.6"
+ultroid_version = "v0.0.7"
OWNER_NAME = ultroid_bot.me.first_name
OWNER_ID = ultroid_bot.me.id
diff --git a/plugins/_inline.py b/plugins/_inline.py
index 82db751218..44550e893c 100644
--- a/plugins/_inline.py
+++ b/plugins/_inline.py
@@ -5,11 +5,11 @@
# PLease read the GNU Affero General Public License in
# .
-import random
import re
import time
from datetime import datetime
from math import ceil
+from os import remove
from platform import python_version as PyVer
from git import Repo
@@ -22,7 +22,7 @@
# ================================================#
notmine = f"This bot is for {OWNER_NAME}"
-ULTROID_PIC = "https://telegra.ph/file/031957757a4f6a5191040.jpg"
+ULTROID_PIC = "https://telegra.ph/file/115f149ed8e154641708b.jpg"
helps = get_string("inline_1")
add_ons = udB.get("ADDONS")
@@ -30,6 +30,10 @@
zhelps = get_string("inline_2")
else:
zhelps = get_string("inline_3")
+if udB.get("INLINE_PIC"):
+ _file_to_replace = udB.get("INLINE_PIC")
+else:
+ _file_to_replace = "resources/extras/inline.jpg"
# ============================================#
@@ -71,453 +75,486 @@ async def e(o):
await o.answer(res, switch_pm=f"👥 ULTROID PORTAL", switch_pm_param="start")
-if asst.me is not None:
-
- @inline
- @in_owner
- async def inline_handler(event):
- builder = event.builder
- result = None
- query = event.text
- if event.query.user_id in sed and query.startswith("ultd"):
- z = []
- for x in LIST.values():
- for y in x:
- z.append(y)
- cmd = len(z) + 10
- bnn = asst.me.username
- result = builder.article(
- title="Help Menu",
- description="Help Menu - UserBot | Telethon ",
- url="https://t.me/TheUltroid",
- thumb=InputWebDocument(ULTROID_PIC, 0, "image/jpeg", []),
- text=get_string("inline_4").format(
- OWNER_NAME,
- len(PLUGINS) - 5,
- len(ADDONS),
- cmd,
- ),
- buttons=[
- [
- Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
- Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
- ],
- [
- Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
- Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
- ],
- [
- Button.url(
- "⚙️Sᴇᴛᴛɪɴɢs⚙️",
- url=f"https://t.me/{bnn}?start=set",
- ),
- ],
- [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
- ],
- )
- await event.answer([result] if result else None)
- elif event.query.user_id in sed and query.startswith("paste"):
- ok = query.split("-")[1]
- link = f"https://nekobin.com/{ok}"
- link_raw = f"https://nekobin.com/raw/{ok}"
- result = builder.article(
- title="Paste",
- text="Pᴀsᴛᴇᴅ Tᴏ Nᴇᴋᴏʙɪɴ!",
- buttons=[
- [
- Button.url("NekoBin", url=f"{link}"),
- Button.url("Raw", url=f"{link_raw}"),
- ],
- ],
- )
- await event.answer([result] if result else None)
-
- @callback("ownr")
- @owner
- async def setting(event):
- await event.edit(
- buttons=[
- [
- Button.inline("•Pɪɴɢ•", data="pkng"),
- Button.inline("•Uᴘᴛɪᴍᴇ•", data="upp"),
- ],
- [Button.inline("•Rᴇsᴛᴀʀᴛ•", data="rstrt")],
- [Button.inline("<- Bᴀᴄᴋ", data="open")],
- ],
- )
-
- @callback("pkng")
- async def _(event):
- start = datetime.now()
- end = datetime.now()
- ms = (end - start).microseconds / 1000
- pin = f"🌋Pɪɴɢ = {ms}ms"
- await event.answer(pin, cache_time=0, alert=True)
-
- @callback("upp")
- async def _(event):
- uptime = grt(time.time() - start_time)
- pin = f"🙋Uᴘᴛɪᴍᴇ = {uptime}"
- await event.answer(pin, cache_time=0, alert=True)
-
- @callback("inlone")
- @owner
- async def _(e):
- button = [
- [
- Button.switch_inline(
- "Sᴇɴᴅ Oғғɪᴄɪᴀʟ Pʟᴜɢɪɴs",
- query="send",
- same_peer=True,
- ),
- ],
- [
- Button.switch_inline(
- "Pʟᴀʏ Sᴛᴏʀᴇ Aᴘᴘs",
- query="app telegram",
- same_peer=True,
- ),
- Button.switch_inline(
- "Mᴏᴅᴅᴇᴅ Aᴘᴘs",
- query="mods minecraft",
- same_peer=True,
- ),
- ],
+@in_pattern("ultd")
+@in_owner
+async def inline_handler(event):
+ z = []
+ for x in LIST.values():
+ for y in x:
+ z.append(y)
+ cmd = len(z)
+ bnn = asst.me.username
+ result = event.builder.photo(
+ file=_file_to_replace,
+ link_preview=False,
+ text=get_string("inline_4").format(
+ OWNER_NAME,
+ len(PLUGINS),
+ len(ADDONS),
+ cmd,
+ ),
+ buttons=[
[
- Button.switch_inline(
- "Sᴇᴀʀᴄʜ Oɴ Gᴏᴏɢʟᴇ",
- query="go TeamUltroid",
- same_peer=True,
- ),
- Button.switch_inline(
- "Sᴇᴀʀᴄʜ Oɴ Yᴀʜᴏᴏ",
- query="yahoo TeamUltroid",
- same_peer=True,
- ),
+ Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
+ Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
],
[
- Button.switch_inline(
- "YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ",
- query="yt Ed Sheeran Perfect",
- same_peer=True,
- ),
+ Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
+ Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
],
[
- Button.switch_inline(
- "CʟɪᴘAʀᴛ Sᴇᴀʀᴄʜ",
- query="clipart frog",
- same_peer=True,
- ),
- Button.switch_inline(
- "OʀᴀɴɢᴇFᴏx🦊",
- query="ofox beryllium",
- same_peer=True,
- ),
+ Button.url("⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{bnn}?start=set"),
],
+ [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
+ ],
+ )
+ await event.answer([result])
+
+
+@in_pattern("paste")
+@in_owner
+async def _(event):
+ ok = event.text.split(" ")[1]
+ link = "https://nekobin.com/"
+ result = event.builder.article(
+ title="Paste",
+ text="Pᴀsᴛᴇᴅ Tᴏ Nᴇᴋᴏʙɪɴ!",
+ buttons=[
[
- Button.inline(
- "<- Bᴀᴄᴋ",
- data="open",
- ),
+ Button.url("NekoBin", url=f"{link}{ok}"),
+ Button.url("Raw", url=f"{link}raw/{ok}"),
],
- ]
- await e.edit(buttons=button, link_preview=False)
-
- @callback("hrrrr")
- @owner
- async def on_plug_in_callback_query_handler(event):
- xhelps = helps.format(OWNER_NAME, len(PLUGINS) - 5)
- buttons = paginate_help(0, PLUGINS, "helpme")
- await event.edit(f"{xhelps}", buttons=buttons, link_preview=False)
-
- @callback("frrr")
- @owner
- async def addon(event):
- halp = zhelps.format(OWNER_NAME, len(ADDONS))
- if len(ADDONS) > 0:
- buttons = paginate_addon(0, ADDONS, "addon")
- await event.edit(f"{halp}", buttons=buttons, link_preview=False)
- else:
- await event.answer(
- f"• Tʏᴘᴇ `{HNDLR}setredis ADDONS True`\n Tᴏ ɢᴇᴛ ᴀᴅᴅᴏɴs ᴘʟᴜɢɪɴs",
- cache_time=0,
- alert=True,
- )
+ ],
+ )
+ await event.answer([result])
- @callback("rstrt")
- @owner
- async def rrst(ult):
- await restart(ult)
- @callback(
- re.compile(
- rb"helpme_next\((.+?)\)",
- ),
- )
- @owner
- async def on_plug_in_callback_query_handler(event):
- current_page_number = int(event.data_match.group(1).decode("UTF-8"))
- buttons = paginate_help(current_page_number + 1, PLUGINS, "helpme")
- await event.edit(buttons=buttons, link_preview=False)
-
- @callback(
- re.compile(
- rb"helpme_prev\((.+?)\)",
- ),
- )
- @owner
- async def on_plug_in_callback_query_handler(event):
- current_page_number = int(event.data_match.group(1).decode("UTF-8"))
- buttons = paginate_help(current_page_number - 1, PLUGINS, "helpme")
- await event.edit(buttons=buttons, link_preview=False)
-
- @callback(
- re.compile(
- rb"addon_next\((.+?)\)",
- ),
- )
- @owner
- async def on_plug_in_callback_query_handler(event):
- current_page_number = int(event.data_match.group(1).decode("UTF-8"))
- buttons = paginate_addon(current_page_number + 1, ADDONS, "addon")
- await event.edit(buttons=buttons, link_preview=False)
-
- @callback(
- re.compile(
- rb"addon_prev\((.+?)\)",
+@callback("ownr")
+@owner
+async def setting(event):
+ z = []
+ for x in LIST.values():
+ for y in x:
+ z.append(y)
+ cmd = len(z)
+ await event.edit(
+ get_string("inline_4").format(
+ OWNER_NAME,
+ len(PLUGINS),
+ len(ADDONS),
+ cmd,
),
- )
- @owner
- async def on_plug_in_callback_query_handler(event):
- current_page_number = int(event.data_match.group(1).decode("UTF-8"))
- buttons = paginate_addon(current_page_number - 1, ADDONS, "addon")
- await event.edit(buttons=buttons, link_preview=False)
-
- @callback("back")
- @owner
- async def backr(event):
- xhelps = helps.format(OWNER_NAME, len(PLUGINS) - 5)
- current_page_number = int(upage)
- buttons = paginate_help(current_page_number, PLUGINS, "helpme")
- await event.edit(f"{xhelps}", buttons=buttons, link_preview=False)
-
- @callback("buck")
- @owner
- async def backr(event):
- xhelps = zhelps.format(OWNER_NAME, len(ADDONS))
- current_page_number = int(addpage)
- buttons = paginate_addon(current_page_number, ADDONS, "addon")
- await event.edit(f"{xhelps}", buttons=buttons, link_preview=False)
-
- @callback("open")
- @owner
- async def opner(event):
- bnn = asst.me.username
- buttons = [
+ file=_file_to_replace,
+ link_preview=False,
+ buttons=[
[
- Button.inline("• Pʟᴜɢɪɴs ", data="hrrrr"),
- Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
+ Button.inline("•Pɪɴɢ•", data="pkng"),
+ Button.inline("•Uᴘᴛɪᴍᴇ•", data="upp"),
],
[
- Button.inline("Oᴡɴᴇʀ•Tᴏᴏʟꜱ", data="ownr"),
- Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
+ Button.inline("•Rᴇsᴛᴀʀᴛ•", data="rstrt"),
+ Button.inline("•Uᴘᴅᴀᴛᴇ•", data="doupdate"),
],
- [
- Button.url(
- "⚙️Sᴇᴛᴛɪɴɢs⚙️",
- url=f"https://t.me/{bnn}?start={ultroid_bot.me.id}",
- ),
+ [Button.inline("« Bᴀᴄᴋ", data="open")],
+ ],
+ )
+
+
+@callback("doupdate")
+@owner
+async def _(event):
+ check = await updater()
+ if not check:
+ return await event.answer(
+ "You Are Already On Latest Version", cache_time=0, alert=True
+ )
+ repo = Repo.init()
+ ac_br = repo.active_branch
+ changelog, tl_chnglog = await gen_chlog(repo, f"HEAD..upstream/{ac_br}")
+ changelog_str = changelog + f"\n\nClick the below button to update!"
+ if len(changelog_str) > 1024:
+ await event.edit(get_string("upd_4"))
+ file = open(f"ultroid_updates.txt", "w+")
+ file.write(tl_chnglog)
+ file.close()
+ await event.edit(
+ get_string("upd_5"),
+ file="ultroid_updates.txt",
+ buttons=[
+ [Button.inline("• Uᴘᴅᴀᴛᴇ Nᴏᴡ •", data="updatenow")],
+ [Button.inline("« Bᴀᴄᴋ", data="ownr")],
],
- [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
- ]
- z = []
- for x in LIST.values():
- for y in x:
- z.append(y)
- cmd = len(z) + 10
+ )
+ remove(f"ultroid_updates.txt")
+ return
+ else:
await event.edit(
- get_string("inline_4").format(
- OWNER_NAME,
- len(PLUGINS) - 5,
- len(ADDONS),
- cmd,
- ),
- buttons=buttons,
- link_preview=False,
+ changelog_str,
+ buttons=[
+ [Button.inline("Update Now", data="updatenow")],
+ [Button.inline("« Bᴀᴄᴋ", data="ownr")],
+ ],
+ parse_mode="html",
)
- @callback("close")
- @owner
- async def on_plug_in_callback_query_handler(event):
- await event.edit(
- get_string("inline_5"),
- buttons=Button.inline("Oᴘᴇɴ Mᴀɪɴ Mᴇɴᴜ Aɢᴀɪɴ", data="open"),
+
+@callback("pkng")
+async def _(event):
+ start = datetime.now()
+ end = datetime.now()
+ ms = (end - start).microseconds / 1000
+ pin = f"🌋Pɪɴɢ = {ms}ms"
+ await event.answer(pin, cache_time=0, alert=True)
+
+
+@callback("upp")
+async def _(event):
+ uptime = grt(time.time() - start_time)
+ pin = f"🙋Uᴘᴛɪᴍᴇ = {uptime}"
+ await event.answer(pin, cache_time=0, alert=True)
+
+
+@callback("inlone")
+@owner
+async def _(e):
+ button = [
+ [
+ Button.switch_inline(
+ "Pʟᴀʏ Sᴛᴏʀᴇ Aᴘᴘs",
+ query="app telegram",
+ same_peer=True,
+ ),
+ Button.switch_inline(
+ "Mᴏᴅᴅᴇᴅ Aᴘᴘs",
+ query="mods minecraft",
+ same_peer=True,
+ ),
+ ],
+ [
+ Button.switch_inline(
+ "Sᴇᴀʀᴄʜ Oɴ Gᴏᴏɢʟᴇ",
+ query="go TeamUltroid",
+ same_peer=True,
+ ),
+ Button.switch_inline(
+ "Sᴇᴀʀᴄʜ Oɴ Yᴀʜᴏᴏ",
+ query="yahoo TeamUltroid",
+ same_peer=True,
+ ),
+ ],
+ [
+ Button.switch_inline(
+ "WʜɪSᴘᴇʀ",
+ query="msg username wspr Hello",
+ same_peer=True,
+ ),
+ Button.switch_inline(
+ "YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ",
+ query="yt Ed Sheeran Perfect",
+ same_peer=True,
+ ),
+ ],
+ [
+ Button.switch_inline(
+ "CʟɪᴘAʀᴛ Sᴇᴀʀᴄʜ",
+ query="clipart frog",
+ same_peer=True,
+ ),
+ Button.switch_inline(
+ "OʀᴀɴɢᴇFᴏx🦊",
+ query="ofox beryllium",
+ same_peer=True,
+ ),
+ ],
+ [
+ Button.inline(
+ "« Bᴀᴄᴋ",
+ data="open",
+ ),
+ ],
+ ]
+ await e.edit(buttons=button, link_preview=False)
+
+
+@callback("hrrrr")
+@owner
+async def on_plug_in_callback_query_handler(event):
+ xhelps = helps.format(OWNER_NAME, len(PLUGINS))
+ buttons = page_num(0, PLUGINS, "helpme", "def")
+ await event.edit(f"{xhelps}", buttons=buttons, link_preview=False)
+
+
+@callback("frrr")
+@owner
+async def addon(event):
+ halp = zhelps.format(OWNER_NAME, len(ADDONS))
+ if len(ADDONS) > 0:
+ buttons = page_num(0, ADDONS, "addon", "add")
+ await event.edit(f"{halp}", buttons=buttons, link_preview=False)
+ else:
+ await event.answer(
+ f"• Tʏᴘᴇ `{HNDLR}setredis ADDONS True`\n Tᴏ ɢᴇᴛ ᴀᴅᴅᴏɴs ᴘʟᴜɢɪɴs",
+ cache_time=0,
+ alert=True,
)
- @callback(
- re.compile(
- b"us_plugin_(.*)",
- ),
+
+@callback("rstrt")
+@owner
+async def rrst(ult):
+ await restart(ult)
+
+
+@callback(
+ re.compile(
+ rb"helpme_next\((.+?)\)",
+ ),
+)
+@owner
+async def on_plug_in_callback_query_handler(event):
+ current_page_number = int(event.data_match.group(1).decode("UTF-8"))
+ buttons = page_num(current_page_number + 1, PLUGINS, "helpme", "def")
+ await event.edit(buttons=buttons, link_preview=False)
+
+
+@callback(
+ re.compile(
+ rb"helpme_prev\((.+?)\)",
+ ),
+)
+@owner
+async def on_plug_in_callback_query_handler(event):
+ current_page_number = int(event.data_match.group(1).decode("UTF-8"))
+ buttons = page_num(current_page_number - 1, PLUGINS, "helpme", "def")
+ await event.edit(buttons=buttons, link_preview=False)
+
+
+@callback(
+ re.compile(
+ rb"addon_next\((.+?)\)",
+ ),
+)
+@owner
+async def on_plug_in_callback_query_handler(event):
+ current_page_number = int(event.data_match.group(1).decode("UTF-8"))
+ buttons = page_num(current_page_number + 1, ADDONS, "addon", "add")
+ await event.edit(buttons=buttons, link_preview=False)
+
+
+@callback(
+ re.compile(
+ rb"addon_prev\((.+?)\)",
+ ),
+)
+@owner
+async def on_plug_in_callback_query_handler(event):
+ current_page_number = int(event.data_match.group(1).decode("UTF-8"))
+ buttons = page_num(current_page_number - 1, ADDONS, "addon", "add")
+ await event.edit(buttons=buttons, link_preview=False)
+
+
+@callback("back")
+@owner
+async def backr(event):
+ xhelps = helps.format(OWNER_NAME, len(PLUGINS))
+ current_page_number = int(upage)
+ buttons = page_num(current_page_number, PLUGINS, "helpme", "def")
+ await event.edit(
+ f"{xhelps}",
+ file=_file_to_replace,
+ buttons=buttons,
+ link_preview=False,
+ )
+
+
+@callback("buck")
+@owner
+async def backr(event):
+ xhelps = zhelps.format(OWNER_NAME, len(ADDONS))
+ current_page_number = int(upage)
+ buttons = page_num(current_page_number, ADDONS, "addon", "add")
+ await event.edit(
+ f"{xhelps}",
+ file=_file_to_replace,
+ buttons=buttons,
+ link_preview=False,
)
- @owner
- async def on_plug_in_callback_query_handler(event):
- plugin_name = event.data_match.group(1).decode("UTF-8")
- help_string = f"Plugin Name - `{plugin_name}`\n"
- try:
- for i in HELP[plugin_name]:
- help_string += i
- except BaseException:
- pass
- if help_string == "":
- reply_pop_up_alert = f"{plugin_name} has no detailed help..."
- else:
- reply_pop_up_alert = help_string
- reply_pop_up_alert += "\n© @TeamUltroid"
- try:
- if event.query.user_id in sed:
- await event.edit(
- reply_pop_up_alert,
- buttons=[
- Button.inline("<- Bᴀᴄᴋ", data="back"),
- Button.inline("••Cʟᴏꜱᴇ••", data="close"),
- ],
- )
- else:
- reply_pop_up_alert = notmine
- await event.answer(reply_pop_up_alert, cache_time=0)
- except BaseException:
- halps = f"Do .help {plugin_name} to get the list of commands."
- await event.edit(halps)
- @callback(
- re.compile(
- b"add_plugin_(.*)",
+
+@callback("open")
+@owner
+async def opner(event):
+ bnn = asst.me.username
+ buttons = [
+ [
+ Button.inline("• Pʟᴜɢɪɴs ", data="hrrrr"),
+ Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
+ ],
+ [
+ Button.inline("Oᴡɴᴇʀ•Tᴏᴏʟꜱ", data="ownr"),
+ Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
+ ],
+ [
+ Button.url(
+ "⚙️Sᴇᴛᴛɪɴɢs⚙️",
+ url=f"https://t.me/{bnn}?start={ultroid_bot.me.id}",
+ ),
+ ],
+ [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
+ ]
+ z = []
+ for x in LIST.values():
+ for y in x:
+ z.append(y)
+ cmd = len(z) + 10
+ await event.edit(
+ get_string("inline_4").format(
+ OWNER_NAME,
+ len(PLUGINS),
+ len(ADDONS),
+ cmd,
),
+ buttons=buttons,
+ link_preview=False,
)
- @owner
- async def on_plug_in_callback_query_handler(event):
- plugin_name = event.data_match.group(1).decode("UTF-8")
- help_string = ""
+
+
+@callback("close")
+@owner
+async def on_plug_in_callback_query_handler(event):
+ await event.edit(
+ get_string("inline_5"),
+ file=_file_to_replace,
+ buttons=Button.inline("Oᴘᴇɴ Mᴀɪɴ Mᴇɴᴜ Aɢᴀɪɴ", data="open"),
+ )
+
+
+@callback(
+ re.compile(
+ b"def_plugin_(.*)",
+ ),
+)
+@owner
+async def on_plug_in_callback_query_handler(event):
+ plugin_name = event.data_match.group(1).decode("UTF-8")
+ help_string = f"Plugin Name - `{plugin_name}`\n"
+ try:
+ for i in HELP[plugin_name]:
+ help_string += i
+ except BaseException:
+ pass
+ if help_string == "":
+ reply_pop_up_alert = f"{plugin_name} has no detailed help..."
+ else:
+ reply_pop_up_alert = help_string
+ reply_pop_up_alert += "\n© @TeamUltroid"
+ buttons = [
+ [
+ Button.inline(
+ "« Sᴇɴᴅ Pʟᴜɢɪɴ »",
+ data=f"sndplug_{(event.data).decode('UTF-8')}",
+ )
+ ],
+ [
+ Button.inline("« Bᴀᴄᴋ", data="back"),
+ Button.inline("••Cʟᴏꜱᴇ••", data="close"),
+ ],
+ ]
+ try:
+ if event.query.user_id in sed:
+ await event.edit(
+ reply_pop_up_alert,
+ buttons=buttons,
+ )
+ else:
+ reply_pop_up_alert = notmine
+ await event.answer(reply_pop_up_alert, cache_time=0)
+ except BaseException:
+ halps = f"Do .help {plugin_name} to get the list of commands."
+ await event.edit(halps, buttons=buttons)
+
+
+@callback(
+ re.compile(
+ b"add_plugin_(.*)",
+ ),
+)
+@owner
+async def on_plug_in_callback_query_handler(event):
+ plugin_name = event.data_match.group(1).decode("UTF-8")
+ help_string = ""
+ try:
+ for i in HELP[plugin_name]:
+ help_string += i
+ except BaseException:
try:
- for i in HELP[plugin_name]:
- help_string += i
+ for u in CMD_HELP[plugin_name]:
+ help_string = f"Plugin Name-{plugin_name}\n\n✘ Commands Available-\n\n"
+ help_string += str(CMD_HELP[plugin_name])
except BaseException:
try:
- for u in CMD_HELP[plugin_name]:
+ if plugin_name in LIST:
help_string = (
f"Plugin Name-{plugin_name}\n\n✘ Commands Available-\n\n"
)
- help_string += str(CMD_HELP[plugin_name])
+ for d in LIST[plugin_name]:
+ help_string += HNDLR + d
+ help_string += "\n"
except BaseException:
- try:
- if plugin_name in LIST:
- help_string = (
- f"Plugin Name-{plugin_name}\n\n✘ Commands Available-\n\n"
- )
- for d in LIST[plugin_name]:
- help_string += HNDLR + d
- help_string += "\n"
- except BaseException:
- pass
- if help_string == "":
- reply_pop_up_alert = f"{plugin_name} has no detailed help..."
+ pass
+ if help_string == "":
+ reply_pop_up_alert = f"{plugin_name} has no detailed help..."
+ else:
+ reply_pop_up_alert = help_string
+ reply_pop_up_alert += "\n© @TeamUltroid"
+ buttons = [
+ [
+ Button.inline(
+ "« Sᴇɴᴅ Pʟᴜɢɪɴ »",
+ data=f"sndplug_{(event.data).decode('UTF-8')}",
+ )
+ ],
+ [
+ Button.inline("« Bᴀᴄᴋ", data="buck"),
+ Button.inline("••Cʟᴏꜱᴇ••", data="close"),
+ ],
+ ]
+ try:
+ if event.query.user_id in sed:
+ await event.edit(
+ reply_pop_up_alert,
+ buttons=buttons,
+ )
else:
- reply_pop_up_alert = help_string
- reply_pop_up_alert += "\n© @TeamUltroid"
- try:
- if event.query.user_id in sed:
- await event.edit(
- reply_pop_up_alert,
- buttons=[
- Button.inline("<- Bᴀᴄᴋ", data="buck"),
- Button.inline("••Cʟᴏꜱᴇ••", data="close"),
- ],
- )
- else:
- reply_pop_up_alert = notmine
- await event.answer(reply_pop_up_alert, cache_time=0)
- except BaseException:
- halps = f"Do .help {plugin_name} to get the list of commands."
- await event.edit(halps)
+ reply_pop_up_alert = notmine
+ await event.answer(reply_pop_up_alert, cache_time=0)
+ except BaseException:
+ halps = f"Do .help {plugin_name} to get the list of commands."
+ await event.edit(halps, buttons=buttons)
-def paginate_help(page_number, loaded_plugins, prefix):
+def page_num(page_number, loaded_plugins, prefix, type):
number_of_rows = 5
number_of_cols = 2
emoji = Redis("EMOJI_IN_HELP")
if emoji:
- multi, mult2i = emoji, emoji
+ multi = emoji
else:
- multi, mult2i = "✘", "✘"
+ multi = "✘"
helpable_plugins = []
global upage
upage = page_number
for p in loaded_plugins:
- if not p.startswith("_"):
- helpable_plugins.append(p)
- helpable_plugins = sorted(helpable_plugins)
- modules = [
- Button.inline(
- "{} {} {}".format(
- random.choice(list(multi)),
- x,
- random.choice(list(mult2i)),
- ),
- data=f"us_plugin_{x}",
- )
- for x in helpable_plugins
- ]
- pairs = list(zip(modules[::number_of_cols], modules[1::number_of_cols]))
- if len(modules) % number_of_cols == 1:
- pairs.append((modules[-1],))
- max_num_pages = ceil(len(pairs) / number_of_rows)
- modulo_page = page_number % max_num_pages
- if len(pairs) > number_of_rows:
- pairs = pairs[
- modulo_page * number_of_rows : number_of_rows * (modulo_page + 1)
- ] + [
- (
- Button.inline(
- "<- Pʀᴇᴠɪᴏᴜs",
- data=f"{prefix}_prev({modulo_page})",
- ),
- Button.inline("-Bᴀᴄᴋ-", data="open"),
- Button.inline(
- "Nᴇxᴛ ->",
- data=f"{prefix}_next({modulo_page})",
- ),
- ),
- ]
- else:
- pairs = pairs[
- modulo_page * number_of_rows : number_of_rows * (modulo_page + 1)
- ] + [(Button.inline("-Bᴀᴄᴋ-", data="open"),)]
- return pairs
-
-
-def paginate_addon(page_number, loaded_plugins, prefix):
- number_of_rows = 5
- number_of_cols = 2
- emoji = Redis("EMOJI_IN_HELP")
- if emoji:
- multi, mult2i = emoji, emoji
- else:
- multi, mult2i = "✘", "✘"
- helpable_plugins = []
- global addpage
- addpage = page_number
- for p in loaded_plugins:
- if not p.startswith("_"):
- helpable_plugins.append(p)
+ helpable_plugins.append(p)
helpable_plugins = sorted(helpable_plugins)
modules = [
Button.inline(
"{} {} {}".format(
- random.choice(list(multi)),
+ multi,
x,
- random.choice(list(mult2i)),
+ multi,
),
- data=f"add_plugin_{x}",
+ data=f"{type}_plugin_{x}",
)
for x in helpable_plugins
]
@@ -532,12 +569,12 @@ def paginate_addon(page_number, loaded_plugins, prefix):
] + [
(
Button.inline(
- "<- Pʀᴇᴠɪᴏᴜs",
+ "« Pʀᴇᴠɪᴏᴜs",
data=f"{prefix}_prev({modulo_page})",
),
- Button.inline("-Bᴀᴄᴋ-", data="open"),
+ Button.inline("« Bᴀᴄᴋ »", data="open"),
Button.inline(
- "Nᴇxᴛ ->",
+ "Nᴇxᴛ »",
data=f"{prefix}_next({modulo_page})",
),
),
@@ -545,5 +582,5 @@ def paginate_addon(page_number, loaded_plugins, prefix):
else:
pairs = pairs[
modulo_page * number_of_rows : number_of_rows * (modulo_page + 1)
- ] + [(Button.inline("-Bᴀᴄᴋ-", data="open"),)]
+ ] + [(Button.inline("« Bᴀᴄᴋ »", data="open"),)]
return pairs
diff --git a/plugins/_ultroid.py b/plugins/_ultroid.py
index 33a8601ea7..d266299822 100644
--- a/plugins/_ultroid.py
+++ b/plugins/_ultroid.py
@@ -26,5 +26,5 @@ async def repify(e):
await q[0].click(e.chat_id)
if e.sender_id == ultroid_bot.uid:
await e.delete()
- except ChatSendInlineForbiddenError or bmi:
+ except (ChatSendInlineForbiddenError, bmi):
await eor(e, REPOMSG)
diff --git a/plugins/_userlogs.py b/plugins/_userlogs.py
index deae16b21b..b161577d0a 100644
--- a/plugins/_userlogs.py
+++ b/plugins/_userlogs.py
@@ -5,14 +5,20 @@
# PLease read the GNU Affero General Public License in
# .
+import re
+
+from telethon.errors.rpcerrorlist import (
+ ChatWriteForbiddenError,
+ MediaEmptyError,
+ PeerIdInvalidError,
+)
from telethon.utils import get_display_name
-from telethon.errors.rpcerrorlist import MediaEmptyError as mee
-from . import *
-import re
+from . import *
# taglogger
+
@ultroid_bot.on(
events.NewMessage(
incoming=True,
@@ -24,11 +30,11 @@ async def all_messages_catcher(e):
try:
NEEDTOLOG = int(udB.get("TAG_LOG"))
except Exception:
- return LOGS.warning("you given Wrong Grp/Channel ID in TAG_LOG.")
- x = await ultroid_bot.get_entity(e.sender_id)
+ return LOGS.info("you given Wrong Grp/Channel ID in TAG_LOG.")
+ x = e.sender
if x.bot or x.verified:
return
- y = await ultroid_bot.get_entity(e.chat_id)
+ y = e.chat
where_n = get_display_name(y)
who_n = get_display_name(x)
where_l = f"https://t.me/c/{y.id}/{e.id}"
@@ -39,36 +45,54 @@ async def all_messages_catcher(e):
await asst.send_message(
NEEDTOLOG,
send,
- buttons=[[Button.url(who_n, who_l)],[Button.url(where_n, where_l)]],
+ buttons=[
+ [Button.url(who_n, who_l)],
+ [Button.url(where_n, where_l)],
+ ],
)
else:
await asst.send_message(
NEEDTOLOG,
send,
- buttons=[[Button.inline(who_n, data=f"who{x.id}")],[Button.url(where_n, where_l)]],
+ buttons=[
+ [Button.inline(who_n, data=f"who{x.id}")],
+ [Button.url(where_n, where_l)],
+ ],
)
- except mee:
+ except MediaEmptyError:
if x.username:
who_l = f"https://t.me/{x.username}"
await asst.send_message(
NEEDTOLOG,
"`Unsupported Media`",
- buttons=[[Button.url(who_n, who_l)],[Button.url(where_n, where_l)]],
+ buttons=[
+ [Button.url(who_n, who_l)],
+ [Button.url(where_n, where_l)],
+ ],
)
else:
await asst.send_message(
NEEDTOLOG,
"`Unsupported Media`",
- buttons=[[Button.inline(who_n, data=f"who{x.id}")],[Button.url(where_n, where_l)]],
+ buttons=[
+ [Button.inline(who_n, data=f"who{x.id}")],
+ [Button.url(where_n, where_l)],
+ ],
)
+ except PeerIdInvalidError:
+ await ultroid_bot.send_message(
+ int(udB.get("LOG_CHANNEL")),
+ "The Chat Id You Set In Tag Logger Is Wrong , Please Correct It",
+ )
+ except ChatWriteForbiddenError:
+ await ultroid_bot.send_message(NEEDTOLOG, "Please Give Your Assistant Bot")
except Exception as er:
LOGS.info(str(er))
- await ultroid_bot.send_message(NEEDTOLOG, f"Please Add Your Assistant Bot - @{asst.me.username} as admin here.")
else:
return
-@callback(re.compile(b"who(.*)"))
+@callback(re.compile("who(.*)"))
async def _(e):
wah = e.pattern_match.group(1).decode("UTF-8")
y = await ultroid_bot.get_entity(int(wah))
@@ -85,18 +109,13 @@ async def when_asst_added_to_chat(event):
user = await event.get_user()
chat = (await event.get_chat()).title
tmp = event.added_by
- add = tmp.id
- if user.id == (await asst.get_me()).id:
- if add == OWNER_ID:
- # , buttons=Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot"))
- return await asst.send_message(
- Var.LOG_CHANNEL, f"#ADD_LOG\n\nYou had added me to {chat}."
- )
- else:
- # , buttons=Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot"))
- return await asst.send_message(
- Var.LOG_CHANNEL, f"#ADD_LOG\n\n`{add}` added me to {chat}."
- )
+ if user.is_self:
+ buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot")
+ return await asst.send_message(
+ int(udB.get("LOG_CHANNEL")),
+ f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
+ buttons=buttons,
+ )
# log for user's new joins
@@ -108,35 +127,37 @@ async def when_ultd_added_to_chat(event):
user = await event.get_user()
chat = (await event.get_chat()).title
tmp = event.added_by
- add = tmp.id
- if user.id == OWNER_ID:
- # , buttons=Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user"))
+ if user.is_self:
+ buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
return await asst.send_message(
- Var.LOG_CHANNEL, f"#ADD_LOG\n\n`{add}` just added you to {chat}."
+ int(udB.get("LOG_CHANNEL")),
+ f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) just added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
+ buttons=buttons,
)
elif event.user_joined:
user = await event.get_user()
chat = (await event.get_chat()).title
- if user.id == OWNER_ID:
- # , buttons=Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user"))
+ if user.is_self:
+ buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
return await asst.send_message(
- Var.LOG_CHANNEL, f"#JOIN_LOG\n\nYou just joined {chat}."
+ int(udB.get("LOG_CHANNEL")),
+ f"#JOIN_LOG\n\n[{user.first_name}](tg://user?id={user.id}) just joined {chat}.",
+ buttons=buttons,
)
-"""
@callback(
re.compile(
- b"leave_ch_(.*)",
+ "leave_ch_(.*)",
),
)
@owner
async def leave_ch_at(event):
cht = event.data_match.group(1).decode("UTF-8")
ch_id, client = cht.split("|")
+ name = (await event.get_chat()).title
if client == "bot":
- await asst.delete_dialog(ch_id)
+ await asst.delete_dialog(int(ch_id))
elif client == "user":
- await ultroid.delete_dialog(ch_id)
- await event.edit(f"Left `{ch_id}`")
-"""
+ await ultroid_bot.delete_dialog(int(ch_id))
+ await event.edit(f"Left `{name}`")
diff --git a/plugins/_wspr.py b/plugins/_wspr.py
index e453a013bb..0b71e3266e 100644
--- a/plugins/_wspr.py
+++ b/plugins/_wspr.py
@@ -100,7 +100,7 @@ async def _(e):
Button.url("Private", url=f"t.me/{username}"),
Button.switch_inline(
"Secret msg",
- query=f"msg {query} wspr ",
+ query=f"msg {query} wspr Hello 👋",
same_peer=True,
),
]
diff --git a/plugins/admintools.py b/plugins/admintools.py
index 80aec04278..152f667311 100644
--- a/plugins/admintools.py
+++ b/plugins/admintools.py
@@ -9,16 +9,12 @@
✘ Commands Available -
• `{i}promote `
- Promote the user in the chat.
-
-• `{i}demote `
- Demote the user in the chat.
+• `{i}demote`
+ Promote/Demote the user in the chat.
• `{i}ban `
- Ban the user from the chat.
-
-• `{i}unban `
- Unban the user from the chat.
+• `{i}unban`
+ Ban/Unban the user from the chat.
• `{i}kick `
Kick the user from the chat.
@@ -28,11 +24,14 @@
for silent pin use ({i}pin silent).
• `{i}unpin (all) `
- Unpin the message(s) in the chat.
+ Unpin the messages in the chat.
• `{i}pinned`
Get pinned message in the current chat.
+• `{i}autodelete <24h/7d/off>`
+ Enable Auto Delete Messages in Chat.
+
• `{i}listpinned`
Get all pinned messages in current chat.
@@ -42,21 +41,16 @@
• `{i}purgeme `
Purge Only your messages from the replied message.
-• `{i}purgeall `
+• `{i}purgeall`
Delete all msgs of replied user.
-
-• `{i}del `
- Delete the replied message.
-
-• `{i}edit `
- Edit your last message.
"""
import asyncio
from telethon.errors import BadRequestError
-from telethon.errors.rpcerrorlist import UserIdInvalidError
-from telethon.tl.functions.channels import EditAdminRequest
+from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidError
+from telethon.tl.functions.channels import DeleteUserHistoryRequest, EditAdminRequest
+from telethon.tl.functions.messages import SetHistoryTTLRequest
from telethon.tl.types import ChatAdminRights, InputMessagesFilterPinned
from . import *
@@ -317,7 +311,13 @@ async def unp(ult):
async def fastpurger(purg):
chat = await purg.get_input_chat()
match = purg.pattern_match.group(1)
- if match and purg.text[6] == " ":
+ try:
+ ABC = purg.text[6]
+ except IndexError:
+ ABC = None
+ if ABC and purg.text[6] in ["m", "a"]:
+ return
+ if match and not purg.is_reply:
p = 0
async for msg in ultroid_bot.iter_messages(purg.chat_id, limit=int(match)):
await msg.delete()
@@ -408,14 +408,9 @@ async def _(e):
input = (await e.get_reply_message()).sender_id
name = (await e.client.get_entity(input)).first_name
try:
- nos = 0
- async for x in e.client.iter_messages(e.chat_id, from_user=input):
- await e.client.delete_messages(e.chat_id, x)
- nos += 1
- await xx.edit(
- f"**Purged **`{nos}`** msgs of **[{name}](tg://user?id={input})",
- )
- except ValueError:
+ await ultroid_bot(DeleteUserHistoryRequest(e.chat_id, input))
+ await eod(e, f"Successfully Purged All Messages from {name}")
+ except Exception as er:
return await eod(xx, str(er), time=5)
else:
return await eod(
@@ -425,40 +420,6 @@ async def _(e):
)
-@ultroid_cmd(
- pattern="del$",
-)
-async def delete_it(delme):
- msg_src = await delme.get_reply_message()
- if delme.reply_to_msg_id:
- try:
- await msg_src.delete()
- await delme.delete()
- except BaseException:
- await eod(
- delme,
- f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`",
- time=5,
- )
-
-
-@ultroid_cmd(
- pattern="edit",
-)
-async def editer(edit):
- message = edit.text
- chat = await edit.get_input_chat()
- self_id = await ultroid_bot.get_peer_id("me")
- string = str(message[6:])
- i = 1
- async for message in ultroid_bot.iter_messages(chat, self_id):
- if i == 2:
- await message.edit(string)
- await edit.delete()
- break
- i = i + 1
-
-
@ultroid_cmd(pattern="pinned")
async def get_pinned(event):
x = await eor(event, get_string("com_1"))
@@ -503,4 +464,22 @@ async def get_all_pinned(event):
await x.edit(m + a, parse_mode="html")
+@ultroid_cmd(pattern="autodelete ?(.*)", groups_only=True, admins_only=True)
+async def autodelte(ult): # Tg Feature
+ match = ult.pattern_match.group(1)
+ if not match or match not in ["24h", "7d", "off"]:
+ return await eod(ult, "`Please Use Proper Format..`")
+ if match == "24h":
+ tt = 3600 * 24
+ elif match == "7d":
+ tt = 3600 * 24 * 7
+ else:
+ tt = 0
+ try:
+ await ultroid_bot(SetHistoryTTLRequest(ult.chat_id, period=tt))
+ except ChatNotModifiedError:
+ return await eod(ult, f"Auto Delete Setting is Already same to `{match}`")
+ await eor(ult, f"Auto Delete Status Changed to {match} !")
+
+
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/afk.py b/plugins/afk.py
index d20df552b1..d8fc12aac3 100644
--- a/plugins/afk.py
+++ b/plugins/afk.py
@@ -37,7 +37,7 @@
last_afk_msg = {}
afk_start = {}
-LOG = Var.LOG_CHANNEL
+LOG = int(udB.get("LOG_CHANNEL"))
@ultroid_bot.on(events.NewMessage(outgoing=True))
diff --git a/plugins/autocorrect.py b/plugins/autocorrect.py
index 25d4de8e67..c96fa61067 100644
--- a/plugins/autocorrect.py
+++ b/plugins/autocorrect.py
@@ -24,14 +24,14 @@
@ultroid_cmd(pattern="autocorrect")
async def acc(e):
- if not is_fullsudo(ult.sender_id):
+ if not is_fullsudo(e.sender_id):
return await eod(ult, "`This Command Is Sudo Restricted.`")
if Redis("AUTOCORRECT") != "True":
udB.set("AUTOCORRECT", "True")
await eod(e, "AUTOCORRECT Feature On")
else:
udB.delete("AUTOCORRECT")
- await eof(e, "AUTOCORRECT Feature Off")
+ await eod(e, "AUTOCORRECT Feature Off")
@ultroid_bot.on(events.NewMessage(outgoing=True))
diff --git a/plugins/autopic.py b/plugins/autopic.py
index 6055a49dd7..66db7677ea 100644
--- a/plugins/autopic.py
+++ b/plugins/autopic.py
@@ -8,10 +8,10 @@
"""
✘ Commands Available -
-• {i}autopic
+• `{i}autopic `
Will change your profile pic at defined intervals with pics related to the given topic.
-• {i}stoppic
+• `{i}stoppic`
Stop the AutoPic command.
"""
diff --git a/plugins/bot.py b/plugins/bot.py
index 490b229ea9..4225f7a60a 100644
--- a/plugins/bot.py
+++ b/plugins/bot.py
@@ -122,17 +122,16 @@ async def cmds(event):
)
async def restartbt(ult):
if Var.HEROKU_API:
- await eor(ult, "`Restarting..`")
- try:
- await restart(ult)
- except BaseException:
- await bash("pkill python3 && python3 -m pyUltroid")
+ await restart(ult)
else:
await bash("pkill python3 && python3 -m pyUltroid")
@ultroid_cmd(pattern="shutdown")
async def shutdownbot(ult):
+ if not ult.out:
+ if not is_fullsudo(ult.sender_id):
+ return await eod(ult, "`This Command Is Sudo Restricted.`")
try:
dyno = ult.text.split(" ", maxsplit=1)[1]
except IndexError:
@@ -181,7 +180,7 @@ async def heroku_logs(event):
await ultroid.send_file(
event.chat_id,
file="ultroid-heroku.log",
- thumb="resources/extras/logo_rdm.png",
+ thumb="resources/extras/ultroid.jpg",
caption=f"**Ultroid Heroku Logs.**\nPasted [here]({url}) too!",
)
os.remove("ultroid-heroku.log")
@@ -201,7 +200,7 @@ async def def_logs(ult):
await ultroid.send_file(
ult.chat_id,
file="ultroid.log",
- thumb="resources/extras/new_thumb.jpg",
+ thumb="resources/extras/ultroid.jpg",
caption=f"**Ultroid Logs.**\nPasted [here]({url}) too!",
)
await xx.edit("Done")
diff --git a/plugins/broadcast.py b/plugins/broadcast.py
index 7844d0c256..b15cc6f969 100644
--- a/plugins/broadcast.py
+++ b/plugins/broadcast.py
@@ -8,10 +8,10 @@
"""
✘ Commands Available
-• `{i}add `
+• `{i}addch `
Add chat to database. Adds current chat if no id specified.
-• `{i}rem `
+• `{i}remch `
Removes the specified chat (current chat if none specified), or all chats.
• `{i}broadcast `
@@ -30,11 +30,11 @@
from . import *
-@ultroid_cmd(pattern="add ?(.*)", allow_sudo=False)
+@ultroid_cmd(
+ pattern="addch ?(.*)",
+ allow_sudo=False,
+)
async def broadcast_adder(event):
- if len(event.text) > 4:
- if not event.text[4] == " ": # weird fix
- return
msgg = event.pattern_match.group(1)
x = await eor(event, get_string("bd_1"))
aldone = new = crsh = 0
@@ -74,7 +74,7 @@ async def broadcast_adder(event):
return
chat_id = event.chat_id
try:
- if int(chat_id) == Var.LOG_CHANNEL:
+ if int(chat_id) == int(udB.get("LOG_CHANNEL")):
return
except BaseException:
pass
@@ -92,11 +92,11 @@ async def broadcast_adder(event):
await event.delete()
-@ultroid_cmd(pattern="rem ?(.*)", allow_sudo=False)
+@ultroid_cmd(
+ pattern="remch ?(.*)",
+ allow_sudo=False,
+)
async def broadcast_remover(event):
- if len(event.text) > 4:
- if not event.text[4] == " ": # weird fix
- return
chat_id = event.pattern_match.group(1)
x = await eor(event, get_string("com_1"))
if chat_id == "all":
@@ -120,7 +120,9 @@ async def broadcast_remover(event):
await x.delete()
-@ultroid_cmd(pattern="listchannels")
+@ultroid_cmd(
+ pattern="listchannels$",
+)
async def list_all(event):
x = await eor(event, "`Calculating...`")
channels = get_channels()
@@ -153,7 +155,10 @@ async def list_all(event):
await x.edit(msg)
-@ultroid_cmd(pattern="forward ?(.*)", allow_sudo=False)
+@ultroid_cmd(
+ pattern="forward$",
+ allow_sudo=False,
+)
async def forw(event):
if not event.is_reply:
await eor(event, "Reply to a message to broadcast.")
@@ -177,7 +182,7 @@ async def forw(event):
except Exception:
try:
await ultroid_bot.send_message(
- Var.LOG_CHANNEL,
+ int(udB.get("LOG_CHANNEL")),
f"Error in sending at {channel}.",
)
except BaseException:
@@ -189,12 +194,17 @@ async def forw(event):
await x.edit(f"{sent_count} messages sent with {error_count} errors.")
if error_count > 0:
try:
- await ultroid_bot.send_message(Var.LOG_CHANNEL, f"{error_count} Errors")
+ await ultroid_bot.send_message(
+ int(udB.get("LOG_CHANNEL")), f"{error_count} Errors"
+ )
except BaseException:
await x.edit("Set up log channel for checking errors.")
-@ultroid_cmd(pattern="broadcast ?(.*)", allow_sudo=False)
+@ultroid_cmd(
+ pattern="broadcast ?(.*)",
+ allow_sudo=False,
+)
async def sending(event):
x = await eor(event, "`Processing...`")
if not event.is_reply:
@@ -220,7 +230,7 @@ async def sending(event):
except Exception as error:
try:
await ultroid_bot.send_message(
- Var.LOG_CHANNEL,
+ int(udB.get("LOG_CHANNEL")),
f"Error in sending at {channel}.\n\n{error}",
)
except BaseException:
@@ -233,7 +243,7 @@ async def sending(event):
if error_count > 0:
try:
await ultroid_bot.send_message(
- Var.LOG_CHANNEL,
+ int(udB.get("LOG_CHANNEL")),
f"{error_count} Errors",
)
except BaseException:
diff --git a/plugins/calculator.py b/plugins/calculator.py
new file mode 100644
index 0000000000..4d64021b60
--- /dev/null
+++ b/plugins/calculator.py
@@ -0,0 +1,146 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available -
+
+•`{i}calc` - Inline Calculator
+
+"""
+
+import re
+
+from . import *
+
+
+@ultroid_cmd(pattern="calc")
+async def icalc(e):
+ udB.delete("calc")
+ results = await ultroid_bot.inline_query(asst.me.username, "calc")
+ await results[0].click(e.chat_id, silent=True, hide_via=True)
+ await e.delete()
+
+
+@in_pattern("calc")
+@in_owner
+async def _(e):
+ m = [
+ "AC",
+ "C",
+ "⌫",
+ "%",
+ "7",
+ "8",
+ "9",
+ "+",
+ "4",
+ "5",
+ "6",
+ "-",
+ "1",
+ "2",
+ "3",
+ "x",
+ "00",
+ "0",
+ ".",
+ "÷",
+ ]
+ tultd = [Button.inline(f"{x}", data=f"calc{x}") for x in m]
+ lst = list(zip(tultd[::4], tultd[1::4], tultd[2::4], tultd[3::4]))
+ lst.append([Button.inline("=", data="calc=")])
+ calc = e.builder.article("Calc", text="• Ultroid Inline Calculator •", buttons=lst)
+ await e.answer([calc])
+
+
+@callback(re.compile("calc(.*)"))
+@owner
+async def _(e):
+ x = (e.data_match.group(1)).decode()
+ if x == "AC":
+ udB.delete("calc")
+ return await e.edit(
+ "• Ultroid Inline Calculator •",
+ buttons=[Button.inline("Open Calculator Again", data="recalc")],
+ )
+ elif x == "C":
+ udB.delete("calc")
+ return await e.answer("cleared")
+ elif x == "⌫":
+ get = udB.get("calc")
+ if get:
+ udB.set("calc", get[:-1])
+ return await e.answer(str(get[:-1]))
+ elif x == "%":
+ get = udB.get("calc")
+ if get:
+ udB.set("calc", get + "/100")
+ return await e.answer(str(get + "/100"))
+ elif x == "÷":
+ get = udB.get("calc")
+ if get:
+ udB.set("calc", get + "/")
+ return await e.answer(str(get + "/"))
+ elif x == "x":
+ get = udB.get("calc")
+ if get:
+ udB.set("calc", get + "*")
+ return await e.answer(str(get + "*"))
+ elif x == "=":
+ get = udB.get("calc")
+ if get:
+ if get.endswith(("*", ".", "/", "-", "+")):
+ get = get[:-1]
+ out = await calcc(get, e)
+ try:
+ num = float(out)
+ return await e.answer(f"Answer : {num}", cache_time=0, alert=True)
+ except BaseException:
+ udB.delete("calc")
+ return await e.answer("Error", cache_time=0, alert=True)
+ return await e.answer("None")
+ else:
+ get = udB.get("calc")
+ if get:
+ udB.set("calc", get + x)
+ return await e.answer(str(get + x))
+ udB.set("calc", x)
+ return await e.answer(str(x))
+
+
+@callback("recalc")
+@owner
+async def _(e):
+ m = [
+ "AC",
+ "C",
+ "⌫",
+ "%",
+ "7",
+ "8",
+ "9",
+ "+",
+ "4",
+ "5",
+ "6",
+ "-",
+ "1",
+ "2",
+ "3",
+ "x",
+ "00",
+ "0",
+ ".",
+ "÷",
+ ]
+ tultd = [Button.inline(f"{x}", data=f"calc{x}") for x in m]
+ lst = list(zip(tultd[::4], tultd[1::4], tultd[2::4], tultd[3::4]))
+ lst.append([Button.inline("=", data="calc=")])
+ await e.edit("Noice Inline Calculator", buttons=lst)
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/channelhacks.py b/plugins/channelhacks.py
index afa5f1a7e9..c9940f41c5 100644
--- a/plugins/channelhacks.py
+++ b/plugins/channelhacks.py
@@ -49,9 +49,8 @@ async def _(e):
return
x = get_source_channels()
th = await e.get_chat()
- for xs in x:
- if str(th.id) not in str(xs):
- return
+ if str(th.id) not in x:
+ return
y = get_destinations()
for ys in y:
try:
@@ -88,7 +87,7 @@ async def _(e):
return
async for msg in ultroid_bot.iter_messages(int(c), reverse=True):
try:
- await asyncio.sleep(1)
+ await asyncio.sleep(1.3)
await ultroid_bot.send_message(int(d), msg)
except BaseException:
pass
diff --git a/plugins/chats.py b/plugins/chats.py
index 3bf53bc772..4ba371a3ee 100644
--- a/plugins/chats.py
+++ b/plugins/chats.py
@@ -14,10 +14,10 @@
• `{i}getlink`
Get link of group this cmd is used in.
-• `{i}create (b|g|c) `
+• `{i}create (g|b|c) `
Create group woth a specific name.
- b - megagroup/supergroup
- g - small group
+ g - megagroup/supergroup
+ b - small group
c - channel
"""
@@ -47,7 +47,9 @@ async def _(e):
return await eod(xx, "`Cant delete this chat`", time=10)
except no_admin:
return await eod(xx, "`I m not an admin`", time=10)
- await e.client.send_message(Var.LOG_CHANNEL, f"#Deleted\nDeleted {e.chat_id}")
+ await e.client.send_message(
+ int(udB.get("LOG_CHANNEL")), f"#Deleted\nDeleted {e.chat_id}"
+ )
@ultroid_cmd(
diff --git a/plugins/compressor.py b/plugins/compressor.py
new file mode 100644
index 0000000000..1438e13d30
--- /dev/null
+++ b/plugins/compressor.py
@@ -0,0 +1,157 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available -
+
+• `{i}compress `
+ optional `crf` and `stream`
+ Example : `{i}compress 27 | stream` or `{i}compress 28`
+ Encode the replied video according to CRF value.
+ Less CRF == High Quality, More Size
+ More CRF == Low Quality, Less Size
+ CRF Range = 20-51
+ Default = 27
+
+"""
+
+import asyncio
+import os
+import re
+import time
+from datetime import datetime as dt
+
+from hachoir.metadata import extractMetadata
+from hachoir.parser import createParser
+from telethon.tl.types import DocumentAttributeVideo
+
+from . import *
+
+
+@ultroid_cmd(pattern="compress ?((\\d+)(.*)|$)")
+async def _(e):
+ crf = e.pattern_match.group(1)
+ if not crf:
+ crf = 27
+ to_stream = e.pattern_match.group(2)
+ vido = await e.get_reply_message()
+ if vido and vido.media:
+ if "video" in mediainfo(vido.media):
+ if hasattr(vido.media, "document"):
+ vfile = vido.media.document
+ name = vido.file.name
+ else:
+ vfile = vido.media
+ name = ""
+ if not name:
+ name = "video_" + dt.now().isoformat("_", "seconds") + ".mp4"
+ xxx = await eor(e, "`Trying To Download...`")
+ c_time = time.time()
+ file = await downloader(
+ "resources/downloads/" + name,
+ vfile,
+ xxx,
+ c_time,
+ "Downloading " + name + "...",
+ )
+ o_size = os.path.getsize(file.name)
+ d_time = time.time()
+ diff = time_formatter((d_time - c_time) * 1000)
+ file_name = (file.name).split("/")[-1]
+ out = file_name.replace(file_name.split(".")[-1], " compressed.mkv")
+ await xxx.edit(
+ f"`Downloaded {file.name} of {humanbytes(o_size)} in {diff}.\nNow Compressing...`"
+ )
+ x, y = await bash(
+ f'mediainfo --fullscan """{file.name}""" | grep "Frame count"'
+ )
+ total_frames = x.split(":")[1].split("\n")[0]
+ progress = "progress.txt"
+ with open(progress, "w") as fk:
+ pass
+ proce = await asyncio.create_subprocess_shell(
+ f'ffmpeg -hide_banner -loglevel quiet -progress {progress} -i """{file.name}""" -preset ultrafast -c:v libx265 -crf {crf} -map 0:v -c:a aac -map 0:a -c:s copy -map 0:s? """{out}""" -y',
+ stdout=asyncio.subprocess.PIPE,
+ stderr=asyncio.subprocess.PIPE,
+ )
+ while proce.returncode != 0:
+ await asyncio.sleep(3)
+ with open(progress, "r+") as fil:
+ text = fil.read()
+ frames = re.findall("frame=(\\d+)", text)
+ size = re.findall("total_size=(\\d+)", text)
+
+ if len(frames):
+ elapse = int(frames[-1])
+ if len(size):
+ size = int(size[-1])
+ per = elapse * 100 / int(total_frames)
+ progress_str = "`[{0}{1}] {2}%\n`".format(
+ "".join(["●" for i in range(math.floor(per / 5))]),
+ "".join(["" for i in range(20 - math.floor(per / 5))]),
+ round(per, 2),
+ )
+ e_size = humanbytes(size)
+ await xxx.edit(progress_str + "\n" + "`" + e_size + "`")
+ os.remove(file.name)
+ c_size = os.path.getsize(out)
+ f_time = time.time()
+ difff = time_formatter((f_time - d_time) * 1000)
+ await xxx.edit(
+ f"`Compressed {humanbytes(o_size)} to {humanbytes(c_size)} in {difff}\nTrying to Upload...`"
+ )
+ differ = 100 - ((c_size / o_size) * 100)
+ caption = f"**Original Size: **`{humanbytes(o_size)}`\n"
+ caption += f"**Compressed Size: **`{humanbytes(c_size)}`\n"
+ caption += f"**Compression Ratio: **`{differ:.2f}%`\n"
+ caption += f"\n**Time Taken To Compress: **`{difff}`"
+ mmmm = await uploader(
+ out,
+ out,
+ f_time,
+ xxx,
+ "Uploading " + out + "...",
+ )
+ if to_stream and "| stream" in to_stream:
+ metadata = extractMetadata(createParser(out))
+ duration = metadata.get("duration").seconds
+ hi, _ = await bash(f'mediainfo "{out}" | grep "Height"')
+ wi, _ = await bash(f'mediainfo "{out}" | grep "Width"')
+ height = int(hi.split(":")[1].split()[0])
+ width = int(wi.split(":")[1].split()[0])
+ attributes = [
+ DocumentAttributeVideo(
+ duration=duration, w=width, h=height, supports_streaming=True
+ )
+ ]
+ await e.client.send_file(
+ e.chat_id,
+ mmmm,
+ thumb="resources/extras/ultroid.jpg",
+ caption=caption,
+ attributes=attributes,
+ force_document=False,
+ reply_to=e.reply_to_msg_id,
+ )
+ else:
+ await e.client.send_file(
+ e.chat_id,
+ mmmm,
+ thumb="resources/extras/ultroid.jpg",
+ caption=caption,
+ force_document=True,
+ reply_to=e.reply_to_msg_id,
+ )
+ await xxx.delete()
+ os.remove(out)
+ else:
+ await eod(e, "`Reply To Video File Only`")
+ else:
+ await eod(e, "`Reply To Video File Only`")
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/converter.py b/plugins/converter.py
index 478fbb2ffd..2c758821ae 100644
--- a/plugins/converter.py
+++ b/plugins/converter.py
@@ -10,10 +10,10 @@
• `{i}mtoi `
- media to image conversion
+ Media to image conversion
• `{i}mtos `
- convert media to sticker.
+ Convert media to sticker.
• `{i}doc `
Reply to a text msg to save it in a file.
@@ -22,14 +22,12 @@
Reply to a file to reveal it's text.
• `{i}rename `
- rename the file
+ Rename the file
-• `{i}thumbnail `
+ Upload Your file with your custom thumbnail.
"""
-import asyncio
import os
import time
@@ -37,6 +35,8 @@
import requests
from PIL import Image
from telegraph import upload_file as uf
+from telethon.tl.types import MessageMediaDocument as doc
+from telethon.tl.types import MessageMediaPhoto as photu
from . import *
@@ -46,13 +46,21 @@
@ultroid_cmd(pattern="thumbnail$")
async def _(e):
r = await e.get_reply_message()
- if not (r and r.media):
- return await eor(e, "`Reply to img`")
- dl = await ultroid_bot.download_media(r.media)
+ pop = "`Reply to img or file with thumbnail.`"
+ if not r:
+ return await eor(e, pop)
+ if isinstance(r.media, photu):
+ dl = await ultroid_bot.download_media(r.media)
+ elif isinstance(r.media, doc):
+ if r.media.document.thumbs:
+ dl = await ultroid_bot.download_media(r, thumb=-1)
+ else:
+ return await eor(e, pop)
variable = uf(dl)
os.remove(dl)
nn = "https://telegra.ph" + variable[0]
udB.set("CUSTOM_THUMBNAIL", str(nn))
+ await bash(f"wget {nn} -O resources/extras/ultroid.jpg")
await eor(e, f"Added [This]({nn}) As Your Custom Thumbnail", link_preview=False)
@@ -78,17 +86,13 @@ async def imak(event):
else:
file = await event.download_media(reply)
os.rename(file, inp)
- if Redis("CUSTOM_THUMBNAIL"):
- await bash(
- f"wget {Redis('CUSTOM_THUMBNAIL')} -O resources/extras/new_thumb.jpg"
- )
k = time.time()
xxx = await uploader(inp, inp, k, xx, "Uploading...")
await ultroid_bot.send_file(
event.chat_id,
xxx,
force_document=True,
- thumb="resources/extras/new_thumb.jpg",
+ thumb="resources/extras/ultroid.jpg",
caption=f"`{xxx.name}`",
reply_to=reply,
)
@@ -155,11 +159,8 @@ async def _(event):
b.write(str(a.message))
b.close()
await xx.edit(f"**Packing into** `{input_str}`")
- await asyncio.sleep(2)
- await xx.edit(f"**Uploading** `{input_str}`")
- await asyncio.sleep(2)
await event.client.send_file(
- event.chat_id, input_str, thumb="resources/extras/new_thumb.jpg"
+ event.chat_id, input_str, thumb="resources/extras/ultroid.jpg"
)
await xx.delete()
os.remove(input_str)
diff --git a/plugins/core.py b/plugins/core.py
index 3d3ceed48b..36b5438665 100644
--- a/plugins/core.py
+++ b/plugins/core.py
@@ -28,80 +28,14 @@
import os
-from telethon import Button
-
from . import *
-@in_pattern(
- "send ?(.*)",
-)
-@in_owner
-async def inline_handler(event):
- builder = event.builder
- input_str = event.pattern_match.group(1)
- if input_str is None or input_str == "":
- plugs = await event.builder.article(
- title=f"Which plugin?",
- text="No Module",
- buttons=[
- Button.switch_inline(
- "Search Again..?",
- query="send ",
- same_peer=True,
- ),
- ],
- )
- await event.answer(plugs)
- else:
- try:
- ultroid = builder.document(
- f"plugins/{input_str}.py",
- title=f"{input_str}.py",
- description=f"Module {input_str} Found",
- text=f"{input_str}.py use below button to paste in neko and raw..",
- buttons=[
- [
- Button.switch_inline(
- "Search Again..?",
- query="send ",
- same_peer=True,
- ),
- ],
- [
- Button.inline(
- "Paste?",
- data=f"pasta-plugins/{input_str}.py",
- ),
- ],
- ],
- )
- await event.answer([ultroid])
- return
- except BaseException:
- ultroidcode = builder.article(
- title=f"Module {input_str}.py Not Found",
- description=f"No Such Module",
- text=f"No Module Named {input_str}.py",
- buttons=[
- [
- Button.switch_inline(
- "Search Again",
- query="send ",
- same_peer=True,
- ),
- ],
- ],
- )
- await event.answer([ultroidcode])
- return
-
-
@ultroid_cmd(
pattern="install",
)
async def install(event):
- if not is_fullsudo(event.sender_id):
+ if not event.out and not is_fullsudo(event.sender_id):
return await eod(event, "`This Command Is Sudo Restricted.`")
await safeinstall(event)
diff --git a/plugins/devtools.py b/plugins/devtools.py
new file mode 100644
index 0000000000..d9cc1de814
--- /dev/null
+++ b/plugins/devtools.py
@@ -0,0 +1,177 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available -
+
+• `{i}bash `
+ Run linux commands on telegram.
+
+• `{i}eval `
+ Evaluate python commands on telegram.
+
+• `{i}sysinfo`
+ Shows System Info.
+"""
+import io
+import sys
+import traceback
+from os import remove
+
+from carbonnow import Carbon
+
+from . import *
+
+
+@ultroid_cmd(
+ pattern="sysinfo$",
+)
+async def _(e):
+ await eor(e, "`Sending...`")
+ x, y = await bash("neofetch|sed 's/\x1B\\[[0-9;\\?]*[a-zA-Z]//g' >> neo.txt")
+ with open("neo.txt", "r") as neo:
+ p = (neo.read()).replace("\n\n", "")
+ ok = Carbon(code=p)
+ haa = await ok.save("neofetch")
+ await e.client.send_file(e.chat_id, haa)
+ remove("neofetch.jpg")
+ remove("neo.txt")
+
+
+@ultroid_cmd(
+ pattern="bash",
+)
+async def _(event):
+ if not event.out and not is_fullsudo(event.sender_id):
+ return await eor(event, "`This Command Is Sudo Restricted.`")
+ if Redis("I_DEV") != "True":
+ await eor(
+ event,
+ f"Developer Restricted!\nIf you know what this does, and want to proceed\n\n `{HNDLR}setredis I_DEV True`\n\nThis Might Be Dangerous.",
+ )
+ return
+ xx = await eor(event, "`Processing...`")
+ try:
+ cmd = event.text.split(" ", maxsplit=1)[1]
+ except IndexError:
+ return await eod(xx, "`No cmd given`", time=10)
+ reply_to_id = event.message.id
+ if event.reply_to_msg_id:
+ reply_to_id = event.reply_to_msg_id
+ stdout, stderr = await bash(cmd)
+ OUT = f"**☞ BASH\n\n• COMMAND:**\n`{cmd}` \n\n"
+ if stderr:
+ OUT += f"**• ERROR:** \n`{stderr}`\n\n"
+ if stdout:
+ _o = stdout.split("\n")
+ o = "\n".join(_o)
+ OUT += f"**• OUTPUT:**\n`{o}`"
+ if not stderr and not stdout:
+ OUT += f"**• OUTPUT:**\n`Success`"
+ if len(OUT) > 4096:
+ ultd = OUT.replace("`", "").replace("*", "").replace("_", "")
+ with io.BytesIO(str.encode(ultd)) as out_file:
+ out_file.name = "bash.txt"
+ await event.client.send_file(
+ event.chat_id,
+ out_file,
+ force_document=True,
+ thumb="resources/extras/ultroid.jpg",
+ allow_cache=False,
+ caption=f"`{cmd}`",
+ reply_to=reply_to_id,
+ )
+ await xx.delete()
+ else:
+ await eor(xx, OUT)
+
+
+p = print # ignore: pylint
+
+
+@ultroid_cmd(
+ pattern="eval",
+)
+async def _(event):
+ if len(event.text) > 5:
+ if not event.text[5] == " ":
+ return
+ if not event.out and not is_fullsudo(event.sender_id):
+ return await eor(event, "`This Command Is Sudo Restricted.`")
+ if Redis("I_DEV") != "True":
+ await eor(
+ event,
+ f"Developer Restricted!\nIf you know what this does, and want to proceed\n\n {HNDLR}setredis I_DEV True\n\nThis Might Be Dangerous.",
+ )
+ return
+ xx = await eor(event, "`Processing ...`")
+ try:
+ cmd = event.text.split(" ", maxsplit=1)[1]
+ except IndexError:
+ return await eod(xx, "`Give some python cmd`", time=5)
+ if event.reply_to_msg_id:
+ reply_to_id = event.reply_to_msg_id
+ old_stderr = sys.stderr
+ old_stdout = sys.stdout
+ redirected_output = sys.stdout = io.StringIO()
+ redirected_error = sys.stderr = io.StringIO()
+ stdout, stderr, exc = None, None, None
+ reply_to_id = event.message.id
+ try:
+ await aexec(cmd, event)
+ except Exception:
+ exc = traceback.format_exc()
+ stdout = redirected_output.getvalue()
+ stderr = redirected_error.getvalue()
+ sys.stdout = old_stdout
+ sys.stderr = old_stderr
+ evaluation = ""
+ if exc:
+ evaluation = exc
+ elif stderr:
+ evaluation = stderr
+ elif stdout:
+ evaluation = stdout
+ else:
+ evaluation = "Success"
+ final_output = (
+ "__►__ **EVALPy**\n```{}``` \n\n __►__ **OUTPUT**: \n```{}``` \n".format(
+ cmd,
+ evaluation,
+ )
+ )
+ if len(final_output) > 4096:
+ ultd = final_output.replace("`", "").replace("*", "").replace("_", "")
+ with io.BytesIO(str.encode(ultd)) as out_file:
+ out_file.name = "eval.txt"
+ await ultroid_bot.send_file(
+ event.chat_id,
+ out_file,
+ force_document=True,
+ thumb="resources/extras/ultroid.jpg",
+ allow_cache=False,
+ caption=f"```{cmd}```",
+ reply_to=reply_to_id,
+ )
+ await xx.delete()
+ else:
+ await eor(xx, final_output)
+
+
+async def aexec(code, event):
+ e = message = event
+ client = event.client
+ exec(
+ f"async def __aexec(e, client): "
+ + "\n message = event = e"
+ + "".join(f"\n {l}" for l in code.split("\n")),
+ )
+
+ return await locals()["__aexec"](e, e.client)
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/download_upload.py b/plugins/download_upload.py
index 134a180814..a97298032b 100644
--- a/plugins/download_upload.py
+++ b/plugins/download_upload.py
@@ -10,6 +10,7 @@
• `{i}ul `
Upload file to telegram chat.
+ You Can Upload Folders too.
• `{i}ul | stream`
Upload files as stream.
@@ -19,6 +20,8 @@
"""
+import glob
+import os
import time
from datetime import datetime as dt
@@ -107,19 +110,89 @@ async def download(event):
tt = time.time()
if not kk:
return await eod(xx, get_string("udl_3"))
+ elif os.path.isdir(kk):
+ if not os.listdir(kk):
+ return await eod(xx, "`This Directory is Empty.`")
+ ok = glob.glob(f"{kk}/*")
+ kk = [*sorted(ok)]
+ for kk in kk:
+ try:
+ try:
+ res = await uploader(kk, kk, tt, xx, "Uploading...")
+ except MessageNotModifiedError as err:
+ return await xx.edit(str(err))
+ title = kk.split("/")[-1]
+ if title.endswith((".mp3", ".m4a", ".opus", ".ogg")):
+ hmm = " | stream"
+ if " | stream" in hmm:
+ metadata = extractMetadata(createParser(res.name))
+ wi = 512
+ hi = 512
+ duration = 0
+ if metadata.has("width"):
+ wi = metadata.get("width")
+ if metadata.has("height"):
+ hi = metadata.get("height")
+ if metadata.has("duration"):
+ duration = metadata.get("duration").seconds
+ if metadata.has("artist"):
+ artist = metadata.get("artist")
+ else:
+ if udB.get("artist"):
+ artist = udB.get("artist")
+ else:
+ artist = ultroid_bot.first_name
+ if res.name.endswith(tuple([".mkv", ".mp4", ".avi"])):
+ attributes = [
+ DocumentAttributeVideo(
+ w=wi, h=hi, duration=duration, supports_streaming=True
+ )
+ ]
+ elif res.name.endswith(tuple([".mp3", ".m4a", ".opus", ".ogg"])):
+ attributes = [
+ DocumentAttributeAudio(
+ duration=duration,
+ title=title.split(".")[0],
+ performer=artist,
+ )
+ ]
+ else:
+ attributes = None
+ try:
+ x = await event.client.send_file(
+ event.chat_id,
+ res,
+ caption=f"`{title}`",
+ attributes=attributes,
+ supports_streaming=True,
+ thumb="resources/extras/ultroid.jpg",
+ )
+ except BaseException:
+ x = await event.client.send_file(
+ event.chat_id,
+ res,
+ caption=f"`{title}`",
+ thumb="resources/extras/ultroid.jpg",
+ )
+ else:
+ x = await event.client.send_file(
+ event.chat_id,
+ res,
+ caption=f"`{title}`",
+ force_document=True,
+ thumb="resources/extras/ultroid.jpg",
+ )
+ except Exception as ve:
+ return await eor(xx, str(ve))
else:
try:
- if Redis("CUSTOM_THUMBNAIL"):
- await bash(
- f"wget {Redis('CUSTOM_THUMBNAIL')} -O resources/extras/new_thumb.jpg"
- )
try:
res = await uploader(kk, kk, tt, xx, "Uploading...")
except MessageNotModifiedError as err:
return await xx.edit(str(err))
- if " | stream" in hmm and res.name.endswith(
- tuple([".mkv", ".mp4", ".mp3", ".opus", ".m4a", ".ogg"])
- ):
+ if title.endswith((".mp3", ".m4a", ".opus", ".ogg")):
+ hmm = " | stream"
+ if " | stream" in hmm:
metadata = extractMetadata(createParser(res.name))
wi = 512
hi = 512
@@ -131,48 +204,72 @@ async def download(event):
if metadata.has("duration"):
duration = metadata.get("duration").seconds
if metadata.has("artist"):
- metadata.get("artist")
- if res.name.endswith(tuple([".mkv", ".mp4"])):
+ artist = metadata.get("artist")
+ else:
+ if udB.get("artist"):
+ artist = udB.get("artist")
+ else:
+ artist = ultroid_bot.first_name
+ if res.name.endswith(tuple([".mkv", ".mp4", ".avi"])):
attributes = [
DocumentAttributeVideo(
w=wi, h=hi, duration=duration, supports_streaming=True
)
]
- if res.name.endswith(tuple([".mp3", ".m4a", ".opus", ".ogg"])):
+ elif res.name.endswith(tuple([".mp3", ".m4a", ".opus", ".ogg"])):
attributes = [
- DocumentAttributeAudio(duration=duration, title=title)
+ DocumentAttributeAudio(
+ duration=duration,
+ title=title.split(".")[0],
+ performer=artist,
+ )
]
+ else:
+ attributes = None
try:
x = await event.client.send_file(
event.chat_id,
res,
- caption=title,
+ caption=f"`{title}`",
attributes=attributes,
supports_streaming=True,
- thumb="resources/extras/new_thumb.jpg",
+ thumb="resources/extras/ultroid.jpg",
)
except BaseException:
x = await event.client.send_file(
event.chat_id,
res,
- caption=title,
+ caption=f"`{title}`",
force_document=True,
- thumb="resources/extras/new_thumb.jpg",
+ thumb="resources/extras/ultroid.jpg",
)
else:
x = await event.client.send_file(
event.chat_id,
res,
- caption=title,
+ caption=f"`{title}`",
force_document=True,
- thumb="resources/extras/new_thumb.jpg",
+ thumb="resources/extras/ultroid.jpg",
)
except Exception as ve:
return await eor(xx, str(ve))
e = datetime.now()
t = time_formatter(((e - s).seconds) * 1000)
if t != "":
- await eor(xx, f"Uploaded `{kk}` in `{t}`")
+ if os.path.isdir(kk):
+ size = 0
+ for path, dirs, files in os.walk(kk):
+ for f in files:
+ fp = os.path.join(path, f)
+ size += os.path.getsize(fp)
+ c = len(os.listdir(kk))
+ await xx.delete()
+ await ultroid_bot.send_message(
+ event.chat_id,
+ f"Uploaded Total - `{c}` files of `{humanbytes(size)}` in `{t}`",
+ )
+ else:
+ await eor(xx, f"Uploaded `{kk}` in `{t}`")
else:
await eor(xx, f"Uploaded `{kk}` in `0 second(s)`")
diff --git a/plugins/echo.py b/plugins/echo.py
new file mode 100644
index 0000000000..94a44935bf
--- /dev/null
+++ b/plugins/echo.py
@@ -0,0 +1,98 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available
+
+•`{i}addecho `
+ Start Auto Echo message of Replied user.
+
+•`{i}remecho `
+ Turn It off
+
+•`{i}listecho `
+ To Get list.
+
+"""
+
+from pyUltroid.functions.echo_db import *
+from telethon.utils import get_display_name
+
+from . import *
+
+
+@ultroid_cmd(pattern="addecho ?(.*)")
+async def echo(e):
+ r = await e.get_reply_message()
+ if r:
+ user = r.sender_id
+ else:
+ try:
+ user = e.text.split()[1]
+ if user.startswith("@"):
+ ok = await ultroid_bot.get_entity(user)
+ user = ok.id
+ else:
+ user = int(user)
+ except BaseException:
+ return await eod(e, "Reply To A user.")
+ if check_echo(e.chat_id, user):
+ return await eod(e, "Echo already activated for this user.")
+ add_echo(e.chat_id, user)
+ ok = await ultroid_bot.get_entity(user)
+ user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
+ await eor(e, f"Activated Echo For {user}.")
+
+
+@ultroid_cmd(pattern="remecho ?(.*)")
+async def rm(e):
+ r = await e.get_reply_message()
+ if r:
+ user = r.sender_id
+ else:
+ try:
+ user = e.text.split()[1]
+ if user.startswith("@"):
+ ok = await ultroid_bot.get_entity(user)
+ user = ok.id
+ else:
+ user = int(user)
+ except BaseException:
+ return await eod(e, "Reply To A User.")
+ if check_echo(e.chat_id, user):
+ rem_echo(e.chat_id, user)
+ ok = await ultroid_bot.get_entity(user)
+ user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
+ return await eor(e, f"Deactivated Echo For {user}.")
+ await eor(e, "Echo not activated for this user")
+
+
+@ultroid_bot.on(events.NewMessage(incoming=True))
+async def okk(e):
+ if check_echo(e.chat_id, e.sender_id):
+ try:
+ ok = await bot.get_messages(e.chat_id, ids=e.id)
+ return await ultroid_bot.send_message(e.chat_id, ok)
+ except Exception as er:
+ LOGS.info(er)
+
+
+@ultroid_cmd(pattern="listecho$")
+async def lstecho(e):
+ k = list_echo(e.chat_id)
+ if k:
+ user = "**Activated Echo For Users:**\n\n"
+ for x in k:
+ ok = await ultroid_bot.get_entity(int(x))
+ kk = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
+ user += "•" + kk + "\n"
+ await eor(e, user)
+ else:
+ await eod(e, "`List is Empty, For echo`")
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/extra.py b/plugins/extra.py
new file mode 100644
index 0000000000..6843147848
--- /dev/null
+++ b/plugins/extra.py
@@ -0,0 +1,118 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available -
+
+• `{i}del `
+ Delete the replied message.
+
+• `{i}edit `
+ Edit your last message or replied msg.
+
+• `{i}copy `
+ Copy replied message / media.
+
+• `{i}reply`
+ Reply the last sent msg to replied user.
+"""
+
+import asyncio
+
+from telethon.events import NewMessage as NewMsg
+
+from . import *
+
+_new_msgs = {}
+
+
+@ultroid_bot.on(
+ NewMsg(
+ outgoing=True,
+ ),
+)
+async def newmsg(event):
+ if event.message.message == f"{HNDLR}reply":
+ return
+ _new_msgs[event.chat_id] = event.message
+
+
+@ultroid_cmd(
+ pattern="del$",
+)
+async def delete_it(delme):
+ msg_src = await delme.get_reply_message()
+ if delme.reply_to_msg_id:
+ try:
+ await msg_src.delete()
+ await delme.delete()
+ except BaseException:
+ await eod(
+ delme,
+ f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`",
+ time=5,
+ )
+
+
+@ultroid_cmd(
+ pattern="copy$",
+)
+async def copy(e):
+ reply = await e.get_reply_message()
+ if reply:
+ if reply.text and not reply.media:
+ await eor(e, reply.text)
+ else:
+ await reply.reply(reply)
+ if e.sender_id == ultroid_bot.uid:
+ await e.delete()
+ else:
+ await eod(e, "`Reply To any message`")
+
+
+@ultroid_cmd(
+ pattern="edit",
+)
+async def editer(edit):
+ message = edit.text
+ chat = await edit.get_input_chat()
+ string = str(message[6:])
+ reply = await edit.get_reply_message()
+ if reply and reply.text:
+ try:
+ await reply.edit(string)
+ await edit.delete()
+ except BaseException:
+ pass
+ else:
+ i = 1
+ async for message in ultroid_bot.iter_messages(chat, ultroid_bot.uid):
+ if i == 2:
+ await message.edit(string)
+ await edit.delete()
+ break
+ i = i + 1
+
+
+@ultroid_cmd(
+ pattern="reply$",
+)
+async def _(e):
+ if e.reply_to_msg_id and e.chat_id in _new_msgs:
+ msg = _new_msgs[e.chat_id]
+ chat = await e.get_input_chat()
+ await asyncio.wait(
+ [
+ e.client.delete_messages(chat, [e.id, msg.id]),
+ e.client.send_message(chat, msg, reply_to=e.reply_to_msg_id),
+ ]
+ )
+ else:
+ await e.delete()
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/fedutils.py b/plugins/fedutils.py
index c38255934d..b824dd03f3 100644
--- a/plugins/fedutils.py
+++ b/plugins/fedutils.py
@@ -36,11 +36,10 @@
@ultroid_cmd(pattern="superfban ?(.*)")
async def _(event):
msg = await eor(event, "Starting a Mass-FedBan...")
- fedList = []
if event.reply_to_msg_id:
previous_message = await event.get_reply_message()
if previous_message.media:
- downloaded_file_name = await ultroid_bot.download_media(
+ downloaded_file_name = await ultroid.download_media(
previous_message,
"fedlist",
)
@@ -52,58 +51,50 @@ async def _(event):
except BaseException:
pass
arg = event.text.split(" ", maxsplit=2)
- if len(arg) > 2:
+ try:
FBAN = arg[1]
REASON = arg[2]
- else:
- FBAN = arg[1]
- REASON = " #TBMassBanned "
+ except IndexError:
+ try:
+ FBAN = arg[1]
+ except IndexError:
+ return await msg.edit("No user was designated.")
+ REASON = "#TBMassBanned "
else:
FBAN = previous_message.sender_id
try:
REASON = event.text.split(" ", maxsplit=1)[1]
- except BaseException:
- REASON = ""
- if REASON.strip() == "":
- REASON = " #TBMassBanned "
+ except IndexError:
+ REASON = "#TBMassBanned"
else:
arg = event.text.split(" ", maxsplit=2)
- if len(arg) > 2:
- try:
- FBAN = arg[1]
- REASON = arg[2]
- except BaseException:
- return await msg.edit("`No user designated!`")
- else:
+ try:
+ FBAN = arg[1]
+ REASON = arg[2]
+ except IndexError:
try:
FBAN = arg[1]
- REASON = " #TBMassBanned "
except BaseException:
- return await msg.edit("`No user designated!`")
+ return await msg.edit("No user was designated.")
+ REASON = "#TBMassBanned"
try:
- if str(FBAN) in DEVLIST:
- await msg.edit("You can't ban my dev you noob!!")
- return
- elif isinstance(FBAN, str):
- try:
- x = await ultroid_bot(GetFullUserRequest(FBAN))
- uid = x.user.id
- if str(uid) in DEVLIST:
- await msg.edit("You can't ban my dev you noob!!")
- return
- except Exception as e:
- print(str(e))
- return await msg.edit(str(e))
- except Exception as e:
- print(str(e))
- return await msg.edit(str(e))
+ uid = int(FBAN)
+ except ValueError:
+ x = await ultroid(GetFullUserRequest(FBAN))
+ uid = x.user.id
+
+ if str(uid) in DEVLIST:
+ return await msg.edit("The user is my Dev and cannot be FBanned!")
+
if udB.get("FBAN_GROUP_ID"):
chat = int(udB.get("FBAN_GROUP_ID"))
else:
chat = await event.get_chat()
+
+ fedList = []
if not len(fedList):
for a in range(3):
- async with ultroid_bot.conversation("@MissRose_bot") as bot_conv:
+ async with ultroid.conversation("@MissRose_bot") as bot_conv:
await bot_conv.send_message("/start")
await asyncio.sleep(3)
await bot_conv.send_message("/myfeds")
@@ -121,7 +112,7 @@ async def _(event):
fedfile = await bot_conv.get_response()
await asyncio.sleep(3)
if fedfile.media:
- downloaded_file_name = await ultroid_bot.download_media(
+ downloaded_file_name = await ultroid.download_media(
fedfile,
"fedlist",
)
@@ -163,7 +154,7 @@ async def _(event):
return
await msg.edit(f"FBaning in {len(fedList)} feds.")
try:
- await ultroid_bot.send_message(chat, f"/start")
+ await ultroid.send_message(chat, f"/start")
except BaseException:
await msg.edit("Specified FBan Group ID is incorrect.")
return
@@ -175,19 +166,19 @@ async def _(event):
exCount = 0
for fed in fedList:
if udB.get("EXCLUDE_FED") and fed in excludeFed:
- await ultroid_bot.send_message(chat, f"{fed} Excluded.")
+ await ultroid.send_message(chat, f"{fed} Excluded.")
exCount += 1
continue
- await ultroid_bot.send_message(chat, f"/joinfed {fed}")
+ await ultroid.send_message(chat, f"/joinfed {fed}")
await asyncio.sleep(3)
- await ultroid_bot.send_message(chat, f"/fban {FBAN} {REASON}")
+ await ultroid.send_message(chat, f"/fban {uid} {REASON}")
await asyncio.sleep(3)
try:
os.remove("fedlist")
except Exception as e:
print(f"Error in removing FedAdmin file.\n{str(e)}")
await msg.edit(
- f"SuperFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\n Affected {len(fedList) - exCount} feds.\n#TB",
+ f"SuperFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\nAffected {len(fedList) - exCount} feds.\n#TB",
)
@@ -198,7 +189,7 @@ async def _(event):
if event.reply_to_msg_id:
previous_message = await event.get_reply_message()
if previous_message.media:
- downloaded_file_name = await ultroid_bot.download_media(
+ downloaded_file_name = await ultroid.download_media(
previous_message,
"fedlist",
)
@@ -238,20 +229,13 @@ async def _(event):
REASON = " #TBMassUnBanned "
except BaseException:
return await msg.edit("`No user designated!`")
- try:
- if str(FBAN) in DEVLIST:
- await msg.edit("You can't ban my dev you noob!!")
- return
- except Exception as e:
- print(str(e))
- return await msg.edit(str(e))
if udB.get("FBAN_GROUP_ID"):
chat = int(udB.get("FBAN_GROUP_ID"))
else:
chat = await event.get_chat()
if not len(fedList):
for a in range(3):
- async with ultroid_bot.conversation("@MissRose_bot") as bot_conv:
+ async with ultroid.conversation("@MissRose_bot") as bot_conv:
await bot_conv.send_message("/start")
await asyncio.sleep(3)
await bot_conv.send_message("/myfeds")
@@ -269,7 +253,7 @@ async def _(event):
fedfile = await bot_conv.get_response()
await asyncio.sleep(3)
if fedfile.media:
- downloaded_file_name = await ultroid_bot.download_media(
+ downloaded_file_name = await ultroid.download_media(
fedfile,
"fedlist",
)
@@ -311,7 +295,7 @@ async def _(event):
return
await msg.edit(f"UnFBaning in {len(fedList)} feds.")
try:
- await ultroid_bot.send_message(chat, f"/start")
+ await ultroid.send_message(chat, f"/start")
except BaseException:
await msg.edit("Specified FBan Group ID is incorrect.")
return
@@ -323,12 +307,12 @@ async def _(event):
exCount = 0
for fed in fedList:
if udB.get("EXCLUDE_FED") and fed in excludeFed:
- await ultroid_bot.send_message(chat, f"{fed} Excluded.")
+ await ultroid.send_message(chat, f"{fed} Excluded.")
exCount += 1
continue
- await ultroid_bot.send_message(chat, f"/joinfed {fed}")
+ await ultroid.send_message(chat, f"/joinfed {fed}")
await asyncio.sleep(3)
- await ultroid_bot.send_message(chat, f"/unfban {FBAN} {REASON}")
+ await ultroid.send_message(chat, f"/unfban {FBAN} {REASON}")
await asyncio.sleep(3)
try:
os.remove("fedlist")
diff --git a/plugins/filter.py b/plugins/filter.py
index f41e044a41..44ff97c029 100644
--- a/plugins/filter.py
+++ b/plugins/filter.py
@@ -22,6 +22,7 @@
from pyUltroid.functions.filter_db import *
from telegraph import upload_file as uf
+from telethon.tl.types import User
from telethon.utils import pack_bot_file_id
from . import *
@@ -81,6 +82,8 @@ async def lsnote(e):
@ultroid_bot.on(events.NewMessage())
async def fl(e):
+ if isinstance(e.sender, User) and e.sender.bot:
+ return
xx = (e.text).lower()
chat = e.chat_id
x = get_filter(int(chat))
diff --git a/plugins/forcesubscribe.py b/plugins/forcesubscribe.py
new file mode 100644
index 0000000000..4aae24d293
--- /dev/null
+++ b/plugins/forcesubscribe.py
@@ -0,0 +1,143 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+
+"""
+✘ Commands Available -
+
+• `{i}fsub `
+ Enable ForceSub in Used Chat !
+
+• `{i}checkfsub`
+ Check/Get Active ForceSub Setting of Used Chat.
+
+• `{i}remfsub`
+ Remove ForceSub from Used Chat !
+
+ Note - You Need to be Admin in Both Channel/Chats
+ in order to Use ForceSubscribe.
+"""
+
+
+import re
+
+from pyUltroid.functions.forcesub_db import *
+from telethon import events
+from telethon.errors.rpcerrorlist import UserNotParticipantError
+from telethon.tl.custom import Button
+from telethon.tl.functions.channels import GetParticipantRequest
+from telethon.tl.functions.messages import ExportChatInviteRequest
+
+from . import *
+
+
+@ultroid_bot.on(events.ChatAction())
+async def forcesub(ult):
+ if not udB.get("FORCESUB"):
+ return
+ if not (ult.user_joined or ult.user_added):
+ return
+ if not get_forcesetting(ult.chat_id):
+ return
+ user = await ult.get_user()
+ if user.bot:
+ return
+ joinchat = get_forcesetting(ult.chat_id)
+ try:
+ await ultroid_bot(GetParticipantRequest(int(joinchat), user.id))
+ except UserNotParticipantError:
+ await ultroid_bot.edit_permissions(ult.chat_id, user.id, send_messages=False)
+ res = await ultroid_bot.inline_query(
+ asst.me.username, f"fsub {user.id}_{joinchat}"
+ )
+ await res[0].click(ult.chat_id, reply_to=ult.action_message.id)
+
+
+@ultroid_cmd(pattern="fsub ?(.*)", admins_only=True, groups_only=True)
+async def addfor(e):
+ match = e.pattern_match.group(1)
+ if not match:
+ return await eod(e, "Give Channel where you want User to Join !")
+ if match.startswith("@"):
+ ch = match
+ else:
+ try:
+ ch = int(match)
+ except BaseException:
+ return await eod(e, "Give Correct Channel Username or id")
+ try:
+ match = (await ultroid_bot.get_entity(ch)).id
+ except BaseException:
+ return await eod(e, "Give Correct Channel Username or id")
+ if not str(match).startswith("-100"):
+ match = int("-100" + str(match))
+ add_forcesub(e.chat_id, match)
+ await eor(e, "Added ForceSub in This Chat !")
+
+
+@ultroid_cmd(pattern="remfsub$")
+async def remor(e):
+ res = rem_forcesub(e.chat_id)
+ if not res:
+ return await eod(e, "ForceSub was not Active in this Chat !")
+ await eor(e, "Removed ForceSub...")
+
+
+@ultroid_cmd(pattern="checkfsub$")
+async def getfsr(e):
+ res = get_forcesetting(e.chat_id)
+ if not res:
+ return await eod(e, "ForceSub is Not Active In This Chat !")
+ cha = await ultroid_bot.get_entity(int(res))
+ await eor(e, f"**ForceSub Status** : `Active`\n- **{cha.title}** `({res})`")
+
+
+@in_pattern("fsub ?(.*)")
+@in_owner
+async def fcall(e):
+ match = e.pattern_match.group(1)
+ spli = match.split("_")
+ user = await ultroid_bot.get_entity(int(spli[0]))
+ cl = await ultroid_bot.get_entity(int(spli[1]))
+ text = f"Hi [{user.first_name}](tg://user?id={user.id}), You Need to Join"
+ text += f" {cl.title} in order to Chat in this Group."
+ if not cl.username:
+ el = (await ultroid_bot(ExportChatInviteRequest(cl))).link
+ else:
+ el = "https://t.me/" + cl.username
+ res = [
+ await e.builder.article(
+ title="forcesub",
+ text=text,
+ buttons=[
+ [Button.url(text="Join Channel", url=el)],
+ [Button.inline("Unmute Me", data=f"unm_{match}")],
+ ],
+ )
+ ]
+ await e.answer(res)
+
+
+@callback(re.compile("unm_(.*)"))
+async def diesoon(e):
+ match = (e.data_match.group(1)).decode("UTF-8")
+ spli = match.split("_")
+ if not e.sender_id == int(spli[0]):
+ return await e.answer("This Message is Not for You", alert=True)
+ try:
+ await ultroid_bot(GetParticipantRequest(int(spli[1]), int(spli[0])))
+ except UserNotParticipantError:
+ return await e.answer(
+ "Please Join That Channel !\nThen Click This Button !", alert=True
+ )
+ await ultroid_bot.edit_permissions(
+ e.chat_id, int(spli[0]), send_messages=True, until_date=None
+ )
+ await e.edit("Thanks For Joining ! ")
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/giftools.py b/plugins/giftools.py
new file mode 100644
index 0000000000..86c17b83a6
--- /dev/null
+++ b/plugins/giftools.py
@@ -0,0 +1,137 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available
+
+•`{i}invertgif`
+ Make Gif Inverted(negative).
+
+•`{i}bwgif`
+ Make Gif black and white
+
+•`{i}vtog`
+ Reply To Video , It will Create Gif
+ Video to Gif
+
+•`{i}gif `
+ Send video regarding to query.
+"""
+
+
+import os
+import random
+import time
+from datetime import datetime as dt
+
+from . import *
+
+
+@ultroid_cmd(pattern="bwgif$")
+async def igif(e):
+ a = await e.get_reply_message()
+ if not (a and a.media):
+ return await eod(e, "`Reply To gif only`")
+ wut = mediainfo(a.media)
+ if "gif" not in wut:
+ return await eod(e, "`Reply To Gif Only`")
+ xx = await eor(e, "`Processing...`")
+ z = await ultroid_bot.download_media(a.media)
+ try:
+ await bash(f'ffmpeg -i "{z}" -vf format=gray ult.gif -y')
+ await e.client.send_file(e.chat_id, "ult.gif", support_stream=True)
+ os.remove(z)
+ os.remove("ult.gif")
+ await xx.delete()
+ except Exception as er:
+ LOGS.info(er)
+
+
+@ultroid_cmd(pattern="invertgif$")
+async def igif(e):
+ a = await e.get_reply_message()
+ if not (a and a.media):
+ return await eod(e, "`Reply To gif only`")
+ wut = mediainfo(a.media)
+ if "gif" not in wut:
+ return await eod(e, "`Reply To Gif Only`")
+ xx = await eor(e, "`Processing...`")
+ z = await ultroid_bot.download_media(a.media)
+ try:
+ await bash(
+ f'ffmpeg -i "{z}" -vf lutyuv="y=negval:u=negval:v=negval" ult.gif -y'
+ )
+ await e.client.send_file(e.chat_id, "ult.gif", support_stream=True)
+ os.remove(z)
+ os.remove("ult.gif")
+ await xx.delete()
+ except Exception as er:
+ LOGS.info(er)
+
+
+@ultroid_cmd(pattern="gif ?(.*)")
+async def gifs(ult):
+ get = ult.pattern_match.group(1)
+ xx = random.randint(0, 5)
+ n = 0
+ if ";" in get:
+ try:
+ n = int(get.split(";")[-1])
+ except BaseException:
+ pass
+ if not get:
+ return await eor(ult, "`{i}gif `")
+ m = await eor(ult, "`Searching gif ...`")
+ gifs = await ultroid_bot.inline_query("gif", get)
+ if not n:
+ await gifs[xx].click(
+ ult.chat.id, reply_to=ult.reply_to_msg_id, silent=True, hide_via=True
+ )
+ else:
+ for x in range(n):
+ await gifs[x].click(
+ ult.chat.id, reply_to=ult.reply_to_msg_id, silent=True, hide_via=True
+ )
+ await m.delete()
+
+
+@ultroid_cmd(pattern="vtog$")
+async def vtogif(e):
+ a = await e.get_reply_message()
+ if not (a and a.media):
+ return await eod(e, "`Reply To video only`")
+ wut = mediainfo(a.media)
+ if "video" not in wut:
+ return await eod(e, "`Reply To Video Only`")
+ xx = await eor(e, "`Processing...`")
+ dur = a.media.document.attributes[0].duration
+ tt = time.time()
+ if int(dur) < 120:
+ z = await ultroid_bot.download_media(a.media)
+ await bash(
+ f'ffmpeg -i {z} -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 ult.gif -y'
+ )
+ await e.client.send_file(e.chat_id, "ult.gif", support_stream=True)
+ os.remove(z)
+ os.remove("ult.gif")
+ await xx.delete()
+ else:
+ filename = a.file.name
+ if not filename:
+ filename = "video_" + dt.now().isoformat("_", "seconds") + ".mp4"
+ vid = await downloader(filename, a.media.document, xx, tt, "Downloading...")
+ z = vid.name
+ await bash(
+ f'ffmpeg -ss 3 -t 100 -i {z} -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 ult.gif'
+ )
+ await e.client.send_file(e.chat_id, "ult.gif", support_stream=True)
+ os.remove(z)
+ os.remove("ult.gif")
+ await xx.delete()
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/globaltools.py b/plugins/globaltools.py
index 814999db08..ad54e78233 100644
--- a/plugins/globaltools.py
+++ b/plugins/globaltools.py
@@ -9,19 +9,18 @@
✘ Commands Available -
• `{i}gban `
- Globally Ban User.
+• `{i}ungban`
+ Ban/Unban Globally.
-• `{i}ungban `
- Unban Globally.
+• `{i}gstat `
+ Check if user is GBanned.
• `{i}listgban`
List all GBanned users.
• `{i}gmute `
- Globally Mute the User.
-
-• `{i}ungmute `
- UnMute Globally.
+• `{i}ungmute`
+ Mute/UnMute Globally.
• `{i}gkick `
Globally Kick User.
@@ -31,15 +30,372 @@
• `{i}gucast `
Globally Send that msg in all Ur Chat Users.
+
+•`{i}gpromote `
+ globally promote user where you are admin.
+ You can also set where To promote only groups or only channels or all.
+ Like. `gpromote group boss` ~ it promote repied user in all groups.
+ Or. `gpromote @username all sar` ~ it promote the users in all group and channel.
+
+•`{i}gdemote`
+ Same function as gpromote.
"""
import os
from telethon import events
+from telethon.tl.functions.channels import EditAdminRequest
+from telethon.tl.types import ChatAdminRights
from . import *
+@ultroid_cmd(pattern="gpromote ?(.*)")
+async def _(e):
+ if not e.out and not is_fullsudo(e.sender_id):
+ return await eod(e, "`This Command Is Sudo Restricted.`")
+ x = e.pattern_match.group(1)
+ if not x:
+ return await eod(e, "`Incorrect Format`")
+ user = await e.get_reply_message()
+ if user:
+ ev = await eor(e, "`Promoting Replied User Globally`")
+ ok = e.text.split()
+ key = "all"
+ if len(ok) > 1:
+ if ("group" in ok[1]) or ("channel" in ok[1]):
+ key = ok[1]
+ rank = "AdMin"
+ if len(ok) > 2:
+ rank = ok[2]
+ c = 0
+ if e.is_private:
+ user.id = user.peer_id.user_id
+ else:
+ user.id = user.from_id.user_id
+ async for x in ultroid_bot.iter_dialogs():
+ if "group" in key.lower():
+ if x.is_group:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user.id,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=True,
+ change_info=False,
+ ban_users=True,
+ delete_messages=True,
+ pin_messages=True,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ elif "channel" in key.lower():
+ if x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user.id,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=True,
+ change_info=False,
+ ban_users=True,
+ delete_messages=True,
+ pin_messages=True,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ else:
+ if x.is_group or x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user.id,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=True,
+ change_info=False,
+ ban_users=True,
+ delete_messages=True,
+ pin_messages=True,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except Exception as er:
+ LOGS.info(er)
+ return await eor(ev, f"Promoted The Replied Users in Total : {c} {key} chats")
+ else:
+ k = e.text.split()
+ if not k[1]:
+ return await eod(e, "`Give someone's username/id or replied to user.")
+ user = k[1]
+ if user.isdigit():
+ user = int(user)
+ try:
+ name = await ultroid_bot.get_entity(user)
+ except BaseException:
+ return await eod(e, f"`No User Found Regarding {user}`")
+ ev = await eor(e, f"`Promoting {name.first_name} globally.`")
+ key = "all"
+ if len(k) > 2:
+ if ("group" in k[2]) or ("channel" in k[2]):
+ key = k[2]
+ rank = "AdMin"
+ if len(k) > 3:
+ rank = k[3]
+ c = 0
+ async for x in ultroid_bot.iter_dialogs():
+ if "group" in key.lower():
+ if x.is_group:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=True,
+ change_info=False,
+ ban_users=True,
+ delete_messages=True,
+ pin_messages=True,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ elif "channel" in key.lower():
+ if x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=True,
+ change_info=False,
+ ban_users=True,
+ delete_messages=True,
+ pin_messages=True,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ else:
+ if x.is_group or x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=True,
+ change_info=False,
+ ban_users=True,
+ delete_messages=True,
+ pin_messages=True,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ return await eor(ev, f"Promoted {name.first_name} in Total : {c} {key} chats.")
+
+
+@ultroid_cmd(pattern="gdemote ?(.*)")
+async def _(e):
+ if not e.out and not is_fullsudo(e.sender_id):
+ return await eod(e, "`This Command Is Sudo Restricted.`")
+ x = e.pattern_match.group(1)
+ if not x:
+ return await eod(e, "`Incorrect Format`")
+ user = await e.get_reply_message()
+ if user:
+ if e.is_private:
+ user.id = user.peer_id.user_id
+ else:
+ user.id = user.from_id.user_id
+ ev = await eor(e, "`Demoting Replied User Globally`")
+ ok = e.text.split()
+ key = "all"
+ if len(ok) > 1:
+ if ("group" in ok[1]) or ("channel" in ok[1]):
+ key = ok[1]
+ rank = "Not AdMin"
+ c = 0
+ async for x in ultroid_bot.iter_dialogs():
+ if "group" in key.lower():
+ if x.is_group:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user.id,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=False,
+ change_info=False,
+ ban_users=False,
+ delete_messages=False,
+ pin_messages=False,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ elif "channel" in key.lower():
+ if x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user.id,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=False,
+ change_info=False,
+ ban_users=False,
+ delete_messages=False,
+ pin_messages=False,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ else:
+ if x.is_group or x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user.id,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=False,
+ change_info=False,
+ ban_users=False,
+ delete_messages=False,
+ pin_messages=False,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ return await eor(ev, f"Demoted The Replied Users in Total : {c} {key} chats")
+ else:
+ k = e.text.split()
+ if not k[1]:
+ return await eod(e, "`Give someone's username/id or replied to user.")
+ user = k[1]
+ if user.isdigit():
+ user = int(user)
+ try:
+ name = await ultroid_bot.get_entity(user)
+ except BaseException:
+ return await eod(e, f"`No User Found Regarding {user}`")
+ ev = await eor(e, f"`Demoting {name.first_name} globally.`")
+ key = "all"
+ if len(k) > 2:
+ if ("group" in k[2]) or ("channel" in k[2]):
+ key = k[2]
+ rank = "Not AdMin"
+ c = 0
+ async for x in ultroid_bot.iter_dialogs():
+ if "group" in key.lower():
+ if x.is_group:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=False,
+ change_info=False,
+ ban_users=False,
+ delete_messages=False,
+ pin_messages=False,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ elif "channel" in key.lower():
+ if x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=False,
+ change_info=False,
+ ban_users=False,
+ delete_messages=False,
+ pin_messages=False,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ else:
+ if x.is_group or x.is_channel:
+ try:
+ await ultroid_bot(
+ EditAdminRequest(
+ x.id,
+ user,
+ ChatAdminRights(
+ add_admins=False,
+ invite_users=False,
+ change_info=False,
+ ban_users=False,
+ delete_messages=False,
+ pin_messages=False,
+ ),
+ rank,
+ ),
+ )
+ c += 1
+ except BaseException:
+ pass
+ return await eor(ev, f"Demoted {name.first_name} in Total : {c} {key} chats.")
+
+
@ultroid_cmd(
pattern="ungban ?(.*)",
)
@@ -84,6 +440,8 @@ async def _(e):
pattern="gban ?(.*)",
)
async def _(e):
+ if not e.out and not is_fullsudo(e.sender_id):
+ return await eor(e, "`This Command Is Sudo Restricted.`")
xx = await eor(e, "`Gbanning...`")
reason = ""
if e.is_private:
@@ -235,6 +593,8 @@ async def gkick(e):
pattern="gmute ?(.*)",
)
async def _(e):
+ if not e.out and not is_fullsudo(e.sender_id):
+ return await eor(e, "`This Command Is Sudo Restricted.`")
xx = await eor(e, "`Gmuting...`")
if e.is_private:
userid = (await e.get_chat()).id
@@ -346,7 +706,7 @@ async def list_gengbanned(event):
name = i
msg += "**User**: " + name + "\n"
reason = get_gban_reason(i)
- if reason is not None:
+ if reason is not None or "":
msg += f"**Reason**: {reason}\n\n"
else:
msg += "\n"
@@ -365,4 +725,39 @@ async def list_gengbanned(event):
await x.edit(gbanned_users)
+@ultroid_cmd(pattern="gstat ?(.*)")
+async def gstat_(e):
+ xx = await eor(e, get_string("com_1"))
+ if e.is_private:
+ userid = (await e.get_chat()).id
+ elif e.reply_to_msg_id:
+ userid = (await e.get_reply_message()).sender_id
+ elif e.pattern_match.group(1):
+ if (e.pattern_match.group(1)).isdigit():
+ try:
+ userid = (await e.client.get_entity(int(e.pattern_match.group(1)))).id
+ except ValueError as err:
+ return await eod(xx, f"{str(err)}", time=5)
+ else:
+ try:
+ userid = (await e.client.get_entity(str(e.pattern_match.group(1)))).id
+ except ValueError as err:
+ return await eod(xx, f"{str(err)}", time=5)
+ else:
+ return await eod(xx, "`Reply to some msg or add their id.`", time=5)
+ name = (await e.client.get_entity(userid)).first_name
+ msg = "**" + name + " is "
+ is_banned = is_gbanned(userid)
+ reason = get_gban_reason(userid)
+ if is_banned:
+ msg += "Globally Banned"
+ if reason:
+ msg += f" with reason** `{reason}`"
+ else:
+ msg += ".**"
+ else:
+ msg += "not Globally Banned.**"
+ await xx.edit(msg)
+
+
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/imagetools.py b/plugins/imagetools.py
index ff3f816a22..10f7880be6 100644
--- a/plugins/imagetools.py
+++ b/plugins/imagetools.py
@@ -40,6 +40,10 @@
• `{i}blue `
just cool.
+
+• `{i}csample `
+ example : `{i}csample red`
+ `{i}csample #ffffff`
"""
import asyncio
@@ -49,6 +53,10 @@
import numpy as np
from PIL import Image
from telegraph import upload_file as upf
+from telethon.errors.rpcerrorlist import (
+ ChatSendMediaForbiddenError,
+ MessageDeleteForbiddenError,
+)
from validators.url import url
from . import *
@@ -492,6 +500,27 @@ async def ultd(event):
os.remove(ultt)
+@ultroid_cmd(pattern="csample (.*)")
+async def sampl(ult):
+ color = ult.pattern_match.group(1)
+ if color:
+ img = Image.new("RGB", (200, 100), f"{color}")
+ img.save("csample.png")
+ try:
+ try:
+ await ult.delete()
+ await ultroid_bot.send_message(
+ ult.chat_id, f"Colour Sample for `{color}` !", file="csample.png"
+ )
+ except MessageDeleteForbiddenError:
+ await ult.reply(f"Colour Sample for `{color}` !", file="csample.png")
+ except ChatSendMediaForbiddenError:
+ await eor(ult, "Umm! Sending Media is disabled here!")
+
+ else:
+ await eor(ult, f"Wrong Color Name/Hex Code specified!")
+
+
@ultroid_cmd(
pattern="blue$",
)
diff --git a/plugins/locks.py b/plugins/locks.py
new file mode 100644
index 0000000000..a58004ef9d
--- /dev/null
+++ b/plugins/locks.py
@@ -0,0 +1,51 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available -
+
+• `{i}lock `
+ Lock the Used Setting in Used Group.
+
+• `{i}unlock `
+ UNLOCK the Used Setting in Used Group.
+
+"""
+
+from pyUltroid.functions.all import lucks, unlucks
+from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest
+
+from . import *
+
+
+@ultroid_cmd(pattern="lock ?(.*)", groups_only=True, admins_only=True)
+async def lockho(e):
+ mat = e.pattern_match.group(1)
+ if not mat:
+ return await eod(e, "`What to Lock ?`")
+ try:
+ ml = lucks(mat)
+ except BaseException:
+ return await eod(e, "`Incorrect Input`")
+ await ultroid_bot(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
+ await eor(e, f"Locked - `{mat}` ! ")
+
+
+@ultroid_cmd(pattern="unlock ?(.*)", groups_only=True, admins_only=True)
+async def unlckho(e):
+ mat = e.pattern_match.group(1)
+ if not mat:
+ return await eod(e, "`What to Lock ?`")
+ try:
+ ml = unlucks(mat)
+ except BaseException:
+ return await eod(e, "`Incorrect Input`")
+ await ultroid_bot(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
+ await eor(e, f"Unlocked - `{mat}` ! ")
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/logo.py b/plugins/logo.py
new file mode 100644
index 0000000000..cc590099d2
--- /dev/null
+++ b/plugins/logo.py
@@ -0,0 +1,114 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available -
+
+• `{i}logo `
+ Generate a logo of the given Text
+ Or Reply To image , to write ur text on it.
+ Or Reply To Font File, To write with that font.
+
+"""
+
+import os
+import random
+import time
+
+from PIL import Image, ImageDraw, ImageFont
+from telethon.tl.types import InputMessagesFilterPhotos
+
+from . import *
+
+
+@ultroid_cmd(pattern="logo ?(.*)")
+async def logo_gen(event):
+ xx = await eor(event, get_string("com_1"))
+ name = event.pattern_match.group(1)
+ if not name:
+ await eod(xx, "`Give a name too!`")
+ bg_, font_ = "", ""
+ if event.reply_to_msg_id:
+ temp = await event.get_reply_message()
+ if temp.media:
+ if hasattr(temp.media, "document"):
+ if "font" in temp.file.mime_type:
+ font_ = await temp.download_media()
+ elif "pic" in mediainfo(temp.media):
+ bg_ = await temp.download_media()
+ else:
+ pics = []
+ async for i in ultroid.iter_messages(
+ "@UltroidLogos", filter=InputMessagesFilterPhotos
+ ):
+ pics.append(i)
+ id_ = random.choice(pics)
+ bg_ = await id_.download_media()
+ fpath_ = "./resources/fonts/"
+ f = random.choice(os.listdir(fpath_))
+ font_ = fpath_ + f
+ if not bg_:
+ pics = []
+ async for i in ultroid.iter_messages(
+ "@UltroidLogos", filter=InputMessagesFilterPhotos
+ ):
+ pics.append(i)
+ id_ = random.choice(pics)
+ bg_ = await id_.download_media()
+ if not font_:
+ fpath_ = "resources/fonts/"
+ f = random.choice(os.listdir(fpath_))
+ font_ = fpath_ + f
+ # next level logic, ignore
+ if len(name) < 8:
+ fnt_size = 150
+ strke = 10
+ elif len(name) > 10:
+ fnt_size = 50
+ strke = 5
+ else:
+ fnt_size = 130
+ strke = 20
+ img = Image.open(bg_)
+ draw = ImageDraw.Draw(img)
+ font = ImageFont.truetype(font_, fnt_size)
+ w, h = draw.textsize(name, font=font)
+ h += int(h * 0.21)
+ image_width, image_height = img.size
+ draw.text(
+ ((image_width - w) / 2, (image_height - h) / 2),
+ name,
+ font=font,
+ fill=(255, 255, 255),
+ )
+ x = (image_width - w) / 2
+ y = (image_height - h) / 2
+ draw.text(
+ (x, y), name, font=font, fill="white", stroke_width=strke, stroke_fill="black"
+ )
+ flnme = f"ultd.png"
+ img.save(flnme, "png")
+ await xx.edit("`Done!`")
+ if os.path.exists(flnme):
+ tt = time.time()
+ up = await uploader(flnme, flnme, tt, xx, "Uploading...")
+ await ultroid.send_file(
+ event.chat_id,
+ file=up,
+ caption=f"Logo by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
+ foce_document=True,
+ )
+ os.remove(flnme)
+ await xx.delete()
+ if os.path.exists(bg_):
+ os.remove(bg_)
+ if os.path.exists(font_):
+ if not font_.startswith("resources/fonts"):
+ os.remove(font_)
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/megadl.py b/plugins/megadl.py
new file mode 100644
index 0000000000..47b5961830
--- /dev/null
+++ b/plugins/megadl.py
@@ -0,0 +1,77 @@
+# Ultroid - UserBot
+# Copyright (C) 2020 TeamUltroid
+#
+# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
+# PLease read the GNU Affero General Public License in
+# .
+
+"""
+✘ Commands Available -
+
+•`{i}megadl `
+ It Downloads and Upload Files from mega.nz links.
+"""
+
+import glob
+import time
+from datetime import datetime
+
+from . import *
+
+
+@ultroid_cmd(pattern="megadl ?(.*)")
+async def _(e):
+ link = e.pattern_match.group(1)
+ if not os.path.isdir("mega"):
+ os.mkdir("mega")
+ else:
+ os.system("rm -rf mega")
+ os.mkdir("mega")
+ xx = await eor(e, f"Processing...\nTo Check Progress : `{HNDLR}ls mega`")
+ s = datetime.now()
+ x, y = await bash(f"megadl {link} --path mega")
+ afl = glob.glob("mega/*")
+ ok = [*sorted(afl)]
+ tt = time.time()
+ c = 0
+ k = []
+ for x in ok:
+ if os.path.isdir(x):
+ k.append(x)
+ break
+ if k:
+ await xx.edit(
+ "Your Unzipped File Saved in `mega` folder.\nDo `{i}ls mega` and browse storage\nUse `{i}ul ` To upload.".format(
+ i=HNDLR
+ )
+ )
+ else:
+ for kk in ok:
+ try:
+ res = await uploader(kk, kk, tt, xx, "Uploading...")
+ await ultroid_bot.send_file(
+ e.chat_id,
+ res,
+ caption="`" + kk.split("/")[-1] + "`",
+ force_document=True,
+ thumb="resources/extras/ultroid.jpg",
+ )
+ c += 1
+ except Exception as er:
+ LOGS.info(er)
+ ee = datetime.now()
+ t = time_formatter(((ee - s).seconds) * 1000)
+ size = 0
+ for path, dirs, files in os.walk("mega"):
+ for f in files:
+ fp = os.path.join(path, f)
+ size += os.path.getsize(fp)
+ await xx.delete()
+ await ultroid_bot.send_message(
+ e.chat_id,
+ f"Downloaded And Uploaded Total - `{c}` files of `{humanbytes(size)}` in `{t}`",
+ )
+ os.system("rm -rf mega")
+
+
+HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
diff --git a/plugins/mute.py b/plugins/mute.py
index e0110afda7..c8104d968b 100644
--- a/plugins/mute.py
+++ b/plugins/mute.py
@@ -21,9 +21,10 @@
Unmute dmuted user in current chat.
• `{i}tmute