undiscord icon indicating copy to clipboard operation
undiscord copied to clipboard

403 Missing Permissions trying to delete bot messages

Open TomArrow opened this issue 1 year ago • 4 comments

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)
  • [X] Channels
  • [ ] Channel (NSFW)

Additional information & file uploads

Not sure what I'm expected to put here.

TomArrow avatar Apr 05 '23 19:04 TomArrow

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.

TomArrow avatar Apr 06 '23 15:04 TomArrow

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 💯)

glassglue avatar Apr 23 '23 22:04 glassglue

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?

coalraider avatar May 04 '23 20:05 coalraider

Fixed in #629 :)

false-fox avatar May 21 '24 17:05 false-fox