diff options
| author | 2022-05-09 18:21:21 +0200 | |
|---|---|---|
| committer | 2022-05-09 18:21:21 +0200 | |
| commit | 019983c3785191a0c7182c62394cec2bac123d51 (patch) | |
| tree | 54c296bd04a13a0097cbd7249b78a6716556d735 /bot/constants.py | |
| parent | Doublefixed indentation and removed unused import. (diff) | |
| parent | Bump pillow from 9.0.0 to 9.0.1 (#1045) (diff) | |
Merge branch 'main' into uwu
Diffstat (limited to 'bot/constants.py')
| -rw-r--r-- | bot/constants.py | 49 | 
1 files changed, 32 insertions, 17 deletions
diff --git a/bot/constants.py b/bot/constants.py index 2313bfdb..da81a089 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -12,6 +12,7 @@ __all__ = (      "Channels",      "Categories",      "Client", +    "Logging",      "Colours",      "Emojis",      "Icons", @@ -23,6 +24,7 @@ __all__ = (      "Reddit",      "RedisConfig",      "RedirectOutput", +    "PYTHON_PREFIX",      "MODERATION_ROLES",      "STAFF_ROLES",      "WHITELISTED_CHANNELS", @@ -34,6 +36,9 @@ __all__ = (  log = logging.getLogger(__name__) +PYTHON_PREFIX = "!" + +  @dataclasses.dataclass  class AdventOfCodeLeaderboard:      id: str @@ -50,7 +55,7 @@ class AdventOfCodeLeaderboard:      def session(self) -> str:          """Return either the actual `session` cookie or the fallback cookie."""          if self.use_fallback_session: -            log.info(f"Returning fallback cookie for board `{self.id}`.") +            log.trace(f"Returning fallback cookie for board `{self.id}`.")              return AdventOfCode.fallback_session          return self._session @@ -88,6 +93,7 @@ class AdventOfCode:      ignored_days = environ.get("AOC_IGNORED_DAYS", "").split(",")      leaderboard_displayed_members = 10      leaderboard_cache_expiry_seconds = 1800 +    max_day_and_star_results = 15      year = int(environ.get("AOC_YEAR", datetime.utcnow().year))      role_id = int(environ.get("AOC_ROLE_ID", 518565788744024082)) @@ -101,9 +107,10 @@ class Cats:  class Channels(NamedTuple): -    advent_of_code = int(environ.get("AOC_CHANNEL_ID", 782715290437943306)) -    advent_of_code_commands = int(environ.get("AOC_COMMANDS_CHANNEL_ID", 607247579608121354)) -    bot = 267659945086812160 +    advent_of_code = int(environ.get("AOC_CHANNEL_ID", 897932085766004786)) +    advent_of_code_commands = int(environ.get("AOC_COMMANDS_CHANNEL_ID", 897932607545823342)) +    bot_commands = 267659945086812160 +    community_meta = 267659945086812160      organisation = 551789653284356126      devlog = int(environ.get("CHANNEL_DEVLOG", 622895325144940554))      dev_contrib = 635950537262759947 @@ -112,7 +119,7 @@ class Channels(NamedTuple):      off_topic_0 = 291284109232308226      off_topic_1 = 463035241142026251      off_topic_2 = 463035268514185226 -    community_bot_commands = int(environ.get("CHANNEL_COMMUNITY_BOT_COMMANDS", 607247579608121354)) +    sir_lancebot_playground = int(environ.get("CHANNEL_COMMUNITY_BOT_COMMANDS", 607247579608121354))      voice_chat_0 = 412357430186344448      voice_chat_1 = 799647045886541885      staff_voice = 541638762007101470 @@ -126,22 +133,31 @@ class Categories(NamedTuple):      media = 799054581991997460      staff = 364918151625965579 +  codejam_categories_name = "Code Jam"  # Name of the codejam team categories +  class Client(NamedTuple):      name = "Sir Lancebot"      guild = int(environ.get("BOT_GUILD", 267624335836053506))      prefix = environ.get("PREFIX", ".")      token = environ.get("BOT_TOKEN") -    sentry_dsn = environ.get("BOT_SENTRY_DSN")      debug = environ.get("BOT_DEBUG", "true").lower() == "true" +    in_ci = environ.get("IN_CI", "false").lower() == "true"      github_bot_repo = "https://github.com/python-discord/sir-lancebot"      # Override seasonal locks: 1 (January) to 12 (December)      month_override = int(environ["MONTH_OVERRIDE"]) if "MONTH_OVERRIDE" in environ else None +class Logging(NamedTuple): +    debug = Client.debug +    file_logs = environ.get("FILE_LOGS", "false").lower() == "true" +    trace_loggers = environ.get("BOT_TRACE_LOGGERS") + +  class Colours:      blue = 0x0279FD +    twitter_blue = 0x1DA1F2      bright_green = 0x01D277      dark_green = 0x1F8B4C      orange = 0xE67E22 @@ -192,7 +208,7 @@ class Emojis:      # These icons are from Github's repo https://github.com/primer/octicons/      issue_open = "<:IssueOpen:852596024777506817>" -    issue_closed = "<:IssueClosed:852596024739758081>" +    issue_closed = "<:IssueClosed:927326162861039626>"      issue_draft = "<:IssueDraft:852596025147523102>"  # Not currently used by Github, but here for future.      pull_request_open = "<:PROpen:852596471505223781>"      pull_request_closed = "<:PRClosed:852596024732286976>" @@ -226,7 +242,6 @@ class Emojis:      status_dnd = "<:status_dnd:470326272082313216>"      status_offline = "<:status_offline:470326266537705472>" -      stackoverflow_tag = "<:stack_tag:870926975307501570>"      stackoverflow_views = "<:stack_eye:870926992692879371>" @@ -280,11 +295,13 @@ if Client.month_override is not None:  class Roles(NamedTuple): -    admin = int(environ.get("BOT_ADMIN_ROLE_ID", 267628507062992896)) -    moderator = 267629731250176001 -    owner = 267627879762755584 +    owners = 267627879762755584 +    admins = int(environ.get("BOT_ADMIN_ROLE_ID", 267628507062992896)) +    moderation_team = 267629731250176001      helpers = int(environ.get("ROLE_HELPERS", 267630620367257601))      core_developers = 587606783669829632 +    everyone = int(environ.get("BOT_GUILD", 267624335836053506)) +    aoc_completionist = int(environ.get("AOC_COMPLETIONIST_ROLE_ID", 916691790181056532))  class Tokens(NamedTuple): @@ -331,13 +348,13 @@ class Reddit:  # Default role combinations -MODERATION_ROLES = Roles.moderator, Roles.admin, Roles.owner -STAFF_ROLES = Roles.helpers, Roles.moderator, Roles.admin, Roles.owner +MODERATION_ROLES = {Roles.moderation_team, Roles.admins, Roles.owners} +STAFF_ROLES = {Roles.helpers, Roles.moderation_team, Roles.admins, Roles.owners}  # Whitelisted channels  WHITELISTED_CHANNELS = ( -    Channels.bot, -    Channels.community_bot_commands, +    Channels.bot_commands, +    Channels.sir_lancebot_playground,      Channels.off_topic_0,      Channels.off_topic_1,      Channels.off_topic_2, @@ -345,8 +362,6 @@ WHITELISTED_CHANNELS = (      Channels.voice_chat_1,  ) -GIT_SHA = environ.get("GIT_SHA", "foobar") -  # Bot replies  ERROR_REPLIES = [      "Please don't do that.",  |