discord.py

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged on as', self.user)

    async def on_message(self, message):
        # don't respond to ourselves
        if message.author == self.user:
            return

        if message.content == 'ping':
            await message.channel.send('pong')

client = MyClient()
client.run('token')

Here is what the above code is Doing:
1. Create a subclass of Client and override its handler methods.
2. Create an instance of the subclass and run the bot.

The on_ready() event is triggered when the bot starts up and is logged in.
The on_message() event is triggered whenever a message is sent in any channel that the bot has access to.

The message.author property contains the User object that represents the person who sent the message.
The message.content property contains the content of the message as a string.

The await keyword is used to wait for an asynchronous operation to complete.
In this case, it waits for the send() operation to complete before moving on to the next line of code.

The Client.run() method starts the bot and connects it to Discord.
The only required parameter is the bot’s token, which is passed as a string.