What are the differences between Bot and Client?

Tl;dr

Just use commands.Bot.


Bot is an extended version of Client (it’s in a subclass relationship). Ie. it’s an extension of Client with commands enabled, thus the name of the subdirectory ext/commands.

The Bot class inherits all the functionalities of Client, which means that everything you can do with Client, Bot can do it too. The most noticeable addition was becoming command-driven (@bot.command()), whereas you would have to manually work with handling events when using Client. A downside of Bot is that you will have to learn the additional functionalities from looking at examples or source codes since the commands extension isn’t much documented. UPD: Now it is documented here.

If you simply want your bots to accept commands and handle them, it would be a lot easier to work with the Bot since all the handling and preprocessing are done for you. But if you’re eager to write your own handles and do crazy stunts with discord.py, then by all means, use the base Client.


In case you’re stumped by which to choose, I recommend you to use commands.Bot since it’s a lot easier to work with and it’s in addition of everything Client can already do. And please remember that you do not need both.

WRONG:

client = discord.Client()
bot = commands.Bot(".")

# do stuff with bot

CORRECT:

bot = commands.Bot(".")

# do stuff with bot

Leave a Comment