Python/Discord:仅阻止某些人访问命令

Python/Discord:仅阻止某些人访问命令,python,discord,discord.py,Python,Discord,Discord.py,我正在为discord RPG设置一个角色创建者,并且我已经编写了一些代码,如果有人已经在启动角色创建者,则会阻止其启动: if message.content == "MMO start": if not currentcreator == 0: await message.channel.send("Someone is already making a profile so please wait") currentc

我正在为discord RPG设置一个角色创建者,并且我已经编写了一些代码,如果有人已经在启动角色创建者,则会阻止其启动:

if message.content == "MMO start":
    if not currentcreator == 0:
        await message.channel.send("Someone is already making a profile so please wait")
    currentcreator = message.author
但是,如果第二个人不取消第一个人,我想不出如何阻止第二个人继续进行?

尝试使用以下方法:

character_creating = False

@bot.event
async def on_message(message):
    if message.content == "MMO start":
        if character_creating:
            await message.channel.send("Someone is already making a profile so please wait")
            return
        character_crearing = True
        

        #then do the character creating code here and at last do
        character_creating = False
尝试使用以下方法:

character_creating = False

@bot.event
async def on_message(message):
    if message.content == "MMO start":
        if character_creating:
            await message.channel.send("Someone is already making a profile so please wait")
            return
        character_crearing = True
        

        #then do the character creating code here and at last do
        character_creating = False

尝试使用布尔值来检查是否正在使用它,或者甚至维护所有函数调用的日志(在存储的某个时间后删除),我可以了解更多关于此操作的详细信息吗?尝试使用布尔值来检查是否正在使用它,或者甚至维护所有函数调用的日志(经过一定时间的存储后删除)我可以再详细了解一下吗?