|
8 | 8 | mentor_request_attachments, |
9 | 9 | ticket_dialog, |
10 | 10 | ) |
11 | | -from pybot.endpoints.slack.utils import ( |
12 | | - MODERATOR_CHANNEL, |
13 | | - PYBACK_HOST, |
14 | | - PYBACK_PORT, |
15 | | - PYBACK_TOKEN, |
16 | | -) |
| 11 | +from pybot.endpoints.slack.utils import MODERATOR_CHANNEL |
17 | 12 | from pybot.endpoints.slack.utils.action_messages import not_claimed_attachment |
18 | | -from pybot.endpoints.slack.utils.command_utils import ( |
19 | | - get_slash_here_messages, |
20 | | - get_slash_repeat_messages, |
21 | | -) |
| 13 | +from pybot.endpoints.slack.utils.command_utils import get_slash_repeat_messages |
22 | 14 | from pybot.endpoints.slack.utils.general_utils import catch_command_slack_error |
23 | 15 | from pybot.endpoints.slack.utils.slash_lunch import LunchCommand |
24 | 16 | from slack import methods |
|
28 | 20 |
|
29 | 21 |
|
30 | 22 | def create_endpoints(plugin: SlackPlugin): |
31 | | - plugin.on_command("/here", slash_here, wait=False) |
32 | 23 | plugin.on_command("/lunch", slash_lunch, wait=False) |
33 | 24 | plugin.on_command("/repeat", slash_repeat, wait=False) |
34 | 25 | plugin.on_command("/report", slash_report, wait=False) |
@@ -97,47 +88,6 @@ async def slash_report(command: Command, app: SirBot): |
97 | 88 | await slack.query(methods.CHAT_POST_MESSAGE, response) |
98 | 89 |
|
99 | 90 |
|
100 | | -@catch_command_slack_error |
101 | | -async def slash_here(command: Command, app: SirBot): |
102 | | - """ |
103 | | - /here allows admins to give non-admins the ability to use @here-esque functionality for specific channels. |
104 | | - Queries pyback to determine if user is authorized |
105 | | - """ |
106 | | - channel_id = command["channel_id"] |
107 | | - slack_id = command["user_id"] |
108 | | - slack = app["plugins"]["slack"].api |
109 | | - |
110 | | - params = {"slack_id": slack_id, "channel_id": channel_id} |
111 | | - headers = {"Authorization": f"Token {PYBACK_TOKEN}"} |
112 | | - |
113 | | - logger.debug(f"/here params: {params}, /here headers {headers}") |
114 | | - async with app.http_session.get( |
115 | | - f"http://{PYBACK_HOST}:{PYBACK_PORT}/api/mods/", params=params, headers=headers |
116 | | - ) as r: |
117 | | - |
118 | | - logger.debug(f"pyback response status: {r.status}") |
119 | | - if r.status >= 400: |
120 | | - return |
121 | | - |
122 | | - response = await r.json() |
123 | | - logger.debug(f"pyback response: {response}") |
124 | | - if not len(response): |
125 | | - return |
126 | | - |
127 | | - message, member_list = await get_slash_here_messages( |
128 | | - slack_id, channel_id, slack, command["text"] |
129 | | - ) |
130 | | - |
131 | | - response = await slack.query( |
132 | | - methods.CHAT_POST_MESSAGE, {"channel": channel_id, "text": message} |
133 | | - ) |
134 | | - timestamp = response["ts"] |
135 | | - await slack.query( |
136 | | - methods.CHAT_POST_MESSAGE, |
137 | | - {"channel": channel_id, "text": member_list, "thread_ts": timestamp}, |
138 | | - ) |
139 | | - |
140 | | - |
141 | 91 | @catch_command_slack_error |
142 | 92 | async def slash_lunch(command: Command, app: SirBot): |
143 | 93 | """ |
|
0 commit comments