Add status text.

This commit is contained in:
2025-07-28 14:05:51 +10:00
parent 34d1af1144
commit 122dcfca3e

View File

@@ -136,6 +136,7 @@ class SubathonComponent(cmds.Component):
sender=self.bot.bot_id
)
# TODO: Websocket update
await self.goalcheck()
# Check goals
@cmds.Component.listener()
@@ -175,6 +176,7 @@ class SubathonComponent(cmds.Component):
)
# TODO: Websocket update
# Check goals
await self.goalcheck()
@cmds.Component.listener()
async def event_safe_subscription_gift(self, payload):
@@ -209,6 +211,7 @@ class SubathonComponent(cmds.Component):
)
# TODO: Websocket update
# Check goals
await self.goalcheck()
# end stream => Automatically pause the timer
@cmds.Component.listener()
@@ -229,7 +232,27 @@ class SubathonComponent(cmds.Component):
@cmds.group(name='subathon', invoke_fallback=True)
async def group_subathon(self, ctx: cmds.Context):
# TODO: Status
...
community = await self.bot.community_fetch(twitchid=ctx.broadcaster.id, name=ctx.broadcaster.name)
cid = community.communityid
if (active := await self.get_active_subathon(cid)) is not None:
score = await active.get_score()
goals = await active.get_goals()
total_goals = len(goals)
donegoals = len([goal for goal in goals if score >= goal.required_score])
goalstr = f"{donegoals}/{total_goals} achieved!"
secs = await active.get_remaining()
remaining = strfdelta(timedelta(seconds=secs))
secs = active.get_duration()
duration = strfdelta(timedelta(seconds=secs))
text = (
f"Subathon running for {duration}! {score} (equivalent) subscriptions recieved, and {remaining} left on the timer"
)
await ctx.reply(text)
else:
await ctx.reply("No active subathon running!")
# subathon start
@group_subathon.command(name='setup')