ui(stats): Improve visibility of season start.
This commit is contained in:
@@ -693,7 +693,7 @@ class RankCog(LionCog):
|
||||
await ui.wait()
|
||||
else:
|
||||
await ui.reload()
|
||||
msg = await ui.make_message()
|
||||
msg = await ui.make_message(show_note=False)
|
||||
await ctx.reply(
|
||||
**msg.send_args,
|
||||
ephemeral=True
|
||||
|
||||
@@ -349,7 +349,7 @@ class RankOverviewUI(MessageUI):
|
||||
string = f"{start} msgs"
|
||||
return string
|
||||
|
||||
async def make_message(self) -> MessageArgs:
|
||||
async def make_message(self, show_note=True) -> MessageArgs:
|
||||
t = self.bot.translator.t
|
||||
|
||||
if self.ranks:
|
||||
@@ -380,6 +380,34 @@ class RankOverviewUI(MessageUI):
|
||||
] or [[]]
|
||||
lines = line_blocks[self.pagen]
|
||||
desc = '\n'.join(reversed(lines))
|
||||
|
||||
# Add note about season start
|
||||
note_name = t(_p(
|
||||
'ui:rank_overview|embed|field:note|name',
|
||||
"Note"
|
||||
))
|
||||
season_start = self.lguild.data.season_start
|
||||
if season_start:
|
||||
season_str = t(_p(
|
||||
'ui:rank_overview|embed|field:note|value:with_season',
|
||||
"Ranks are determined by activity since {timestamp}."
|
||||
)).format(
|
||||
timestamp=discord.utils.format_dt(season_start)
|
||||
)
|
||||
else:
|
||||
season_str = t(_p(
|
||||
'ui:rank_overview|embed|field:note|value:without_season',
|
||||
"Ranks are determined by *all-time* statistics.\n"
|
||||
"To reward ranks from a later time (e.g. to have monthly/quarterly/yearly ranks) "
|
||||
"set the `season_start` with {stats_cmd}"
|
||||
)).format(stats_cmd=self.bot.core.mention_cmd('configure statistics'))
|
||||
if self.rank_type is RankType.VOICE:
|
||||
addendum = t(_p(
|
||||
'ui:rank_overview|embed|field:note|value|voice_addendum',
|
||||
"Also note that ranks will only be updated when a member leaves a tracked voice channel! "
|
||||
"Use the **Refresh Member Ranks** button below to update all members manually."
|
||||
))
|
||||
season_str = '\n'.join((season_str, addendum))
|
||||
else:
|
||||
# No ranks, give hints about adding ranks
|
||||
desc = t(_p(
|
||||
@@ -410,6 +438,13 @@ class RankOverviewUI(MessageUI):
|
||||
title=title,
|
||||
description=desc
|
||||
)
|
||||
if show_note:
|
||||
embed.add_field(
|
||||
name=note_name,
|
||||
value=season_str,
|
||||
inline=False
|
||||
)
|
||||
|
||||
return MessageArgs(embed=embed)
|
||||
|
||||
async def refresh_layout(self):
|
||||
|
||||
Reference in New Issue
Block a user