You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
698 B

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')