Skip to content

Commit adb2e3e

Browse files
authored
Fixes
1 parent a862dce commit adb2e3e

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

plugins/chats.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424

2525
from telethon.errors import ChatAdminRequiredError as no_admin
26-
from telethon.tl import functions
26+
from telethon.tl.functions.messages import DeleteChatUserRequest, CreateChatRequest, ExportChatInviteRequest
27+
from telethon.tl.functions.channels import DeleteChannelRequest
2728

2829
from . import *
2930

@@ -35,7 +36,7 @@
3536
async def _(e):
3637
xx = await eor(e, "`Processing...`")
3738
try:
38-
await e.client(functions.channels.DeleteChannelRequest(e.chat_id))
39+
await e.client(DeleteChannelRequest(e.chat_id))
3940
except TypeError:
4041
return await eod(xx, "`Cant delete this chat`", time=10)
4142
except no_admin:
@@ -51,7 +52,7 @@ async def _(e):
5152
xx = await eor(e, "`Processing...`")
5253
try:
5354
r = await e.client(
54-
functions.messages.ExportChatInviteRequest(e.chat_id),
55+
ExportChatInviteRequest(e.chat_id),
5556
)
5657
except no_admin:
5758
return await eod(xx, "`I m not an admin`", time=10)
@@ -68,20 +69,20 @@ async def _(e):
6869
if type_of_group == "b":
6970
try:
7071
r = await e.client(
71-
functions.messages.CreateChatRequest(
72+
CreateChatRequest(
7273
users=["@missrose_bot"],
7374
title=group_name,
7475
),
7576
)
7677
created_chat_id = r.chats[0].id
7778
await e.client(
78-
functions.messages.DeleteChatUserRequest(
79+
DeleteChatUserRequest(
7980
chat_id=created_chat_id,
8081
user_id="@missrose_bot",
8182
),
8283
)
8384
result = await e.client(
84-
functions.messages.ExportChatInviteRequest(
85+
ExportChatInviteRequest(
8586
peer=created_chat_id,
8687
),
8788
)
@@ -94,15 +95,15 @@ async def _(e):
9495
elif type_of_group == "g" or type_of_group == "c":
9596
try:
9697
r = await e.client(
97-
functions.channels.CreateChannelRequest(
98+
CreateChannelRequest(
9899
title=group_name,
99100
about="Join @TeamUltroid",
100101
megagroup=False if type_of_group == "c" else True,
101102
),
102103
)
103104
created_chat_id = r.chats[0].id
104105
result = await e.client(
105-
functions.messages.ExportChatInviteRequest(
106+
ExportChatInviteRequest(
106107
peer=created_chat_id,
107108
),
108109
)

0 commit comments

Comments
 (0)