Skip to content

Conversation

Zabuzard
Copy link
Member

@Zabuzard Zabuzard commented Nov 8, 2021

Overview

Partially implements #64 . Adds commands:

  • /mute user reason
  • /unmute user reason

muted_unmuted

The commands are fairly simple and follow the pattern introduced by #244 . That said, the branch is based on that branch and hence also blocked by its release.


Notes

This PR slightly changes the initialization process of the bot by moving routines and listeners down into Commands.java (instead of Application.java). This is a temporary change that is unfortuantely required, since they need access to systems such as TagSystem or ModAuditLogStore, and also the JDA instance (which is now also passed down through CommandSystem).

All of this will be made nicer anyways with #235 and #236 , so I wouldnt bother too much for now.


Bot permission change

The bot needs to listen to user-join events, which requires the privileged Server Members Intent to be enabled (already enabled it on our bots and added it to the config, since it doesnt harm - but we have to tell contributors in an announcement).

setting


Checklist

Basic

  • Mute a user
  • Unmute a user

DM

  • Mute a user who has disabled DMs
  • Mute a user who has enabled DMs
  • Unmute a user who has disabled DMs
  • Unmute a user who has enabled DMs

Foreign users

  • Attempt to mute a user who is not in the guild
  • Attempt to unmute a user who is not in the guild

Logic

  • Attempt to mute an already muted user
  • Attempt to unmute an user who is not muted yet

Permissions

  • Mute with the bot not having role permissions
  • Unmute with the bot not having role permissions
  • Mute with the author not having the soft moderation role
  • Unmute with the author not having the soft moderation role
  • Mute with the bot being lower in the hierarchy than the target
  • Unmute with the bot being lower in the hierarchy than the target
  • Mute with the bot being lower in the hierarchy than the muted role
  • Unmute with the bot being lower in the hierarchy than the muted role
  • Mute with the author being lower in the hierarchy than the target
  • Unmute with the author being lower in the hierarchy than the target
  • Mute with the author being lower in the hierarchy than the muted role
  • Unmute with the author being lower in the hierarchy than the muted role

Rejoin

  • Mute user, then leave and rejoin, user should be muted again
  • Mute user, then unmute. Then leave and rejoin, user should not be muted
  • Mute user, then leave. Unmute and rejoin, user should not be muted
  • Mute user, then leave. Unmute and mute. Then rejoin, user should be muted again

TODO

  • If user leaves and joins the server back, they would be unmuted again. The role has to be applied again by the bot (use database, listen to join event, ...)

@Zabuzard Zabuzard added blocked This issue is currently blocked by another issue (see comments) new command Add a new command or group of commands to the bot labels Nov 8, 2021
@Zabuzard Zabuzard added this to the Migrate existing commands milestone Nov 8, 2021
@Zabuzard Zabuzard self-assigned this Nov 8, 2021
@Zabuzard
Copy link
Member Author

Zabuzard commented Nov 8, 2021

mute_dm
mute_muted_user
muted_unmuted
muteTooPowerful
muting_foreign_user
unmute_dm
unmuting_foreign_user
unmuting_unmuted_user

@Zabuzard
Copy link
Member Author

Zabuzard commented Nov 8, 2021

SonarCloud Quality Gate failed. Quality Gate failed

Bug A 0 Bugs Vulnerability A 0 Vulnerabilities Security Hotspot A 0 Security Hotspots Code Smell A 2 Code Smells

0.0% 0.0% Coverage 3.4% 3.4% Duplication

The remaining code duplication is a non-issue and cant be fixed nicely. (it is complaining about the part where we extract the arguments out of the event call)

I am going to ignore this and push anyways.

@Zabuzard Zabuzard marked this pull request as ready for review November 9, 2021 11:18
@Zabuzard Zabuzard requested review from a team as code owners November 9, 2021 11:18
@Zabuzard Zabuzard marked this pull request as draft November 9, 2021 11:19
@Zabuzard
Copy link
Member Author

Zabuzard commented Nov 9, 2021

draft until unblocked

@Zabuzard Zabuzard force-pushed the feature/migrate_mute_unmute branch from 89a8746 to b68cab1 Compare November 12, 2021 08:44
@CLAassistant
Copy link

CLAassistant commented Nov 15, 2021

CLA assistant check
All committers have signed the CLA.

@Zabuzard Zabuzard force-pushed the feature/migrate_mute_unmute branch from b68cab1 to 9b2609c Compare November 16, 2021 09:02
@Zabuzard Zabuzard removed the blocked This issue is currently blocked by another issue (see comments) label Nov 16, 2021
@Zabuzard Zabuzard marked this pull request as ready for review November 16, 2021 09:13
@Zabuzard Zabuzard dismissed stale reviews from Tais993 and java-coding-prodigy November 16, 2021 09:32

Implemented.

@Zabuzard Zabuzard mentioned this pull request Nov 16, 2021
13 tasks
@Zabuzard Zabuzard removed the blocked This issue is currently blocked by another issue (see comments) label Dec 10, 2021
@Zabuzard Zabuzard force-pushed the feature/migrate_mute_unmute branch from cdddebf to 9ec7f2b Compare December 10, 2021 08:20
@Zabuzard
Copy link
Member Author

If the user rejoins the server they're unmuted.

Seems to work now.

log

@Zabuzard Zabuzard marked this pull request as ready for review December 10, 2021 10:08
@Zabuzard Zabuzard force-pushed the feature/migrate_mute_unmute branch from 8ab08a3 to 5554048 Compare December 10, 2021 10:15
@Zabuzard Zabuzard enabled auto-merge (rebase) December 10, 2021 10:17
@Zabuzard Zabuzard mentioned this pull request Dec 10, 2021
Tais993
Tais993 previously approved these changes Dec 11, 2021
@Zabuzard
Copy link
Member Author

Resolved conflicts, no code changes. Tais approval is still valid.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
6.7% 6.7% Duplication

@Zabuzard Zabuzard mentioned this pull request Dec 14, 2021
2 tasks
@Zabuzard Zabuzard merged commit bb0c501 into develop Dec 14, 2021
@Zabuzard Zabuzard deleted the feature/migrate_mute_unmute branch December 14, 2021 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new command Add a new command or group of commands to the bot priority: major

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants