Fix escaping html
This commit is contained in:
parent
030276a23f
commit
095e7791d3
7
bot.py
7
bot.py
|
@ -9,6 +9,7 @@ from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, \
|
||||||
RegexHandler
|
RegexHandler
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import config
|
import config
|
||||||
|
@ -20,6 +21,11 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - \
|
||||||
%(message)s', level=logging.INFO)
|
%(message)s', level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
def escape_html(message):
|
||||||
|
return re.sub("<", "<",
|
||||||
|
re.sub("&", "&", message))
|
||||||
|
|
||||||
|
|
||||||
def start(bot, update):
|
def start(bot, update):
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
name = str(update.message.from_user.first_name)
|
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)
|
name = str(update.message.from_user.first_name)
|
||||||
if update.message.from_user.last_name:
|
if update.message.from_user.last_name:
|
||||||
name += " " + str(update.message.from_user.last_name)
|
name += " " + str(update.message.from_user.last_name)
|
||||||
|
name = escape_html(name)
|
||||||
points = player.get_points()
|
points = player.get_points()
|
||||||
total_quests = len(player.get_quests(None))
|
total_quests = len(player.get_quests(None))
|
||||||
completed_quests = len(player.get_quests(1))
|
completed_quests = len(player.get_quests(1))
|
||||||
|
|
Loading…
Reference in New Issue