-
Notifications
You must be signed in to change notification settings - Fork 24
Add ?lqvote and ?votequeue for flavortown #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexlam0206
wants to merge
10
commits into
hackclub:main
Choose a base branch
from
alexlam0206:ft-macros-nok
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
564bfba
Add ?lqvote and ?votequeue for flavortown
alexlam0206 3773bbf
Run pre-commit formatting
alexlam0206 2c8eca9
Fix: ft-maacros-nok pre-commit
alexlam0206 c43efa4
fix: wordings (ft-macros-nok)
alexlam0206 e0f45bd
Remove the vote queue macro
MMK21Hub 61b63ea
Change phrasing of low quality votes macro
MMK21Hub 7166756
Avoid abbreviations in variable names
MMK21Hub 95549c4
Rename lqvotes.py => low_quality_votes.py
MMK21Hub 751b4ea
Actually import the low-quality votes macro
MMK21Hub 5fecbac
Make low_quality_votes_macro a bit more professional-looking
MMK21Hub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] | ||
alexlam0206 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.