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.
23 lines
596 B
Python
23 lines
596 B
Python
import discord
|
|
|
|
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('!deleteme'):
|
|
msg = client.send_message(message.channel, 'I will delete myself now...')
|
|
client.delete_message(msg)
|
|
|
|
@client.event
|
|
def on_message_delete(message):
|
|
client.send_message(message.channel, '{} has deleted the message:\n{}'.format(message.author.name, message.content))
|
|
|
|
client.run()
|