File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ async def close(ctx):
6969
7070 # We need to archive after adding tags in case it was a forum.
7171 await channel .edit (archived = True )
72+ else :
73+ # Remove command message
74+ await ctx .message .delete ()
75+
76+ await channel .send ("The !close command is intended to be used inside a thread/post" ,
77+ suppress_embeds = True ,
78+ delete_after = 5 )
7279
7380
7481
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ async def test_wiki_command():
102102 )
103103
104104@pytest .mark .asyncio
105- async def test_close_command ():
105+ async def test_close_command_working ():
106106 # Mock context
107107 ctx = AsyncMock ()
108108 ctx .channel = AsyncMock ()
@@ -118,6 +118,23 @@ async def test_close_command():
118118 suppress_embeds = True ,
119119 )
120120
121+ @pytest .mark .asyncio
122+ async def test_close_command_notworking ():
123+ # Mock context
124+ ctx = AsyncMock ()
125+ ctx .channel = AsyncMock ()
126+ ctx .message .author = AsyncMock ()
127+
128+ # Call the command
129+ await close (ctx )
130+
131+ # Assert that the command sent the expected message
132+ ctx .channel .send .assert_called_once_with (
133+ "The !close command is intended to be used inside a thread/post" ,
134+ suppress_embeds = True ,
135+ delete_after = 5
136+ )
137+
121138
122139@pytest .mark .asyncio
123140async def test_version_command ():
You can’t perform that action at this time.
0 commit comments