Skip to content

TypeError: GetForumTopics.__init__() got an unexpected keyword argument 'channel' #168

Description

@tradingshop

Checklist

  • I am sure the error is coming from Pyrofork's code and not elsewhere
  • I have searched in the issue tracker for similar bug reports, including closed ones
  • I ran pip3 install -U git+https://github.com/Mayuri-Chan/pyrofork and reproduced the issue using the latest development version

Description

Возникло исключение: TypeError
GetForumTopics.init() got an unexpected keyword argument 'channel'
File "/Users/dken/OpenServer/domains/python/copytelegram/copy-telegram-forums.py", line 133, in list_forum_topics
topic_count += 1
...<2 lines>...

File "/Users/dken/OpenServer/domains/python/copytelegram/copy-telegram-forums.py", line 153, in
asyncio.run(list_forum_topics(from_cannel))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GetForumTopics.init() got an unexpected keyword argument 'channel'

Steps to reproduce

test chat.FORUM

Code example

async def list_forum_topics(chat_id: int):  # Параметр называется chat_id
    """
    Получает и выводит список тем (топиков) в форуме Telegram.
    """
    client = Client(name=SESSION_NAME, api_id=API_ID, api_hash=API_HASH)
    await client.start()
    
    print(f"Получение списка тем для чата/форума: {chat_id}")
    # Используем параметр chat_id, как указано в документации[citation:1]
    topics_generator = client.get_forum_topics(chat_id=chat_id)

    topic_count = 0
    async for topic in topics_generator:
        topic_count += 1
        # Выводим информацию о теме
        print(f"Тема #{topic_count}: ID={topic.id}, Заголовок='{topic.title}'")

    if topic_count == 0:
        print("В этом чате не найдено тем. Убедитесь, что это форум.")
    else:
        print(f"--- Всего тем найдено: {topic_count} ---")

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions