aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris <[email protected]>2021-04-02 14:53:27 +0100
committerGravatar Chris <[email protected]>2021-04-02 14:53:27 +0100
commite3b7b3bc5b56b805112558377e25e2537cc86083 (patch)
tree78c79c19a1780e51df830c0f16d4c28999619a60
parentFirst pass of easy to produce errors (diff)
Don't allow users to run the issue command in DMs, given error feedback.
-rw-r--r--bot/exts/evergreen/issues.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py
index 1f22f287..0f0be33a 100644
--- a/bot/exts/evergreen/issues.py
+++ b/bot/exts/evergreen/issues.py
@@ -7,7 +7,16 @@ from enum import Enum
import discord
from discord.ext import commands, tasks
-from bot.constants import Categories, Channels, Colours, ERROR_REPLIES, Emojis, Tokens, WHITELISTED_CHANNELS
+from bot.constants import (
+ Categories,
+ Channels,
+ Colours,
+ ERROR_REPLIES,
+ Emojis,
+ NEGATIVE_REPLIES,
+ Tokens,
+ WHITELISTED_CHANNELS
+)
log = logging.getLogger(__name__)
@@ -148,11 +157,20 @@ class Issues(commands.Cog):
user: str = "python-discord"
) -> None:
"""Command to retrieve issue(s) from a GitHub repository."""
- if not(
+ if not ctx.guild or not(
ctx.channel.category.id in WHITELISTED_CATEGORIES
or ctx.channel.id in WHITELISTED_CHANNELS
):
- return
+ await ctx.send(
+ embed=discord.Embed(
+ title=random.choice(NEGATIVE_REPLIES),
+ description=(
+ "You can't run this command in this channel. "
+ f"Try again in {Channels.community_bot_commands}"
+ ),
+ colour=discord.Colour.red()
+ )
+ )
result = await self.fetch_issues(set(numbers), repository, user)