-
-
Notifications
You must be signed in to change notification settings - Fork 34
Suggestion Command Draft PR #869
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideIntroduces a new suggestion command flow: a modal for user submissions, configuration UI for setting the suggestion channel, database support for persisting suggestions and channel settings, and interactive approve/deny buttons with reactions and thread creation. Sequence Diagram: Admin Reviewing a SuggestionsequenceDiagram
actor Admin
participant DiscordClient as Discord Client
participant SuggestionMessage as Suggestion Message (in Channel)
participant ButtonView as ButtonView (Tux Bot Component)
participant DiscordAPI as Discord API
Admin->>DiscordClient: Clicks "Approve" or "Deny" button on SuggestionMessage
DiscordClient->>ButtonView: Button interaction received
ButtonView->>ButtonView: Perform permission check (e.g., checks.has_pl(5))
alt Admin has required permissions
ButtonView->>ButtonView: Update internal embed state (e.g., status to "Accepted"/"Rejected", add reviewer)
ButtonView->>DiscordAPI: Edit original SuggestionMessage with updated embed and buttons
else Admin lacks permissions
ButtonView->>Admin: (Interaction fails or ephemeral error - not explicitly shown in diff)
end
Class Diagram: New UI Components -
|
Change | Details | Files |
---|---|---|
Add suggestion channel configuration support |
|
tux/database/controllers/guild_config.py tux/ui/views/config.py |
Register persistent suggestion button view on bot startup |
|
tux/bot.py |
Implement suggestion modal and interactive button view |
|
tux/ui/modals/suggestion.py |
Add SuggestionController for database operations |
|
tux/database/controllers/suggestion.py |
Add slash command Cog for suggestions |
|
tux/cogs/misc/suggestions.py |
Possibly linked issues
- #1: Implements the /suggest command, adding channel posting, reactions, admin buttons, and discussion threads as requested.
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai review
on the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issue
to create an issue from it. - Generate a pull request title: Write
@sourcery-ai
anywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai title
on the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summary
anywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summary
on the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guide
on the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolve
on the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismiss
on the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai review
to trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
will need rewrites following completion of #853 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to be in bot.py?
@@ -116,7 +117,10 @@ async def get_private_log_id(self, guild_id: int) -> int | None: | |||
async def get_report_log_id(self, guild_id: int) -> int | None: | |||
return await self.get_guild_config_field_value(guild_id, "report_log_id") | |||
|
|||
async def get_dev_log_id(self, guild_id: int) -> int | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this rename necessary?
from tux.database.client import db | ||
|
||
|
||
class SuggestionController: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This controller should probably have a method for retrieving suggestions and maybe even searching them.
create_suggestion should be an upsert method, rather than a pure insert.
auto_archive_duration=1440, | ||
) | ||
|
||
reactions = ["👍", "👎"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to constants file, or ideally make configurable.
Description
When the command is run makes a post in a defined channel which has two buttons, approve and deny, those buttons can only be interacted with by admins. It also will add thumps up and down reaction for user votes and create a thread attached to it.
Guidelines
My code follows the style guidelines of this project (formatted with Ruff)
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation if needed
My changes generate no new warnings
I have tested this change
Any dependent changes have been merged and published in downstream modules
I have added all appropriate labels to this PR
I have followed all of these guidelines.
Additional Information
Most of it has been completed, the major missing component is button persistence on restart.
Summary by Sourcery
Implement a suggestion submission feature allowing users to submit suggestions via a slash command, log them to a configurable channel, and enable admin-only approve/deny interactions with vote tracking and threaded discussions.
New Features:
Enhancements: