Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending message with embed triggers on_message_edit #2476

Closed
3 tasks done
slysherz opened this issue Dec 13, 2019 · 5 comments
Closed
3 tasks done

Sending message with embed triggers on_message_edit #2476

slysherz opened this issue Dec 13, 2019 · 5 comments
Labels
question This is a question about the library

Comments

@slysherz
Copy link

Summary

When the bot sends a message with an embed, it triggers on_message_edit.
If the message with the embed is sent by a user instead, it works correctly and on_message_edit doesn't trigger.

Reproduction Steps

1 - Run the bot

import discord

token = "???"
client = discord.Client()

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    embed = discord.Embed()

    await message.channel.send(embed=embed)

@client.event
async def on_message_edit(before, after):
    print("message update!")

@client.event
async def on_ready():
    print("ready")

client.run(token)

2 - Send any message to the bot

Expected Results

on_message_edit should not trigger and message update! should not be printed.

Actual Results

ready
message update!

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

System Information

Windows:

  • Python v3.8.0-final
  • discord.py v1.2.5-final
  • aiohttp v3.5.4
  • websockets v6.0
  • system info: Windows 10 10.0.18362

Linux

@Zomatree
Copy link
Contributor

this is a intentional thing by discord

@slysherz
Copy link
Author

Oh, okay. Do you know the reason for it, or do you have a link with more information?

@Zomatree
Copy link
Contributor

it happens because that's how discord does embeds

@Rapptz Rapptz added the question This is a question about the library label Dec 14, 2019
@Rapptz
Copy link
Owner

Rapptz commented Dec 14, 2019

Discord fires what's called an "embed-only edit" to update the embeds in the message of the links you posted in the chat. It's best to check the delta for things you care about, e.g. if before.content != after.content or something along those lines.

@Rapptz Rapptz closed this as completed Dec 14, 2019
@slysherz
Copy link
Author

Okay, I see. Thanks for your help guys : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question about the library
Projects
None yet
Development

No branches or pull requests

3 participants