@@ -19,6 +19,7 @@ def create_endpoints(plugin):
19
19
plugin .on_command ("/snippet" , snippet )
20
20
plugin .on_command ("/report" , report )
21
21
plugin .on_command ("/resources" , resources )
22
+ plugin .on_command ("/xpost" , xpost )
22
23
23
24
24
25
async def just_ask (command , app ):
@@ -163,9 +164,7 @@ async def pypi_search(command, app):
163
164
164
165
else :
165
166
response ["response_type" ] = "ephemeral"
166
- response [
167
- "text"
168
- ] = f"Could not find anything on PyPi matching `{ command ['text' ]} `"
167
+ response ["text" ] = f"Could not find anything on PyPi matching `{ command ['text' ]} `"
169
168
170
169
await app .plugins ["slack" ].api .query (url = methods .CHAT_POST_MESSAGE , data = response )
171
170
@@ -255,3 +254,19 @@ async def resources(command, app):
255
254
)
256
255
257
256
await app .plugins ["slack" ].api .query (url = methods .CHAT_POST_MESSAGE , data = response )
257
+
258
+
259
+ async def xpost (command , app ):
260
+ slack = app .plugins ["slack" ]
261
+ response = Message ()
262
+ response ["channel" ] = command ["channel_id" ]
263
+ response ["unfurl_links" ] = False
264
+
265
+ response ["text" ] = (
266
+ "Please don't cross post the same question in multiple channels. "
267
+ "There may not be a lot of folks online or active at any given moment, "
268
+ "but please be patient. If your question fits in multiple channels, please "
269
+ "pick the one you think is most suitable and post it there."
270
+ )
271
+
272
+ await slack .api .query (url = methods .CHAT_POST_MESSAGE , data = response )
0 commit comments