escape ( and )

This commit is contained in:
2021-03-14 14:54:59 +01:00
parent 8c9cc4db88
commit 6f5cbcc23a
2 changed files with 30 additions and 13 deletions

View File

@@ -16,6 +16,8 @@ def escape_mods(text: str) -> str:
text = text.replace('%', '{%}')
text = text.replace('+', '{+}')
text = text.replace('^', '{^}')
text = text.replace('(', '{(}')
text = text.replace(')', '{)}')
return text
@@ -31,20 +33,27 @@ def send_to_format(type: str, message: data.Message) -> None:
message (data.Message): Message data. Placeholders in the message type will be replaced with this data.
conf (dict): Configution dictionary where the messages are stored.
"""
text = conf['Chat'][type].format(message=message.message,
date=message.date,
channel=message.channel.name,
user=message.user,
guild=message.guild,
to_from=message.to_from)
if message.trade:
text = text.format(item=message.trade.item,
amount=message.trade.amount,
currency=message.trade.currency,
tab=message.trade.tab,
row=message.trade.row,
col=message.trade.col,
league=message.trade.league)
text = config.conf['Chat'][type].format(message=message.message,
date=message.date,
channel=message.channel.name,
user=message.user,
guild=message.guild,
to_from=message.to_from,
item=message.trade.item,
amount=message.trade.amount,
currency=message.trade.currency,
tab=message.trade.tab,
row=message.trade.row,
col=message.trade.col,
league=message.trade.league)
else:
text = config.conf['Chat'][type].format(message=message.message,
date=message.date,
channel=message.channel.name,
user=message.user,
guild=message.guild,
to_from=message.to_from)
send_to(message.user, text)