python discord library code example
Example 1: how to import discord in python
py -3 -m pip install -U discord.py
Example 2: python discord
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')
Example 3: import discord python
import discord