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:
Saleh 2025-12-28 03:20:31 +02:00 committed by GitHub
parent b156145811
commit 1651ad2d38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 0 deletions

View file

@ -29,6 +29,7 @@ Sometimes its nice to be able to do things quickly... Heres 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

View file

@ -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]

View 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,
)

View file

@ -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"
)