discord.py 中 on_message 的冷却时间
问题描述
我已经制作了一个练级系统,但我不知道在on_message
中制作一个冷却我想添加一个 BucketType.member
冷却时间,并且因为我使用 MondoDB 作为数据库,所以我无法存储他们最后一次发送消息的时间,而是我正在寻找 on_message 的冷却时间
的作用类似于命令冷却,因此它可以自动执行任何操作
这是目前的代码
I have made a Leveling system but i can't figure out to make a cooldown in on_message
i want to add a BucketType.member
cooldown and as im using MondoDB for database so i can't afford to store the last time they send message instead im looking for a cooldown for on_message
which works similar to commands cooldown so it can automatically take any action
This is the code so far
推荐答案
您应该使用 CooldownMapping.from_cooldown
为 on_message
事件添加冷却时间,例如:
You should use CooldownMapping.from_cooldown
to add cooldowns to the on_message
event, example:
这篇关于discord.py 中 on_message 的冷却时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!