feat(config): Split mod and admin config.
This commit is contained in:
@@ -57,7 +57,7 @@ class VideoCog(LionCog):
|
||||
"Could not load ConfigCog. VideoCog configuration will not crossload."
|
||||
)
|
||||
else:
|
||||
self.crossload_group(self.configure_group, configcog.configure_group)
|
||||
self.crossload_group(self.configure_group, configcog.admin_config_group)
|
||||
|
||||
if self.bot.is_ready():
|
||||
await self.initialise()
|
||||
@@ -522,7 +522,7 @@ class VideoCog(LionCog):
|
||||
video_blacklist_durations=VideoSettings.VideoBlacklistDurations._desc,
|
||||
video_grace_period=VideoSettings.VideoGracePeriod._desc,
|
||||
)
|
||||
@low_management_ward
|
||||
@high_management_ward
|
||||
async def configure_video(self, ctx: LionContext,
|
||||
video_blacklist: Optional[discord.Role] = None,
|
||||
video_blacklist_durations: Optional[str] = None,
|
||||
@@ -572,4 +572,3 @@ class VideoCog(LionCog):
|
||||
ui = VideoSettingUI(self.bot, ctx.guild.id, ctx.channel.id)
|
||||
await ui.run(ctx.interaction)
|
||||
await ui.wait()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ from meta.sharding import THIS_SHARD
|
||||
from meta.logger import log_wrap
|
||||
from core.data import CoreData
|
||||
from babel.translator import ctx_translator
|
||||
from wards import low_management_iward, high_management_iward
|
||||
|
||||
from . import babel, logger
|
||||
from .data import VideoData
|
||||
@@ -25,6 +26,7 @@ class VideoSettings(SettingGroup):
|
||||
class VideoChannels(ListData, ChannelListSetting):
|
||||
setting_id = "video_channels"
|
||||
_event = 'guildset_video_channels'
|
||||
_write_ward = high_management_iward
|
||||
|
||||
_display_name = _p('guildset:video_channels', "video_channels")
|
||||
_desc = _p(
|
||||
@@ -101,6 +103,7 @@ class VideoSettings(SettingGroup):
|
||||
class VideoBlacklist(ModelData, RoleSetting):
|
||||
setting_id = "video_blacklist"
|
||||
_event = 'guildset_video_blacklist'
|
||||
_write_ward = high_management_iward
|
||||
|
||||
_display_name = _p('guildset:video_blacklist', "video_blacklist")
|
||||
_desc = _p(
|
||||
@@ -158,6 +161,7 @@ class VideoSettings(SettingGroup):
|
||||
class VideoBlacklistDurations(ListData, ListSetting, InteractiveSetting):
|
||||
setting_id = 'video_durations'
|
||||
_setting = DurationSetting
|
||||
_write_ward = high_management_iward
|
||||
|
||||
_display_name = _p('guildset:video_durations', "video_blacklist_durations")
|
||||
_desc = _p(
|
||||
@@ -217,6 +221,7 @@ class VideoSettings(SettingGroup):
|
||||
class VideoGracePeriod(ModelData, DurationSetting):
|
||||
setting_id = "video_grace_period"
|
||||
_event = 'guildset_video_grace_period'
|
||||
_write_ward = high_management_iward
|
||||
|
||||
_display_name = _p('guildset:video_grace_period', "video_grace_period")
|
||||
_desc = _p(
|
||||
@@ -252,6 +257,7 @@ class VideoSettings(SettingGroup):
|
||||
class VideoExempt(ListData, RoleListSetting):
|
||||
setting_id = "video_exempt"
|
||||
_event = 'guildset_video_exempt'
|
||||
_write_ward = high_management_iward
|
||||
|
||||
_display_name = _p('guildset:video_exempt', "video_exempt")
|
||||
_desc = _p(
|
||||
|
||||
@@ -45,6 +45,7 @@ class VideoSettingUI(ConfigUI):
|
||||
await selection.response.defer(thinking=True, ephemeral=True)
|
||||
|
||||
setting = self.get_instance(VideoSettings.VideoChannels)
|
||||
await setting.interaction_check(setting.parent_id, selection)
|
||||
setting.value = selected.values
|
||||
await setting.write()
|
||||
await selection.delete_original_response()
|
||||
@@ -70,6 +71,7 @@ class VideoSettingUI(ConfigUI):
|
||||
await selection.response.defer(thinking=True, ephemeral=True)
|
||||
|
||||
setting = self.get_instance(VideoSettings.VideoExempt)
|
||||
await setting.interaction_check(setting.parent_id, selection)
|
||||
setting.value = selected.values
|
||||
await setting.write()
|
||||
await selection.delete_original_response()
|
||||
@@ -95,6 +97,7 @@ class VideoSettingUI(ConfigUI):
|
||||
await selection.response.defer(thinking=True, ephemeral=True)
|
||||
|
||||
setting = self.get_instance(VideoSettings.VideoBlacklist)
|
||||
await setting.interaction_check(setting.parent_id, selection)
|
||||
setting.value = selected.values[0] if selected.values else None
|
||||
if setting.value:
|
||||
await equippable_role(self.bot, setting.value, selection.user)
|
||||
@@ -153,7 +156,7 @@ class VideoSettingUI(ConfigUI):
|
||||
class VideoDashboard(DashboardSection):
|
||||
section_name = _p(
|
||||
"dash:video|title",
|
||||
"Video Channel Settings ({commands[configure video_channels]})"
|
||||
"Video Channel Settings ({commands[admin config video_channels]})"
|
||||
)
|
||||
_option_name = _p(
|
||||
"dash:video|option|name",
|
||||
|
||||
Reference in New Issue
Block a user