Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
buddhhu authored Apr 16, 2021
1 parent a862dce commit adb2e3e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions plugins/chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@


from telethon.errors import ChatAdminRequiredError as no_admin
from telethon.tl import functions
from telethon.tl.functions.messages import DeleteChatUserRequest, CreateChatRequest, ExportChatInviteRequest
from telethon.tl.functions.channels import DeleteChannelRequest

from . import *

Expand All @@ -35,7 +36,7 @@
async def _(e):
xx = await eor(e, "`Processing...`")
try:
await e.client(functions.channels.DeleteChannelRequest(e.chat_id))
await e.client(DeleteChannelRequest(e.chat_id))
except TypeError:
return await eod(xx, "`Cant delete this chat`", time=10)
except no_admin:
Expand All @@ -51,7 +52,7 @@ async def _(e):
xx = await eor(e, "`Processing...`")
try:
r = await e.client(
functions.messages.ExportChatInviteRequest(e.chat_id),
ExportChatInviteRequest(e.chat_id),
)
except no_admin:
return await eod(xx, "`I m not an admin`", time=10)
Expand All @@ -68,20 +69,20 @@ async def _(e):
if type_of_group == "b":
try:
r = await e.client(
functions.messages.CreateChatRequest(
CreateChatRequest(
users=["@missrose_bot"],
title=group_name,
),
)
created_chat_id = r.chats[0].id
await e.client(
functions.messages.DeleteChatUserRequest(
DeleteChatUserRequest(
chat_id=created_chat_id,
user_id="@missrose_bot",
),
)
result = await e.client(
functions.messages.ExportChatInviteRequest(
ExportChatInviteRequest(
peer=created_chat_id,
),
)
Expand All @@ -94,15 +95,15 @@ async def _(e):
elif type_of_group == "g" or type_of_group == "c":
try:
r = await e.client(
functions.channels.CreateChannelRequest(
CreateChannelRequest(
title=group_name,
about="Join @TeamUltroid",
megagroup=False if type_of_group == "c" else True,
),
)
created_chat_id = r.chats[0].id
result = await e.client(
functions.messages.ExportChatInviteRequest(
ExportChatInviteRequest(
peer=created_chat_id,
),
)
Expand Down

0 comments on commit adb2e3e

Please sign in to comment.