Skip to content

Commit

Permalink
Add routine stop
Browse files Browse the repository at this point in the history
  • Loading branch information
boxfrommars committed Jun 15, 2024
1 parent 76c800a commit c17a5e9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ async def tit(
user.name, title_record['title'])
await ctx.send(self.title_manager.format_title_info(title_record))

async def close(self):
"""
Close database connection before bot shutdown
"""
await self.title_manager.close()
await super().close()

async def announce(self, broadcaster: PartialUser, content: str):
"""Send announcement to the broadcaster channel"""
logger.info('[announce] %s', content)
Expand All @@ -173,6 +166,14 @@ def is_reward_message(self, message: Message) -> bool:
return message.tags \
and message.tags.get('custom-reward-id') == self.title_reward_id

async def close(self):
"""
Close database connection before bot shutdown
"""
await self.title_manager.close()
self.advertise.cancel() # pylint: disable=no-member
await super().close()


if __name__ == '__main__':
load_dotenv()
Expand Down

0 comments on commit c17a5e9

Please sign in to comment.