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.
The
ModManagementcog 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:305126844661760000)620607373828030464)365960823622991872)473092532147060736)Since this restriction should hold for all the commands in the cog, the implementation should be straightforward by modifying the
cog_checkmethod:bot/bot/cogs/moderation/management.py
Lines 257 to 260 in 8040724
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.ymlfor 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_CHANNELSconstant in a similar way to theMODERATION_ROLESconstant 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.