-
Notifications
You must be signed in to change notification settings - Fork 0
Revert "Feature/capr 52 dm module" #127
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
Merged
Merged
Changes from all commits
Commits
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 was deleted.
Oops, something went wrong.
Empty file.
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,49 @@ | ||
| """Pydantic models for guild settings used by ModelModal.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
|
|
||
| class ChannelSettingsForm(BaseModel): | ||
| """Form for configuring guild channel destinations.""" | ||
|
|
||
| reports: str = Field(default="", title="Reports Channel", description="Channel ID for bug reports") | ||
| announcements: str = Field(default="", title="Announcements Channel", description="Channel ID for announcements") | ||
| feedback: str = Field(default="", title="Feedback Channel", description="Channel ID for feedback routing") | ||
|
|
||
|
|
||
| class RoleSettingsForm(BaseModel): | ||
| """Form for configuring guild role scopes.""" | ||
|
|
||
| admin: str = Field(default="", title="Admin Role", description="Role ID for administrator access") | ||
| member: str = Field(default="", title="Member Role", description="Role ID for general member access") | ||
|
|
||
|
|
||
| class AnnouncementChannelForm(BaseModel): | ||
| """Form for setting the announcement channel.""" | ||
|
|
||
| channel: str = Field(default="", title="Announcement Channel", description="Channel ID for global pings") | ||
|
|
||
|
|
||
| class FeedbackChannelForm(BaseModel): | ||
| """Form for setting the feedback channel.""" | ||
|
|
||
| channel: str = Field(default="", title="Feedback Channel", description="Channel ID for feedback routing") | ||
|
|
||
|
|
||
| class WelcomeMessageForm(BaseModel): | ||
| """Form for customizing the onboarding welcome message.""" | ||
|
|
||
| message: str = Field(default="", title="Welcome Message", description="Custom welcome message for your guild") | ||
|
|
||
|
|
||
| class GuildSettings(BaseModel): | ||
| """Persisted guild settings (not a form — internal state).""" | ||
|
|
||
| reports_channel: int | None = None | ||
| announcements_channel: int | None = None | ||
| feedback_channel: int | None = None | ||
| admin_role: str | None = None | ||
| member_roles: list[str] = Field(default_factory=list) # Store multiple member role IDs as strings | ||
| onboarding_welcome: str | None = None | ||
Oops, something went wrong.
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.
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.
issue (complexity): Consider consolidating the similar channel form models and aligning ID types between forms and
GuildSettingsto reduce redundancy and conversion overhead.You can simplify this by (1) consolidating the very-similar form models and (2) normalizing ID types with
GuildSettingsto avoid future conversion glue.1. Consolidate the single-field channel forms
AnnouncementChannelFormandFeedbackChannelFormare just single-field variants of the same concept. You can express them with a reusable model instead of two separate Pydantic classes:This keeps the ability to have different titles/descriptions but avoids extra top-level models that look “different” but behave the same.
If you don’t need runtime factories, an even simpler variant is a single
SingleChannelFormand you pass the label text from the UI layer instead of encoding it into the model.2. Normalize ID types across forms and
GuildSettingsRight now the forms use
strfor IDs whileGuildSettingsusesint | Nonefor channels andstrfor roles. That guarantees extra parsing/branching later.You can align all channel/role IDs to
int | Nonein both the forms andGuildSettings:This removes the type mismatch between “form” and “internal state”, so future
GuildCogcode can assign directly:instead of carrying conversion/parsing logic or mixed
str/inthandling inguild_summary.