(timer): Channel template changes.

This commit is contained in:
2022-01-11 17:51:21 +02:00
parent 4cd4fab68f
commit 271ecfffa4
2 changed files with 7 additions and 7 deletions

View File

@@ -129,13 +129,13 @@ class Timer:
Current name for the voice channel
"""
stage = self.current_stage
name_format = self.data.channel_name or "{remaining} -- {name}"
name_format = self.data.channel_name or "{remaining} {stage} -- {name}"
return name_format.replace(
'{remaining}', "{}m left".format(
'{remaining}', "{}m".format(
int(5 * math.ceil((stage.end - utc_now()).total_seconds() / 300)),
)
).replace(
'{stage}', stage.name
'{stage}', stage.name.lower()
).replace(
'{members}', str(len(self.channel.members))
).replace(

View File

@@ -143,19 +143,19 @@ async def cmd_pomodoro(ctx, flags):
--threshold: How many focus+break cycles before a member is kicked.
--text: Text channel to send timer alerts in (defaults to value of `{prefix}config pomodoro_channel`).
Channel name substitutions::
{{remaining}}: The time left in the current focus or break session, e.g. `10m left`.
{{stage}}: The name of the current stage (`FOCUS` or `BREAK`).
{{remaining}}: The time left in the current focus or break session, e.g. `10m`.
{{stage}}: The name of the current stage (`focus` or `break`).
{{name}}: The configured timer name.
{{pattern}}: The timer pattern in the form `focus/break` (e.g. `50/10`).
Examples:
Add a timer to your study room with `50` minutes focus, `10` minutes break.
> `{prefix}pomodoro 50, 10`
Add a timer with a custom updating channel name
> `{prefix}pomodoro 50, 10 {{stage}} {{remaining}} -- {{pattern}} room`
> `{prefix}pomodoro 50, 10 {{remaining}} {{stage}} -- {{pattern}} room`
Change the name on the `{prefix}timer` status
> `{prefix}pomodoro --name 50/10 study room`
Change the updating channel name
> `{prefix}pomodoro --channelname {{remaining}} -- {{name}}`
> `{prefix}pomodoro --channelname {{remaining}} left -- {{name}}`
"""
await _pomo_admin(ctx, flags)