From 71ce990ba28dca3edf713ac28eff81065155f793 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Sat, 11 Sep 2021 23:39:41 +0400 Subject: Adds Core Dev Voting To Changelog Blacklist Adds the channel used for voting on contributors to the message changelog blacklist. Signed-off-by: Hassan Abouelela --- config-default.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config-default.yml b/config-default.yml index a18fdafa5..3405934e0 100644 --- a/config-default.yml +++ b/config-default.yml @@ -157,9 +157,10 @@ guild: reddit: &REDDIT_CHANNEL 458224812528238616 # Development - dev_contrib: &DEV_CONTRIB 635950537262759947 - dev_core: &DEV_CORE 411200599653351425 - dev_log: &DEV_LOG 622895325144940554 + dev_contrib: &DEV_CONTRIB 635950537262759947 + dev_core: &DEV_CORE 411200599653351425 + dev_voting: &DEV_CORE_VOTING 839162966519447552 + dev_log: &DEV_LOG 622895325144940554 # Discussion meta: 429409067623251969 @@ -251,6 +252,7 @@ guild: - *MESSAGE_LOG - *MOD_LOG - *STAFF_VOICE + - *DEV_CORE_VOTING reminder_whitelist: - *BOT_CMD -- cgit v1.2.3 From 3c1cc75371fa8be3e1de3affa7b5a1f54b55da6b Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Fri, 17 Sep 2021 13:34:15 +0100 Subject: Add metricity to docker-compose By adding metricity to the compose, we allow it to migrate itself, rather than needing the site to do it. Defaulting 'USE_METRICITY' to false means that it will run migrations, but not actually start the bot. This means we don't add another service that needs to run all the time, which could impact some contribs on lower powered hardware. --- .gitignore | 1 + docker-compose.yml | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f74a142f3..177345908 100644 --- a/.gitignore +++ b/.gitignore @@ -116,6 +116,7 @@ log.* # Custom user configuration config.yml docker-compose.override.yml +metricity-config.toml # xmlrunner unittest XML reports TEST-**.xml diff --git a/docker-compose.yml b/docker-compose.yml index 0f0355dac..b3ca6baa4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,11 @@ services: POSTGRES_DB: pysite POSTGRES_PASSWORD: pysite POSTGRES_USER: pysite + healthcheck: + test: ["CMD-SHELL", "pg_isready -U pysite"] + interval: 2s + timeout: 1s + retries: 5 redis: << : *logging @@ -31,6 +36,21 @@ services: ports: - "127.0.0.1:6379:6379" + metricity: + << : *logging + restart: on-failure # USE_METRICITY=false will stop the container, so this ensures it only restarts on error + depends_on: + postgres: + condition: service_healthy + image: ghcr.io/python-discord/metricity:latest + env_file: + - .env + environment: + DATABASE_URI: postgres://pysite:pysite@postgres/metricity + USE_METRICITY: ${USE_METRICITY-false} + volumes: + - .:/tmp/bot:ro + snekbox: << : *logging << : *restart_policy @@ -56,7 +76,7 @@ services: - "127.0.0.1:8000:8000" tty: true depends_on: - - postgres + - metricity environment: DATABASE_URL: postgres://pysite:pysite@postgres:5432/pysite METRICITY_DB_URL: postgres://pysite:pysite@postgres:5432/metricity -- cgit v1.2.3 From fe248cc05a3c50beb064c43aef224c0204512df9 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Fri, 17 Sep 2021 13:35:38 +0100 Subject: Remove duplicate roles when defining allowed_mentions --- bot/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/bot.py b/bot/bot.py index 914da9c98..db3d651a3 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -109,7 +109,7 @@ class Bot(commands.Bot): def create(cls) -> "Bot": """Create and return an instance of a Bot.""" loop = asyncio.get_event_loop() - allowed_roles = [discord.Object(id_) for id_ in constants.MODERATION_ROLES] + allowed_roles = list({discord.Object(id_) for id_ in constants.MODERATION_ROLES}) intents = discord.Intents.all() intents.presences = False -- cgit v1.2.3 From 802fa0dd29f35d4cf02c7be88dcec01d9ab67729 Mon Sep 17 00:00:00 2001 From: Izan Date: Mon, 20 Sep 2021 18:55:49 +0100 Subject: Remove coveralls from lint-test --- .github/workflows/lint-test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 619544e1a..2f42f1895 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -121,13 +121,6 @@ jobs: - name: Run tests and generate coverage report run: pytest -n auto --cov --disable-warnings -q - # This step will publish the coverage reports coveralls.io and - # print a "job" link in the output of the GitHub Action - - name: Publish coverage report to coveralls.io - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: coveralls - # Prepare the Pull Request Payload artifact. If this fails, we # we fail silently using the `continue-on-error` option. It's # nice if this succeeds, but if it fails for any reason, it -- cgit v1.2.3 From eff7d7f2cf3f2cd91ed6654b97edd95db786fd47 Mon Sep 17 00:00:00 2001 From: Boris Muratov <8bee278@gmail.com> Date: Tue, 21 Sep 2021 23:39:52 +0300 Subject: Add `cog` as an alias to extensions command --- bot/exts/utils/extensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/utils/extensions.py b/bot/exts/utils/extensions.py index f78664527..309126d0e 100644 --- a/bot/exts/utils/extensions.py +++ b/bot/exts/utils/extensions.py @@ -36,7 +36,7 @@ class Extensions(commands.Cog): def __init__(self, bot: Bot): self.bot = bot - @group(name="extensions", aliases=("ext", "exts", "c", "cogs"), invoke_without_command=True) + @group(name="extensions", aliases=("ext", "exts", "c", "cog", "cogs"), invoke_without_command=True) async def extensions_group(self, ctx: Context) -> None: """Load, unload, reload, and list loaded extensions.""" await ctx.send_help(ctx.command) -- cgit v1.2.3 From 18b5fd814377ba059a5ca2f8f17475a59d87fd8f Mon Sep 17 00:00:00 2001 From: Izan Date: Thu, 23 Sep 2021 10:29:04 +0100 Subject: Use full paste link --- bot/resources/tags/paste.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/resources/tags/paste.md b/bot/resources/tags/paste.md index 2ed51def7..8c3c2985d 100644 --- a/bot/resources/tags/paste.md +++ b/bot/resources/tags/paste.md @@ -1,6 +1,6 @@ **Pasting large amounts of code** If your code is too long to fit in a codeblock in discord, you can paste your code here: -https://paste.pydis.com/ +https://paste.pythondiscord.com/ After pasting your code, **save** it by clicking the floppy disk icon in the top right, or by typing `ctrl + S`. After doing that, the URL should **change**. Copy the URL and post it here so others can see it. -- cgit v1.2.3 From 650e739fbb66eb30502675cc3b8bd257e1ee825d Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Fri, 24 Sep 2021 19:53:58 +0200 Subject: Suppress NotFound for batch deletion. I will copy my comment from the code, as it explains why we want this: In the rare case where we found messages matching the spam filter across multiple channels, it is possible that a single channel will only contain a single message to delete. If that should be the case, discord.py will use the "delete single message" endpoint instead of the bulk delete endpoint, and the single message deletion endpoint will complain if you give it that does not exist. As this means that we have no other message to delete in this channel (and message deletes work per-channel), we can just log an exception and carry on with business. --- bot/exts/filters/antispam.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bot/exts/filters/antispam.py b/bot/exts/filters/antispam.py index 8c075fa95..72103c9fb 100644 --- a/bot/exts/filters/antispam.py +++ b/bot/exts/filters/antispam.py @@ -250,7 +250,20 @@ class AntiSpam(Cog): for message in messages: channel_messages[message.channel].append(message) for channel, messages in channel_messages.items(): - await channel.delete_messages(messages) + try: + await channel.delete_messages(messages) + except NotFound: + # In the rare case where we found messages matching the + # spam filter across multiple channels, it is possible + # that a single channel will only contain a single message + # to delete. If that should be the case, discord.py will + # use the "delete single message" endpoint instead of the + # bulk delete endpoint, and the single message deletion + # endpoint will complain if you give it that does not exist. + # As this means that we have no other message to delete in + # this channel (and message deletes work per-channel), + # we can just log an exception and carry on with business. + log.info(f"Tried to delete message `{messages[0].id}`, but message could not be found.") # Otherwise, the bulk delete endpoint will throw up. # Delete the message directly instead. -- cgit v1.2.3