Search code examples
pythondiscordbots

Discord.py bot: Filter commands for specific user


does anyone know, how I can give only one specific user acces to a command?


Solution

  • I would do something like this:

    @bot.command()
    async def commandname(ctx):
    if ctx.author.id == 'usersID': 
       # do something 
    else: 
      await ctx.send(f"Sorry you can't do that.")