mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 09:26:10 +00:00
Update example code.
This commit is contained in:
@ -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')
|
||||
|
Reference in New Issue
Block a user