Version 3.1
Changes:
- Added a
@checks.is_owner
check which raises aUserNotOwner
exception - Added a
@checks.not_blacklisted
check which raises aUserBlacklisted
exception - Using checks instead of same code for every command
- Various code cleanup
What's new is mostly the ability to use checks instead of code for checking if, for example, the user trying to execute the command is not an owner.
Before: (Blacklist check, had to be copied on every command)
@cog_ext.cog_slash(
name="ping",
description="Check if the bot is alive.",
)
async def ping(self, context: SlashContext):
with open("blacklist.json") as file:
blacklist = json.load(file)
if context.author.id in blacklist["ids"]:
return
# Rest of the code
Now:
@cog_ext.cog_slash(
name="ping",
description="Check if the bot is alive.",
)
@checks.not_blacklisted() # Here is the difference
async def ping(self, context: SlashContext):
# Rest of the code