diff options
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/seasons/christmas/adventofcode.py | 10 | ||||
| -rw-r--r-- | bot/seasons/christmas/hanukkah_embed.py | 5 | ||||
| -rw-r--r-- | bot/seasons/halloween/candy_collection.py | 1 | ||||
| -rw-r--r-- | bot/seasons/halloween/hacktober-issue-finder.py | 4 | ||||
| -rw-r--r-- | bot/seasons/halloween/hacktoberstats.py | 8 | ||||
| -rw-r--r-- | bot/seasons/valentines/be_my_valentine.py | 9 | 
6 files changed, 25 insertions, 12 deletions
diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py index 8caf43bd..e6100056 100644 --- a/bot/seasons/christmas/adventofcode.py +++ b/bot/seasons/christmas/adventofcode.py @@ -13,8 +13,8 @@ from bs4 import BeautifulSoup  from discord.ext import commands  from pytz import timezone -from bot.constants import AdventOfCode as AocConfig, Channels, Colours, Emojis, Tokens, WHITELISTED_CHANNELS -from bot.decorators import override_in_channel +from bot.constants import AdventOfCode as AocConfig, Channels, Colours, Emojis, Month, Tokens, WHITELISTED_CHANNELS +from bot.decorators import in_month, override_in_channel  from bot.utils import unlocked_role  log = logging.getLogger(__name__) @@ -153,11 +153,13 @@ class AdventOfCode(commands.Cog):          status_coro = countdown_status(self.bot)          self.status_task = self.bot.loop.create_task(status_coro) -    @commands.group(name="adventofcode", aliases=("aoc",), invoke_without_command=True) +    @in_month(Month.december) +    @commands.group(name="adventofcode", aliases=("aoc",))      @override_in_channel(AOC_WHITELIST)      async def adventofcode_group(self, ctx: commands.Context) -> None:          """All of the Advent of Code commands.""" -        await ctx.send_help(ctx.command) +        if not ctx.invoked_subcommand: +            await ctx.send_help(ctx.command)      @adventofcode_group.command(          name="subscribe", diff --git a/bot/seasons/christmas/hanukkah_embed.py b/bot/seasons/christmas/hanukkah_embed.py index aaa02b27..e73a33ad 100644 --- a/bot/seasons/christmas/hanukkah_embed.py +++ b/bot/seasons/christmas/hanukkah_embed.py @@ -5,8 +5,8 @@ from typing import List  from discord import Embed  from discord.ext import commands -from bot.constants import Colours - +from bot.constants import Colours, Month +from bot.decorators import in_month  log = logging.getLogger(__name__) @@ -34,6 +34,7 @@ class HanukkahEmbed(commands.Cog):                  hanukkah_dates.append(date)          return hanukkah_dates +    @in_month(Month.december)      @commands.command(name='hanukkah', aliases=['chanukah'])      async def hanukkah_festival(self, ctx: commands.Context) -> None:          """Tells you about the Hanukkah Festivaltime of festival, festival day, etc).""" diff --git a/bot/seasons/halloween/candy_collection.py b/bot/seasons/halloween/candy_collection.py index 8f2ed6f3..967a62aa 100644 --- a/bot/seasons/halloween/candy_collection.py +++ b/bot/seasons/halloween/candy_collection.py @@ -181,6 +181,7 @@ class CandyCollection(commands.Cog):          with open(json_location, 'w') as outfile:              json.dump(self.candy_json, outfile) +    @in_month(Month.october)      @commands.command()      async def candy(self, ctx: commands.Context) -> None:          """Get the candy leaderboard and save to JSON.""" diff --git a/bot/seasons/halloween/hacktober-issue-finder.py b/bot/seasons/halloween/hacktober-issue-finder.py index 10732374..e90796f1 100644 --- a/bot/seasons/halloween/hacktober-issue-finder.py +++ b/bot/seasons/halloween/hacktober-issue-finder.py @@ -7,6 +7,9 @@ import aiohttp  import discord  from discord.ext import commands +from bot.constants import Month +from bot.decorators import in_month +  log = logging.getLogger(__name__)  URL = "https://api.github.com/search/issues?per_page=100&q=is:issue+label:hacktoberfest+language:python+state:open" @@ -23,6 +26,7 @@ class HacktoberIssues(commands.Cog):          self.cache_beginner = None          self.cache_timer_beginner = datetime.datetime(1, 1, 1) +    @in_month(Month.october)      @commands.command()      async def hacktoberissues(self, ctx: commands.Context, option: str = "") -> None:          """ diff --git a/bot/seasons/halloween/hacktoberstats.py b/bot/seasons/halloween/hacktoberstats.py index d61e048b..3b1444ab 100644 --- a/bot/seasons/halloween/hacktoberstats.py +++ b/bot/seasons/halloween/hacktoberstats.py @@ -10,11 +10,10 @@ import aiohttp  import discord  from discord.ext import commands -from bot.constants import Channels, WHITELISTED_CHANNELS -from bot.decorators import override_in_channel +from bot.constants import Channels, Month, WHITELISTED_CHANNELS +from bot.decorators import in_month, override_in_channel  from bot.utils.persist import make_persistent -  log = logging.getLogger(__name__)  CURRENT_YEAR = datetime.now().year  # Used to construct GH API query @@ -30,6 +29,7 @@ class HacktoberStats(commands.Cog):          self.link_json = make_persistent(Path("bot", "resources", "halloween", "github_links.json"))          self.linked_accounts = self.load_linked_users() +    @in_month(Month.october)      @commands.group(name="hacktoberstats", aliases=("hackstats",), invoke_without_command=True)      @override_in_channel(HACKTOBER_WHITELIST)      async def hacktoberstats_group(self, ctx: commands.Context, github_username: str = None) -> None: @@ -57,6 +57,7 @@ class HacktoberStats(commands.Cog):          await self.get_stats(ctx, github_username) +    @in_month(Month.october)      @hacktoberstats_group.command(name="link")      @override_in_channel(HACKTOBER_WHITELIST)      async def link_user(self, ctx: commands.Context, github_username: str = None) -> None: @@ -91,6 +92,7 @@ class HacktoberStats(commands.Cog):              logging.info(f"{author_id} tried to link a GitHub account but didn't provide a username")              await ctx.send(f"{author_mention}, a GitHub username is required to link your account") +    @in_month(Month.october)      @hacktoberstats_group.command(name="unlink")      @override_in_channel(HACKTOBER_WHITELIST)      async def unlink_user(self, ctx: commands.Context) -> None: diff --git a/bot/seasons/valentines/be_my_valentine.py b/bot/seasons/valentines/be_my_valentine.py index ab8ea290..67d8796a 100644 --- a/bot/seasons/valentines/be_my_valentine.py +++ b/bot/seasons/valentines/be_my_valentine.py @@ -8,7 +8,8 @@ import discord  from discord.ext import commands  from discord.ext.commands.cooldowns import BucketType -from bot.constants import Channels, Client, Colours, Lovefest +from bot.constants import Channels, Client, Colours, Lovefest, Month +from bot.decorators import in_month  log = logging.getLogger(__name__) @@ -30,7 +31,8 @@ class BeMyValentine(commands.Cog):              valentines = load(json_data)              return valentines -    @commands.group(name="lovefest", invoke_without_command=True) +    @in_month(Month.february) +    @commands.group(name="lovefest")      async def lovefest_role(self, ctx: commands.Context) -> None:          """          Subscribe or unsubscribe from the lovefest role. @@ -40,7 +42,8 @@ class BeMyValentine(commands.Cog):          1) use the command \".lovefest sub\" to get the lovefest role.          2) use the command \".lovefest unsub\" to get rid of the lovefest role.          """ -        await ctx.send_help(ctx.command) +        if not ctx.invoked_subcommand: +            await ctx.send_help(ctx.command)      @lovefest_role.command(name="sub")      async def add_role(self, ctx: commands.Context) -> None:  |