aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar janine9vn <[email protected]>2020-12-02 09:28:32 -0500
committerGravatar Janine <[email protected]>2020-12-11 22:08:18 -0500
commitd884c21e8ae2bd82370b11621230d7172cb098a3 (patch)
tree067eceeab232010f63e7e58071ee3e84d0d400a2
parentMerge pull request #540 from RohanJnr/error_handler_changes (diff)
Disallow .aoc commands in primary aoc channel
Commands like `.aoc leaderboard` and `.aoc stats` proved to be spammy in the main advent of code channel. An aoc_commands channel has been added for aoc commands and this update prohibits aoc commands from being used in the primary aoc channel and adds the comands channel to the whitelist. This also specifically allows the less spammier commands: join, subscribe, unsubscribe, and countdown in the primary channel to foster discussion though.
-rw-r--r--bot/constants.py1
-rw-r--r--bot/exts/christmas/advent_of_code/_cog.py10
2 files changed, 6 insertions, 5 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 9e6db7a6..5dc42462 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -95,6 +95,7 @@ class Branding:
class Channels(NamedTuple):
admins = 365960823622991872
advent_of_code = int(environ.get("AOC_CHANNEL_ID", 782715290437943306))
+ advent_of_code_commands = int(environ.get("AOC_COMMANDS_CHANNEL_ID", 783503267849437205))
announcements = int(environ.get("CHANNEL_ANNOUNCEMENTS", 354619224620138496))
big_brother_logs = 468507907357409333
bot = 267659945086812160
diff --git a/bot/exts/christmas/advent_of_code/_cog.py b/bot/exts/christmas/advent_of_code/_cog.py
index 0bcd9f42..fad13f23 100644
--- a/bot/exts/christmas/advent_of_code/_cog.py
+++ b/bot/exts/christmas/advent_of_code/_cog.py
@@ -21,7 +21,7 @@ AOC_REQUEST_HEADER = {"user-agent": "PythonDiscord AoC Event Bot"}
COUNTDOWN_STEP = 60 * 5
-AOC_WHITELIST = WHITELISTED_CHANNELS + (Channels.advent_of_code,)
+AOC_WHITELIST = WHITELISTED_CHANNELS + (Channels.advent_of_code_commands,)
async def countdown_status(bot: commands.Bot) -> None:
@@ -139,7 +139,7 @@ class AdventOfCode(commands.Cog):
aliases=("sub", "notifications", "notify", "notifs"),
brief="Notifications for new days"
)
- @override_in_channel(AOC_WHITELIST)
+ @override_in_channel(AOC_WHITELIST + (Channels.advent_of_code))
async def aoc_subscribe(self, ctx: commands.Context) -> None:
"""Assign the role for notifications about new days being ready."""
current_year = datetime.now().year
@@ -160,7 +160,7 @@ class AdventOfCode(commands.Cog):
@in_month(Month.DECEMBER)
@adventofcode_group.command(name="unsubscribe", aliases=("unsub",), brief="Notifications for new days")
- @override_in_channel(AOC_WHITELIST)
+ @override_in_channel(AOC_WHITELIST + Channels.advent_of_code)
async def aoc_unsubscribe(self, ctx: commands.Context) -> None:
"""Remove the role for notifications about new days being ready."""
role = ctx.guild.get_role(AocConfig.role_id)
@@ -172,7 +172,7 @@ class AdventOfCode(commands.Cog):
await ctx.send("Hey, you don't even get any notifications about new Advent of Code tasks currently anyway.")
@adventofcode_group.command(name="countdown", aliases=("count", "c"), brief="Return time left until next day")
- @override_in_channel(AOC_WHITELIST)
+ @override_in_channel(AOC_WHITELIST + (Channels.advent_of_code))
async def aoc_countdown(self, ctx: commands.Context) -> None:
"""Return time left until next day."""
if not _helpers.is_in_advent():
@@ -207,7 +207,7 @@ class AdventOfCode(commands.Cog):
await ctx.send("", embed=self.cached_about_aoc)
@adventofcode_group.command(name="join", aliases=("j",), brief="Learn how to join the leaderboard (via DM)")
- @override_in_channel(AOC_WHITELIST)
+ @override_in_channel(AOC_WHITELIST + (Channels.advent_of_code))
async def join_leaderboard(self, ctx: commands.Context) -> None:
"""DM the user the information for joining the Python Discord leaderboard."""
current_year = datetime.now().year