timeouts module¶
Provides a way to limit how often a user’s command is acknowledged by the bot. The username is used as a key in the dictionary and the value is the time when that user is allowed to do another command. The set time is created by getting the current time and adding the delay to it.
-
class
timeouts.
Timeouts
¶ Bases:
object
-
user_can_message
(username: str, sec_delay, set_time=True) → bool¶ Return if a user can send a command to the bot. Check if the current time is greater than the stored time plus message delay to determine if the user can command.
Parameters: - sec_delay –
- username –
Returns: True or false
-