1@commands.guild_only()
2# Command cannot be used in private messages.
3
4@commands.is_owner()
5# Command can only be used by the bot owner.
6
7@commands.is_nsfw()
8# Command can only be used in NSFW channels
9
10@commands.has_role("name")
11# Check if member has a role with the name "name"
12
13@commands.bot_has_role(11132312313213)
14# As above, but for the bot itself. (name can be replaced with id)
15
16@commands.has_any_role(["role1","foo",11132312313213])
17# Check if user has any of the roles with the names "role1", "foo", or the role with id 11132312313213
18
19@commands.bot_has_any_role(*roles)
20# As above, but for the bot itself
21
22@commands.has_permissions([ban_members=True, kick_members=True])
23# Check if user has all of the passed permissions
24# e.g. this command will require both kick and ban permissions
25
26@commands.bot_has_permissions(**perms)
27# As above, but for the bot itself.
28
29@commands.has_guild_permissions(**perms)
30@commands.bot_has_guild_permissions(**perms)
31# As for the two above, but for guild permissions rather than channel permissions.
32
33@commands.check(myfunction)
34# Check against your own function that returns those able to use your command
35
36@commands.check_any(*myfunctions)
37# Command will be ran if the conditions of any of your own check functions are met
38
39from discord.ext.commands.cooldowns import BucketType
40# BucketType can be BucketType.default, member, user, guild, role, or channel
41@commands.cooldown(rate,per,BucketType)
42# Limit how often a command can be used, (num per, seconds, BucketType)
43
44@commands.max_concurrency(number, per=BucketType.default, *, wait=False)
45# Limit how many instances of the command can be running at the same time.
46# Setting wait=True will queue up additional commands. False will raise MaxConcurrencyReached
47
48# Checks can be stacked, and will Raise a CheckFailure if any check fails.