Update Ultroid v0.7.1
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: Aditya <me@xditya.me> Co-authored-by: ᴀɴᴏɴʏᴍᴏᴜs <rahulking25102006@gmail.com>
This commit is contained in:
@@ -43,7 +43,6 @@ from . import (
|
||||
)
|
||||
async def prmte(ult):
|
||||
xx = await ult.eor(get_string("com_1"))
|
||||
await ult.get_chat()
|
||||
user, rank = await get_uinfo(ult)
|
||||
rank = rank or "Admin"
|
||||
FullRight = False
|
||||
@@ -87,7 +86,6 @@ async def prmte(ult):
|
||||
)
|
||||
async def dmote(ult):
|
||||
xx = await ult.eor(get_string("com_1"))
|
||||
await ult.get_chat()
|
||||
user, rank = await get_uinfo(ult)
|
||||
if not rank:
|
||||
rank = "Not Admin"
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
# Ultroid - UserBot
|
||||
# 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
|
||||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
from . import get_help
|
||||
|
||||
__doc__ = get_help("help_fedutils")
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
from telethon.errors.rpcerrorlist import YouBlockedUserError
|
||||
|
||||
from pyUltroid.dB import DEVLIST
|
||||
|
||||
from . import get_string, udB, ultroid_bot, ultroid_cmd
|
||||
|
||||
bot = "@MissRose_bot"
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="superfban( (.*)|$)",
|
||||
)
|
||||
async def _(event):
|
||||
msg = await event.eor(get_string("sf_1"))
|
||||
inputt = event.pattern_match.group(1).strip()
|
||||
if event.reply_to_msg_id:
|
||||
FBAN = (await event.get_reply_message()).sender_id
|
||||
if inputt:
|
||||
REASON = inputt
|
||||
elif inputt:
|
||||
REASON = "#ULTMassBanned"
|
||||
arg = event.text.split()
|
||||
if len(arg) == 2:
|
||||
FBAN = await event.client.parse_id(arg[1])
|
||||
elif len(arg) > 2:
|
||||
FBAN = await event.client.parse_id(arg[1])
|
||||
REASON = event.text.split(maxsplit=2)[-1]
|
||||
else:
|
||||
return await msg.edit(get_string("sf_22"))
|
||||
else:
|
||||
return await msg.edit("`Reply to a message or give some input...`")
|
||||
if FBAN in DEVLIST:
|
||||
return await msg.edit("The user is my Dev and cannot be FBanned!")
|
||||
|
||||
if udB.get_key("FBAN_GROUP_ID"):
|
||||
chat = int(udB.get_key("FBAN_GROUP_ID"))
|
||||
else:
|
||||
chat = await event.get_chat()
|
||||
fedList = []
|
||||
if not fedList:
|
||||
for a in range(3):
|
||||
async with event.client.conversation("@MissRose_bot") as bot_conv:
|
||||
await bot_conv.send_message("/start")
|
||||
await asyncio.sleep(3)
|
||||
await bot_conv.send_message("/myfeds")
|
||||
await asyncio.sleep(3)
|
||||
try:
|
||||
response = await bot_conv.get_response()
|
||||
except asyncio.exceptions.TimeoutError:
|
||||
return await msg.edit(
|
||||
get_string("sf_4"),
|
||||
)
|
||||
await asyncio.sleep(3)
|
||||
if "make a file" in response.text or "Looks like" in response.text:
|
||||
await response.click(0)
|
||||
await asyncio.sleep(3)
|
||||
fedfile = await bot_conv.get_response()
|
||||
await asyncio.sleep(3)
|
||||
if fedfile.media:
|
||||
downloaded_file_name = await ultroid_bot.download_media(
|
||||
fedfile,
|
||||
"fedlist",
|
||||
)
|
||||
await asyncio.sleep(6)
|
||||
file = open(downloaded_file_name, errors="ignore")
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
try:
|
||||
fedList.append(line[:36])
|
||||
except BaseException:
|
||||
pass
|
||||
elif get_string("sf_5") in (await bot_conv.get_edit):
|
||||
return await msg.edit(get_string("sf_6"))
|
||||
if not fedList:
|
||||
await msg.edit(
|
||||
f"Unable to collect FedAdminList. Retrying ({a+1}/3)...",
|
||||
)
|
||||
else:
|
||||
break
|
||||
else:
|
||||
await msg.edit(get_string("sf_8"))
|
||||
In = False
|
||||
tempFedId = ""
|
||||
for x in response.text:
|
||||
if x == "`":
|
||||
if In:
|
||||
In = False
|
||||
fedList.append(tempFedId)
|
||||
tempFedId = ""
|
||||
else:
|
||||
In = True
|
||||
elif In:
|
||||
tempFedId += x
|
||||
if not fedList:
|
||||
return await msg.edit(get_string("sf_9"))
|
||||
await msg.edit(f"FBaning in {len(fedList)} feds.")
|
||||
try:
|
||||
await ultroid_bot.send_message(chat, "/start")
|
||||
except BaseException:
|
||||
return await msg.edit(get_string("sf_11"))
|
||||
await asyncio.sleep(3)
|
||||
if udB.get_key("EXCLUDE_FED"):
|
||||
excludeFed = udB.get_key("EXCLUDE_FED").split(" ")
|
||||
for num, item in enumerate(excludeFed):
|
||||
excludeFed[num] = item.strip()
|
||||
exCount = 0
|
||||
for fed in fedList:
|
||||
if udB.get_key("EXCLUDE_FED") and fed in excludeFed:
|
||||
await ultroid_bot.send_message(chat, f"{fed} Excluded.")
|
||||
exCount += 1
|
||||
continue
|
||||
await event.client.send_message(chat, f"/joinfed {fed}")
|
||||
await asyncio.sleep(3)
|
||||
await event.client.send_message(chat, f"/fban {FBAN} {REASON}")
|
||||
await asyncio.sleep(3)
|
||||
try:
|
||||
os.remove("fedlist")
|
||||
except Exception as e:
|
||||
print(f"Error in removing FedAdmin file.\n{e}")
|
||||
await msg.edit(
|
||||
f"SuperFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\nAffected {len(fedList) - exCount} feds.\n#Ultroid",
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="superunfban( (.*)|$)",
|
||||
)
|
||||
async def _(event):
|
||||
msg = await event.eor(get_string("sf_15"))
|
||||
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(
|
||||
previous_message,
|
||||
"fedlist",
|
||||
)
|
||||
file = open(downloaded_file_name, encoding="utf8")
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
try:
|
||||
fedList.append(line[:36])
|
||||
except BaseException:
|
||||
pass
|
||||
arg = event.text.split(" ", maxsplit=2)
|
||||
FBAN = arg[1]
|
||||
REASON = arg[2] if len(arg) > 2 else ""
|
||||
else:
|
||||
FBAN = previous_message.sender_id
|
||||
try:
|
||||
REASON = event.text.split(" ", maxsplit=1)[1]
|
||||
except BaseException:
|
||||
REASON = ""
|
||||
if not REASON.strip():
|
||||
REASON = ""
|
||||
else:
|
||||
arg = event.text.split(" ", maxsplit=2)
|
||||
if len(arg) > 2:
|
||||
try:
|
||||
FBAN = arg[1]
|
||||
REASON = arg[2]
|
||||
except BaseException:
|
||||
return await msg.edit(get_string("sf_2"))
|
||||
else:
|
||||
try:
|
||||
FBAN = arg[1]
|
||||
REASON = " #ULTMassUnBanned "
|
||||
except BaseException:
|
||||
return await msg.edit(get_string("sf_2"))
|
||||
if udB.get_key("FBAN_GROUP_ID"):
|
||||
chat = int(udB.get_key("FBAN_GROUP_ID"))
|
||||
else:
|
||||
chat = await event.get_chat()
|
||||
if not fedList:
|
||||
for a in range(3):
|
||||
async with event.client.conversation("@MissRose_bot") as bot_conv:
|
||||
await bot_conv.send_message("/start")
|
||||
await asyncio.sleep(3)
|
||||
await bot_conv.send_message("/myfeds")
|
||||
await asyncio.sleep(3)
|
||||
try:
|
||||
response = await bot_conv.get_response()
|
||||
except asyncio.exceptions.TimeoutError:
|
||||
return await msg.edit(
|
||||
get_string("sf_4"),
|
||||
)
|
||||
await asyncio.sleep(3)
|
||||
if "make a file" in response.text or "Looks like" in response.text:
|
||||
await response.click(0)
|
||||
await asyncio.sleep(3)
|
||||
fedfile = await bot_conv.get_response()
|
||||
await asyncio.sleep(3)
|
||||
if fedfile.media:
|
||||
downloaded_file_name = await ultroid_bot.download_media(
|
||||
fedfile,
|
||||
"fedlist",
|
||||
)
|
||||
await asyncio.sleep(6)
|
||||
file = open(downloaded_file_name, errors="ignore")
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
try:
|
||||
fedList.append(line[:36])
|
||||
except BaseException:
|
||||
pass
|
||||
elif get_string("sf_5") in (await bot_conv.get_edit):
|
||||
return await msg.edit(get_string("sf_6"))
|
||||
if not fedList:
|
||||
await msg.edit(
|
||||
f"Unable to collect FedAdminList. Retrying ({a+1}/3)...",
|
||||
)
|
||||
else:
|
||||
break
|
||||
else:
|
||||
await msg.edit(get_string("sf_8"))
|
||||
In = False
|
||||
tempFedId = ""
|
||||
for x in response.text:
|
||||
if x == "`":
|
||||
if In:
|
||||
In = False
|
||||
fedList.append(tempFedId)
|
||||
tempFedId = ""
|
||||
else:
|
||||
In = True
|
||||
elif In:
|
||||
tempFedId += x
|
||||
if not fedList:
|
||||
return await msg.edit(get_string("sf_9"))
|
||||
await msg.edit(f"UnFBaning in {len(fedList)} feds.")
|
||||
try:
|
||||
await event.client.send_message(chat, "/start")
|
||||
except BaseException:
|
||||
return await msg.edit(get_string("sf_11"))
|
||||
await asyncio.sleep(3)
|
||||
if udB.get_key("EXCLUDE_FED"):
|
||||
excludeFed = udB.get_key("EXCLUDE_FED").split(" ")
|
||||
for n, m in enumerate(excludeFed):
|
||||
excludeFed[n] = excludeFed[n].strip()
|
||||
exCount = 0
|
||||
for fed in fedList:
|
||||
if udB.get_key("EXCLUDE_FED") and fed in excludeFed:
|
||||
await event.client.send_message(chat, f"{fed} Excluded.")
|
||||
exCount += 1
|
||||
continue
|
||||
await ultroid_bot.send_message(chat, f"/joinfed {fed}")
|
||||
await asyncio.sleep(3)
|
||||
await ultroid_bot.send_message(chat, f"/unfban {FBAN} {REASON}")
|
||||
await asyncio.sleep(3)
|
||||
try:
|
||||
os.remove("fedlist")
|
||||
except Exception as e:
|
||||
print(f"Error in removing FedAdmin file.\n{e}")
|
||||
await msg.edit(
|
||||
f"SuperUnFBan Completed.\nTotal Feds - {len(fedList)}.\nExcluded - {exCount}.\n Affected {len(fedList) - exCount} feds.\n#TB",
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="fstat( (.*)|$)",
|
||||
)
|
||||
async def _(event):
|
||||
ok = await event.eor("`Checking...`")
|
||||
if event.reply_to_msg_id:
|
||||
previous_message = await event.get_reply_message()
|
||||
sysarg = str(previous_message.sender_id)
|
||||
user = f"[user](tg://user?id={sysarg})"
|
||||
if event.pattern_match.group(1).strip():
|
||||
sysarg += f" {event.pattern_match.group(1).strip()}"
|
||||
else:
|
||||
sysarg = event.pattern_match.group(1).strip()
|
||||
user = sysarg
|
||||
if sysarg == "":
|
||||
await ok.edit(
|
||||
get_string("sf_17"),
|
||||
)
|
||||
else:
|
||||
async with event.client.conversation(bot) as conv:
|
||||
try:
|
||||
await conv.send_message("/start")
|
||||
await conv.get_response()
|
||||
await conv.send_message(f"/fedstat {sysarg}")
|
||||
audio = await conv.get_response()
|
||||
if audio.message.startswith("This command can only be used once"):
|
||||
await ok.edit(
|
||||
"Oops, you can use this command only once every minute!",
|
||||
)
|
||||
elif "Looks like" in audio.text:
|
||||
await audio.click(0)
|
||||
await asyncio.sleep(2)
|
||||
audio = await conv.get_response()
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
audio,
|
||||
caption=f"List of feds {user} has been banned in.\n\nCollected using Ultroid.",
|
||||
link_preview=False,
|
||||
)
|
||||
await ok.delete()
|
||||
else:
|
||||
okk = await conv.get_edit()
|
||||
await ok.edit(okk.message)
|
||||
await ultroid_bot.send_read_acknowledge(bot)
|
||||
except YouBlockedUserError:
|
||||
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="fedinfo( (.*)|$)",
|
||||
)
|
||||
async def _(event):
|
||||
ok = await event.edit(get_string("sf_20"))
|
||||
sysarg = event.pattern_match.group(1).strip()
|
||||
async with event.client.conversation(bot) as conv:
|
||||
try:
|
||||
await conv.send_message("/start")
|
||||
await conv.get_response()
|
||||
await conv.send_message(f"/fedinfo {sysarg}")
|
||||
audio = await conv.get_response()
|
||||
await event.client.send_read_acknowledge(bot)
|
||||
await ok.edit(audio.text + "\n\nFedInfo Extracted by Ultroid")
|
||||
except YouBlockedUserError:
|
||||
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
|
||||
@@ -7,7 +7,7 @@
|
||||
"""
|
||||
✘ Commands Available -
|
||||
|
||||
• `{i}mediainfo <reply to media>`
|
||||
• `{i}mediainfo <reply to media>/<file path>/<url>`
|
||||
To get info about it.
|
||||
|
||||
• `{i}rotate <degree/angle> <reply to media>`
|
||||
@@ -21,7 +21,16 @@ from datetime import datetime as dt
|
||||
from pyUltroid.fns.misc import rotate_image
|
||||
from pyUltroid.fns.tools import make_html_telegraph
|
||||
|
||||
from . import LOGS, Telegraph, bash, downloader, get_string, mediainfo, ultroid_cmd
|
||||
from . import (
|
||||
LOGS,
|
||||
Telegraph,
|
||||
bash,
|
||||
downloader,
|
||||
get_string,
|
||||
is_url_ok,
|
||||
mediainfo,
|
||||
ultroid_cmd,
|
||||
)
|
||||
|
||||
try:
|
||||
import cv2
|
||||
@@ -63,7 +72,9 @@ async def mi(e):
|
||||
naam = dl.name
|
||||
else:
|
||||
naam = await r.download_media()
|
||||
elif match and os.path.isfile(match):
|
||||
elif match and (
|
||||
os.path.isfile(match) or (match.startswith("https://") and is_url_ok(match))
|
||||
):
|
||||
naam, xx = match, "file"
|
||||
else:
|
||||
return await e.eor(get_string("cvt_3"), time=5)
|
||||
@@ -74,7 +85,10 @@ async def mi(e):
|
||||
return await e.edit(out, link_preview=False)
|
||||
makehtml = ""
|
||||
if naam.endswith((".jpg", ".png")):
|
||||
med = "https://graph.org" + Telegraph.upload_file(naam)[0]["src"]
|
||||
if os.path.exists(naam):
|
||||
med = "https://graph.org" + Telegraph.upload_file(naam)[0]["src"]
|
||||
else:
|
||||
med = match
|
||||
makehtml += f"<img src='{med}'><br>"
|
||||
for line in out.split("\n"):
|
||||
line = line.strip()
|
||||
|
||||
@@ -210,7 +210,7 @@ async def hbd(event):
|
||||
elif month == "09":
|
||||
sign = "Virgo" if (day < 23) else "Libra"
|
||||
elif month == "10":
|
||||
sign = "Libra" if (day < 23) else "Scorpion"
|
||||
sign = "Libra" if (day < 23) else "Scorpio"
|
||||
elif month == "11":
|
||||
sign = "Scorpio" if (day < 22) else "Sagittarius"
|
||||
elif month == "12":
|
||||
|
||||
Reference in New Issue
Block a user