aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/alias.py8
-rw-r--r--bot/cogs/bot.py7
-rw-r--r--bot/cogs/eval.py2
-rw-r--r--bot/cogs/site.py16
4 files changed, 28 insertions, 5 deletions
diff --git a/bot/cogs/alias.py b/bot/cogs/alias.py
index 940bdaa43..7b342a2d0 100644
--- a/bot/cogs/alias.py
+++ b/bot/cogs/alias.py
@@ -85,6 +85,14 @@ class Alias:
await self.invoke(ctx, "site faq")
+ @command(name="rules", hidden=True)
+ async def site_rules_alias(self, ctx):
+ """
+ Alias for invoking <prefix>site rules.
+ """
+
+ await self.invoke(ctx, "site rules")
+
@command(name="reload", hidden=True)
async def reload_cog_alias(self, ctx, *, cog_name: str):
"""
diff --git a/bot/cogs/bot.py b/bot/cogs/bot.py
index 168916a64..846783e08 100644
--- a/bot/cogs/bot.py
+++ b/bot/cogs/bot.py
@@ -236,8 +236,7 @@ class Bot:
"\u3003\u3003\u3003"
]
- has_bad_ticks = msg.content[:3] in not_backticks
- return has_bad_ticks
+ return msg.content[:3] in not_backticks
async def on_message(self, msg: Message):
"""
@@ -372,11 +371,11 @@ class Bot:
channel = self.bot.get_channel(payload.data.get("channel_id"))
user_message = await channel.get_message(payload.message_id)
- # Checks to see if the user has corrected their codeblock
+ # Checks to see if the user has corrected their codeblock. If it's fixed, has_fixed_codeblock will be None
has_fixed_codeblock = self.codeblock_stripping(payload.data.get("content"), self.has_bad_ticks(user_message))
# If the message is fixed, delete the bot message and the entry from the id dictionary
- if has_fixed_codeblock:
+ if has_fixed_codeblock is None:
bot_message = await channel.get_message(self.codeblock_message_ids[payload.message_id])
await bot_message.delete()
del self.codeblock_message_ids[payload.message_id]
diff --git a/bot/cogs/eval.py b/bot/cogs/eval.py
index faecdf145..421fa5b53 100644
--- a/bot/cogs/eval.py
+++ b/bot/cogs/eval.py
@@ -185,7 +185,7 @@ async def func(): # (None,) -> Any
async def eval(self, ctx, *, code: str):
""" Run eval in a REPL-like format. """
code = code.strip("`")
- if code.startswith("py\n"):
+ if re.match('py(thon)?\n', code):
code = "\n".join(code.split("\n")[1:])
if not re.search( # Check if it's an expression
diff --git a/bot/cogs/site.py b/bot/cogs/site.py
index e5fd645fb..442e80cd2 100644
--- a/bot/cogs/site.py
+++ b/bot/cogs/site.py
@@ -92,6 +92,22 @@ class Site:
await ctx.send(embed=embed)
+ @site_group.command(name="rules")
+ async def site_rules(self, ctx: Context):
+ """Info about the server's rules."""
+
+ url = f"{URLs.site_schema}{URLs.site}/about/rules"
+
+ embed = Embed(title="Rules")
+ embed.set_footer(text=url)
+ embed.colour = Colour.blurple()
+ embed.description = (
+ f"The rules and guidelines that apply to this community can be found on our [rules page]({url}). "
+ "We expect all members of the community to have read and understood these."
+ )
+
+ await ctx.send(embed=embed)
+
def setup(bot):
bot.add_cog(Site(bot))