[commands] Minor speed-up for the BucketType.guild case.
None case: 344ns ± 24.4ns -> 49.9ns ± 1.39ns Valid case: 128ns ± 2.76ns -> 42.7ns ± 0.459ns
This commit is contained in:
parent
1bb7b6ff2d
commit
9b4a2dc7cb
@ -108,7 +108,7 @@ class CooldownMapping:
|
|||||||
if bucket_type is BucketType.user:
|
if bucket_type is BucketType.user:
|
||||||
return msg.author.id
|
return msg.author.id
|
||||||
elif bucket_type is BucketType.guild:
|
elif bucket_type is BucketType.guild:
|
||||||
return getattr(msg.guild, 'id', msg.author.id)
|
return (msg.guild or msg.author).id
|
||||||
elif bucket_type is BucketType.channel:
|
elif bucket_type is BucketType.channel:
|
||||||
return msg.channel.id
|
return msg.channel.id
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user