fix(ranks): Fix refreshui monitor.

This commit is contained in:
2023-09-20 23:44:54 +03:00
parent dd42c82b63
commit 4f39d873de
2 changed files with 5 additions and 1 deletions

View File

@@ -495,6 +495,7 @@ class RankCog(LionCog):
await interaction.response.defer(thinking=False) await interaction.response.defer(thinking=False)
ui = RankRefreshUI(self.bot, guild, callerid=interaction.user.id, timeout=None) ui = RankRefreshUI(self.bot, guild, callerid=interaction.user.id, timeout=None)
await ui.send(interaction.channel) await ui.send(interaction.channel)
ui.start()
# Retrieve fresh rank roles # Retrieve fresh rank roles
ranks = await self.get_guild_ranks(guild.id, refresh=True) ranks = await self.get_guild_ranks(guild.id, refresh=True)

View File

@@ -64,9 +64,12 @@ class RankRefreshUI(MessageUI):
def poke(self): def poke(self):
self._wakeup.set() self._wakeup.set()
def start(self):
self._loop_task = asyncio.create_task(self._refresh_loop(), name='Rank RefreshUI Monitor')
async def run(self, *args, **kwargs): async def run(self, *args, **kwargs):
await super().run(*args, **kwargs) await super().run(*args, **kwargs)
self._loop_task = asyncio.create_task(self._refresh_loop(), name='refresh ui loop') self.start()
async def cleanup(self): async def cleanup(self):
if self._loop_task and not self._loop_task.done(): if self._loop_task and not self._loop_task.done():