diff options
| author | 2020-03-05 00:11:17 +0700 | |
|---|---|---|
| committer | 2020-03-05 00:11:17 +0700 | |
| commit | 20a47defed8169eb72f8dda5d889ada718155fd9 (patch) | |
| tree | d9eebac255aebf138aff4044c78e9e7ebfcc8d7a | |
| parent | (Games Cog): Added space between game search result + removed cutoff in get_c... (diff) | |
| parent | Merge pull request #366 from python-discord/tidy-seasonal-channels (diff) | |
Merge branch 'master' into games-command
| -rw-r--r-- | bot/constants.py | 4 | ||||
| -rw-r--r-- | bot/seasons/easter/__init__.py | 2 | ||||
| -rw-r--r-- | bot/seasons/easter/egg_facts.py | 2 | ||||
| -rw-r--r-- | bot/seasons/evergreen/issues.py | 5 | ||||
| -rw-r--r-- | bot/seasons/halloween/candy_collection.py | 8 | ||||
| -rw-r--r-- | bot/seasons/halloween/halloween_facts.py | 2 | ||||
| -rw-r--r-- | bot/seasons/pride/__init__.py | 2 | ||||
| -rw-r--r-- | bot/seasons/pride/pride_facts.py | 2 | ||||
| -rw-r--r-- | bot/seasons/season.py | 15 | ||||
| -rw-r--r-- | bot/seasons/valentines/be_my_valentine.py | 2 | ||||
| -rw-r--r-- | docker-compose.yml | 1 | 
11 files changed, 27 insertions, 18 deletions
| diff --git a/bot/constants.py b/bot/constants.py index cb3228b6..6d4a50f1 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -35,7 +35,7 @@ class Channels(NamedTuple):      bot = 267659945086812160      checkpoint_test = 422077681434099723      devalerts = 460181980097675264 -    devlog = int(environ.get("CHANNEL_DEVLOG", 548438471685963776)) +    devlog = int(environ.get("CHANNEL_DEVLOG", 622895325144940554))      devtest = 414574275865870337      help_0 = 303906576991780866      help_1 = 303906556754395136 @@ -52,7 +52,6 @@ class Channels(NamedTuple):      off_topic_2 = 463035268514185226      python = 267624335836053506      reddit = 458224812528238616 -    seasonalbot_chat = int(environ.get("CHANNEL_SEASONALBOT_CHAT", 542272993192050698))      seasonalbot_commands = int(environ.get("CHANNEL_SEASONALBOT_COMMANDS", 607247579608121354))      seasonalbot_voice = int(environ.get("CHANNEL_SEASONALBOT_VOICE", 606259004230074378))      staff_lounge = 464905259261755392 @@ -69,6 +68,7 @@ class Client(NamedTuple):      token = environ.get("SEASONALBOT_TOKEN")      debug = environ.get("SEASONALBOT_DEBUG", "").lower() == "true"      season_override = environ.get("SEASON_OVERRIDE") +    icon_cycle_frequency = 3  # N days to wait between cycling server icons within a single season  class Colours: diff --git a/bot/seasons/easter/__init__.py b/bot/seasons/easter/__init__.py index 1d77b6a6..dd60bf5c 100644 --- a/bot/seasons/easter/__init__.py +++ b/bot/seasons/easter/__init__.py @@ -16,7 +16,7 @@ class Easter(SeasonBase):       • You may see stuff like an Easter themed esoteric challenge, a celebration of Earth Day, or      Easter-related micro-events for you to join. Stay tuned! -    If you'd like to contribute, head on over to <#542272993192050698> and we will help you get +    If you'd like to contribute, head on over to <#635950537262759947> and we will help you get      started. It doesn't matter if you're new to open source or Python, if you'd like to help, we      will find you a task and teach you what you need to know.      """ diff --git a/bot/seasons/easter/egg_facts.py b/bot/seasons/easter/egg_facts.py index 9e6fb1cb..e66e25a3 100644 --- a/bot/seasons/easter/egg_facts.py +++ b/bot/seasons/easter/egg_facts.py @@ -34,7 +34,7 @@ class EasterFacts(commands.Cog):      async def send_egg_fact_daily(self) -> None:          """A background task that sends an easter egg fact in the event channel everyday.""" -        channel = self.bot.get_channel(Channels.seasonalbot_chat) +        channel = self.bot.get_channel(Channels.seasonalbot_commands)          while True:              embed = self.make_embed()              await channel.send(embed=embed) diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index c7501a5d..fba5b174 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,11 +3,10 @@ import logging  import discord  from discord.ext import commands -from bot.constants import Channels, Colours, Emojis, WHITELISTED_CHANNELS +from bot.constants import Colours, Emojis, WHITELISTED_CHANNELS  from bot.decorators import override_in_channel  log = logging.getLogger(__name__) -ISSUE_WHITELIST = WHITELISTED_CHANNELS + (Channels.seasonalbot_chat,)  BAD_RESPONSE = {      404: "Issue/pull request not located! Please enter a valid number!", @@ -22,7 +21,7 @@ class Issues(commands.Cog):          self.bot = bot      @commands.command(aliases=("pr",)) -    @override_in_channel(ISSUE_WHITELIST) +    @override_in_channel(WHITELISTED_CHANNELS)      async def issue(          self, ctx: commands.Context, number: int, repository: str = "seasonalbot", user: str = "python-discord"      ) -> None: diff --git a/bot/seasons/halloween/candy_collection.py b/bot/seasons/halloween/candy_collection.py index 64da7ced..490609dd 100644 --- a/bot/seasons/halloween/candy_collection.py +++ b/bot/seasons/halloween/candy_collection.py @@ -41,7 +41,7 @@ class CandyCollection(commands.Cog):          if message.author.bot:              return          # ensure it's hacktober channel -        if message.channel.id != Channels.seasonalbot_chat: +        if message.channel.id != Channels.seasonalbot_commands:              return          # do random check for skull first as it has the lower chance @@ -64,7 +64,7 @@ class CandyCollection(commands.Cog):              return          # check to ensure it is in correct channel -        if message.channel.id != Channels.seasonalbot_chat: +        if message.channel.id != Channels.seasonalbot_commands:              return          # if its not a candy or skull, and it is one of 10 most recent messages, @@ -124,7 +124,7 @@ class CandyCollection(commands.Cog):          ten_recent = []          recent_msg_id = max(              message.id for message in self.bot._connection._messages -            if message.channel.id == Channels.seasonalbot_chat +            if message.channel.id == Channels.seasonalbot_commands          )          channel = await self.hacktober_channel() @@ -155,7 +155,7 @@ class CandyCollection(commands.Cog):      async def hacktober_channel(self) -> discord.TextChannel:          """Get #hacktoberbot channel from its ID.""" -        return self.bot.get_channel(id=Channels.seasonalbot_chat) +        return self.bot.get_channel(id=Channels.seasonalbot_commands)      async def remove_reactions(self, reaction: discord.Reaction) -> None:          """Remove all candy/skull reactions.""" diff --git a/bot/seasons/halloween/halloween_facts.py b/bot/seasons/halloween/halloween_facts.py index f8610bd3..94730d9e 100644 --- a/bot/seasons/halloween/halloween_facts.py +++ b/bot/seasons/halloween/halloween_facts.py @@ -40,7 +40,7 @@ class HalloweenFacts(commands.Cog):      @commands.Cog.listener()      async def on_ready(self) -> None:          """Get event Channel object and initialize fact task loop.""" -        self.channel = self.bot.get_channel(Channels.seasonalbot_chat) +        self.channel = self.bot.get_channel(Channels.seasonalbot_commands)          self.bot.loop.create_task(self._fact_publisher_task())      def random_fact(self) -> Tuple[int, str]: diff --git a/bot/seasons/pride/__init__.py b/bot/seasons/pride/__init__.py index 75e90b2a..08df2fa1 100644 --- a/bot/seasons/pride/__init__.py +++ b/bot/seasons/pride/__init__.py @@ -16,7 +16,7 @@ class Pride(SeasonBase):      • [Pride issues are now available for SeasonalBot on the repo](https://git.io/pythonpride).      • You may see Pride-themed esoteric challenges and other microevents. -    If you'd like to contribute, head on over to <#542272993192050698> and we will help you get +    If you'd like to contribute, head on over to <#635950537262759947> and we will help you get      started. It doesn't matter if you're new to open source or Python, if you'd like to help, we      will find you a task and teach you what you need to know.      """ diff --git a/bot/seasons/pride/pride_facts.py b/bot/seasons/pride/pride_facts.py index b705bfb4..5c19dfd0 100644 --- a/bot/seasons/pride/pride_facts.py +++ b/bot/seasons/pride/pride_facts.py @@ -33,7 +33,7 @@ class PrideFacts(commands.Cog):      async def send_pride_fact_daily(self) -> None:          """Background task to post the daily pride fact every day.""" -        channel = self.bot.get_channel(Channels.seasonalbot_chat) +        channel = self.bot.get_channel(Channels.seasonalbot_commands)          while True:              await self.send_select_fact(channel, datetime.utcnow())              await asyncio.sleep(24 * 60 * 60) diff --git a/bot/seasons/season.py b/bot/seasons/season.py index e7b7a69c..763a08d2 100644 --- a/bot/seasons/season.py +++ b/bot/seasons/season.py @@ -383,18 +383,29 @@ class SeasonManager(commands.Cog):          """Asynchronous timer loop to check for a new season every midnight."""          await self.bot.wait_until_ready()          await self.season.load() +        days_since_icon_change = 0          while True:              await asyncio.sleep(self.sleep_time)  # Sleep until midnight -            self.sleep_time = 86400  # Next time, sleep for 24 hours. +            self.sleep_time = 24 * 3600  # Next time, sleep for 24 hours + +            days_since_icon_change += 1 +            log.debug(f"Days since last icon change: {days_since_icon_change}")              # If the season has changed, load it.              new_season = get_season(date=datetime.datetime.utcnow())              if new_season.name != self.season.name:                  self.season = new_season                  await self.season.load() +                days_since_icon_change = 0  # Start counting afresh for the new season + +            # Otherwise we check whether it's time for an icon cycle within the current season              else: -                await self.season.change_server_icon() +                if days_since_icon_change == Client.icon_cycle_frequency: +                    await self.season.change_server_icon() +                    days_since_icon_change = 0 +                else: +                    log.debug(f"Waiting {Client.icon_cycle_frequency - days_since_icon_change} more days to cycle icon")      @with_role(Roles.moderator, Roles.admin, Roles.owner)      @commands.command(name="season") diff --git a/bot/seasons/valentines/be_my_valentine.py b/bot/seasons/valentines/be_my_valentine.py index a073e1bd..de97cb4e 100644 --- a/bot/seasons/valentines/be_my_valentine.py +++ b/bot/seasons/valentines/be_my_valentine.py @@ -96,7 +96,7 @@ class BeMyValentine(commands.Cog):          emoji_1, emoji_2 = self.random_emoji()          lovefest_role = discord.utils.get(ctx.guild.roles, id=Lovefest.role_id) -        channel = self.bot.get_channel(Channels.seasonalbot_chat) +        channel = self.bot.get_channel(Channels.seasonalbot_commands)          valentine, title = self.valentine_check(valentine_type)          if user is None: diff --git a/docker-compose.yml b/docker-compose.yml index f2f4b056..30e8a109 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,6 @@ services:      # - SEASONALBOT_ADMIN_ROLE_ID=      # - CHANNEL_ANNOUNCEMENTS=      # - CHANNEL_DEVLOG= -    # - CHANNEL_SEASONALBOT_CHAT=      # - SEASON_OVERRIDE=      volumes: | 
