Skip to content

Non-staff rule usage alert#3338

Merged
jb3 merged 3 commits intomainfrom
jb3/non-staff-rule-usage
Jun 23, 2025
Merged

Non-staff rule usage alert#3338
jb3 merged 3 commits intomainfrom
jb3/non-staff-rule-usage

Conversation

@jb3
Copy link
Copy Markdown
Member

@jb3 jb3 commented Jun 23, 2025

Adds an alert within a Moderator+ channel whenever a non-staff member (user without the Helpers role) uses the !rule command.

image

Feature implemented as discussed in #mod-meta with Moderators.

@jb3 jb3 requested a review from mbaruh as a code owner June 23, 2025 00:26
@jb3 jb3 force-pushed the jb3/non-staff-rule-usage branch from dc4d058 to b2bf526 Compare June 23, 2025 01:00
@jb3 jb3 force-pushed the jb3/non-staff-rule-usage branch from b2bf526 to 3c72b27 Compare June 23, 2025 01:04
@jb3 jb3 requested a review from ChrisLovering June 23, 2025 01:12
@jb3 jb3 changed the title Non-staff rule usage Non-staff rule usage alert Jun 23, 2025
@jb3 jb3 requested a review from Copilot June 23, 2025 03:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds an alert mechanism so whenever a non-staff member uses the !rule command, a message is sent to a dedicated rules-alerts thread in the Moderator+ channel.

  • Introduces a new rule_alerts constant for the thread ID
  • Implements _send_rules_alert in information.py and integrates it into the rules command
  • Updates tests to mock channel fetching for the new alert behavior

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/bot/exts/info/test_information.py Patches get_channel to simulate the rules-alerts thread in tests
bot/exts/info/information.py Adds get_or_fetch_channel import, new _send_rules_alert method, and alert trigger in rules command
bot/constants.py Defines rule_alerts channel/thread ID
Comments suppressed due to low confidence (1)

bot/exts/info/information.py:692

  • There is no existing test to verify that non-staff users trigger the rules alert. Consider adding a test case to ensure _send_rules_alert is invoked and the alert embed is sent as expected.
        if constants.Roles.helpers not in {role.id for role in ctx.author.roles}:

Comment thread tests/bot/exts/info/test_information.py
@jb3 jb3 requested a review from jchristgit June 23, 2025 04:43
@L3viathan
Copy link
Copy Markdown
Contributor

LGTM 👍

Copy link
Copy Markdown
Member

@vivekashok1221 vivekashok1221 left a comment

Choose a reason for hiding this comment

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

LGTM

@jb3 jb3 merged commit 3c72b27 into main Jun 23, 2025
5 checks passed
@jb3 jb3 deleted the jb3/non-staff-rule-usage branch June 23, 2025 05:51
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.

5 participants