Skip to content

Conversation

@oliveratgithub
Copy link

Introduces a new optional QUOTE_NICKNAME=true setting, that adjusts how IRC messages - particularly the nickname part - are rendered when bridged to Telegram.

Instead of a whole unformatted string, it uses the supported <blockquote>-formatting for the Telegram messages. This results in the sending IRC nickname to be better visible, but also clearly distinguishable from the IRC user's effective Text Message.

Comparison

  • Telegram message default behaviour / before:

<ircnick> Hello from IRC to Telegram

  • New behaviour and format, if this mode is enabled, will rather look as follows:
> <ircnick>
Hello from IRC to Telegram

Context

For this to work:

  • the message's parse_mode has to be set to HTML
  • and this requires proper HTML-escaping / HTML-tag removal on the IRC nickname & message parts, before calling the Telegram Bot API sendMessage command.
  • The StripHTML() func invoked for that, was taken from here: https://go.dev/play/p/fqHzlCJa9ta (L31-35)

Introduces a new optional `QUOTE_NICKNAME=true` setting, that adjusts how IRC messages - particularly the nickname part - are rendered when bridged to Telegram: instead of a whole unformatted string, it uses the supported `<blockquote>`-formatting for the Telegram messages. This results in the sending IRC nickname to be better visible, but also clearly distinguishable from the IRC user's effective Text Message.

- Telegram message default behaviour / before:

`<ircnick> Hello from IRC to Telegram`

- New behaviour and format, if this mode is enabled, will rather look as follows:

```
> <ircnick>
Hello from IRC to Telegram
```

For this to work:
- the message's parse_mode has to be set to `HTML`
- and this requires proper HTML-escaping / HTML-tag removal on the IRC nickname & message parts, before calling the Telegram Bot API sendMessage command.
- The StripHTML() func invoked for that, was taken from here: https://go.dev/play/p/fqHzlCJa9ta (L31-35)
+ A few Go syntax validation improvements
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

Successfully merging this pull request may close these issues.

2 participants