@develom

Python библиотека telethon. Как создать папку с чатами?

Мне нужно создавать с помощью юзер бота папку с чатами в телеграмме , но выдается такая ошибка :

Traceback (most recent call last):
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\tl\tlobject.py", line 194, in __bytes__
return self._bytes()
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\tl\functions\messages.py", line 5627, in _bytes
b'' if self.filter is None or self.filter is False else (self.filter._bytes()),
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\tl\types\__init__.py", line 5126, in _bytes
b'\x15\xc4\xb5\x1c',struct.pack(' File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\tl\types\__init__.py", line 5126, in
b'\x15\xc4\xb5\x1c',struct.pack(' AttributeError: 'str' object has no attribute '_bytes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\develom\Desktop\тг консоль\main.py", line 38, in
result = client(functions.messages.UpdateDialogFilterRequest(
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\sync.py", line 39, in syncified
return loop.run_until_complete(coro)
File "C:\Users\develom\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 608, in run_until_complete
return future.result()
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\client\users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\client\users.py", line 63, in _call
future = sender.send(request, ordered=ordered)
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\network\mtprotosender.py", line 176, in send
state = RequestState(request)
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\network\requeststate.py", line 17, in __init__
self.data = bytes(request)
File "C:\Users\develom\AppData\Roaming\Python\Python38\site-packages\telethon\tl\tlobject.py", line 200, in __bytes__
raise TypeError('a TLObject was expected but found something else')
TypeError: a TLObject was expected but found something else

----------------------------КОД-----------------------------------

from telethon.sync import TelegramClient
from telethon import functions, types

api_id = *******
api_hash = '******'
phone = '+*******'
name = 't*****e'

# with TelegramClient(name, api_id, api_hash) as client:
# result = client(functions.messages.UpdateDialogFilterRequest(
# id=1,
# filter=types.DialogFilter(
# id=4,
# title='My awesome title',
# pinned_peers=[199779864],
# include_peers=[199779864],
# exclude_peers=[199779864]
# )
# ))
# print(result)

# with TelegramClient(name, api_id, api_hash) as client:
# result = client(functions.messages.GetDialogFiltersRequest())
# for x in result:
# print(x,'\n\n')

with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.UpdateDialogFiltersOrderRequest(
order=[42]
))
print(result)

with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.UpdateDialogFilterRequest(
id=42,
filter=types.DialogFilter(
id=42,
title='My awesome title',
pinned_peers=['Paveldyrovv'],
include_peers=['Paveldyrovv'],
exclude_peers=['Paveldyrovv'],
contacts=True,
non_contacts=True,
groups=True,
broadcasts=True,
bots=True,
exclude_muted=True,
exclude_read=True,
exclude_archived=True,
emoticon='some string here'
)
))
print(result)
  • Вопрос задан
  • 696 просмотров
Пригласить эксперта
Ответы на вопрос 1
@develom Автор вопроса
61e7dda9df94a566727620.png
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы