aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons
diff options
context:
space:
mode:
Diffstat (limited to 'bot/seasons')
-rw-r--r--bot/seasons/christmas/adventofcode.py2
-rw-r--r--bot/seasons/easter/egg_hunt/cog.py3
-rw-r--r--bot/seasons/easter/egg_hunt/constants.py3
-rw-r--r--bot/seasons/evergreen/error_handler.py15
-rw-r--r--bot/seasons/evergreen/issues.py2
-rw-r--r--bot/seasons/evergreen/speedrun.py28
-rw-r--r--bot/seasons/season.py3
7 files changed, 53 insertions, 3 deletions
diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py
index 08b07e83..a9e72805 100644
--- a/bot/seasons/christmas/adventofcode.py
+++ b/bot/seasons/christmas/adventofcode.py
@@ -14,6 +14,7 @@ from discord.ext import commands
from pytz import timezone
from bot.constants import AdventOfCode as AocConfig, Channels, Colours, Emojis, Tokens
+from bot.decorators import override_in_channel
log = logging.getLogger(__name__)
@@ -125,6 +126,7 @@ class AdventOfCode(commands.Cog):
self.status_task = asyncio.ensure_future(self.bot.loop.create_task(status_coro))
@commands.group(name="adventofcode", aliases=("aoc",), invoke_without_command=True)
+ @override_in_channel
async def adventofcode_group(self, ctx: commands.Context):
"""All of the Advent of Code commands."""
await ctx.send_help(ctx.command)
diff --git a/bot/seasons/easter/egg_hunt/cog.py b/bot/seasons/easter/egg_hunt/cog.py
index 30fd3284..a4ad27df 100644
--- a/bot/seasons/easter/egg_hunt/cog.py
+++ b/bot/seasons/easter/egg_hunt/cog.py
@@ -9,7 +9,8 @@ from pathlib import Path
import discord
from discord.ext import commands
-from bot.constants import Channels, Client, Roles as MainRoles, bot
+from bot.bot import bot
+from bot.constants import Channels, Client, Roles as MainRoles
from bot.decorators import with_role
from .constants import Colours, EggHuntSettings, Emoji, Roles
diff --git a/bot/seasons/easter/egg_hunt/constants.py b/bot/seasons/easter/egg_hunt/constants.py
index c7d9818b..02f6e9f2 100644
--- a/bot/seasons/easter/egg_hunt/constants.py
+++ b/bot/seasons/easter/egg_hunt/constants.py
@@ -2,7 +2,8 @@ import os
from discord import Colour
-from bot.constants import Channels, Client, bot
+from bot.bot import bot
+from bot.constants import Channels, Client
GUILD = bot.get_guild(Client.guild)
diff --git a/bot/seasons/evergreen/error_handler.py b/bot/seasons/evergreen/error_handler.py
index f4457f8f..6690cf89 100644
--- a/bot/seasons/evergreen/error_handler.py
+++ b/bot/seasons/evergreen/error_handler.py
@@ -1,10 +1,15 @@
import logging
import math
+import random
import sys
import traceback
+from discord import Colour, Embed
from discord.ext import commands
+from bot.constants import NEGATIVE_REPLIES
+from bot.decorators import InChannelCheckFailure
+
log = logging.getLogger(__name__)
@@ -34,6 +39,16 @@ class CommandErrorHandler(commands.Cog):
error = getattr(error, 'original', error)
+ if isinstance(error, InChannelCheckFailure):
+ logging.debug(
+ f"{ctx.author} the command '{ctx.command}', but they did not have "
+ f"permissions to run commands in the channel {ctx.channel}!"
+ )
+ embed = Embed(colour=Colour.red())
+ embed.title = random.choice(NEGATIVE_REPLIES)
+ embed.description = str(error)
+ return await ctx.send(embed=embed)
+
if isinstance(error, commands.CommandNotFound):
return logging.debug(
f"{ctx.author} called '{ctx.message.content}' but no command was found."
diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py
index 2a31a2e1..f19a1129 100644
--- a/bot/seasons/evergreen/issues.py
+++ b/bot/seasons/evergreen/issues.py
@@ -4,6 +4,7 @@ import discord
from discord.ext import commands
from bot.constants import Colours
+from bot.decorators import override_in_channel
log = logging.getLogger(__name__)
@@ -15,6 +16,7 @@ class Issues(commands.Cog):
self.bot = bot
@commands.command(aliases=("issues",))
+ @override_in_channel
async def issue(self, ctx, number: int, repository: str = "seasonalbot", user: str = "python-discord"):
"""Command to retrieve issues from a GitHub repository."""
api_url = f"https://api.github.com/repos/{user}/{repository}/issues/{number}"
diff --git a/bot/seasons/evergreen/speedrun.py b/bot/seasons/evergreen/speedrun.py
new file mode 100644
index 00000000..f6a43a63
--- /dev/null
+++ b/bot/seasons/evergreen/speedrun.py
@@ -0,0 +1,28 @@
+import json
+import logging
+from pathlib import Path
+from random import choice
+
+from discord.ext import commands
+
+log = logging.getLogger(__name__)
+with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf-8") as file:
+ LINKS = json.load(file)
+
+
+class Speedrun(commands.Cog):
+ """Commands about the video game speedrunning community."""
+
+ def __init__(self, bot):
+ self.bot = bot
+
+ @commands.command(name="speedrun")
+ async def get_speedrun(self, ctx):
+ """Sends a link to a video of a random speedrun."""
+ await ctx.send(choice(LINKS))
+
+
+def setup(bot):
+ """Load the Speedrun cog"""
+ bot.add_cog(Speedrun(bot))
+ log.info("Speedrun cog loaded")
diff --git a/bot/seasons/season.py b/bot/seasons/season.py
index 3b623040..c88ef2a7 100644
--- a/bot/seasons/season.py
+++ b/bot/seasons/season.py
@@ -12,7 +12,8 @@ import async_timeout
import discord
from discord.ext import commands
-from bot.constants import Channels, Client, Roles, bot
+from bot.bot import bot
+from bot.constants import Channels, Client, Roles
from bot.decorators import with_role
log = logging.getLogger(__name__)