Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Commit 98e127f

Browse files
authored
Addition of /xpost command (#288)
Addition of /xpost command closes #284
1 parent e5e9119 commit 98e127f

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

sirbot_pyslackers/endpoints/slack/commands.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def create_endpoints(plugin):
1919
plugin.on_command("/snippet", snippet)
2020
plugin.on_command("/report", report)
2121
plugin.on_command("/resources", resources)
22+
plugin.on_command("/xpost", xpost)
2223

2324

2425
async def just_ask(command, app):
@@ -163,9 +164,7 @@ async def pypi_search(command, app):
163164

164165
else:
165166
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']}`"
169168

170169
await app.plugins["slack"].api.query(url=methods.CHAT_POST_MESSAGE, data=response)
171170

@@ -255,3 +254,19 @@ async def resources(command, app):
255254
)
256255

257256
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

Comments
 (0)