diff options
| author | 2021-04-06 10:29:46 +0200 | |
|---|---|---|
| committer | 2021-04-06 10:29:46 +0200 | |
| commit | 6241e9db8a2489c1bbdd0079cabd9dbd7b5b9b61 (patch) | |
| tree | ceb61a295c6a4456d6e077e35e9c56a55df06475 /bot/exts/easter/easter_riddle.py | |
| parent | Issues: ignore bots (diff) | |
| parent | Merge pull request #658 from python-discord/ks123/ghcr-token-to-github (diff) | |
Merge remote-tracking branch 'origin/main' into akarys/630/automatic-linking-everywhere
Diffstat (limited to 'bot/exts/easter/easter_riddle.py')
| -rw-r--r-- | bot/exts/easter/easter_riddle.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bot/exts/easter/easter_riddle.py b/bot/exts/easter/easter_riddle.py index 3c612eb1..a93b3745 100644 --- a/bot/exts/easter/easter_riddle.py +++ b/bot/exts/easter/easter_riddle.py @@ -7,7 +7,7 @@ from pathlib import Path import discord from discord.ext import commands -from bot.constants import Colours +from bot.constants import Colours, NEGATIVE_REPLIES log = logging.getLogger(__name__) @@ -36,6 +36,17 @@ class EasterRiddle(commands.Cog): if self.current_channel: return await ctx.send(f"A riddle is already being solved in {self.current_channel.mention}!") + # Don't let users start in a DM + if not ctx.guild: + await ctx.send( + embed=discord.Embed( + title=random.choice(NEGATIVE_REPLIES), + description="You can't start riddles in DMs", + colour=discord.Colour.red() + ) + ) + return + self.current_channel = ctx.message.channel random_question = random.choice(RIDDLE_QUESTIONS) |