Skip to content

Conversation

@michael-kenzel
Copy link
Contributor

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

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
Copy link

sonarqubecloud bot commented May 6, 2025

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 <[email protected]>
@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
Copy link
Member

@jeremy-rifkin jeremy-rifkin left a comment

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:

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
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.

Copy link
Contributor Author

@michael-kenzel michael-kenzel Oct 10, 2025

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?

override async setup(commands: CommandSetBuilder) {
// const role_manager = unwrap(this.wheatley.components.get("RoleManager")) as RoleManager;
// role_manager.register_role_check(this.check_established.bind(this));
this.wheatley.is_established_member = this.is_established_member.bind(this);
Copy link
Member

Choose a reason for hiding this comment

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

This sort of thing makes me pretty uneasy. If the check isn't suitable to just be implemented in wheatley, I think it'd be better for other components to just get handles to this component and use its logic.

Copy link
Contributor Author

@michael-kenzel michael-kenzel Oct 10, 2025

Choose a reason for hiding this comment

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

Well, the issue with that is that we have some components like anti-invite-links or anti-screenshots that I think we would like to just work out-of-the-box, independent of guild-specific components. Otherwise, we would probably have to move these into the TCCPP components?

@sonarqubecloud
Copy link

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