Skip to content

Restrict ModManagement commands to moderation channels #535

@SebastiaanZ

Description

@SebastiaanZ

The ModManagement cog contains commands to search for and edit infractions stored in our database. Since we'd like to keep that data confidential, we want to restrict these commands to the following channels:

  • #mods (ID: 305126844661760000)
  • #mod-spam (ID: 620607373828030464)
  • #admins (ID: 365960823622991872)
  • #mod-alerts (ID: 473092532147060736)

Since this restriction should hold for all the commands in the cog, the implementation should be straightforward by modifying the cog_check method:

# This cannot be static (must have a __func__ attribute).
def cog_check(self, ctx: Context) -> bool:
"""Only allow moderators to invoke the commands in this cog."""
return with_role_check(ctx, *constants.MODERATION_ROLES)

Please make sure to add this check in addition to the moderation roles check; it's not a replacement.

Additional info

A constant with the channel id already exists in constants.py/config-default.yml for the #admins and #mod-alerts channels, but you will need to add a constant for the other two channels.

It may also be a good idea add a MODERATION_CHANNELS constant in a similar way to the MODERATION_ROLES constant we have. That makes it easier to modify the specific channels we want to include and as well as it making it easier to use the same set of channels in the future.

Metadata

Metadata

Assignees

Labels

a: moderationRelated to community moderation functionality: (moderation, defcon, verification)good first issueGood for newcomerss: WIPWork In Progress

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions