aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/issues.py
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-04-06 10:29:46 +0200
committerGravatar Matteo Bertucci <[email protected]>2021-04-06 10:29:46 +0200
commit6241e9db8a2489c1bbdd0079cabd9dbd7b5b9b61 (patch)
treeceb61a295c6a4456d6e077e35e9c56a55df06475 /bot/exts/evergreen/issues.py
parentIssues: ignore bots (diff)
parentMerge 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/evergreen/issues.py')
-rw-r--r--bot/exts/evergreen/issues.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py
index 7e9defbe..7255d450 100644
--- a/bot/exts/evergreen/issues.py
+++ b/bot/exts/evergreen/issues.py
@@ -7,7 +7,16 @@ from dataclasses import dataclass
import discord
from discord.ext import commands, tasks
-from bot.constants import Categories, Colours, ERROR_REPLIES, Emojis, Tokens, WHITELISTED_CHANNELS
+from bot.constants import (
+ Categories,
+ Channels,
+ Colours,
+ ERROR_REPLIES,
+ Emojis,
+ NEGATIVE_REPLIES,
+ Tokens,
+ WHITELISTED_CHANNELS
+)
from bot.utils.decorators import whitelist_override
log = logging.getLogger(__name__)
@@ -200,7 +209,7 @@ class Issues(commands.Cog):
await ctx.invoke(self.bot.get_command('help'), 'issue')
results = [await self.fetch_issues(number, repository, user) for number in numbers]
- await ctx.send(embed=self.format_embed(results))
+ await ctx.send(embed=self.format_embed(results, user, repository))
@commands.Cog.listener()
async def on_message(self, message: discord.Message) -> None:
@@ -218,6 +227,20 @@ class Issues(commands.Cog):
links = []
if issues:
+ # Block this from working in DMs
+ if not message.guild:
+ await message.channel.send(
+ embed=discord.Embed(
+ title=random.choice(NEGATIVE_REPLIES),
+ description=(
+ "You can't retrieve issues from DMs. "
+ f"Try again in <#{Channels.community_bot_commands}>"
+ ),
+ colour=discord.Colour.red()
+ )
+ )
+ return
+
log.trace(f"Found {issues = }")
# Remove duplicates
issues = set(issues)