From 205e50e1548054854ad043da5ba81714116da9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Sat, 8 Feb 2025 16:42:39 +0100 Subject: [PATCH] Allow close command to be called in any channel This also removed an unnecesary mock from the test --- intbot/core/bot/main.py | 2 +- intbot/tests/test_bot/test_main.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/intbot/core/bot/main.py b/intbot/core/bot/main.py index 4dd0c6f..c6e8584 100644 --- a/intbot/core/bot/main.py +++ b/intbot/core/bot/main.py @@ -41,11 +41,11 @@ async def wiki(ctx): @bot.command() async def close(ctx): channel = ctx.channel - parent = channel.parent author = ctx.message.author # Check if it's a public or private post (thread) if channel.type in (discord.ChannelType.public_thread, discord.ChannelType.private_thread): + parent = channel.parent # Check if the post (thread) was sent in a forum, # so we can add a tag diff --git a/intbot/tests/test_bot/test_main.py b/intbot/tests/test_bot/test_main.py index 393bc37..ea3517e 100644 --- a/intbot/tests/test_bot/test_main.py +++ b/intbot/tests/test_bot/test_main.py @@ -123,7 +123,6 @@ async def test_close_command_notworking(): # Mock context ctx = AsyncMock() ctx.channel = AsyncMock() - ctx.message.author = AsyncMock() # Call the command await close(ctx)