blob: 690460ce3e2a1eee79b67175ecea397c3505b0ce (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Connected!')
print(f'Username: {self.user.name}\nID: {self.user.id}')
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):
msg = f'{message.author} has deleted the message: {message.content}'
await message.channel.send(msg)
client = MyClient()
client.run('token')
|