Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.53k stars 3.74k forks source link

INFO: Unhandled event MESSAGE_ACK #1851

Closed Jack-Development closed 5 years ago

Jack-Development commented 5 years ago

I'm trying to use a bot that produces a prespecified message, but only when it receives a message with a specific 'title' on it, however it isn't being produced when I attempt to search for it.

Code: async def on_message(message): if len(message.embeds) != 0 and message.embeds[0]['title'] == 'TITLE_TEXT': print(message.content) print(message.embeds) await client.send_message(message.channel, MESSAGE)

Harmon758 commented 5 years ago

I'm not sure how the title of the issue is relevant. Message ACK refers to marking a message as read for Discord's API. Bots can't use the endpoint that does this, and I don't think they can receive this event. Is this occurring on a self-bot?

As for your described issue, I'm unable to reproduce this. I'm able to check a message's embeds for a specific title and send a message successfully when it's found. Is MESSAGE defined? Are you getting any errors? Can you give a reproducible example of the embed you're trying to do this with and the code you're using? Specifically, are you sure that 'TITLE_TEXT' matches the embed title and that the embed isn't using the author name field instead?

For code block usage, see https://help.github.com/articles/creating-and-highlighting-code-blocks/.

Jack-Development commented 5 years ago

I was very confused, but I have now done debugging with the code since the post was made and the error is still prevalent, however the bot is not working with this proceeding it:

if len(message.embeds) != 0:
    print(message.embeds[0]['title'])

I have no idea why, but this has made the bot work now, but some errors still popup.

Harmon758 commented 5 years ago

What's the error you're referring to? The Message ACK event? As I said, bot accounts shouldn't be receiving this event. Are you using a self-bot? If that's not what you're referring to, can you provide the full traceback of the errors?

Jack-Development commented 5 years ago

The following error I'm receiving are:

INFO:discord.gateway:Unhandled event SESSIONS_REPLACE INFO:discord.gateway:Unhandled event GUILD_INTEGRATIONS_UPDATE INFO:discord.gateway:Unhandled event MESSAGE_ACK

These aren't appearing very often, or at least as much as they were.

I am running the bot on my own account (I assume that's what you mean by a self-bot?)

numbermaniac commented 5 years ago

Those lines begin with INFO - they are information, not errors. And yes, running it on your own account is called a selfbot. You don't have any errors.

Harmon758 commented 5 years ago

Yes, self-bots on user accounts are forbidden now. You should create a bot account instead.

These aren't errors. They are simply logging messages informing about events that discord.py doesn't handle. SESSIONS_REPLACE is an undocumented event that can be safely ignored. GUILD_INTEGRATIONS_UPDATE happens when servers update their integrations. As previously stated, MESSAGE_ACK is when messages are marked as read and shouldn't be received by bots.

For future questions like this, you should join either the official discord.py server or the Discord API server for help, as the README recommends.

Jack-Development commented 5 years ago

Alright, I will make a bot account now, thank you.