mirror of
https://github.com/brandons209/Red-bot-Cogs.git
synced 2024-04-27 00:52:24 +12:00
fix timeout error when bot boots and loading this cog
This commit is contained in:
parent
6df616443f
commit
35ead5152c
|
@ -3,7 +3,6 @@ from .activitylog import ActivityLogger
|
|||
__red_end_user_data_statement__ = "Depending on setup, can log user messages, voice channel activity, audit actions in guilds, activity statistics per guild, user name changes, and any moderation actions per guild."
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
def setup(bot):
|
||||
n = ActivityLogger(bot)
|
||||
await n.initialize()
|
||||
bot.add_cog(n)
|
||||
|
|
|
@ -89,6 +89,7 @@ class ActivityLogger(commands.Cog):
|
|||
|
||||
# remove userinfo since we are replacing it
|
||||
self.bot.remove_command("userinfo")
|
||||
self.load_task = asyncio.create_task(self.initialize())
|
||||
|
||||
def cog_unload(self):
|
||||
self.lock = True
|
||||
|
@ -96,6 +97,9 @@ class ActivityLogger(commands.Cog):
|
|||
for h in self.handles.values():
|
||||
h.close()
|
||||
|
||||
if self.load_task:
|
||||
self.load_task.cancel()
|
||||
|
||||
async def initialize(self):
|
||||
await self.bot.wait_until_ready()
|
||||
|
||||
|
|
Loading…
Reference in a new issue