Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Include limited characters from Telegram replies in relayed IRC message #51
The teleboto bot in #fedora-zh does to interesting things. Notice this exchange from the IRC side:
[alick9188] @bexelbie You're living in China?
First, the name from telegram is in square brackets, making it more obvious it is passed through.
Second, it quotes part of the replied to message to give greater context.
I see this issue as a UI/UX enhancement for two things:
I will update this accordingly.
Quoting messages should be a configurable options. If set to true, there should also be a configuration value for the number of characters for quoting messages. Assume a default of maybe 15 characters.
When configured accordingly, the messages appear like this:
...I swear we had a way in teleirc to determine if a message from telegram was a reply or not... Did I dream that 0_o? That would be step one.
Step two would be getting the message that was replied to. Its been a while since I looked at the Telegram Bot API... but I would assume it would include either the replied message as a string, a message object, or an ID on a message object. If its a string or message object, that's not too bad to grab, but an ID could get tricky as we'll have to make a second request to get the string of the message of that ID (or heaven forbid do caching).
The rest is straightforward, pre-pending the IRC message with the characters from the config, and making a substring of the message that was replied to.
Another thing to consider, we need to set an upper limit of the number of characters to quote. An IRC message can go up to 510 characters (512 if you count \r\n). Subtract 7 for "PRIVMSG", 50 for a worst-case Channel name, 3 for special IRC characters, 32 characters for the worst-case Telegram user name length, leaves 418 characters for an IRC message (for Chaskis, I actually round down to 400 for the maximum number of characters a message can have to be safe). 400 characters is pretty significant, so we can probably be generous with the upper limit of the number of characters to quote (like 50-100). A number of 0 could disable the feature. A negative number should raise a configuration error.
Discussed in 2019-03-02 developer meeting.
This feature is accepted for the v1.4 release. @Tjzabel will work on this feature for this sprint. His next action item is to share a short write-up of how to approach this one before the next developer meeting on March 9th.
good first issue
Mar 2, 2019
Discussed during 2019-04-06 developer meeting.
During the meeting, we took a realistic evaluation of work remaining for this sprint and what will make the next release. We changed our original plans of releasing v1.4 at the end of this month, and instead we're going for a smaller release, v1.3.1, with some of the other tasks.
This ticket will not be completed in the v1.3.1 sprint. It will remain on the v1.4 release milestone. Work on this release may not begin until August 2019.
Work has gone underway! Here's what's been done so far:
It is unknown when I will get around to actually completing this issue, but at least a head start has been made. I'm projecting an early-summer deadline.
Also, as an update to @xforever1313's comment, a reply message is indeed a Message object in itself, so a simple check just needs to be made to see if the
If it does, then we go into that message object, grab say, the first 20 characters, and prepend it to the main message. We should make the reply message length a config variable. After that, it's pretty straight forward!