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):
69
69
70
70
# We need to archive after adding tags in case it was a forum.
71
71
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 )
72
79
73
80
74
81
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ async def test_wiki_command():
102
102
)
103
103
104
104
@pytest .mark .asyncio
105
- async def test_close_command ():
105
+ async def test_close_command_working ():
106
106
# Mock context
107
107
ctx = AsyncMock ()
108
108
ctx .channel = AsyncMock ()
@@ -118,6 +118,23 @@ async def test_close_command():
118
118
suppress_embeds = True ,
119
119
)
120
120
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
+
121
138
122
139
@pytest .mark .asyncio
123
140
async def test_version_command ():
You can’t perform that action at this time.
0 commit comments