JDJG-Holding-Team / Sincroni

A special version of JDBot by me.
MIT License
1 stars 4 forks source link

anti-spam support #9

Open JDJGInc opened 8 months ago

JDJGInc commented 8 months ago
class SomeBot(commands.Bot):
    def __init__(self):
        super().__init__(...) # whatever here
        self.cd_mapping = commands.CooldownMapping.from_cooldown(10, 10, commands.BucketType.member)

    async def on_message(self, message):
        bucket = self.cd_mapping.get_bucket(message)
        retry_after = bucket.update_rate_limit()
        if retry_after:
            # rate limited
        else:
            # not rate limited

        # get_context and friends here or above who knows

https://discordapp.com/channels/336642139381301249/381965515721146390/550512685691830303 I am going to use this to return their messages so that way in global chat it will not appear at all 3 messages = 15 second timeout discord.User I want to have the messages in a row but having 3 messages after a bit and waiting 15 seconds

JDJGInc commented 8 months ago

Basically add anti-spam support.