1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Fix diario text bug

This commit is contained in:
Steffo 2019-02-09 19:57:49 +01:00
parent 7613e368dc
commit 11b119b08e
2 changed files with 8 additions and 6 deletions

View file

@ -7,7 +7,10 @@ class SafeDict(dict):
return key
def safely_format_string(string: str, words: typing.Dict[str, str]) -> str:
def safely_format_string(string: str, words: typing.Dict[str, str], ignore_escaping=False) -> str:
if ignore_escaping:
escaped = words
else:
escaped = {}
for key in words:
escaped[key] = words[key].replace("<", "&lt;").replace(">", "&gt;")

View file

@ -53,8 +53,7 @@ sentry = raven.Client(config["Sentry"]["token"],
def reply_msg(bot: telegram.Bot, chat_id: int, string: str, ignore_escaping=False, **kwargs) -> telegram.Message:
if not ignore_escaping:
string = strings.safely_format_string(string, words=kwargs)
string = strings.safely_format_string(string, ignore_escaping=ignore_escaping, words=kwargs)
return bot.send_message(chat_id, string,
parse_mode="HTML",
disable_web_page_preview=True)