35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
|
from discord.ext import commands
|
||
|
from discord.ext.commands import Context
|
||
|
|
||
|
from helpers import checks
|
||
|
|
||
|
|
||
|
# Here we name the cog and create a new class for the cog.
|
||
|
class Template(commands.Cog, name="template"):
|
||
|
def __init__(self, bot):
|
||
|
self.bot = bot
|
||
|
|
||
|
# Here you can just add your own commands, you'll always need to provide "self" as first parameter.
|
||
|
|
||
|
@commands.hybrid_command(
|
||
|
name="testcommand",
|
||
|
description="This is a testing command that does nothing.",
|
||
|
)
|
||
|
# This will only allow non-blacklisted members to execute the command
|
||
|
@checks.not_blacklisted()
|
||
|
# This will only allow owners of the bot to execute the command -> config.json
|
||
|
@checks.is_owner()
|
||
|
async def testcommand(self, context: Context):
|
||
|
"""
|
||
|
This is a testing command that does nothing.
|
||
|
:param context: The application command context.
|
||
|
"""
|
||
|
# Do your stuff here
|
||
|
|
||
|
# Don't forget to remove "pass", I added this just because there's no content in the method.
|
||
|
pass
|
||
|
|
||
|
|
||
|
# And then we finally add the cog to the bot so that it can load, unload, reload and use it's content.
|
||
|
async def setup(bot):
|
||
|
await bot.add_cog(Template(bot))
|