Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channels.getForumTopics always return "Cannot read properties of undefined (reading 'call')" #281

Open
Endytech opened this issue May 31, 2023 · 1 comment

Comments

@Endytech
Copy link

Endytech commented May 31, 2023

Try to get Forum list by mtproto API "channels.getForumTopics"

        let resolvedPeer = { chats: [] };
        try {
            resolvedPeer = await api.call('contacts.resolveUsername', {
                username,
            });
        } catch (error) {
            console.warn('Error for get chat', username);
        }
        const chat = resolvedPeer.chats.find((chat) => (chat.id === resolvedPeer.peer.channel_id));
  const inputChannel = {
      _: 'inputChannel',
      channel_id: chat.id,
      access_hash: chat.access_hash,
  };
  const forumTopics = await api.call('channels.getForumTopics', {
      channel: inputChannel,
      offset_date: 0,
      offset_id: 0,
      offset_topic: 0,
      limit: 100,
      q: '',
  });

It always return "Cannot read properties of undefined (reading 'call')"

Expected behavior
To get example ForumTopic that must be returned i used Telethon Python Library.

from telethon.tl.functions.channels import GetForumTopicsRequest

chatEntity = client.get_entity(chat_name)
forums = client(GetForumTopicsRequest(chatEntity, 0, 0, 0, 1000))
print(forums)

ForumTopic(id=3, date=datetime.datetime(2023, 2, 27, 13, 29, 19, tzinfo=datetime.timezone.utc), title='Сделки Bybit', icon_color=16766590, top_message=611,
read_inbox_max_id=611, read_outbox_max_id=611, unread_count=0, unread_mentions_count=0, unread_reactions_count=0, from_id=PeerUser(user_id=5228976776), notify_settings=PeerNotifySettings(show_previews=None, silent=None, mute_until=None, ios_sound=None, android_sound=None, other_sound=None), my=False, closed=False, pinned=True, short=False, hidden=False, icon_emoji_
id=5269673041079574154, draft=None)

Docs
https://core.telegram.org/api/forum#forum-topics
https://core.telegram.org/constructor/messages.forumTopics

@joeberetta
Copy link

It's happening cuz current supported layer(so named api version of telegram) is 139, while forums was added in layer 148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants