fix(ranks): Fix refreshui monitor.
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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():
|
||||||
|
|||||||
Reference in New Issue
Block a user