diff --git a/nephthys/data/transcript.py b/nephthys/data/transcript.py index 3599538..c0e190f 100644 --- a/nephthys/data/transcript.py +++ b/nephthys/data/transcript.py @@ -4,6 +4,7 @@ class Transcript: FAQ_LINK = "https://hackclub.slack.com/docs/T0266FRGM/F090MQF0H2Q" EXPLORPHEUS_PFP = "https://hc-cdn.hel1.your-objectstorage.com/s/v3/d6d828d6ba656d09a62add59dc07e2974bfdb38f_image.png" + IDENTITY_HELP_CHANNEL = "C092833JXKK" first_ticket_create = f""" oh, hey (user) it looks like this is your first time here, welcome! someone should be along to help you soon but in the mean time i suggest you read the faq <{FAQ_LINK}|here>, it answers a lot of common questions. diff --git a/nephthys/events/message.py b/nephthys/events/message.py index d8f3226..f3b4447 100644 --- a/nephthys/events/message.py +++ b/nephthys/events/message.py @@ -18,9 +18,6 @@ async def on_message(event: Dict[str, Any], client: AsyncWebClient): if "subtype" in event and event["subtype"] not in ALLOWED_SUBTYPES: return - if event.get("thread_ts"): - return - user = event.get("user", "unknown") text = event.get("text", "") diff --git a/nephthys/macros/__init__.py b/nephthys/macros/__init__.py index 074592b..3f47f9d 100644 --- a/nephthys/macros/__init__.py +++ b/nephthys/macros/__init__.py @@ -1,6 +1,8 @@ from typing import Any +from nephthys.macros.faq import FAQ from nephthys.macros.hello_world import HelloWorld +from nephthys.macros.identity import Identity from nephthys.macros.resolve import Resolve from nephthys.utils.env import env from nephthys.utils.logging import send_heartbeat @@ -8,7 +10,7 @@ from prisma.models import User -macros = [Resolve, HelloWorld] +macros = [Resolve, HelloWorld, FAQ, Identity] async def run_macro( diff --git a/nephthys/macros/faq.py b/nephthys/macros/faq.py new file mode 100644 index 0000000..2b92eb2 --- /dev/null +++ b/nephthys/macros/faq.py @@ -0,0 +1,29 @@ +from nephthys.actions.resolve import resolve +from nephthys.data.transcript import Transcript +from nephthys.macros.types import Macro +from nephthys.utils.env import env + + +class FAQ(Macro): + name = "faq" + + async def run(self, ticket, helper, **kwargs): + """ + A simple hello world macro that does nothing. + """ + user_info = await env.slack_client.users_info(user=helper.slackId) + name = ( + user_info["user"]["profile"].get("display_name") + or user_info["user"]["profile"].get("real_name") + or user_info["user"]["name"] + ) + await env.slack_client.chat_postMessage( + text=f"hey, {name}! this question is answered in the faq i sent earlier, please make sure to check it out! :rac_cute:\n\n", + channel=env.slack_help_channel, + thread_ts=ticket.msgTs, + ) + await resolve( + ts=ticket.msgTs, + resolver=helper.slackId, + client=env.slack_client, + ) diff --git a/nephthys/macros/identity.py b/nephthys/macros/identity.py new file mode 100644 index 0000000..de9ea4f --- /dev/null +++ b/nephthys/macros/identity.py @@ -0,0 +1,29 @@ +from nephthys.actions.resolve import resolve +from nephthys.data.transcript import Transcript +from nephthys.macros.types import Macro +from nephthys.utils.env import env + + +class Identity(Macro): + name = "identity" + + async def run(self, ticket, helper, **kwargs): + """ + A simple hello world macro that does nothing. + """ + user_info = await env.slack_client.users_info(user=helper.slackId) + name = ( + user_info["user"]["profile"].get("display_name") + or user_info["user"]["profile"].get("real_name") + or user_info["user"]["name"] + ) + await env.slack_client.chat_postMessage( + text=f"hey, {name}! please could you ask questions about identity verification in <#{Transcript.IDENTITY_HELP_CHANNEL}>? :rac_cute:\n\nit helps the verification team keep track of questions easier!", + channel=env.slack_help_channel, + thread_ts=ticket.msgTs, + ) + await resolve( + ts=ticket.msgTs, + resolver=helper.slackId, + client=env.slack_client, + )