下面的代碼為命令添加了一個冷卻時間,但是當(dāng)bot重新啟動時,冷卻時間將重置。那么,如何使機(jī)器人記起以前的用法呢?如果冷卻時間限制是每天5次,并且該成員使用了3次,并且bot重新啟動,則應(yīng)該從為所有成員保留的位置開始。import discordfrom discord.ext import commandsimport randomfrom utils import Botfrom utils import CommandWithCooldownclass Members(): def __init__(self, bot): self.bot = bot @commands.command(pass_context=True, cls=CommandWithCooldown) @commands.cooldown(1, 600, commands.BucketType.user) async def ping(self, ctx): msg = "Pong {0.author.mention}".format(ctx.message) await self.bot.say(msg)def setup(bot): bot.add_cog(Members(bot))
如何保存命令冷卻時間?
慕田峪9158850
2021-04-09 14:15:53