1
0
Fork 0
mirror of https://github.com/uhIgnacio/EmoteManager.git synced 2024-08-15 02:23:13 +00:00

stats: fix reloading the cog (discord token is popped after launch)

This commit is contained in:
io mintz 2020-06-03 21:21:41 +00:00
parent e284b9ee62
commit 8739902754
2 changed files with 5 additions and 4 deletions

View file

@ -23,10 +23,7 @@ class Stats(BotBinStats):
super().__init__(bot)
seq = [0] * self.bot.shard_count if self.is_opener() else None
# Use our user ID as part of the shm name to allow running multiple instances of the bot on the same machine.
# on_ready() hasn't run yet, so we don't have self.bot.user.
token = self.bot.config['tokens']['discord']
user_id = token.partition('.')[0]
self.shlist = ShareableList(seq, name=f'emote-manager-{user_id}')
self.shlist = ShareableList(seq, name=f'emote-manager-{self.bot.user_id}')
def is_opener(self):
"""return whether this is the process that should open the shared memory"""