telegramircd icon indicating copy to clipboard operation
telegramircd copied to clipboard

[Feature Request] Pinned messages as room description

Open rodneyrod opened this issue 8 years ago • 11 comments

Currently there's not any easy way to locate pinned messages after they're posted, one solution could be to change the IRC room description to match whatever's pinned

rodneyrod avatar Jul 19 '17 02:07 rodneyrod

How is pinned message implemented?

MaskRay avatar Oct 24 '17 03:10 MaskRay

From what I can see, you can access that API from other libraries but it's not implemented in telegram-cli as development of that seems to have halted. I'll try and supply a list of what libraries have that API to hook in to.

rodneyrod avatar Oct 24 '17 09:10 rodneyrod

I would also like to know what library can a good replacement of telegram-cli. telegram-cli leaks memory and has so many other issues that I have to restart it after running for one or two days.

MaskRay avatar Oct 26 '17 02:10 MaskRay

I think that Telethon library (Python) hooks into these hidden APIs https://github.com/LonamiWebs/Telethon

https://lonamiwebs.github.io/Telethon/constructors/update_dialog_pinned.html

rodneyrod avatar Oct 26 '17 05:10 rodneyrod

This library is awesome! I have updated https://github.com/MaskRay/telegramircd to substitue Telethon for telegram-cli to communicate with Telegram servers. The installation is different, please review the instructions in README.md.

I am tired of restarting telegram-cli one day or two... Hope telethon can be much stabler.

MaskRay avatar Oct 30 '17 01:10 MaskRay

How to retrieve the pinned message of a chat/channel?

MaskRay avatar Oct 31 '17 04:10 MaskRay

I'll test your latest version either tonight or tomorrow to see how it's going. The refactor looks very large, thanks so much for putting in the effort of rebasing this on a new library. I know that it's not an easy job, so many thanks for putting the time in to this :)

rodneyrod avatar Oct 31 '17 08:10 rodneyrod

Testing the latest version, everything seems to be working as it did before.

As far as the exact API to get pinned messages I'm not sure of myself, but it might be this: https://lonamiwebs.github.io/Telethon/methods/messages/get_pinned_dialogs.html

rodneyrod avatar Nov 08 '17 10:11 rodneyrod

In an IPython session in the directory containing telegramircd.session, I ran the following commands and found nothing related to pinned messages:

In [1]: from telethon import TelegramClient

In [2]: client  = TelegramClient('telegramircd', ................)

In [3]: import telethon.tl as tl

In [4]: dialogs = client.invoke(tl.functions.messages.GetPinnedDialogsRequest())

In [5]: dialogs
Out[5]: <telethon.tl.types.messages.PeerDialogs at 0x7fa899881f28>

In [6]: dialogs.dialogs
Out[6]: []

In [7]: dialogs.chats
Out[7]: []

In [8]: dialogs.to_dict
Out[8]: <bound method PeerDialogs.to_dict of <telethon.tl.types.messages.PeerDialogs object at 0x7fa899881f28>>

In [9]: dialogs.to_dict()
Out[9]:
{'chats': [],
 'dialogs': [],
 'messages': [],
 'state': {'date': datetime.datetime(2017, 11, 9, 6, 17, 45),
  'pts': 264080,
  'qts': 0,
  'seq': 1199,
  'unread_count': 421},
....

MaskRay avatar Nov 09 '17 14:11 MaskRay

Any solution to fetch pinned message from a channel ? I also ran on same issue @MaskRay .

ccir105 avatar Jan 22 '18 19:01 ccir105

Might be under function 'GetPinnedDialogsRequest'

rodneyrod avatar Jan 08 '20 08:01 rodneyrod