forked from Pycord-Development/pycord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleted.py
34 lines (22 loc) · 851 Bytes
/
deleted.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import discord
intents = discord.Intents.default()
intents.message_content = (
True # < This may give you `read-only` warning, just ignore it.
)
# This intent requires "Message Content Intent" to be enabled at https://discord.com/developers
bot = discord.Bot(intents=intents)
@bot.event
async def on_ready():
print("Ready!")
@bot.event
async def on_message(message: discord.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)
@bot.event
async def on_message_delete(message: discord.Message):
msg = f"{message.author} has deleted the message: {message.content}"
await message.channel.send(msg)
bot.run("TOKEN")