Ultroid v0.3 Updates
Co-authored-by: Aditya <xditya@ultroid.tech> Co-authored-by: Danish <danish@ultroid.tech> Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: TechiError <error@notavailable.live> Co-authored-by: Avish Kumar <85635883+aviskumar@users.noreply.github.com> Co-authored-by: Vɪɴᴀʏᴀᴋ Pᴀɴᴅᴇʏ <87496159+harpia-vieillot@users.noreply.github.com> Co-authored-by: Shrimadhav U K <6317196+spechide@users.noreply.github.com> Co-authored-by: Dark <darkbeamer.official@gmail.com> Co-authored-by: Muhamad Risman Aziz <62795826+mrismanaziz@users.noreply.github.com> Co-authored-by: Ashik Muhammed <84127769+MR-JINN-OF-TG@users.noreply.github.com> Co-authored-by: MMETMA <79155572+MMETMA@users.noreply.github.com> Co-authored-by: amirmehdinzri <94852182+amirmehdinzri@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 TeamUltroid
|
||||
# Copyright (C) 2021-2022 TeamUltroid
|
||||
#
|
||||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||||
# PLease read the GNU Affero General Public License in
|
||||
@@ -21,9 +21,9 @@ import os
|
||||
from pyUltroid.dB.asstcmd_db import *
|
||||
from pyUltroid.functions.tools import create_tl_btn, format_btn, get_msg_button
|
||||
from telegraph import upload_file as uf
|
||||
from telethon.utils import pack_bot_file_id
|
||||
from telethon import events, utils
|
||||
|
||||
from . import asst_cmd, eor, get_string, mediainfo, ultroid_cmd
|
||||
from . import asst, get_string, mediainfo, ultroid_cmd
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="addcmd ?(.*)")
|
||||
@@ -31,7 +31,7 @@ async def ac(e):
|
||||
wrd = (e.pattern_match.group(1)).lower()
|
||||
wt = await e.get_reply_message()
|
||||
if not (wt and wrd):
|
||||
return await eor(e, get_string("asstcmd_1"), time=5)
|
||||
return await e.eor(get_string("asstcmd_1"), time=5)
|
||||
if "/" in wrd:
|
||||
wrd = wrd.replace("/", "")
|
||||
btn = format_btn(wt.buttons) if wt.buttons else None
|
||||
@@ -44,36 +44,42 @@ async def ac(e):
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
elif wut == "video":
|
||||
if wt.media.document.size > 8 * 1000 * 1000:
|
||||
return await eor(e, get_string("com_4"), time=5)
|
||||
return await e.eor(get_string("com_4"), time=5)
|
||||
dl = await e.client.download_media(wt.media)
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
else:
|
||||
m = pack_bot_file_id(wt.media)
|
||||
m = utils.pack_bot_file_id(wt.media)
|
||||
if wt.text:
|
||||
txt = wt.text
|
||||
if not btn:
|
||||
txt, btn = get_msg_button(wt.text)
|
||||
add_cmd(wrd, txt, m, btn)
|
||||
else:
|
||||
add_cmd(wrd, None, m)
|
||||
add_cmd(wrd, None, m, btn)
|
||||
else:
|
||||
txt = wt.text
|
||||
if not btn:
|
||||
txt, btn = get_msg_button(wt.text)
|
||||
add_cmd(wrd, txt, None, btn)
|
||||
await eor(e, get_string("asstcmd_4").format(wrd))
|
||||
asst.add_handler(
|
||||
astcmds,
|
||||
events.NewMessage(
|
||||
func=lambda x: x.text.startswith("/") and x.text[1:] in list(list_cmds())
|
||||
),
|
||||
)
|
||||
await e.eor(get_string("asstcmd_4").format(wrd))
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="remcmd ?(.*)")
|
||||
async def rc(e):
|
||||
wrd = (e.pattern_match.group(1)).lower()
|
||||
if not wrd:
|
||||
return await eor(e, get_string("asstcmd_2"), time=5)
|
||||
return await e.eor(get_string("asstcmd_2"), time=5)
|
||||
wrd = wrd.replace("/", "")
|
||||
rem_cmd(wrd)
|
||||
await eor(e, get_string("asstcmd_3").format(wrd))
|
||||
await e.eor(get_string("asstcmd_3").format(wrd))
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="listcmd$")
|
||||
@@ -82,15 +88,23 @@ async def lscmd(e):
|
||||
ok = get_string("asstcmd_6")
|
||||
for x in list_cmds():
|
||||
ok += "/" + x + "\n"
|
||||
return await eor(e, ok)
|
||||
return await eor(e, get_string("asstcmd_5"))
|
||||
return await e.eor(ok)
|
||||
return await e.eor(get_string("asstcmd_5"))
|
||||
|
||||
|
||||
@asst_cmd(func=lambda x: x.text.startswith("/") and x.text[1:] in list(list_cmds()))
|
||||
async def ascmds(e):
|
||||
async def astcmds(e):
|
||||
xx = (e.text.replace("/", "")).lower().split()[0]
|
||||
if cmd_reply(xx):
|
||||
msg, media, bt = cmd_reply(xx)
|
||||
if bt:
|
||||
bt = create_tl_btn(bt)
|
||||
await e.reply(msg, file=media, buttons=bt)
|
||||
|
||||
|
||||
if udB.get_key("ASST_CMDS"):
|
||||
asst.add_handler(
|
||||
astcmds,
|
||||
events.NewMessage(
|
||||
func=lambda x: x.text.startswith("/") and x.text[1:] in list(list_cmds())
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user