* Fixed Addons issue

* Fixed Vc (now u can use direct video links too)

* Fixed Minor Bugs & Issues

Co-authored-by: Devesh Pal <newdev0@outlook.com>
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
This commit is contained in:
Danish
2021-09-18 22:00:56 +05:30
committed by GitHub
parent 0265012512
commit 50bd12708a
12 changed files with 56 additions and 77 deletions

View File

@@ -1044,7 +1044,7 @@ async def disus(event):
name = "Pm Logger Group"
async with event.client.conversation(pru) as conv:
await conv.send_message(
f"Send The Symbol Which u want as your {name}\n\n use /cancel to cancel.",
f"Send The Chat Id of group Which u want as your {name}\n\n use /cancel to cancel.",
)
response = conv.wait_event(events.NewMessage(chats=pru))
response = await response
@@ -1054,11 +1054,6 @@ async def disus(event):
"Cancelled!!",
buttons=get_back_button("pml"),
)
elif len(themssg) > 1:
await conv.send_message(
"Incorrect Value",
buttons=get_back_button("pml"),
)
else:
await setit(event, var, themssg)
await conv.send_message(

View File

@@ -14,6 +14,8 @@ import re
from . import *
CALC = {}
m = [
"AC",
"C",
@@ -62,54 +64,64 @@ async def _(e):
@owner
async def _(e):
x = (e.data_match.group(1)).decode()
user = e.query.user_id
get = None
if x == "AC":
udB.delete("calc")
if CALC.get(user):
CALC.pop(user)
await e.edit(
"• Ultroid Inline Calculator •",
buttons=[Button.inline("Open Calculator Again", data="recalc")],
)
elif x == "C":
udB.delete("calc")
if CALC.get(user):
CALC.pop(user)
await e.answer("cleared")
elif x == "":
get = udB.get("calc")
if CALC.get(user):
get = CALC[user]
if get:
udB.set("calc", get[:-1])
CALC.update({user: get[:-1]})
await e.answer(str(get[:-1]))
elif x == "%":
get = udB.get("calc")
if CALC.get(user):
get = CALC[user]
if get:
udB.set("calc", get + "/100")
CALC.update({user: get + "/100"})
await e.answer(str(get + "/100"))
elif x == "÷":
get = udB.get("calc")
if CALC.get(user):
get = CALC[user]
if get:
udB.set("calc", get + "/")
CALC.update({user: get + "/"})
await e.answer(str(get + "/"))
elif x == "x":
get = udB.get("calc")
if CALC.get(user):
get = CALC[user]
if get:
udB.set("calc", get + "*")
CALC.update({user: get + "*"})
await e.answer(str(get + "*"))
elif x == "=":
get = udB.get("calc")
if CALC.get(user):
get = CALC[user]
if get:
if get.endswith(("*", ".", "/", "-", "+")):
get = get[:-1]
out = await calcc(get, e)
out = eval(get)
try:
num = float(out)
await e.answer(f"Answer : {num}", cache_time=0, alert=True)
except BaseException:
udB.delete("calc")
CALC.pop(user)
await e.answer("Error", cache_time=0, alert=True)
await e.answer("None")
else:
get = udB.get("calc")
if CALC.get(user):
get = CALC[user]
if get:
udB.set("calc", get + x)
await e.answer(str(get + x))
udB.set("calc", x)
CALC.update({user: get + x})
return await e.answer(str(get + x))
CALC.update({user: x})
await e.answer(str(x))

View File

@@ -95,7 +95,7 @@ async def _(e):
text = fil.read()
frames = re.findall("frame=(\\d+)", text)
size = re.findall("total_size=(\\d+)", text)
speed = 0
if len(frames):
elapse = int(frames[-1])
if len(size):

View File

@@ -27,7 +27,7 @@ from . import *
pattern="poll ?(.*)",
)
async def uri_poll(e):
if not e.sender._bot and e.is_private:
if not e.client._bot and e.is_private:
return await eor(e, "`Use this in Group/Channel.`", time=15)
match = e.pattern_match.group(1)
if not match:

View File

@@ -446,7 +446,7 @@ async def ultdround(event):
async def ultdestroy(event):
ult = await event.get_reply_message()
if not (
ult and ult.media and "animated" in mediainfo(a.media)
ult and ult.media and "animated" in mediainfo(ult.media)
):
return await eor(event, "`Reply to Animated Sticker only`")
await event.client.download_media(ult, "ultroid.tgs")

View File

@@ -14,34 +14,19 @@
"""
import os
import requests
from htmlwebshot import WebShot
from . import *
@ultroid_cmd(pattern="webshot")
@ultroid_cmd(pattern="webshot ?(.*)")
async def webss(event):
xx = await eor(event, get_string("com_1"))
mssg = event.text.split(" ", maxsplit=2)
try:
xurl = mssg[1]
except IndexError:
xurl = e.pattern_match.group(1)
if not xurl:
return await eor(xx, "`Give a URL please!`", time=5)
try:
requests.get(xurl)
except requests.ConnectionError:
elif not is_url_ok(xurl):
return await eor(xx, "Invalid URL!", time=5)
except requests.exceptions.MissingSchema:
try:
xurl = "https://" + xurl
requests.get(xurl)
except requests.ConnectionError:
try:
xurl = "http://" + xurl
requests.get(xurl)
except requests.ConnectionError:
return await eor(xx, "Invalid URL!", time=5)
shot = WebShot(quality=88, flags=["--enable-javascript", "--no-stop-slow-scripts"])
pic = await shot.create_pic_async(url=xurl)
await xx.reply(

View File

@@ -1,3 +1,3 @@
https://github.com/New-dev0/Telethon/archive/Crunch.zip
py-Ultroid==2021.9.16
py-Ultroid==2021.9.18
pytgcalls==3.0.0.dev19

View File

@@ -31,6 +31,7 @@ from pyUltroid.functions.all import (
bash,
downloader,
get_user_id,
is_url_ok,
get_videos_link,
inline_mention,
mediainfo,
@@ -365,12 +366,15 @@ async def dl_playlist(chat, from_user, link):
return song, thumb, title, vid1["link"], duration
finally:
for z in links[1:]:
search = VideosSearch(z, limit=1).result()
vid = search["result"][0]
duration = vid.get("duration") or ""
title = vid["title"]
thumb = f"https://i.ytimg.com/vi/{vid['id']}/hqdefault.jpg"
add_to_queue(chat, None, title, vid["link"], thumb, from_user, duration)
try:
search = VideosSearch(z, limit=1).result()
vid = search["result"][0]
duration = vid.get("duration") or ""
title = vid["title"]
thumb = f"https://i.ytimg.com/vi/{vid['id']}/hqdefault.jpg"
add_to_queue(chat, None, title, vid["link"], thumb, from_user, duration)
except Exception as er:
LOGS.exception(er)
async def file_download(event, reply, fast_download=True):

View File

@@ -71,7 +71,10 @@ async def listVc(e):
text = "• <strong>Vc Auth Chats •</strong>\n\n"
for on in chats.keys():
st = "Admins" if chats[on]["admins"] else "All"
title = (await e.client.get_entity(on)).title
try:
title = (await e.client.get_entity(on)).title
except ValueError:
title = "No Info"
text += f"∆ <strong>{title}</strong> [ <code>{on}</code> ] : <code>{st}</code>"
await eor(e, text, parse_mode="html")

View File

@@ -16,8 +16,6 @@
"""
import requests
from . import *
@@ -37,9 +35,7 @@ async def radio_mirchi(e):
else:
song = e.text.split(maxsplit=1)[1]
chat = e.chat_id
try:
requests.get(song)
except BaseException:
if not is_url_ok(song):
return await eor(xx, f"`{song}`\n\nNot a playable link.🥱")
ultSongs = Player(chat, e)
if not ultSongs.group_call.is_connected:
@@ -69,9 +65,7 @@ async def live_stream(e):
else:
song = e.text.split(maxsplit=1)[1]
chat = e.chat_id
try:
requests.get(song)
except BaseException:
if not is_url_ok(song):
return await eor(xx, f"`{song}`\n\nNot a playable link.🥱")
is_live_vid = False
if re.search("youtu", song):

View File

@@ -15,10 +15,6 @@
"""
import requests
from requests.exceptions import MissingSchema
from . import *
@@ -59,13 +55,7 @@ async def video_c(event):
if reply and reply.media and mediainfo(reply.media).startswith("video"):
song, thumb, title, link, duration = await file_download(xx, reply)
else:
try:
requests.get(song)
is_link = True
except MissingSchema:
is_link = None
except BaseException:
is_link = False
is_link = is_url_ok(song)
if is_link is False:
return await eor(xx, f"`{song}`\n\nNot a playable link.🥱")
if is_link is None:

View File

@@ -13,8 +13,6 @@
"""
import requests
from . import *
@@ -36,9 +34,7 @@ async def live_stream(e):
chat = e.chat_id
if not (re.search("youtu", song) and re.search("playlist\\?list", song)):
return await eor(xx, "Give only youtube playlist")
try:
requests.get(song)
except BaseException:
if not is_url_ok(song):
return await eor(xx, f"`Only Youtube Playlist please.`")
await xx.edit("`Keep patience... It'll take some time.`")
file, thumb, title, link, duration = await dl_playlist(chat, html_mention(e), song)