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:
Devesh Pal
2021-12-31 23:48:53 +05:30
committed by GitHub
parent d780cd1665
commit 0df53caf4c
158 changed files with 7834 additions and 4567 deletions

View File

@@ -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
@@ -42,12 +42,12 @@ from telethon.tl.functions.channels import (
)
from telethon.tl.functions.messages import (
CreateChatRequest,
DeleteChatUserRequest,
ExportChatInviteRequest,
GetFullChatRequest,
)
from telethon.tl.types import (
ChannelParticipantsKicked,
User,
UserStatusEmpty,
UserStatusLastMonth,
UserStatusLastWeek,
@@ -56,17 +56,7 @@ from telethon.tl.types import (
UserStatusRecently,
)
from . import (
HNDLR,
eor,
get_string,
get_user_id,
mediainfo,
os,
types,
udB,
ultroid_cmd,
)
from . import HNDLR, LOGS, asst, get_string, mediainfo, os, types, udB, ultroid_cmd
@ultroid_cmd(
@@ -74,32 +64,36 @@ from . import (
groups_only=True,
)
async def _(e):
xx = await eor(e, get_string("com_1"))
xx = await e.eor(get_string("com_1"))
try:
match = e.text.split(" ", maxsplit=1)[1]
chat = "-100" + str(await get_user_id(match))
chat = await e.client.parse_id(match)
except IndexError:
chat = e.chat_id
try:
await e.client(DeleteChannelRequest(chat))
except TypeError:
return await eor(xx, get_string("chats_1"), time=10)
return await xx.eor(get_string("chats_1"), time=10)
except no_admin:
return await eor(xx, get_string("chats_2"), time=10)
return await xx.eor(get_string("chats_2"), time=10)
await e.client.send_message(
int(udB.get("LOG_CHANNEL")), get_string("chats_6").format(e.chat_id)
int(udB.get_key("LOG_CHANNEL")), get_string("chats_6").format(e.chat_id)
)
@ultroid_cmd(
pattern="getlink$",
groups_only=True,
type=["official", "manager"],
manager=True,
)
async def _(e):
chat = await e.get_chat()
if chat.username:
return await eor(e, f"Username: @{chat.username}")
reply = await e.get_reply_message()
if reply and not isinstance(reply.sender, User):
chat = await reply.get_sender()
else:
chat = await e.get_chat()
if hasattr(chat, "username") and chat.username:
return await e.eor(f"Username: @{chat.username}")
if isinstance(chat, types.Chat):
FC = await e.client(GetFullChatRequest(chat.id))
elif isinstance(chat, types.Channel):
@@ -113,9 +107,9 @@ async def _(e):
ExportChatInviteRequest(e.chat_id),
)
except no_admin:
return await eor(e, get_string("chats_2"), time=10)
return await e.eor(get_string("chats_2"), time=10)
link = r.link
await eor(e, f"Link:- {link}")
await e.eor(f"Link:- {link}")
@ultroid_cmd(
@@ -129,22 +123,16 @@ async def _(e):
group_ = group_name.split(" ; ", maxsplit=1)
group_name = group_[0]
username = group_[1]
xx = await eor(e, get_string("com_1"))
xx = await e.eor(get_string("com_1"))
if type_of_group == "b":
try:
r = await e.client(
CreateChatRequest(
users=["@missrose_bot"],
users=[asst.me.username],
title=group_name,
),
)
created_chat_id = r.chats[0].id
await e.client(
DeleteChatUserRequest(
chat_id=created_chat_id,
user_id="@missrose_bot",
),
)
result = await e.client(
ExportChatInviteRequest(
peer=created_chat_id,
@@ -190,44 +178,38 @@ async def _(e):
@ultroid_cmd(
pattern="setgpic ?(.*)",
groups_only=True,
admins_only=True,
type=["official", "manager"],
pattern="setgpic ?(.*)", admins_only=True, manager=True, require="change_info"
)
async def _(ult):
if not ult.is_reply:
return await eor(ult, "`Reply to a Media..`", time=5)
return await ult.eor("`Reply to a Media..`", time=5)
match = ult.pattern_match.group(1)
if not ult.client._bot and match:
try:
chat = await get_user_id(match)
chat = await ult.client.parse_id(match)
except Exception as ok:
return await eor(ult, str(ok))
return await ult.eor(str(ok))
else:
chat = ult.chat_id
reply_message = await ult.get_reply_message()
if reply_message.media:
replfile = await reply_message.download_media()
else:
return await eor(ult, "Reply to a Photo or Video..")
return await ult.eor("Reply to a Photo or Video..")
file = await ult.client.upload_file(replfile)
mediain = mediainfo(reply_message.media)
try:
if "pic" not in mediain:
file = types.InputChatUploadedPhoto(video=file)
await ult.client(EditPhotoRequest(chat, file))
await eor(ult, "`Group Photo has Successfully Changed !`", time=5)
await ult.eor("`Group Photo has Successfully Changed !`", time=5)
except Exception as ex:
await eor(ult, "Error occured.\n`{}`".format(str(ex)), time=5)
await ult.eor("Error occured.\n`{}`".format(str(ex)), time=5)
os.remove(replfile)
@ultroid_cmd(
pattern="delgpic ?(.*)",
groups_only=True,
admins_only=True,
type=["official", "manager"],
pattern="delgpic ?(.*)", admins_only=True, manager=True, require="change_info"
)
async def _(ult):
match = ult.pattern_match.group(1)
@@ -239,15 +221,12 @@ async def _(ult):
text = "`Removed Chat Photo..`"
except Exception as E:
text = str(E)
return await eor(ult, text, time=5)
return await ult.eor(text, time=5)
@ultroid_cmd(
pattern="unbanall$",
groups_only=True,
)
@ultroid_cmd(pattern="unbanall$", manager=True, admins_only=True, require="ban_users")
async def _(event):
xx = await eor(event, "Searching Participant Lists.")
xx = await event.eor("Searching Participant Lists.")
p = 0
title = (await event.get_chat()).title
async for i in event.client.iter_participants(
@@ -258,9 +237,11 @@ async def _(event):
try:
await event.client.edit_permissions(event.chat_id, i, view_messages=True)
p += 1
except BaseException:
except no_admin:
pass
await eor(xx, f"{title}: {p} unbanned", time=5)
except BaseException as er:
LOGS.exception(er)
await xx.eor(f"{title}: {p} unbanned", time=5)
@ultroid_cmd(
@@ -270,7 +251,7 @@ async def _(event):
fullsudo=True,
)
async def _(event):
xx = await eor(event, get_string("com_1"))
xx = await event.eor(get_string("com_1"))
input_str = event.pattern_match.group(1)
p, a, b, c, d, m, n, y, w, o, q, r = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
async for i in event.client.iter_participants(event.chat_id):
@@ -369,4 +350,4 @@ async def _(event):
required_string += f" `{HNDLR}rmusers recently` **••** `{r}`\n"
required_string += f" `{HNDLR}rmusers bot` **••** `{b}`\n"
required_string += f" `{HNDLR}rmusers none` **••** `{n}`"
await eor(xx, required_string)
await xx.eor(required_string)