Update example code.

This commit is contained in:
Rapptz
2015-12-06 03:05:50 -05:00
parent a91dad53a8
commit e87d54dd12
5 changed files with 32 additions and 33 deletions

View File

@ -1,22 +1,22 @@
import discord
client = discord.Client()
client.login('email', 'password')
@client.event
@client.async_event
def on_message(message):
# we do not want the bot to reply to itself
if message.author == client.user:
return
if message.content.startswith('!hello'):
client.send_message(message.channel, 'Hello {}!'.format(message.author.mention()))
msg = 'Hello {}!'.format(message.author.mention()
yield from client.send_message(message.channel, msg))
@client.event
@client.async_event
def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
client.run()
client.run('email', 'password')