write a discord bot python code example
Example 1: bot discord python
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="!", description="The description")
@bot.event
async def on_ready():
print("Ready !")
@bot.command()
async def ping(ctx):
await ctx.send('**pong**')
bot.run("enter the token here between the quotes")
Example 2: how to import discord in python
py -3 -m pip install -U discord.py
Example 3: discord bot python
import discord.py
client = discord.Client()
@client.event
async def on_ready():
print("Logged in as {0.user}".format(client)
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == '.hello':
print("Hello there!!")
client.run('here put your token')