rewrite: New Scheduled Session System.

This commit is contained in:
2023-06-30 11:15:39 +03:00
parent b7d66ffe8c
commit a7c5af59a7
31 changed files with 4588 additions and 44 deletions

View File

@@ -173,6 +173,7 @@ class VoiceSession:
live_video=state.video,
hourly_coins=self.hourly_rate
)
self.bot.dispatch('voice_session_start', self.data)
self.start_task = None
def schedule_expiry(self, expire_time):
@@ -230,7 +231,11 @@ class VoiceSession:
"""
if self.activity is SessionState.ONGOING:
# End the ongoing session
await self.data.close_study_session_at(self.guildid, self.userid, utc_now())
now = utc_now()
await self.data.close_study_session_at(self.guildid, self.userid, now)
# TODO: Something a bit saner/safer.. dispatch the finished session instead?
self.bot.dispatch('voice_session_end', self.data, now)
# Rank update
# TODO: Change to broadcasted event?