-
-
Notifications
You must be signed in to change notification settings - Fork 723
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
undiscord tries to delete app commands #526
Comments
It looks like this bug is caused as the result of Discord's search API including messages that were sent as replies to a user's slash commands. The issue is fixed by ensuring that the to-be-deleted messages' author ids matches the author id given in the GUI's options. An extra check could be added in if (this.options.authorId) messagesToDelete = messagesToDelete.filter(msg => msg.author.id === this.options.authorId); I included an extra conditional statement to avoid needlessly filtering the list if the option was not utilized, rather than using an unperformant nullish coalescing operator as the other filters do. |
I think this is the same as #535 , with it trying to delete MEE6 messages. @CactusHamster I will try your solution, but my bug report also includes archived threads, do you have a fix on that? Edit: Cactus, how do we edit the tampermonkey script to implement your code as line 314 I don't think is the same as the one you are referencing. Edit 2: Found it at line 731 |
@JayBoom line 314 seems to be the correct place? I'm not the author- you definitely could know better than me but github displays it as line 314 for me. edit: Sorry for the URL rather than a snippet- according to a quick google, GitHub seems to be having problems with them right now? another edit: oh!! I see what you meant. I expected the author to have a tool to build the tampermonkey script rather than manually updating both sources. |
All good! I Did make two edits after mentioning you and it is line 314. I have also implemented the extra code from #520 to try and remove the thread messages and it appears to be working with both of your codes so far. So potentially this is something that @victornpb can implement in the next update for both. What I would love is an option to "skip" thread messages, so far @ckcr4lyf 's code unarchives the threads if possible then removes the messages, but if it was possible to just have a clause that says "if the message is in a thread, skip it" rather than unarchiving it to delete the messages. Just having both options would be great :) |
@JayBoom the fix you describe is certainly possible. Discord's search API returns, along with the list of messages, threads that are referenced by them. I wrote a quick implementation of this fix. // Don't do all this calculation for nothing! Only check for threads if threads are referenced.
if ("threads" in data && data.threads.length > 0) {
// Find ID's of private threads.
let privateThreads = data.threads.filter(thread => thread.thread_metadata.archived === true).map(thread => thread.id);
// Filter messages in private threads out of the list of deletable messages.
// If a message's channel id is in the list of archived threads, leave it alone!
if (privateThreads.length > 0) messagesToDelete = messagesToDelete.filter(msg => !privateThreads.includes(msg.channel_id));
} This code is untested; however I am quite confident it will work. My only worry is avoiding archived messages could be unexpected behavior from a script expected to delete everything. edit: I did not implement a menu option. I could prolly do that quickly tho ^^ |
hey so I made a fork for anyone intersted it's not perfect and works by checking username, the changes are low quality otherwise i'd make a pr. |
Fixed in #629 :) |
Undiscord Version
v5.2.3
Browser
firefox 115.0.1 (64-bit)
Extension
tampermonkey
Reproduction steps
....
Actual results
Error deleting message, API responded with status 403! {"message":"Missing Permissions","code":50013}
Expected results
dont delete app commands when you have no permissions to
Bug affects
Additional information & file uploads
ssfsa df
The text was updated successfully, but these errors were encountered: