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

403 Missing Permissions trying to delete bot messages #487

Open
1 of 4 tasks
TomArrow opened this issue Apr 5, 2023 · 4 comments
Open
1 of 4 tasks

403 Missing Permissions trying to delete bot messages #487

TomArrow opened this issue Apr 5, 2023 · 4 comments

Comments

@TomArrow
Copy link

TomArrow commented Apr 5, 2023

Undiscord Version

5.2.1

Browser

Firefox

Extension

TamperMonkey

Reproduction steps

There's a bot on the server that has commands you can run.

Those commands result in messages that aren't MY messages but they are the bot's message, but I am the "initiator" so to speak.

Undiscord is trying to delete those. I do not have the permission to delete them, as they aren't posted by me but by the bot.

Any way to fix that?

Actual results

Repeatedly tries to delete the message and keeps getting 403. Feels uncomfortable man.

Expected results

Do not try to delete bot messages that aren't my own. Or provide an option for this.

Bug affects

  • DMs
  • DMs (group)
  • Channels
  • Channel (NSFW)

Additional information & file uploads

Not sure what I'm expected to put here.

@TomArrow
Copy link
Author

TomArrow commented Apr 6, 2023

Looks like it can be fixed by adding a filter that checks msg.author.id==options.authorId.

Another thing I noticed is that messagetype 21 can't be deleted according to discord docs but the filter in undiscord is <=21, so including it and throwing errors, not sure why. They seem to be thread starter messages and discord docs list them as not deletable. Though in my case the error I got was "system message can't be deleted". Perhaps the deletion succeeded but it stayed up as a "system message" with empty content which then couldn't be further deleted. In discord itself it shows it as "couldn't fetch this message" or sth like that. I wonder if the empty content is how it gets detected. No idea.

@glassglue
Copy link

I handled this in a less space-friendly method (matching message ID to a set, skipping fetches if they previously failed), but I really like your solution to this!

As it stands, I think this is fixed on my fork if anyone runs into it again (although it sounds like you figured out the problem already 💯)

@coalraider
Copy link

Looks like it can be fixed by adding a filter that checks msg.author.id==options.authorId.

Another thing I noticed is that messagetype 21 can't be deleted according to discord docs but the filter in undiscord is <=21, so including it and throwing errors, not sure why. They seem to be thread starter messages and discord docs list them as not deletable. Though in my case the error I got was "system message can't be deleted". Perhaps the deletion succeeded but it stayed up as a "system message" with empty content which then couldn't be further deleted. In discord itself it shows it as "couldn't fetch this message" or sth like that. I wonder if the empty content is how it gets detected. No idea.

sorry im a noob to all this. how do i go about adding a filter?

@false-fox
Copy link

Fixed in #629 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants