Skip to content

Commit 414d1e7

Browse files
committed
Remove /here
1 parent ece733d commit 414d1e7

2 files changed

Lines changed: 2 additions & 63 deletions

File tree

pybot/endpoints/slack/commands.py

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,9 @@
88
mentor_request_attachments,
99
ticket_dialog,
1010
)
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
1712
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
2214
from pybot.endpoints.slack.utils.general_utils import catch_command_slack_error
2315
from pybot.endpoints.slack.utils.slash_lunch import LunchCommand
2416
from slack import methods
@@ -28,7 +20,6 @@
2820

2921

3022
def create_endpoints(plugin: SlackPlugin):
31-
plugin.on_command("/here", slash_here, wait=False)
3223
plugin.on_command("/lunch", slash_lunch, wait=False)
3324
plugin.on_command("/repeat", slash_repeat, wait=False)
3425
plugin.on_command("/report", slash_report, wait=False)
@@ -97,47 +88,6 @@ async def slash_report(command: Command, app: SirBot):
9788
await slack.query(methods.CHAT_POST_MESSAGE, response)
9889

9990

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-
14191
@catch_command_slack_error
14292
async def slash_lunch(command: Command, app: SirBot):
14393
"""

pybot/endpoints/slack/utils/command_utils.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
from slack import methods
33

44

5-
async def get_slash_here_messages(mod_id, channel, slack, text):
6-
channel_members_response = await slack.query(
7-
methods.CONVERSATIONS_MEMBERS, data={"channel": channel}
8-
)
9-
member_list = " ".join(
10-
[f"<@{member}>" for member in channel_members_response["members"]]
11-
)
12-
announcement = f":exclamation:Announcement:exclamation: <@{mod_id}>: {text}"
13-
return announcement, member_list
14-
15-
165
def get_slash_repeat_messages(user_id, channel, text):
176
response_type = {
187
"ephemeral": methods.CHAT_POST_EPHEMERAL,

0 commit comments

Comments
 (0)