1
0
mirror of https://github.com/Rapptz/discord.py.git synced 2025-09-19 14:38:43 +00:00
Files
.github
discord
docs
examples
background_task.py
basic_bot.py
basic_voice.py
deleted.py
edits.py
guessing_game.py
new_member.py
reply.py
.gitignore
.readthedocs.yml
LICENSE
MANIFEST.in
README.ja.rst
README.rst
requirements.txt
setup.py
discord.py/examples/deleted.py
2017-01-03 20:58:11 -05:00

22 lines
698 B
Python

import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Connected!')
print('Username: {0.name}\nID: {0.id}'.format(self.user))
async def on_message(self, message):
if message.content.startswith('!deleteme'):
msg = await message.channel.send('I will delete myself now...')
await msg.delete()
# this also works
await message.channel.send('Goodbye in 3 seconds...', delete_after=3.0)
async def on_message_delete(self, message):
fmt = '{0.author} has deleted the message: {0.content}'
await message.channel.send(fmt.format(message))
client = MyClient()
client.run('token')