Port feedback_cog from deprecated repo - #56
Merged
shamikkarkhanis merged 9 commits intoFeb 6, 2026
Merged
Conversation
Contributor
Reviewer's GuidePorts a generic, reaction-based ticket/feedback submission system into the new codebase, built around a reusable TicketBase cog with a Pydantic-backed modal form, plus a concrete Feedback cog wired to a configurable channel and improved error/timeout handling, and a minor pre-commit tweak. Sequence diagram for feedback submission via modal and ticket creationsequenceDiagram
actor User
participant Discord_Client
participant Discord_API
participant Feedback_Cog
participant TicketBase
participant FeedbackButtonView
participant ModelModal
participant Feedback_Channel
User->>Discord_Client: Trigger slash command feedback
Discord_Client->>Discord_API: Send interaction
Discord_API->>Feedback_Cog: Dispatch app command feedback
Feedback_Cog->>Feedback_Cog: feedback(interaction)
Feedback_Cog->>TicketBase: _show_feedback_button(interaction)
TicketBase->>FeedbackButtonView: __init__(schema_cls, callback, modal_title)
TicketBase->>FeedbackButtonView: reply(interaction, content, ephemeral False)
FeedbackButtonView-->>User: Button Open_Survey visible
User->>Discord_Client: Click Open_Survey button
Discord_Client->>Discord_API: Send button interaction
Discord_API->>FeedbackButtonView: on_click open_modal(interaction)
FeedbackButtonView->>ModelModal: __init__(model_cls FeedbackForm, callback _handle_ticket_submit, title)
FeedbackButtonView->>Discord_API: interaction.response.send_modal(ModelModal)
Discord_API-->>User: Show feedback modal
User->>Discord_Client: Submit modal with title and description
Discord_Client->>Discord_API: Submit modal data
Discord_API->>ModelModal: Validate data with FeedbackForm
ModelModal->>TicketBase: _handle_ticket_submit(interaction, validated_data)
TicketBase->>TicketBase: _validate_and_get_text_channel(interaction)
TicketBase->>Feedback_Channel: send(embed)
Feedback_Channel-->>TicketBase: message
loop Add status reactions
TicketBase->>Feedback_Channel: add_reaction(emoji)
end
TicketBase->>Discord_API: Send success followup or response
Discord_API-->>User: Ephemeral success message
Sequence diagram for reaction-based feedback ticket status updatessequenceDiagram
actor Staff
participant Discord_Client
participant Discord_API
participant TicketBase
participant Ticket_Channel
Staff->>Discord_Client: React to feedback ticket message
Discord_Client->>Discord_API: Send RawReactionActionEvent
Discord_API->>TicketBase: on_raw_reaction_add(payload)
TicketBase->>TicketBase: _should_process_reaction(payload)
alt Reaction not in configured channel or from bot or unknown emoji
TicketBase-->>TicketBase: Return without processing
else Valid reaction
TicketBase->>Ticket_Channel: get_channel(payload.channel_id)
TicketBase->>Ticket_Channel: fetch_message(payload.message_id)
Ticket_Channel-->>TicketBase: message
TicketBase->>TicketBase: _is_ticket_embed(message)
alt Not a ticket embed
TicketBase-->>TicketBase: Return
else Is ticket embed
TicketBase->>TicketBase: _update_ticket_status(message, emoji, payload)
TicketBase->>Ticket_Channel: remove_reaction(payload.emoji, payload.member)
TicketBase->>Ticket_Channel: edit(embed with new status and color)
end
end
Class diagram for the new ticket-based feedback systemclassDiagram
class TicketBase {
- bot : commands.Bot
- schema_cls : BaseModel
- status_emoji : dict~str, str~
- command_config : dict~str, Any~
- color_config : dict~str, Any~
- reaction_footer : str
- log : logging.Logger
+ __init__(bot, schema_cls, status_emoji, command_config, color_config, reaction_footer) void
+ _show_feedback_button(interaction) void
+ _validate_and_get_text_channel(interaction) TextChannel | None
+ _build_ticket_embed(data, submitter) discord.Embed
+ _handle_ticket_submit(interaction, validated_data) void
+ _should_process_reaction(payload) bool
+ _is_ticket_embed(message) bool
+ _update_ticket_status(message, emoji, payload) void
+ on_raw_reaction_add(payload) void
}
class FeedbackButtonView {
- schema_cls : BaseModel
- callback : Callable~discord.Interaction, BaseModel, Any~
- modal_title : str
+ __init__(schema_cls, callback, modal_title) void
+ open_modal(interaction, _button) void
}
class Feedback {
- log : logging.Logger
+ __init__(bot) void
+ feedback(interaction) void
}
class FeedbackForm {
+ title : str
+ description : str
}
class Settings {
+ prefix : str
+ token : str
+ ticket_feedback_channel_id : int
}
TicketBase ..> FeedbackButtonView : creates
TicketBase ..> FeedbackForm : uses_as_schema
TicketBase ..> Settings : reads_channel_id
FeedbackButtonView --|> BaseView
TicketBase --|> commands.Cog
Feedback --|> TicketBase
Feedback ..> FeedbackForm : configures_schema
Settings ..> Feedback : configures_request_channel_id
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
.ideaproject files (.gitignore,discord-bot.iml,modules.xml,vcs.xml) look like IDE artifacts and probably shouldn’t be committed; consider removing them from the repo and adding the.idea/directory to the global/project.gitignoreinstead. - In
TicketBase._build_ticket_embedand the logging in_handle_ticket_submit, you’re usingtype: ignore[attr-defined]to accesstitle/descriptiononBaseModel; consider tightening the typing (e.g., aProtocolor generic type bound with those attributes) so these fields are statically known rather than suppressed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `.idea` project files (`.gitignore`, `discord-bot.iml`, `modules.xml`, `vcs.xml`) look like IDE artifacts and probably shouldn’t be committed; consider removing them from the repo and adding the `.idea/` directory to the global/project `.gitignore` instead.
- In `TicketBase._build_ticket_embed` and the logging in `_handle_ticket_submit`, you’re using `type: ignore[attr-defined]` to access `title`/`description` on `BaseModel`; consider tightening the typing (e.g., a `Protocol` or generic type bound with those attributes) so these fields are statically known rather than suppressed.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Member
|
few things:
|
Member
|
Few more things after looking into this more.
|
shamikkarkhanis
deleted the
feature/capr-22-port-feedback_cog-from-deprecated-repo
branch
February 6, 2026 21:42
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CAPR-22
Ports the feedback_cog functionality from the deprecated repository to the new capy-discord codebase.
Changes:
Summary by Sourcery
Introduce a ticket-based feedback submission system using a shared ticket base cog and UI modal flow.
New Features:
Enhancements:
uv runfor thetyhook.Chores: