Skip to content

Commit c2ff703

Browse files
committed
Update linked message edit to use new format
1 parent 697152b commit c2ff703

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bot.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,19 @@ async def on_message_delete(self, message):
252252
async for msg in channel.history():
253253
if msg.embeds and msg.embeds[0].author:
254254
url = msg.embeds[0].author.url
255-
if message_id == re.findall(r'\d+', url):
255+
if message_id == re.findall(r'\d+', url)[0]:
256256
return await msg.delete()
257257

258258
async def on_message_edit(self, before, after):
259259
if before.author.bot:
260260
return
261261
if isinstance(before.channel, discord.DMChannel):
262-
channel = await self.find_or_create_thread(before.author)
263-
async for msg in channel.history():
262+
thread = await self.threads.find(recipient=before.author)
263+
async for msg in thread.channel.history():
264264
if msg.embeds:
265265
embed = msg.embeds[0]
266-
if f'User - {before.id}' in embed.footer.text:
266+
matches = re.findall(r'\d+', str(embed.author.url))
267+
if matches and int(matches[0]) == before.id:
267268
if ' - (Edited)' not in embed.footer.text:
268269
embed.set_footer(text=embed.footer.text + ' - (Edited)')
269270
embed.description = after.content

0 commit comments

Comments
 (0)