PythonistaGuild / TwitchIO

An Async Bot/API wrapper for Twitch made in Python.
https://twitchio.dev
MIT License
802 stars 163 forks source link

Support multiple cooldowns #470

Open bartmoorman opened 2 months ago

bartmoorman commented 2 months ago

Description

This adds support for multiple cooldowns for a given command. It also adds support for turbo, vip, and broadcaster buckets. It checks each cooldown individually and if any of the cooldowns have expired, the command is invoked. If none of the cooldowns have expired, it raises a CommandOnCooldown exception using the time of the cooldown which will expire first.

Checklist

chillymosh commented 2 months ago

Before I review the code, which honestly most likely won't get merged soon as we're pushing ahead with 3.x in the very near future.

You ticked that this fixes an issue, which issue does it fix? As it looks purely like new features based on the description.

You also ticked it contains breaking changes, we don't make or merge breaking changes for a same major version.

bartmoorman commented 2 months ago

Issue fixed: it looks like multiple cooldowns were implemented but did not work as expected. Before this PR, it is possible to have multiple cooldowns for a command, but doing so raises an error when the command is invoked.

Something new: support for turbo, vip, and broadcaster buckets.

Breaking changes: this does rename some of the methods within Cooldown class. This could possibly break if anyone is using cooldowns outside of supported means. If cooldowns are being used as documented and advertised, there should not be any breaking changes.