Skip to content

Commit a7f468b

Browse files
authored
Merge pull request #221 from Vioshim/master
Fix Discord.py 2.0's CooldownMapping
2 parents 9e2ffb9 + 6827d09 commit a7f468b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

discord_slash/model.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from inspect import iscoroutinefunction
66

77
import discord
8-
from discord.ext.commands import CommandOnCooldown, CooldownMapping
8+
from discord.ext.commands import BucketType, CommandOnCooldown, CooldownMapping
99

1010
from . import error, http
1111
from .dpy_overrides import ComponentMessage
@@ -138,7 +138,10 @@ def __init__(self, func):
138138
cooldown = None
139139
if hasattr(self.func, "__commands_cooldown__"):
140140
cooldown = self.func.__commands_cooldown__
141-
self._buckets = CooldownMapping(cooldown)
141+
try:
142+
self._buckets = CooldownMapping(cooldown)
143+
except TypeError:
144+
self._buckets = CooldownMapping(cooldown, BucketType.default)
142145

143146
self._max_concurrency = None
144147
if hasattr(self.func, "__commands_max_concurrency__"):

0 commit comments

Comments
 (0)