From e87d54dd12c2a655e6e075abd8e2d03ce3b6d059 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 6 Dec 2015 03:05:50 -0500 Subject: Update example code. --- examples/reply.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/reply.py') diff --git a/examples/reply.py b/examples/reply.py index b106675f..0324797b 100644 --- a/examples/reply.py +++ b/examples/reply.py @@ -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') -- cgit v1.2.3