DEV Community

Cover image for Get started with!
Tejas Kathuria
Tejas Kathuria

Posted on • Updated on

Get started with!

[](url) is a very fantastic API. It helps us in creating Discord bots easily. People have made game bots, RPG bots, Moderation Bots, Economy bots, and even more! Using this guide, you can learn how to use it.


Make sure you have python installed on your computer. You have to install with

pip install
Enter fullscreen mode Exit fullscreen mode

voilà! has been installed!

For making bots you'll need to have a developer account. You can check this guide!

Basics of developing a bot

When starting you have to choose weather to use discord.Client or commands.Bot.

• Is more lightweight than commands.Bot
• Is best if you're not going to be using commands

• Is best if your bot is going to have commands
• Supports easy discord object conversion

In this series we will make a bot with commands.Bot.

We have to start by importing discord and discord.ext.commands

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="$")'YOUR TOKEN HERE')
Enter fullscreen mode Exit fullscreen mode

We initialized a class as an object. We defined this class to the variable bot, which can be named whatever you want. Most people use bot or client.

Now when our bot is defined, we can start with our first command. In we make commands like this:

@bot.command(name='command_name', description="description for help command")
async def command(ctx, other_arguments_here):
   # Tell bot what to do here
Enter fullscreen mode Exit fullscreen mode

Let's make a command which will greet the user with a hello. We'll use for doing this:

@bot.command(name='Hello', description="Greets the sender")
async def hello(ctx):
    await ctx.reply(f"Hello {}!")
# f-string
Enter fullscreen mode Exit fullscreen mode

Now, when we greet the user, it will say Hello USER!

Congrats!! You've just written a bot using! Run the code. When you'll type $hello it should respond!
Image description
Source Code:

Top comments (0)