Skip to content
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Sometimes it’s nice to be able to do things quickly... Here’s where macros c
- `?fraud` - redirect to Fraud Squad
- `?thread` - remove the reaction and all Nephthys replies to unclutter duplicates
- `?shipwrights` - redirect to #ask-the-shipwrights
- `?lqvote` - explain how to cast high quality votes

- more to come?? feel free to PR your own into hackclub/nephthys or tell me what you want

### Stale
Expand Down
2 changes: 2 additions & 0 deletions nephthys/macros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from nephthys.macros.fraud import Fraud
from nephthys.macros.hello_world import HelloWorld
from nephthys.macros.identity import Identity
from nephthys.macros.low_quality_votes import LowQualityVotes
from nephthys.macros.reopen import Reopen
from nephthys.macros.resolve import Resolve
from nephthys.macros.shipcertqueue import ShipCertQueue
Expand Down Expand Up @@ -32,6 +33,7 @@
FulfillmentReminder,
Shipwrights,
TeamTag,
LowQualityVotes,
]

macros = [macro() for macro in macro_list]
Expand Down
39 changes: 39 additions & 0 deletions nephthys/macros/low_quality_votes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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 LowQualityVotes(Macro):
name = "lqvote"
aliases = ["lqvote", "lqvotes"]

async def run(self, ticket, helper, **kwargs):
"""
Macro to warn users their votes are being marked low-quality.
"""
macro_text = env.transcript.low_quality_votes_macro
if not macro_text:
await env.slack_client.chat_postEphemeral(
channel=env.slack_help_channel,
thread_ts=ticket.msgTs,
user=helper.slackId,
text=f"Invalid macro: The `{self.name}` macro is not configured for this channel.",
)
return
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=macro_text.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,
)
5 changes: 5 additions & 0 deletions nephthys/transcripts/transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ def program_snake_case(self) -> str:
description="Message to be sent when the ship cert queue macro is used (only applies to Flavortown and SoM)",
)

low_quality_votes_macro: str | None = Field(
default=None,
description="Message to be sent when votes are marked low-quality (Flavortown)",
)

not_allowed_channel: str = Field(
default="", description="Message for unauthorized channel access"
)
Expand Down
10 changes: 10 additions & 0 deletions nephthys/transcripts/transcripts/flavortown.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,13 @@ class Flavortown(Transcript):
ship_cert_queue_macro: str | None = (
"Hey (user), we currently have a backlog of projects waiting to be certified. Please be patient.\n\n*You can keep track of the queue <https://us.review.hackclub.com/queue | here>!*"
)

low_quality_votes_macro: str | None = (
"Hey (user), some of your votes are likely being marked as low quality and are discarded.\n\n"
"When you're <https://flavortown.hackclub.com/votes/new | voting>, make sure that you are:\n"
"• Checking both the repo and demo links\n"
"• Spending some time looking through the project's devlogs\n"
"• Giving good, thoughtful scores and feedback\n"
"• Generally caring and not rushing through voting\n\n"
"_Low quality votes won't count towards your vote requirement!_"
)
Loading