Skip to content

Skill role refactor - #148

Merged
jeremy-rifkin merged 8 commits into
TCCPP:mainfrom
michael-kenzel:skill-role-refactor
Nov 9, 2025
Merged

Skill role refactor#148
jeremy-rifkin merged 8 commits into
TCCPP:mainfrom
michael-kenzel:skill-role-refactor

Conversation

@michael-kenzel

@michael-kenzel michael-kenzel commented May 6, 2025

Copy link
Copy Markdown
Contributor

Yet more untethering: make the bot core independent from skill role stuff.

  • introduce SkillRoles component to house skill role logic and tracking
  • simplify skill role logic by using sets instead of arrays
  • introduce Wheatley.is_established_member() method to replace skill-role-based checks for screenshots and invite links
    • the idea is that guilds will install guild-specific components that overwrite this method with guild-specific logic.
    • by default, just performs a simple check based on join date, server boost state, and moderation permissions.
  • introduce TheEstablishment component that overwrites Wheatley.is_established_member() with TCCPP-specific logic.

@sonarqubecloud

sonarqubecloud Bot commented May 6, 2025

Copy link
Copy Markdown

jeremy-rifkin added a commit that referenced this pull request Oct 3, 2025
Prerequisite for #148 and #179, factored out for easier review:
* introduce callbacks for other components to register role checks and
be notified of role updates
* recast role change detection logic into the language of sets
* role update events only fire once new state has been committed, no
need for debounce map anymore

---------

Co-authored-by: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com>
@michael-kenzel
michael-kenzel force-pushed the skill-role-refactor branch 3 times, most recently from a095f60 to 3b0d2ca Compare October 9, 2025 13:37
@michael-kenzel
michael-kenzel marked this pull request as ready for review October 9, 2025 14:01

@jeremy-rifkin jeremy-rifkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to do this! Some initial comments:

Comment thread src/modules/tccpp/components/establishment.ts Outdated
Comment thread src/wheatley.ts
options: Discord.GuildMember | Discord.User | Discord.UserResolvable | Discord.FetchMemberOptions,
) {
const member = await this.try_fetch_guild_member(options);
if (!member || (member.joinedAt && member.joinedAt.getDate() + 28 * DAY <= Date.now())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user leaves and rejoins this will be reset. I think ideally we'd look in the database for some information about how long they've been around.

@michael-kenzel michael-kenzel Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the idea was that this would be a default implementation that provides a somewhat reasonable starting point out of the box. I'm not sure requiring a database for it is the way to go here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just have the default implementation return false and then have modules overwrite it with something meaningful

Comment thread src/modules/tccpp/components/establishment.ts
Comment thread src/modules/tccpp/components/skill-role-suggestion.ts Outdated
Comment thread src/modules/tccpp/components/formatting-error-detection.ts Outdated
Comment thread src/modules/tccpp/components/formatting-error-detection.ts Outdated
user_id: string;
roles: string[];
last_known_skill_role: string | null;
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a schema so changing it like this isn't great. I'll give a think about how to do it better.

Comment thread src/wheatley.ts
options: Discord.GuildMember | Discord.User | Discord.UserResolvable | Discord.FetchMemberOptions,
) {
const member = await this.try_fetch_guild_member(options);
if (!member || (member.joinedAt && member.joinedAt.getDate() + 28 * DAY <= Date.now())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just have the default implementation return false and then have modules overwrite it with something meaningful


type interaction_context = { member: Discord.GuildMember; role?: string; context?: Discord.Message };

type skill_level = "beginner" | "intermediate" | "proficient" | "advanced" | "expert";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skill_level now is going to be uppercase versions of these strings, so this is schema breaking

Comment on lines +80 to +81
if (current_skill_level > 0) {
// don't announce self-assigned roles

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (current_skill_level > 0) {
// don't announce self-assigned roles
if (current_skill_level > SkillLevel.Beginner) {

@jeremy-rifkin

Copy link
Copy Markdown
Member

I've pushed some take or leave changes for how I think the above comments should be resolved, please feel free to discard if you'd like to solve them in a different way

@sonarqubecloud

sonarqubecloud Bot commented Nov 7, 2025

Copy link
Copy Markdown

@jeremy-rifkin

Copy link
Copy Markdown
Member

I will merge and do any further necessary changes

@jeremy-rifkin
jeremy-rifkin merged commit ddedcb5 into TCCPP:main Nov 9, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants