Skip to content

Added IRC string formatting to HTML conversion#1

Open
stormtrek wants to merge 2 commits into
6697:developfrom
stormtrek:patch-1
Open

Added IRC string formatting to HTML conversion#1
stormtrek wants to merge 2 commits into
6697:developfrom
stormtrek:patch-1

Conversation

@stormtrek
Copy link
Copy Markdown

-Added function that converts IRC string formatting code to its equivalent HTML code
-Set sendMessage's optional parse_mode parameter to HTML

-Added function that converts IRC string formatting code to its equivalent HTML code
-Set sendMessage's optional parse_mode parameter to HTML
Comment thread src/tg/index.js

if (message.user) {
message.text = '<' + message.user + '> ' + message.text;
message.text = '<' + message.user + '> ' + irc_to_html_format(message.text);
Copy link
Copy Markdown

@melamity melamity Jun 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely if you're sending HTML tags in a message you'd want to escape where it shows the username of the person who talked? It might be mistaken as a tag.

Copy link
Copy Markdown

@omnidan omnidan Jun 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<username> will be interpreted as an XML tag and probably will end up being removed by telegram, same goes for user input that contains these characters. We need to escape all occurences of < and > first.

Comment thread src/tg/index.js

logger.verbose('>> relaying to TG:', message.text);
tg.sendMessage(message.channel.tgChatId, message.text);
tg.sendMessage(message.channel.tgChatId, message.text, parse_mode=telegram.ParseMode.HTML);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax does not exist in JavaScript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants