From 3c02761087e98cede89f330470002248e03d0d0b Mon Sep 17 00:00:00 2001 From: Daniel Brown Date: Mon, 12 Oct 2020 13:42:22 -0500 Subject: Adding #voice_chat to the Seasonal Bot white list Since SeasonalBot is able to be used in the off-topic channels, it makes to have it work in the voice_chat channel as well. --- bot/constants.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index e113428e..1909cb86 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -75,6 +75,7 @@ class Channels(NamedTuple): show_your_projects = int(environ.get("CHANNEL_SHOW_YOUR_PROJECTS", 303934982764625920)) show_your_projects_discussion = 360148304664723466 hacktoberfest_2020 = 760857070781071431 + voice_chat = 412357430186344448 class Client(NamedTuple): @@ -209,6 +210,7 @@ WHITELISTED_CHANNELS = ( Channels.off_topic_0, Channels.off_topic_1, Channels.off_topic_2, + Channels.voice_chat, ) # Bot replies -- cgit v1.2.3 From 42316a7a57de91a04fdd1edf145cfb81294aafb7 Mon Sep 17 00:00:00 2001 From: Daniel Brown Date: Thu, 15 Oct 2020 09:47:18 -0500 Subject: Added Core Dev Sprint to whitelist For the sake of entertainment of the Core Devs, I have added the SeasonalBot functionality to the Core Dev Sprint channels. --- bot/constants.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 1909cb86..2466da02 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -76,6 +76,23 @@ class Channels(NamedTuple): show_your_projects_discussion = 360148304664723466 hacktoberfest_2020 = 760857070781071431 voice_chat = 412357430186344448 + + # Core Dev Sprint channels + announcements = 755958119963557958 + information = 753338352136224798 + organisers = 753340132639375420 + general = 753340631538991305 + social1_cheese_shop = 758779754789863514 + social2_pet_shop = 758780951978573824 + escape_room = 761031075942105109 + stdlib = 758553316732698634 + asyncio = 762904152438472714 + typing = 762904690341838888 + discussion_capi = 758553358587527218 + discussion_triage = 758553458365300746 + discussion_design = 758553492662255616 + discussion_mentor = 758553536623280159 + documentation = 761038271127093278 class Client(NamedTuple): @@ -211,6 +228,23 @@ WHITELISTED_CHANNELS = ( Channels.off_topic_1, Channels.off_topic_2, Channels.voice_chat, + + # Core Dev Sprint Channels + Channels.announcements, + Channels.information, + Channels.organisers, + Channels.general, + Channels.social1_cheese_shop, + Channels.social2_pet_shop, + Channels.escape_room, + Channels.stdlib, + Channels.asyncio, + Channels.typing, + Channels.discussion_capi, + Channels.discussion_triage, + Channels.discussion_design, + Channels.discussion_mentor, + Channels.documentation, ) # Bot replies -- cgit v1.2.3 From 273a5170a42c119d74c337532e3ff8fe91a6f34c Mon Sep 17 00:00:00 2001 From: Daniel Brown Date: Thu, 15 Oct 2020 10:32:09 -0500 Subject: Corrected Trailing Whitespace Removed a trailing white space that caused a build failure. --- bot/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 2466da02..c5eed1f8 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -76,7 +76,7 @@ class Channels(NamedTuple): show_your_projects_discussion = 360148304664723466 hacktoberfest_2020 = 760857070781071431 voice_chat = 412357430186344448 - + # Core Dev Sprint channels announcements = 755958119963557958 information = 753338352136224798 @@ -228,7 +228,7 @@ WHITELISTED_CHANNELS = ( Channels.off_topic_1, Channels.off_topic_2, Channels.voice_chat, - + # Core Dev Sprint Channels Channels.announcements, Channels.information, -- cgit v1.2.3 From 725d3982128ae7da549b2a9aa1bfa5194393ba42 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Thu, 15 Oct 2020 20:17:49 +0200 Subject: Constants: rename conflicting channel There were two attributes named 'announcements' on the Channels class. --- bot/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index c5eed1f8..2056d542 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -78,7 +78,7 @@ class Channels(NamedTuple): voice_chat = 412357430186344448 # Core Dev Sprint channels - announcements = 755958119963557958 + sprint_announcements = 755958119963557958 information = 753338352136224798 organisers = 753340132639375420 general = 753340631538991305 @@ -230,7 +230,7 @@ WHITELISTED_CHANNELS = ( Channels.voice_chat, # Core Dev Sprint Channels - Channels.announcements, + Channels.sprint_announcements, Channels.information, Channels.organisers, Channels.general, -- cgit v1.2.3 From e67f4a063eb7c9926ed295a9c99394487d5ca633 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Thu, 15 Oct 2020 20:28:38 +0200 Subject: Constants: prefix sprint channel names These are channels created for the CPython Core Dev Sprint event. --- bot/constants.py | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 2056d542..f1f34886 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -79,20 +79,20 @@ class Channels(NamedTuple): # Core Dev Sprint channels sprint_announcements = 755958119963557958 - information = 753338352136224798 - organisers = 753340132639375420 - general = 753340631538991305 - social1_cheese_shop = 758779754789863514 - social2_pet_shop = 758780951978573824 - escape_room = 761031075942105109 - stdlib = 758553316732698634 - asyncio = 762904152438472714 - typing = 762904690341838888 - discussion_capi = 758553358587527218 - discussion_triage = 758553458365300746 - discussion_design = 758553492662255616 - discussion_mentor = 758553536623280159 - documentation = 761038271127093278 + sprint_information = 753338352136224798 + sprint_organisers = 753340132639375420 + sprint_general = 753340631538991305 + sprint_social1_cheese_shop = 758779754789863514 + sprint_social2_pet_shop = 758780951978573824 + sprint_escape_room = 761031075942105109 + sprint_stdlib = 758553316732698634 + sprint_asyncio = 762904152438472714 + sprint_typing = 762904690341838888 + sprint_discussion_capi = 758553358587527218 + sprint_discussion_triage = 758553458365300746 + sprint_discussion_design = 758553492662255616 + sprint_discussion_mentor = 758553536623280159 + sprint_documentation = 761038271127093278 class Client(NamedTuple): @@ -231,20 +231,20 @@ WHITELISTED_CHANNELS = ( # Core Dev Sprint Channels Channels.sprint_announcements, - Channels.information, - Channels.organisers, - Channels.general, - Channels.social1_cheese_shop, - Channels.social2_pet_shop, - Channels.escape_room, - Channels.stdlib, - Channels.asyncio, - Channels.typing, - Channels.discussion_capi, - Channels.discussion_triage, - Channels.discussion_design, - Channels.discussion_mentor, - Channels.documentation, + Channels.sprint_information, + Channels.sprint_organisers, + Channels.sprint_general, + Channels.sprint_social1_cheese_shop, + Channels.sprint_social2_pet_shop, + Channels.sprint_escape_room, + Channels.sprint_stdlib, + Channels.sprint_asyncio, + Channels.sprint_typing, + Channels.sprint_discussion_capi, + Channels.sprint_discussion_triage, + Channels.sprint_discussion_design, + Channels.sprint_discussion_mentor, + Channels.sprint_documentation, ) # Bot replies -- cgit v1.2.3 From a1fc1ad5643f4ae5f5ebbb3cb8f8cdc0a34df95a Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:18:21 +0200 Subject: Create Redis configuration class --- bot/constants.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index f1f34886..1dcc8846 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -216,6 +216,13 @@ class Wolfram(NamedTuple): key = environ.get("WOLFRAM_API_KEY") +class RedisCache(NamedTuple): + host = environ.get("REDIS_HOST", "redis.default.svc.cluster.local") + port = environ.get("REDIS_PORT", 6379) + password = environ.get("REDIS_PASSWORD") + use_fakeredis = environ.get("USE_FAKEREDIS", "false").lower() == "true" + + # Default role combinations MODERATION_ROLES = Roles.moderator, Roles.admin, Roles.owner STAFF_ROLES = Roles.helpers, Roles.moderator, Roles.admin, Roles.owner -- cgit v1.2.3 From 824084bf7c18edd96ea194b242fa47cb58bed15c Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:23:20 +0200 Subject: Rename redis configuration class --- bot/constants.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 1dcc8846..b9648507 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -17,6 +17,7 @@ __all__ = ( "Roles", "Tokens", "Wolfram", + "RedisConfig", "MODERATION_ROLES", "STAFF_ROLES", "WHITELISTED_CHANNELS", @@ -216,7 +217,7 @@ class Wolfram(NamedTuple): key = environ.get("WOLFRAM_API_KEY") -class RedisCache(NamedTuple): +class RedisConfig(NamedTuple): host = environ.get("REDIS_HOST", "redis.default.svc.cluster.local") port = environ.get("REDIS_PORT", 6379) password = environ.get("REDIS_PASSWORD") -- cgit v1.2.3 From 6f524c3594a3ec7715569c66f8a3c0db369b5636 Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Sat, 21 Nov 2020 00:30:19 +0100 Subject: Make the bot name less hard-coded. --- bot/bot.py | 38 ++++++++++++++++++++------------------ bot/constants.py | 3 ++- 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/bot.py b/bot/bot.py index 3b4d43df..bf4a59c2 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -9,14 +9,14 @@ from async_rediscache import RedisSession from discord import DiscordException, Embed from discord.ext import commands -from bot.constants import Channels, Client, MODERATION_ROLES, RedisConfig +import bot.constants as constants log = logging.getLogger(__name__) -__all__ = ("SeasonalBot", "bot") +__all__ = ("Bot", "bot") -class SeasonalBot(commands.Bot): +class Bot(commands.Bot): """ Base bot instance. @@ -25,6 +25,8 @@ class SeasonalBot(commands.Bot): that the upload was successful. See the `mock_in_debug` decorator for further details. """ + name = constants.Client.name + def __init__(self, redis_session: RedisSession, **kwargs): super().__init__(**kwargs) self.http_session = ClientSession( @@ -33,12 +35,12 @@ class SeasonalBot(commands.Bot): self._guild_available = asyncio.Event() self.redis_session = redis_session - self.loop.create_task(self.send_log("SeasonalBot", "Connected!")) + self.loop.create_task(self.send_log(self.name, "Connected!")) @property def member(self) -> Optional[discord.Member]: """Retrieves the guild member object for the bot.""" - guild = self.get_guild(Client.guild) + guild = self.get_guild(constants.Client.guild) if not guild: return None return guild.me @@ -72,12 +74,12 @@ class SeasonalBot(commands.Bot): async def send_log(self, title: str, details: str = None, *, icon: str = None) -> None: """Send an embed message to the devlog channel.""" await self.wait_until_guild_available() - devlog = self.get_channel(Channels.devlog) + devlog = self.get_channel(constants.Channels.devlog) if not devlog: - log.info(f"Fetching devlog channel as it wasn't found in the cache (ID: {Channels.devlog})") + log.info(f"Fetching devlog channel as it wasn't found in the cache (ID: {constants.Channels.devlog})") try: - devlog = await self.fetch_channel(Channels.devlog) + devlog = await self.fetch_channel(constants.Channels.devlog) except discord.HTTPException as discord_exc: log.exception("Fetch failed", exc_info=discord_exc) return @@ -97,7 +99,7 @@ class SeasonalBot(commands.Bot): If the cache appears to still be empty (no members, no channels, or no roles), the event will not be set. """ - if guild.id != Client.guild: + if guild.id != constants.Client.guild: return if not guild.roles or not guild.members or not guild.channels: @@ -108,7 +110,7 @@ class SeasonalBot(commands.Bot): async def on_guild_unavailable(self, guild: discord.Guild) -> None: """Clear the internal `_guild_available` event when PyDis guild becomes unavailable.""" - if guild.id != Client.guild: + if guild.id != constants.Client.guild: return self._guild_available.clear() @@ -123,7 +125,7 @@ class SeasonalBot(commands.Bot): await self._guild_available.wait() -_allowed_roles = [discord.Object(id_) for id_ in MODERATION_ROLES] +_allowed_roles = [discord.Object(id_) for id_ in constants.MODERATION_ROLES] _intents = discord.Intents.default() # Default is all intents except for privileged ones (Members, Presences, ...) _intents.bans = False @@ -133,20 +135,20 @@ _intents.typing = False _intents.webhooks = False redis_session = RedisSession( - address=(RedisConfig.host, RedisConfig.port), - password=RedisConfig.password, + address=(constants.RedisConfig.host, constants.RedisConfig.port), + password=constants.RedisConfig.password, minsize=1, maxsize=20, - use_fakeredis=RedisConfig.use_fakeredis, - global_namespace="seasonalbot" + use_fakeredis=constants.RedisConfig.use_fakeredis, + global_namespace="sir-lancebot" ) loop = asyncio.get_event_loop() loop.run_until_complete(redis_session.connect()) -bot = SeasonalBot( +bot = Bot( redis_session=redis_session, - command_prefix=Client.prefix, - activity=discord.Game(name=f"Commands: {Client.prefix}help"), + command_prefix=constants.Client.prefix, + activity=discord.Game(name=f"Commands: {constants.Client.prefix}help"), allowed_mentions=discord.AllowedMentions(everyone=False, roles=_allowed_roles), intents=_intents, ) diff --git a/bot/constants.py b/bot/constants.py index b9648507..eda10121 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -97,7 +97,8 @@ class Channels(NamedTuple): class Client(NamedTuple): - guild = int(environ.get("SEASONALBOT_GUILD", 267624335836053506)) + name = "Sir Lancebot" + guild = int(environ.get("BOT_GUILD", 267624335836053506)) prefix = environ.get("PREFIX", ".") token = environ.get("SEASONALBOT_TOKEN") sentry_dsn = environ.get("SEASONALBOT_SENTRY_DSN") -- cgit v1.2.3 From 16417225e7c0bfbb4260d51722c2f68696e7ccd6 Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Sat, 21 Nov 2020 00:30:58 +0100 Subject: Remove references to old name. I've tried to replace this with generic references where appropriate, but a lot of the time it just doesn't make a lot of sense to do so. --- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/workflows/build.yaml | 8 ++++---- CONTRIBUTING.md | 6 +++--- README.md | 12 +++++------ bot/constants.py | 33 +++++++++++++++--------------- bot/exts/easter/egg_facts.py | 8 ++++---- bot/exts/evergreen/game.py | 6 +++--- bot/exts/evergreen/help.py | 8 ++++---- bot/exts/evergreen/issues.py | 2 +- bot/exts/evergreen/source.py | 2 +- bot/exts/evergreen/space.py | 6 +++--- bot/exts/halloween/candy_collection.py | 6 +++--- bot/exts/halloween/hacktoberstats.py | 6 +++--- bot/exts/halloween/spookyreact.py | 6 +----- bot/exts/pride/pride_facts.py | 8 ++++---- bot/exts/utils/extensions.py | 2 +- bot/exts/valentines/be_my_valentine.py | 2 +- bot/resources/halloween/spooky_rating.json | 18 ++++++++-------- bot/utils/checks.py | 2 +- deployment.yaml | 12 +++++------ docker-compose.yml | 16 +++++++-------- 21 files changed, 82 insertions(+), 89 deletions(-) (limited to 'bot/constants.py') diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 519294a0..4580be2f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -4,4 +4,4 @@ contact_links: url: https://discord.gg/python about: Contributors must be part of the community, so be sure to join! - name: Contributing Guide - url: https://pythondiscord.com/pages/contributing/seasonalbot/ + url: https://pythondiscord.com/pages/contributing/sir-lancebot/ diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f133ba24..20449741 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -44,11 +44,11 @@ jobs: context: . file: ./Dockerfile push: true - cache-from: type=registry,ref=ghcr.io/python-discord/seasonalbot:latest + cache-from: type=registry,ref=ghcr.io/python-discord/sir-lancebot:latest cache-to: type=inline tags: | - ghcr.io/python-discord/seasonalbot:latest - ghcr.io/python-discord/seasonalbot:${{ steps.sha_tag.outputs.tag }} + ghcr.io/python-discord/sir-lancebot:latest + ghcr.io/python-discord/sir-lancebot:${{ steps.sha_tag.outputs.tag }} - name: Authenticate with Kubernetes uses: azure/k8s-set-context@v1 @@ -61,5 +61,5 @@ jobs: with: manifests: | deployment.yaml - images: 'ghcr.io/python-discord/seasonalbot:${{ steps.sha_tag.outputs.tag }}' + images: 'ghcr.io/python-discord/sir-lancebot:${{ steps.sha_tag.outputs.tag }}' kubectl-version: 'latest' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1fa39ec..7cf83db5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to Seasonalbot +# Contributing to Sir Lancebot -Seasonalbot is a community project for the Python Discord community over at https://discord.gg/python. We will be providing support for those of you who are new to Git, and this project is to be considered educational. +Sir Lancebot is a community project for the Python Discord community over at https://discord.gg/python. We will be providing support for those of you who are new to Git, and this project is to be considered educational. Our projects are open-source and are automatically deployed whenever commits are pushed to the `master` branch on each repository, so we've created a set of guidelines in order to keep everything clean and in working order. @@ -39,7 +39,7 @@ All projects evolve over time, and this contribution guide is no different. This ## Supplemental Information ### Developer Environment -Seasonalbot utilizes [Pipenv](https://pipenv.readthedocs.io/en/latest/) for installation and dependency management. For users unfamiliar with the Pipenv workflow, Pipenv's documentation provides a [Basic Usage](https://pipenv.readthedocs.io/en/latest/basics/) tutorial, along with some of the more advanced workflows. A project-specific installation guide can be found in [Seasonalbot's README](https://github.com/python-discord/seasonalbot/blob/master/README.md). +Sir Lancebot utilizes [Pipenv](https://pipenv.readthedocs.io/en/latest/) for installation and dependency management. For users unfamiliar with the Pipenv workflow, Pipenv's documentation provides a [Basic Usage](https://pipenv.readthedocs.io/en/latest/basics/) tutorial, along with some of the more advanced workflows. A project-specific installation guide can be found in [Sir Lancebot's README](https://github.com/python-discord/sir-lancebot/blob/master/README.md). When pulling down changes from GitHub, remember to sync your environment using `pipenv sync --dev` to ensure you're using the most up-to-date versions the project's dependencies. diff --git a/README.md b/README.md index 0c9d1e7d..20e6c8c1 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# SeasonalBot +# Sir Lancebot [![Lint Badge][1]][2] [![Build Badge][3]][4] @@ -17,9 +17,9 @@ This later evolved into a bot that runs all year, providing season-appropriate f ## Getting started Before you start, please take some time to read through our [contributing guidelines](CONTRIBUTING.md). -See [Seasonalbot's Wiki](https://pythondiscord.com/pages/contributing/seasonalbot/) for in-depth guides on getting started with the project! +See [Sir Lancebot's Wiki](https://pythondiscord.com/pages/contributing/sir-lancebot/) for in-depth guides on getting started with the project! -[1]:https://github.com/python-discord/seasonalbot/workflows/Lint/badge.svg?branch=master -[2]:https://github.com/python-discord/seasonalbot/actions?query=workflow%3ALint+branch%3Amaster -[3]:https://github.com/python-discord/seasonalbot/workflows/Build/badge.svg?branch=master -[4]:https://github.com/python-discord/seasonalbot/actions?query=workflow%3ABuild+branch%3Amaster +[1]:https://github.com/python-discord/sir-lancebot/workflows/Lint/badge.svg?branch=master +[2]:https://github.com/python-discord/sir-lancebot/actions?query=workflow%3ALint+branch%3Amaster +[3]:https://github.com/python-discord/sir-lancebot/workflows/Build/badge.svg?branch=master +[4]:https://github.com/python-discord/sir-lancebot/actions?query=workflow%3ABuild+branch%3Amaster diff --git a/bot/constants.py b/bot/constants.py index eda10121..6999f321 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -68,13 +68,10 @@ class Channels(NamedTuple): off_topic_2 = 463035268514185226 python = 267624335836053506 reddit = 458224812528238616 - seasonalbot_commands = int(environ.get("CHANNEL_SEASONALBOT_COMMANDS", 607247579608121354)) - seasonalbot_voice = int(environ.get("CHANNEL_SEASONALBOT_VOICE", 606259004230074378)) + community_bot_commands = int(environ.get("CHANNEL_COMMUNITY_BOT_COMMANDS", 607247579608121354)) staff_lounge = 464905259261755392 verification = 352442727016693763 python_discussion = 267624335836053506 - show_your_projects = int(environ.get("CHANNEL_SHOW_YOUR_PROJECTS", 303934982764625920)) - show_your_projects_discussion = 360148304664723466 hacktoberfest_2020 = 760857070781071431 voice_chat = 412357430186344448 @@ -100,10 +97,10 @@ class Client(NamedTuple): name = "Sir Lancebot" guild = int(environ.get("BOT_GUILD", 267624335836053506)) prefix = environ.get("PREFIX", ".") - token = environ.get("SEASONALBOT_TOKEN") - sentry_dsn = environ.get("SEASONALBOT_SENTRY_DSN") - debug = environ.get("SEASONALBOT_DEBUG", "").lower() == "true" - github_bot_repo = "https://github.com/python-discord/seasonalbot" + token = environ.get("BOT_TOKEN") + sentry_dsn = environ.get("BOT_SENTRY_DSN") + debug = environ.get("BOT_DEBUG", "").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 @@ -185,7 +182,7 @@ if Client.month_override is not None: class Roles(NamedTuple): - admin = int(environ.get("SEASONALBOT_ADMIN_ROLE_ID", 267628507062992896)) + admin = int(environ.get("BOT_ADMIN_ROLE_ID", 267628507062992896)) announcements = 463658397560995840 champion = 430492892331769857 contributor = 295488872404484098 @@ -225,6 +222,15 @@ class RedisConfig(NamedTuple): use_fakeredis = environ.get("USE_FAKEREDIS", "false").lower() == "true" +class Wikipedia: + total_chance = 3 + + +class Source: + github = "https://github.com/python-discord/sir-lancebot" + github_avatar_url = "https://avatars1.githubusercontent.com/u/9919" + + # Default role combinations MODERATION_ROLES = Roles.moderator, Roles.admin, Roles.owner STAFF_ROLES = Roles.helpers, Roles.moderator, Roles.admin, Roles.owner @@ -232,7 +238,7 @@ STAFF_ROLES = Roles.helpers, Roles.moderator, Roles.admin, Roles.owner # Whitelisted channels WHITELISTED_CHANNELS = ( Channels.bot, - Channels.seasonalbot_commands, + Channels.community_bot_commands, Channels.off_topic_0, Channels.off_topic_1, Channels.off_topic_2, @@ -309,10 +315,3 @@ POSITIVE_REPLIES = [ "Aye aye, cap'n!", "I'll allow it.", ] - -class Wikipedia: - total_chance = 3 - -class Source: - github = "https://github.com/python-discord/seasonalbot" - github_avatar_url = "https://avatars1.githubusercontent.com/u/9919" diff --git a/bot/exts/easter/egg_facts.py b/bot/exts/easter/egg_facts.py index 0051aa50..761e9059 100644 --- a/bot/exts/easter/egg_facts.py +++ b/bot/exts/easter/egg_facts.py @@ -6,7 +6,7 @@ from pathlib import Path import discord from discord.ext import commands -from bot.bot import SeasonalBot +from bot.bot import Bot from bot.constants import Channels, Colours, Month from bot.utils.decorators import seasonal_task @@ -20,7 +20,7 @@ class EasterFacts(commands.Cog): It also contains a background task which sends an easter egg fact in the event channel everyday. """ - def __init__(self, bot: SeasonalBot): + def __init__(self, bot: Bot): self.bot = bot self.facts = self.load_json() @@ -38,7 +38,7 @@ class EasterFacts(commands.Cog): """A background task that sends an easter egg fact in the event channel everyday.""" await self.bot.wait_until_guild_available() - channel = self.bot.get_channel(Channels.seasonalbot_commands) + channel = self.bot.get_channel(Channels.community_bot_commands) await channel.send(embed=self.make_embed()) @commands.command(name='eggfact', aliases=['fact']) @@ -56,6 +56,6 @@ class EasterFacts(commands.Cog): ) -def setup(bot: SeasonalBot) -> None: +def setup(bot: Bot) -> None: """Easter Egg facts cog load.""" bot.add_cog(EasterFacts(bot)) diff --git a/bot/exts/evergreen/game.py b/bot/exts/evergreen/game.py index 3c8b2725..d0fd7a40 100644 --- a/bot/exts/evergreen/game.py +++ b/bot/exts/evergreen/game.py @@ -11,7 +11,7 @@ from discord import Embed from discord.ext import tasks from discord.ext.commands import Cog, Context, group -from bot.bot import SeasonalBot +from bot.bot import Bot from bot.constants import STAFF_ROLES, Tokens from bot.utils.decorators import with_role from bot.utils.pagination import ImagePaginator, LinePaginator @@ -130,7 +130,7 @@ class AgeRatings(IntEnum): class Games(Cog): """Games Cog contains commands that collect data from IGDB.""" - def __init__(self, bot: SeasonalBot): + def __init__(self, bot: Bot): self.bot = bot self.http_session: ClientSession = bot.http_session @@ -415,7 +415,7 @@ class Games(Cog): return sorted((item for item in results if item[0] >= 0.60), reverse=True)[:4] -def setup(bot: SeasonalBot) -> None: +def setup(bot: Bot) -> None: """Add/Load Games cog.""" # Check does IGDB API key exist, if not, log warning and don't load cog if not Tokens.igdb: diff --git a/bot/exts/evergreen/help.py b/bot/exts/evergreen/help.py index ccd76d76..91147243 100644 --- a/bot/exts/evergreen/help.py +++ b/bot/exts/evergreen/help.py @@ -12,7 +12,7 @@ from discord.ext.commands import CheckFailure, Cog as DiscordCog, Command, Conte from fuzzywuzzy import fuzz, process from bot import constants -from bot.bot import SeasonalBot +from bot.bot import Bot from bot.constants import Emojis from bot.utils.pagination import ( FIRST_EMOJI, LAST_EMOJI, @@ -511,7 +511,7 @@ class Help(DiscordCog): await ctx.send(embed=embed) -def unload(bot: SeasonalBot) -> None: +def unload(bot: Bot) -> None: """ Reinstates the original help command. @@ -521,7 +521,7 @@ def unload(bot: SeasonalBot) -> None: bot.add_command(bot._old_help) -def setup(bot: SeasonalBot) -> None: +def setup(bot: Bot) -> None: """ The setup for the help extension. @@ -542,7 +542,7 @@ def setup(bot: SeasonalBot) -> None: raise -def teardown(bot: SeasonalBot) -> None: +def teardown(bot: Bot) -> None: """ The teardown for the help extension. diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py index 97ee6a12..e419a6f5 100644 --- a/bot/exts/evergreen/issues.py +++ b/bot/exts/evergreen/issues.py @@ -33,7 +33,7 @@ class Issues(commands.Cog): self, ctx: commands.Context, numbers: commands.Greedy[int], - repository: str = "seasonalbot", + repository: str = "sir-lancebot", user: str = "python-discord" ) -> None: """Command to retrieve issue(s) from a GitHub repository.""" diff --git a/bot/exts/evergreen/source.py b/bot/exts/evergreen/source.py index 0725714f..cdfe54ec 100644 --- a/bot/exts/evergreen/source.py +++ b/bot/exts/evergreen/source.py @@ -38,7 +38,7 @@ class BotSource(commands.Cog): async def source_command(self, ctx: commands.Context, *, source_item: SourceConverter = None) -> None: """Display information and a GitHub link to the source code of a command, tag, or cog.""" if not source_item: - embed = Embed(title="Seasonal Bot's GitHub Repository") + embed = Embed(title="Sir Lancebot's GitHub Repository") embed.add_field(name="Repository", value=f"[Go to GitHub]({Source.github})") embed.set_thumbnail(url=Source.github_avatar_url) await ctx.send(embed=embed) diff --git a/bot/exts/evergreen/space.py b/bot/exts/evergreen/space.py index 3587fc00..bc8e3118 100644 --- a/bot/exts/evergreen/space.py +++ b/bot/exts/evergreen/space.py @@ -8,7 +8,7 @@ from discord import Embed from discord.ext import tasks from discord.ext.commands import BadArgument, Cog, Context, Converter, group -from bot.bot import SeasonalBot +from bot.bot import Bot from bot.constants import Tokens logger = logging.getLogger(__name__) @@ -37,7 +37,7 @@ class DateConverter(Converter): class Space(Cog): """Space Cog contains commands, that show images, facts or other information about space.""" - def __init__(self, bot: SeasonalBot): + def __init__(self, bot: Bot): self.bot = bot self.http_session = bot.http_session @@ -240,7 +240,7 @@ class Space(Cog): ).set_image(url=image).set_footer(text="Powered by NASA API" + footer) -def setup(bot: SeasonalBot) -> None: +def setup(bot: Bot) -> None: """Load Space Cog.""" if not Tokens.nasa: logger.warning("Can't find NASA API key. Not loading Space Cog.") diff --git a/bot/exts/halloween/candy_collection.py b/bot/exts/halloween/candy_collection.py index 33e18b24..0cb37ecd 100644 --- a/bot/exts/halloween/candy_collection.py +++ b/bot/exts/halloween/candy_collection.py @@ -51,7 +51,7 @@ class CandyCollection(commands.Cog): if message.author.bot: return # ensure it's hacktober channel - if message.channel.id != Channels.seasonalbot_commands: + if message.channel.id != Channels.community_bot_commands: return # do random check for skull first as it has the lower chance @@ -73,7 +73,7 @@ class CandyCollection(commands.Cog): return # check to ensure it is in correct channel - if message.channel.id != Channels.seasonalbot_commands: + if message.channel.id != Channels.community_bot_commands: return # if its not a candy or skull, and it is one of 10 most recent messages, @@ -130,7 +130,7 @@ class CandyCollection(commands.Cog): @property def hacktober_channel(self) -> discord.TextChannel: """Get #hacktoberbot channel from its ID.""" - return self.bot.get_channel(id=Channels.seasonalbot_commands) + return self.bot.get_channel(id=Channels.community_bot_commands) @staticmethod async def send_spook_msg( diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py index 26d75565..84b75022 100644 --- a/bot/exts/halloween/hacktoberstats.py +++ b/bot/exts/halloween/hacktoberstats.py @@ -193,7 +193,7 @@ class HacktoberStats(commands.Cog): For each PR: { "repo_url": str - "repo_shortname": str (e.g. "python-discord/seasonalbot") + "repo_shortname": str (e.g. "python-discord/sir-lancebot") "created_at": datetime.datetime "number": int } @@ -360,10 +360,10 @@ class HacktoberStats(commands.Cog): """ Extract shortname from https://api.github.com/repos/* URL. - e.g. "https://api.github.com/repos/python-discord/seasonalbot" + e.g. "https://api.github.com/repos/python-discord/sir-lancebot" | V - "python-discord/seasonalbot" + "python-discord/sir-lancebot" """ exp = r"https?:\/\/api.github.com\/repos\/([/\-\_\.\w]+)" return re.findall(exp, in_url)[0] diff --git a/bot/exts/halloween/spookyreact.py b/bot/exts/halloween/spookyreact.py index e5945aea..21b8ff7c 100644 --- a/bot/exts/halloween/spookyreact.py +++ b/bot/exts/halloween/spookyreact.py @@ -30,11 +30,7 @@ class SpookyReact(Cog): @Cog.listener() async def on_message(self, ctx: discord.Message) -> None: """ - A command to send the seasonalbot github project. - - Lines that begin with the bot's command prefix are ignored - - Seasonalbot's own messages are ignored + Triggered when the bot sees a message in October. """ for trigger in SPOOKY_TRIGGERS.keys(): trigger_test = re.search(SPOOKY_TRIGGERS[trigger][0], ctx.content.lower()) diff --git a/bot/exts/pride/pride_facts.py b/bot/exts/pride/pride_facts.py index 9ff4c9e0..5bd5d0ce 100644 --- a/bot/exts/pride/pride_facts.py +++ b/bot/exts/pride/pride_facts.py @@ -9,7 +9,7 @@ import dateutil.parser import discord from discord.ext import commands -from bot.bot import SeasonalBot +from bot.bot import Bot from bot.constants import Channels, Colours, Month from bot.utils.decorators import seasonal_task @@ -21,7 +21,7 @@ Sendable = Union[commands.Context, discord.TextChannel] class PrideFacts(commands.Cog): """Provides a new fact every day during the Pride season!""" - def __init__(self, bot: SeasonalBot): + def __init__(self, bot: Bot): self.bot = bot self.facts = self.load_facts() @@ -38,7 +38,7 @@ class PrideFacts(commands.Cog): """Background task to post the daily pride fact every day.""" await self.bot.wait_until_guild_available() - channel = self.bot.get_channel(Channels.seasonalbot_commands) + channel = self.bot.get_channel(Channels.community_bot_commands) await self.send_select_fact(channel, datetime.utcnow()) async def send_random_fact(self, ctx: commands.Context) -> None: @@ -102,6 +102,6 @@ class PrideFacts(commands.Cog): ) -def setup(bot: SeasonalBot) -> None: +def setup(bot: Bot) -> None: """Cog loader for pride facts.""" bot.add_cog(PrideFacts(bot)) diff --git a/bot/exts/utils/extensions.py b/bot/exts/utils/extensions.py index 102a0416..bb22c353 100644 --- a/bot/exts/utils/extensions.py +++ b/bot/exts/utils/extensions.py @@ -8,7 +8,7 @@ from discord.ext import commands from discord.ext.commands import Context, group from bot import exts -from bot.bot import SeasonalBot as Bot +from bot.bot import Bot from bot.constants import Client, Emojis, MODERATION_ROLES, Roles from bot.utils.checks import with_role_check from bot.utils.extensions import EXTENSIONS, unqualify diff --git a/bot/exts/valentines/be_my_valentine.py b/bot/exts/valentines/be_my_valentine.py index b1258307..4db4d191 100644 --- a/bot/exts/valentines/be_my_valentine.py +++ b/bot/exts/valentines/be_my_valentine.py @@ -99,7 +99,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_commands) + channel = self.bot.get_channel(Channels.community_bot_commands) valentine, title = self.valentine_check(valentine_type) if user is None: diff --git a/bot/resources/halloween/spooky_rating.json b/bot/resources/halloween/spooky_rating.json index d9c8dcb7..533e7107 100644 --- a/bot/resources/halloween/spooky_rating.json +++ b/bot/resources/halloween/spooky_rating.json @@ -2,46 +2,46 @@ "-1": { "title": "\uD83D\uDD6F You're not scarin' anyone \uD83D\uDD6F", "text": "No matter what you say or do, nobody even flinches when you try to scare them. Was your costume this year only a white sheet with holes for eyes? Or did you even bother with a costume at all? Either way, don't expect too many treats when going from door-to-door.", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/candle.jpeg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/candle.jpeg" }, "5": { "title": "\uD83D\uDC76 Like taking candy from a baby \uD83D\uDC76", "text": "Your scaring will probably make a baby cry... but that's the limit on your frightening powers. Be careful not to get to the point where everyone's running away from you because they don't like you, not because they're scared of you.", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/baby.jpeg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/baby.jpeg" }, "20": { "title": "\uD83C\uDFDA You're skills are forming... \uD83C\uDFDA", "text": "As you become the Devil's apprentice, you begin to make people jump every time you sneak up on them. A good start, but you have to learn not to wear the same costume every year until it doesn't fit you. People will notice you and your prowess will decrease.", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/tiger.jpeg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/tiger.jpeg" }, "30": { "title": "\uD83D\uDC80 Picture Perfect... \uD83D\uDC80", "text": "You've nailed the costume this year! You look suuuper scary! Now make sure to play the part and act out your costume and you'll be sure to give a few people a massive fright!", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/costume.jpeg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/costume.jpeg" }, "50": { "title": "\uD83D\uDC7B Uhm... are you human \uD83D\uDC7B", "text": "Uhm... you're too good to be human and now you're beginning to sound like a ghost. You're almost invisible when haunting and nobody truly knows where you are at any given time. But they will always scream at the sound of a ghost...", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/ghost.jpeg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/ghost.jpeg" }, "65": { "title": "\uD83C\uDF83 That potion can't be real \uD83C\uDF83", "text": "You're carrying... some... unknown liquids and no one knows who they are but yourself. Be careful on who you use these powerful spells on, because no Mage has the power to do any irreversible enchantments because even you won't know what will happen to these mortals.", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/necromancer.jepg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/necromancer.jepg" }, "80": { "title": "\uD83E\uDD21 The most sinister face \uD83E\uDD21", "text": "Who knew something intended to be playful could be so menacing... Especially other people seeing you in their nightmares, continuing to haunt them day by day, stuck in their head throughout the entire year. Make sure to pull a face they will never forget.", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/clown.jpeg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/clown.jpeg" }, "95": { "title": "\uD83D\uDE08 The Devil's Accomplice \uD83D\uDE08", "text": "Imagine being allies with the most evil character with an aim to scare people to death. Force people to suffer as they proceed straight to hell to meet your boss and best friend. Not even you know the power He has...", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/jackolantern.jpg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/jackolantern.jpg" }, "100": { "title":"\uD83D\uDC7F The Devil Himself \uD83D\uDC7F", "text": "You are the evillest creature in existence to scare anyone and everyone humanly possible. The reason your underlings are called mortals is that they die. With your help, they die a lot quicker. With all the evil power in the universe, you know what to do.", - "image": "https://raw.githubusercontent.com/python-discord/seasonalbot/master/bot/resources/halloween/spookyrating/devil.jpeg" + "image": "https://raw.githubusercontent.com/python-discord/sir-lancebot/master/bot/resources/halloween/spookyrating/devil.jpeg" } } diff --git a/bot/utils/checks.py b/bot/utils/checks.py index 3031a271..9dd4dde0 100644 --- a/bot/utils/checks.py +++ b/bot/utils/checks.py @@ -39,7 +39,7 @@ def in_whitelist_check( channels: Container[int] = (), categories: Container[int] = (), roles: Container[int] = (), - redirect: Optional[int] = constants.Channels.seasonalbot_commands, + redirect: Optional[int] = constants.Channels.community_bot_commands, fail_silently: bool = False, ) -> bool: """ diff --git a/deployment.yaml b/deployment.yaml index b04b528c..cad97c18 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -1,21 +1,21 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: seasonalbot + name: sir-lancebot spec: replicas: 1 selector: matchLabels: - app: seasonalbot + app: sir-lancebot template: metadata: labels: - app: seasonalbot + app: sir-lancebot spec: containers: - - name: seasonalbot - image: ghcr.io/python-discord/seasonalbot:latest + - name: sir-lancebot + image: ghcr.io/python-discord/sir-lancebot:latest imagePullPolicy: Always envFrom: - secretRef: - name: seasonalbot-env + name: sir-lancebot-env diff --git a/docker-compose.yml b/docker-compose.yml index 24eeafe0..bb6ad6ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ version: "3.7" services: - seasonalbot: + sir-lancebot: build: context: . dockerfile: Dockerfile - container_name: seasonalbot + container_name: sir-lancebot init: true restart: always @@ -12,17 +12,15 @@ services: - redis environment: - - SEASONALBOT_TOKEN - - SEASONALBOT_DEBUG - - SEASONALBOT_GUILD - - SEASONALBOT_ADMIN_ROLE_ID + - BOT_TOKEN + - BOT_DEBUG + - BOT_GUILD + - BOT_ADMIN_ROLE_ID - CHANNEL_DEVLOG - - CHANNEL_SEASONALBOT_COMMANDS + - CHANNEL_COMMUNITY_BOT_COMMANDS - REDIS_HOST=redis volumes: - - /opt/pythondiscord/seasonalbot/log:/bot/bot/log - - /opt/pythondiscord/seasonalbot/data:/bot/data - .:/bot redis: -- cgit v1.2.3