Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nephthys/data/transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions nephthys/events/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")

Expand Down
4 changes: 3 additions & 1 deletion nephthys/macros/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
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
from prisma.models import Ticket
from prisma.models import User


macros = [Resolve, HelloWorld]
macros = [Resolve, HelloWorld, FAQ, Identity]


async def run_macro(
Expand Down
29 changes: 29 additions & 0 deletions nephthys/macros/faq.py
Original file line number Diff line number Diff line change
@@ -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<here it is again|{Transcript.FAQ_LINK}>",
channel=env.slack_help_channel,
thread_ts=ticket.msgTs,
)
await resolve(
ts=ticket.msgTs,
resolver=helper.slackId,
client=env.slack_client,
)
29 changes: 29 additions & 0 deletions nephthys/macros/identity.py
Original file line number Diff line number Diff line change
@@ -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,
)