aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/bot.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/bot/cogs/bot.py b/bot/cogs/bot.py
index 1aa335388..cf2257b97 100644
--- a/bot/cogs/bot.py
+++ b/bot/cogs/bot.py
@@ -105,37 +105,37 @@ class Bot:
content = content.strip()
return content
- async def on_message(self, msg: Message):
- if msg.channel.id in self.channel_cooldowns:
- on_cooldown = time.time() - self.channel_cooldowns[msg.channel.id] < 300
- if not on_cooldown or msg.channel.id == DEVTEST_CHANNEL:
- try:
- content = self.codeblock_stripping(msg.content)
- if not content:
- return
-
- # Attempts to parse the message into an AST node.
- # Invalid Python code will raise a SyntaxError.
- tree = ast.parse(content)
-
- # Multiple lines of single words could be interpreted as expressions.
- # This check is to avoid all nodes being parsed as expressions.
- # (e.g. words over multiple lines)
- if not all(isinstance(node, ast.Expr) for node in tree.body):
- codeblock_tag = await self.bot.get_cog("Tags").get_tag_data("codeblock")
- if codeblock_tag == {}:
- # todo: add logging
- return
- howto = (f"Hey {msg.author.mention}!\n\n"
- "I noticed you were trying to paste code into this channel.\n\n"
- f"{codeblock_tag['tag_content']}")
-
- howto_embed = Embed(description=howto)
- await msg.channel.send(embed=howto_embed)
- self.channel_cooldowns[msg.channel.id] = time.time()
- except SyntaxError:
- # todo: add logging
- pass
+# async def on_message(self, msg: Message):
+# if msg.channel.id in self.channel_cooldowns:
+# on_cooldown = time.time() - self.channel_cooldowns[msg.channel.id] < 300
+# if not on_cooldown or msg.channel.id == DEVTEST_CHANNEL:
+# try:
+# content = self.codeblock_stripping(msg.content)
+# if not content:
+# return
+#
+# # Attempts to parse the message into an AST node.
+# # Invalid Python code will raise a SyntaxError.
+# tree = ast.parse(content)
+#
+# # Multiple lines of single words could be interpreted as expressions.
+# # This check is to avoid all nodes being parsed as expressions.
+# # (e.g. words over multiple lines)
+# if not all(isinstance(node, ast.Expr) for node in tree.body):
+# codeblock_tag = await self.bot.get_cog("Tags").get_tag_data("codeblock")
+# if codeblock_tag == {}:
+# # todo: add logging
+# return
+# howto = (f"Hey {msg.author.mention}!\n\n"
+# "I noticed you were trying to paste code into this channel.\n\n"
+# f"{codeblock_tag['tag_content']}")
+#
+# howto_embed = Embed(description=howto)
+# await msg.channel.send(embed=howto_embed)
+# self.channel_cooldowns[msg.channel.id] = time.time()
+# except SyntaxError:
+# # todo: add logging
+# pass
def setup(bot):