mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
The logging module is no longer required to get diagnostic output since we use `stderr` by default regardless of the logging module. Which means that the logging module will only give a more verbose output than is necessary. Client.is_logged_in checking is no longer necessary since all HTTP request handling now raise an exception if they fail so those chunks are also gone.
25 lines
606 B
Python
25 lines
606 B
Python
import discord
|
|
import time
|
|
|
|
client = discord.Client()
|
|
client.login('email', 'password')
|
|
|
|
@client.event
|
|
def on_ready():
|
|
print('Connected!')
|
|
print('Username: ' + client.user.name)
|
|
print('ID: ' + client.user.id)
|
|
|
|
@client.event
|
|
def on_message(message):
|
|
if message.content.startswith('!editme'):
|
|
msg = client.send_message(message.author, '10')
|
|
time.sleep(3)
|
|
client.edit_message(msg, '40')
|
|
|
|
@client.event
|
|
def on_message_edit(before, after):
|
|
client.send_message(after.channel, '**{}** edited their message:\n{}'.format(after.author.name, before.content))
|
|
|
|
client.run()
|