Skip to content
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

Add 'user notes' functionality #191

Merged
merged 19 commits into from
Jun 30, 2024
Merged

Conversation

FloatingMilkshake
Copy link
Sponsor Collaborator

This PR closes #135.

Adds the ability to set notes on users. These notes are shown only to moderators, and can be queried manually or shown automatically when the target user is warned or opens a modmail thread. Notes can also be set to show only one time, after which they will be removed. The /note command offers options to add, edit, delete, list, and show details for notes.

Commands that require referencing a note (e.g. the target note in /note details) support autocomplete, just like /warndetails & similar.

image

Note embeds are very similar to warning embeds. Note commands are all ephemeral by default, but /note list and /note details can be shown publicly in chat for ease of reference.

image
image

When a modmail thread is opened for a user who has notes set to 'Show on Modmail', Cliptok will send an embed with only the relevant notes into the thread channel, similar to how it already sends warning & mute information if the user is muted.

image

When a user with notes set to 'Show on Warn' is issued a warning, Cliptok will send an alert into #investigations pinging the moderator responsible for the warning. Relevant notes will be displayed, but only if either A) they are set to 'Show all Mods', or B) the moderator responsible for the warning was also responsible for the note(s).

image

'Show all Mods' only applies to warning alerts. Notes set to 'Show on Modmail' will be displayed in modmail threads regardless of the 'Show all Mods' setting.

Notes are stored in Redis directly next to warnings—they are not stored under a separate hash like userNotes. They use the same ID namespace as warnings. Notes and warnings both have a new WarningType property to help distinguish between them. This type can either be Warning or Note. Older warnings without a type are treated as having the type Warning.

@Erisa Erisa self-requested a review June 4, 2024 22:47
Helpers/UserNoteHelpers.cs Outdated Show resolved Hide resolved
Events/MessageEvent.cs Outdated Show resolved Hide resolved
Copy link
Owner

@Erisa Erisa left a comment

Choose a reason for hiding this comment

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

Can we log all note events to the mod log, please?

@FloatingMilkshake
Copy link
Sponsor Collaborator Author

Can we log all note events to the mod log, please?

Absolutely! Done in 3d27ab3

Copy link
Owner

@Erisa Erisa left a comment

Choose a reason for hiding this comment

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

lgtm

@FloatingMilkshake FloatingMilkshake merged commit e570e47 into main Jun 30, 2024
2 checks passed
@FloatingMilkshake FloatingMilkshake deleted the floatingmilkshake/user-notes branch June 30, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Suggestion: User notes
2 participants