Browse Source

Fix escaping html

master
Ceda EI 3 years ago
parent
commit
095e7791d3
  1. 7
      bot.py

7
bot.py

@ -9,6 +9,7 @@ from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, \
RegexHandler
import signal
import sys
import re
try:
import config
@ -20,6 +21,11 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - \
%(message)s', level=logging.INFO)
def escape_html(message):
return re.sub("<", "&lt;",
re.sub("&", "&amp;", message))
def start(bot, update):
chat_id = update.message.chat_id
name = str(update.message.from_user.first_name)
@ -151,6 +157,7 @@ def send_status(bot, update, player, prefix=""):
name = str(update.message.from_user.first_name)
if update.message.from_user.last_name:
name += " " + str(update.message.from_user.last_name)
name = escape_html(name)
points = player.get_points()
total_quests = len(player.get_quests(None))
completed_quests = len(player.get_quests(1))

Loading…
Cancel
Save