Python 如何确保每个公会都有自己运行的类/命令实例?不和谐

Python 如何确保每个公会都有自己运行的类/命令实例?不和谐,python,Python,这是我的齿轮 class AmongUs(commands.Cog): def __init__(self, bot): self.bot = bot self.guilds_ids = {} async def start(self, ctx): self.guild = ctx.guild.id self.msg = await ctx.send(f'Starting new instance with Gam

这是我的齿轮

class AmongUs(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.guilds_ids = {}

    async def start(self, ctx):
        self.guild = ctx.guild.id
        self.msg = await ctx.send(f'Starting new instance with Game ID: {self.gameID} - {self.guild} - {self.guilds_ids}')

        await self.msg.add_reaction('\U00002705')
        def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == '\U00002705'
        self.result = await self.bot.wait_for('reaction_add', check=check)
        if self.result[0].emoji == '\U00002705':
            await self.msg.delete()
            del self.guilds_ids[self.guild]

    @commands.command()
    async def amongus(self, ctx, *, gameID='No Code Provided'):
        self.gameID = gameID
        if ctx.guild.id in self.guilds_ids:
            await ctx.send('Game already in progress.')
            return
        else:
            self.guilds_ids[ctx.guild.id] = AmongUs(self.bot)
            await self.start(ctx)
我可以向每个行会发送
msg
,并提供其独特的详细信息,但当我按下表情按钮时,问题就出现了。它不是停止在特定公会上运行的实例,而是在所有时间段内停止它。我使用
del
方法有什么错

我已经坚持了几天,甚至在没有库的情况下编写了一些代码来进一步理解类和实例,但是库的行为有点不同。我觉得如果我能够理解这一点,我最终能够创建一个适用于多个公会的机器人