forked from Pycord-Development/pycord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedits.py
37 lines (25 loc) · 842 Bytes
/
edits.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
35
36
37
import asyncio
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("!editme"):
msg = await message.channel.send("10")
await asyncio.sleep(3.0)
await msg.edit(content="40")
@bot.event
async def on_message_edit(before: discord.Message, after: discord.Message):
msg = (
f"**{before.author}** edited their message:\n{before.content} ->"
f" {after.content}"
)
await before.channel.send(msg)
bot.run("TOKEN")