aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar JoeBanks13 <[email protected]>2018-03-02 17:06:49 +0000
committerGravatar JoeBanks13 <[email protected]>2018-03-02 17:06:49 +0000
commit632e7edb013c1359668860d0dafe891ab2b8e9f6 (patch)
treeca11c878c10d0b2c08b7514603415992b758ad4d
parentCog management #1404e (#19) (diff)
Stop single tick multi line formatting
-rw-r--r--bot/cogs/bot.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/cogs/bot.py b/bot/cogs/bot.py
index 4c10faa0c..56e36e86a 100644
--- a/bot/cogs/bot.py
+++ b/bot/cogs/bot.py
@@ -78,6 +78,10 @@ class Bot:
if time.time()-self.previous_format_times[msg.channel.id] > 300 or msg.channel.id == DEVTEST_CHANNEL:
if msg.content.count("\n") >= 3:
try:
+ # Some users formatted multi-line code using `'s
+ # This fixes that by treating them as nothing.
+ if "`" in msg.content:
+ msg.content = msg.content.replace("`", "").replace("`", "")
tree = ast.parse(msg.content)
# Attempts to parse the message into an AST node.