mirror of
https://github.com/System-End/nephthys.git
synced 2026-04-19 19:45:12 +00:00
add identity and faq macros
This commit is contained in:
parent
40ff2a17f8
commit
1521e61329
4 changed files with 62 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ from nephthys.utils.env import env
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -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 Ticket
|
|||
from prisma.models import User
|
||||
|
||||
|
||||
macros = [Resolve, HelloWorld]
|
||||
macros = [Resolve, HelloWorld, FAQ, Identity]
|
||||
|
||||
|
||||
async def run_macro(
|
||||
|
|
|
|||
29
nephthys/macros/faq.py
Normal file
29
nephthys/macros/faq.py
Normal file
|
|
@ -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
nephthys/macros/identity.py
Normal file
29
nephthys/macros/identity.py
Normal file
|
|
@ -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,
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue