[commands] Ensure cooldowns are properly copied.

This commit is contained in:
Rapptz 2019-06-12 23:40:43 -04:00
parent dfcf9cdb0a
commit 671a19a24a

View File

@ -290,7 +290,7 @@ class Command(_BaseCommand):
other._after_invoke = self._after_invoke other._after_invoke = self._after_invoke
if self.checks != other.checks: if self.checks != other.checks:
other.checks = self.checks.copy() other.checks = self.checks.copy()
if self._buckets != other._buckets: if self._buckets.valid and not other._buckets.valid:
other._buckets = self._buckets.copy() other._buckets = self._buckets.copy()
try: try:
other.on_error = self.on_error other.on_error = self.on_error
@ -305,8 +305,9 @@ class Command(_BaseCommand):
def _update_copy(self, kwargs): def _update_copy(self, kwargs):
if kwargs: if kwargs:
copy = self.__class__(self.callback, **kwargs) kw = kwargs.copy()
copy.update(**self.__original_kwargs__) kw.update(self.__original_kwargs__)
copy = self.__class__(self.callback, **kw)
return self._ensure_assignment_on_copy(copy) return self._ensure_assignment_on_copy(copy)
else: else:
return self.copy() return self.copy()