-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added IRC string formatting to HTML conversion #1
base: develop
Are you sure you want to change the base?
Conversation
-Added function that converts IRC string formatting code to its equivalent HTML code -Set sendMessage's optional parse_mode parameter to HTML
@@ -64,11 +71,11 @@ var init = function(msgCallback) { | |||
} | |||
|
|||
if (message.user) { | |||
message.text = '<' + message.user + '> ' + message.text; | |||
message.text = '<' + message.user + '> ' + irc_to_html_format(message.text); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
} | ||
|
||
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); |
There was a problem hiding this comment.
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
-Added function that converts IRC string formatting code to its equivalent HTML code
-Set sendMessage's optional parse_mode parameter to HTML