feat(config): Split mod and admin config.

This commit is contained in:
2023-10-16 21:43:54 +03:00
parent d9c58806cf
commit ab39ceee71
44 changed files with 227 additions and 102 deletions

View File

@@ -6,6 +6,7 @@ from settings.setting_types import (
from core.data import CoreData
from babel.translator import ctx_translator
from wards import low_management_iward, high_management_iward
from . import babel
@@ -16,6 +17,7 @@ class ModerationSettings(SettingGroup):
class TicketLog(ModelData, ChannelSetting):
setting_id = "ticket_log"
_event = 'guildset_ticket_log'
_write_ward = low_management_iward
_display_name = _p('guildset:ticket_log', "ticket_log")
_desc = _p(
@@ -66,6 +68,7 @@ class ModerationSettings(SettingGroup):
class AlertChannel(ModelData, ChannelSetting):
setting_id = "alert_channel"
_event = 'guildset_alert_channel'
_write_ward = low_management_iward
_display_name = _p('guildset:alert_channel', "alert_channel")
_desc = _p(
@@ -119,18 +122,23 @@ class ModerationSettings(SettingGroup):
class ModRole(ModelData, RoleSetting):
setting_id = "mod_role"
_event = 'guildset_mod_role'
_write_ward = high_management_iward
_display_name = _p('guildset:mod_role', "mod_role")
_desc = _p(
'guildset:mod_role|desc',
"Guild role permitted to view configuration and perform moderation tasks."
"Server role permitted to perform moderation and minor bot configuration."
)
_long_desc = _p(
'guildset:mod_role|long_desc',
"Members with the set role will be able to access my configuration panels, "
"and perform some moderation tasks, such as setting up pomodoro timers. "
"Moderators cannot reconfigure most bot configuration, "
"or perform operations they do not already have permission for in Discord."
"Members with the moderator role are considered moderators,"
" and are permitted to use moderator commands,"
" such as viewing and pardoning moderation tickets,"
" creating moderation notes,"
" and performing minor reconfiguration through the `/config` command.\n"
"Moderators are never permitted to perform actions (such as giving roles)"
" that they do not already have the Discord permissions for.\n"
"Members with the 'Manage Guild' permission are always considered moderators."
)
_accepts = _p(
'guildset:mod_role|accepts',
@@ -149,11 +157,13 @@ class ModerationSettings(SettingGroup):
resp = t(_p(
'guildset:mod_role|set_response:set',
"Members with {role} will be considered moderators."
" You may need to grant them access to view moderation commands"
" via the server integration settings."
)).format(role=value.mention)
else:
resp = t(_p(
'guildset:mod_role|set_response:unset',
"No members will be given moderation privileges."
"Only members with the 'Manage Guild' permission will be considered moderators."
))
return resp
@@ -171,6 +181,7 @@ class ModerationSettings(SettingGroup):
class AdminRole(ModelData, RoleSetting):
setting_id = "admin_role"
_event = 'guildset_admin_role'
_write_ward = high_management_iward
_display_name = _p('guildset:admin_role', "admin_role")
_desc = _p(