studio07
studio07

Reputation: 11

discord python kick and ban command

In Discord.py, we have created a command to banish a user. However, the result is output as Nameerror: name'app' is not definded. This is my code.

Do you have any problems with @app.command?

I use client run instead of app run.

@app.command(name="<<kick", pass_context= True)
@commands.has_permissions(administrator=True)
async def _kick(ctx, *, username: discord.Member, reason=None):
    await user_name.kick(reason=reason)
    await ctx.send(str(user_name) + '\n```User was kick!```')```

Upvotes: 0

Views: 83

Answers (2)

Secret Agent
Secret Agent

Reputation: 429

Judging from your comments, you're using a discord.Client instead of a commands.Bot. If you want to use the commands module, you need to use commands.Bot instead.

Upvotes: 1

LoahL
LoahL

Reputation: 2613

If you use client.run you also have to use @client.command(...).

Upvotes: 1

Related Questions