Skip to main content

A simplistic decorator based approach to rate limiting function calls.

Project description

Function Cooldowns

A simplistic take on functional cooldowns.

pip install function-cooldowns


Example usage

A simplistic example, read more on the docs!

import cooldowns

...

@bot.slash_command(
    description="Ping command",
)
@cooldowns.cooldown(1, 15, bucket=cooldowns.SlashBucket.author)
async def ping(interaction: nextcord.Interaction):
    await interaction.response.send_message("Pong!")

Find more examples here.

For documentation, please see here.

This implements the leaky bucket algorithm


Support

Want realtime help? Join the discord here.


Funding

Want a feature added quickly? Want me to help build your software using this?

Sponsor me here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

function_cooldowns-2.2.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

function_cooldowns-2.2.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file function_cooldowns-2.2.0.tar.gz.

File metadata

  • Download URL: function_cooldowns-2.2.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-58-generic

File hashes

Hashes for function_cooldowns-2.2.0.tar.gz
Algorithm Hash digest
SHA256 b9c9ed1dc4e4b5f4b0c90bf945f521db98622148cba69aa6f6ff1bb707ca703d
MD5 5e77cb55980ff2cb34f1257a5f6b6cb1
BLAKE2b-256 58e5560bc1c01087b152511fc31ea6945dcdc9b9077573614edd60d0ad42ccef

See more details on using hashes here.

File details

Details for the file function_cooldowns-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: function_cooldowns-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-58-generic

File hashes

Hashes for function_cooldowns-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91cabb1051c76748f7970bf7b979e17a89f2f8fdf505bc2b45f62d7d277debcc
MD5 67e79da8d2f987999b679df0801662f3
BLAKE2b-256 0e4a644242c934306c234e44fdf26bd2c8096da9b92ed3813658717738908305

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page