-
-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 2226-track-old-votes-in-github
# Conflicts: # bot/exts/recruitment/talentpool/_cog.py # bot/exts/recruitment/talentpool/_review.py
- Loading branch information
Showing
69 changed files
with
1,146 additions
and
2,052 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,15 @@ | ||
from bot import constants | ||
|
||
from bot.bot import Bot | ||
from bot.exts.help_channels._channel import MAX_CHANNELS_PER_CATEGORY | ||
from bot.constants import HelpChannels | ||
from bot.exts.help_channels._cog import HelpForum | ||
from bot.log import get_logger | ||
|
||
log = get_logger(__name__) | ||
|
||
|
||
def validate_config() -> None: | ||
"""Raise a ValueError if the cog's config is invalid.""" | ||
log.trace("Validating config.") | ||
total = constants.HelpChannels.max_total_channels | ||
available = constants.HelpChannels.max_available | ||
|
||
if total == 0 or available == 0: | ||
raise ValueError("max_total_channels and max_available and must be greater than 0.") | ||
|
||
if total < available: | ||
raise ValueError( | ||
f"max_total_channels ({total}) must be greater than or equal to max_available " | ||
f"({available})." | ||
) | ||
|
||
if total > MAX_CHANNELS_PER_CATEGORY: | ||
raise ValueError( | ||
f"max_total_channels ({total}) must be less than or equal to " | ||
f"{MAX_CHANNELS_PER_CATEGORY} due to Discord's limit on channels per category." | ||
) | ||
|
||
|
||
async def setup(bot: Bot) -> None: | ||
"""Load the HelpChannels cog.""" | ||
# Defer import to reduce side effects from importing the help_channels package. | ||
from bot.exts.help_channels._cog import HelpChannels | ||
try: | ||
validate_config() | ||
except ValueError as e: | ||
log.error(f"HelpChannels cog will not be loaded due to misconfiguration: {e}") | ||
else: | ||
await bot.add_cog(HelpChannels(bot)) | ||
"""Load the HelpForum cog.""" | ||
if not HelpChannels.enable: | ||
log.warning("HelpChannel.enabled set to false, not loading help channel cog.") | ||
return | ||
await bot.add_cog(HelpForum(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.