Skip to content

Commit 1521e61

Browse files
committed
add identity and faq macros
1 parent 40ff2a1 commit 1521e61

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

nephthys/data/transcript.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class Transcript:
55
FAQ_LINK = "https://hackclub.slack.com/docs/T0266FRGM/F090MQF0H2Q"
66
EXPLORPHEUS_PFP = "https://hc-cdn.hel1.your-objectstorage.com/s/v3/d6d828d6ba656d09a62add59dc07e2974bfdb38f_image.png"
7+
IDENTITY_HELP_CHANNEL = "C092833JXKK"
78

89
first_ticket_create = f"""
910
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.

nephthys/macros/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from typing import Any
22

3+
from nephthys.macros.faq import FAQ
34
from nephthys.macros.hello_world import HelloWorld
5+
from nephthys.macros.identity import Identity
46
from nephthys.macros.resolve import Resolve
57
from nephthys.utils.env import env
68
from nephthys.utils.logging import send_heartbeat
79
from prisma.models import Ticket
810
from prisma.models import User
911

1012

11-
macros = [Resolve, HelloWorld]
13+
macros = [Resolve, HelloWorld, FAQ, Identity]
1214

1315

1416
async def run_macro(

nephthys/macros/faq.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from nephthys.actions.resolve import resolve
2+
from nephthys.data.transcript import Transcript
3+
from nephthys.macros.types import Macro
4+
from nephthys.utils.env import env
5+
6+
7+
class FAQ(Macro):
8+
name = "faq"
9+
10+
async def run(self, ticket, helper, **kwargs):
11+
"""
12+
A simple hello world macro that does nothing.
13+
"""
14+
user_info = await env.slack_client.users_info(user=helper.slackId)
15+
name = (
16+
user_info["user"]["profile"].get("display_name")
17+
or user_info["user"]["profile"].get("real_name")
18+
or user_info["user"]["name"]
19+
)
20+
await env.slack_client.chat_postMessage(
21+
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<here it is again|{Transcript.FAQ_LINK}>",
22+
channel=env.slack_help_channel,
23+
thread_ts=ticket.msgTs,
24+
)
25+
await resolve(
26+
ts=ticket.msgTs,
27+
resolver=helper.slackId,
28+
client=env.slack_client,
29+
)

nephthys/macros/identity.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from nephthys.actions.resolve import resolve
2+
from nephthys.data.transcript import Transcript
3+
from nephthys.macros.types import Macro
4+
from nephthys.utils.env import env
5+
6+
7+
class Identity(Macro):
8+
name = "identity"
9+
10+
async def run(self, ticket, helper, **kwargs):
11+
"""
12+
A simple hello world macro that does nothing.
13+
"""
14+
user_info = await env.slack_client.users_info(user=helper.slackId)
15+
name = (
16+
user_info["user"]["profile"].get("display_name")
17+
or user_info["user"]["profile"].get("real_name")
18+
or user_info["user"]["name"]
19+
)
20+
await env.slack_client.chat_postMessage(
21+
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!",
22+
channel=env.slack_help_channel,
23+
thread_ts=ticket.msgTs,
24+
)
25+
await resolve(
26+
ts=ticket.msgTs,
27+
resolver=helper.slackId,
28+
client=env.slack_client,
29+
)

0 commit comments

Comments
 (0)