(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 Current name for the voice channel
""" """
stage = self.current_stage 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( return name_format.replace(
'{remaining}', "{}m left".format( '{remaining}', "{}m".format(
int(5 * math.ceil((stage.end - utc_now()).total_seconds() / 300)), int(5 * math.ceil((stage.end - utc_now()).total_seconds() / 300)),
) )
).replace( ).replace(
'{stage}', stage.name '{stage}', stage.name.lower()
).replace( ).replace(
'{members}', str(len(self.channel.members)) '{members}', str(len(self.channel.members))
).replace( ).replace(

View File

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