rewrite: Setting input strings and localisation.

This commit is contained in:
2023-06-06 12:57:29 +03:00
parent 809cada228
commit e1a23695ee
29 changed files with 823 additions and 236 deletions

View File

@@ -304,8 +304,8 @@ class TimerCog(LionCog):
# ----- Timer Commands -----
@cmds.hybrid_group(
name=_p('cmd:pomodoro', "pomodoro"),
desc=_p('cmd:pomodoro|desc', "Base group for all pomodoro timer commands.")
name=_p('cmd:pomodoro', "timers"),
description=_p('cmd:pomodoro|desc', "Base group for all pomodoro timer commands.")
)
@cmds.guild_only()
async def pomodoro_group(self, ctx: LionContext):
@@ -787,7 +787,7 @@ class TimerCog(LionCog):
await timer.update_status_card()
# Show the config UI
ui = TimerOptionsUI(self.bot, timer, timer_role)
ui = TimerOptionsUI(self.bot, timer, timer_role, callerid=ctx.author.id)
await ui.run(ctx.interaction)
await ui.wait()

View File

@@ -14,6 +14,7 @@ class TimerSettings(SettingGroup):
class PomodoroChannel(ModelData, ChannelSetting):
setting_id = 'pomodoro_channel'
_event = 'guildset_pomodoro_channel'
_set_cmd = 'configure pomodoro'
_display_name = _p('guildset:pomodoro_channel', "pomodoro_channel")
_desc = _p(
@@ -27,6 +28,15 @@ class TimerSettings(SettingGroup):
"If this setting is not set, pomodoro notifications will default to the "
"timer voice channel itself."
)
_notset_str = _p(
'guildset:pomodoro_channel|formatted|notset',
"Not Set (Will use timer voice channel.)"
)
_accepts = _p(
'guildset:pomodoro_channel|accepts',
"Timer notification channel name or id."
)
_model = CoreData.Guild
_column = CoreData.Guild.pomodoro_channel.name
@@ -45,3 +55,12 @@ class TimerSettings(SettingGroup):
"Pomodoro timer notifications will now default to their voice channel."
))
return resp
@property
def set_str(self) -> str:
cmdstr = super().set_str
t = ctx_translator.get().t
return t(_p(
'guildset:pomdoro_channel|set_using',
"{cmd} or channel selector below."
)).format(cmd=cmdstr)

View File

@@ -78,7 +78,7 @@ class TimerConfigUI(ConfigUI):
class TimerDashboard(DashboardSection):
section_name = _p(
'dash:pomodoro|title',
"Pomodoro Configuration"
"Pomodoro Configuration ({commands[configure pomodoro]})"
)
configui = TimerConfigUI
setting_classes = TimerConfigUI.setting_classes