mirror of
https://github.com/System-End/nephthys.git
synced 2026-04-19 19:45:12 +00:00
Added shipwrights macro (#139)
* Added shipwrights macro * fixes ig idk? * renamed class for consistency * reordered imports * removed extra space * Update README.md * Adjust grammar in ?shipwrights response * Remove spaces next to newlines --------- Co-authored-by: MMK21Hub <50421330+MMK21Hub@users.noreply.github.com>
This commit is contained in:
parent
b156145811
commit
1651ad2d38
4 changed files with 39 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ Sometimes it’s nice to be able to do things quickly... Here’s where macros c
|
|||
- `?shipcertqueue` - tell them to wait and vote because there's a backlog of ships
|
||||
- `?fraud` - redirect to fraud dept
|
||||
- `?thread` - remove the reaction and all Nephthys replies to unclutter duplicates
|
||||
- `?shipwrights` - redirect to #ask-the-shipwrights
|
||||
- more to come?? feel free to PR your own into hackclub/nephthys or tell me what you want
|
||||
|
||||
### Stale
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ from nephthys.macros.identity import Identity
|
|||
from nephthys.macros.reopen import Reopen
|
||||
from nephthys.macros.resolve import Resolve
|
||||
from nephthys.macros.shipcertqueue import ShipCertQueue
|
||||
from nephthys.macros.shipwrights import Shipwrights
|
||||
from nephthys.macros.thread import Thread
|
||||
from nephthys.macros.trigger_daily_stats import DailyStats
|
||||
from nephthys.macros.types import Macro
|
||||
|
|
@ -27,6 +28,7 @@ macro_list: list[type[Macro]] = [
|
|||
Thread,
|
||||
Reopen,
|
||||
DailyStats,
|
||||
Shipwrights,
|
||||
]
|
||||
|
||||
macros = [macro() for macro in macro_list]
|
||||
|
|
|
|||
31
nephthys/macros/shipwrights.py
Normal file
31
nephthys/macros/shipwrights.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
from nephthys.actions.resolve import resolve
|
||||
from nephthys.macros.types import Macro
|
||||
from nephthys.utils.env import env
|
||||
from nephthys.utils.slack_user import get_user_profile
|
||||
from nephthys.utils.ticket_methods import reply_to_ticket
|
||||
|
||||
|
||||
class Shipwrights(Macro):
|
||||
name = "shipwrights"
|
||||
|
||||
async def run(self, ticket, helper, **kwargs):
|
||||
"""
|
||||
A macro used to refer people to shipwrights support.
|
||||
"""
|
||||
sender = await env.db.user.find_first(where={"id": ticket.openedById})
|
||||
if not sender:
|
||||
return
|
||||
user = await get_user_profile(sender.slackId)
|
||||
await reply_to_ticket(
|
||||
text=env.transcript.shipwrights_macro.replace(
|
||||
"(user)", user.display_name()
|
||||
),
|
||||
ticket=ticket,
|
||||
client=env.slack_client,
|
||||
)
|
||||
await resolve(
|
||||
ts=ticket.msgTs,
|
||||
resolver=helper.slackId,
|
||||
client=env.slack_client,
|
||||
send_resolved_message=False,
|
||||
)
|
||||
|
|
@ -86,6 +86,11 @@ class Transcript(BaseModel):
|
|||
description="Message to be sent when the fraud macro is used",
|
||||
)
|
||||
|
||||
shipwrights_macro: str = Field(
|
||||
default="Hey, (user)!\nPlease ask questions about project shipping or certifications in <#C099P9FQQ91>.\n\nThe Shipwrights Team will help with your question!",
|
||||
description="Message to be sent when the shipwrights macro is used",
|
||||
)
|
||||
|
||||
identity_macro: str = Field(
|
||||
default="", description="Message to be sent when the identity macro is used"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue