how to make a help command in discord.py code example
Example 1: how to make a cog discord.py
from discord.ext import commands
class Test_Cog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('Bot is ready!.')
@commands.command()
async def ping(self, ctx):
await ctx.send(f'Pong! {round(self.bot.latency * 1000)}')
def setup(bot):
bot.add_cog(Test_Cog(bot))
Example 2: how to let only admins do a command in discord.py
@commands.has_permissions(administrator=True)
@client.command()
async def admins_only_command(ctx, *, args):