-
-
Save kiki67100/6c68436766ea3a037508970999b7e89e to your computer and use it in GitHub Desktop.
/* | |
This version is probably out of date, look at the dsci4-hacks ( Thanks to him x) ) instead: | |
*** not tested *** | |
https://github.com/dsci4-hacks/Delete-Teams-Messages/blob/main/delete_my_teams_messages.js | |
Thank you for all your contributions in comments | |
**** Original **** | |
By kiki67100 https://gist.github.com/kiki67100 | |
Tested on Google Chrome | |
Open Microsoft teams web version, select a conversation | |
Open Developper tools and copy / paste (Change YOUR_NAME by your) | |
Work on March 2020 maybe no work on the future... | |
*/ | |
window.id = []; | |
YOUR_NAME = "YOUR_NAME"; | |
window.idx=0; | |
setInterval(function() { | |
jQuery('#page-content-wrapper').find('div[id^=m]').each(function() { | |
$('virtual-repeat').scrollTop(0); | |
setTimeout(function(_this) { | |
//console.log('timeout...'); | |
//console.log('_this = ',_this); | |
txt = $(_this).text(); | |
if (txt.indexOf(YOUR_NAME) != -1) { | |
console.log('not inside'); | |
$(_this).css({ | |
'outline': '1px solid red' | |
}); | |
_id = $(_this).attr('id'); | |
//console.log('_this id =' + _id) | |
if (window.id.indexOf(_id) == -1) { | |
window.id.push(_id.substr(1)); | |
//console.log('add'); | |
} else { | |
//console.log('!!'); | |
} | |
}else{ | |
//console.log('already inside'); | |
} | |
}, 1000, this); | |
}); | |
}, 2000); | |
/* | |
- Extract messages id | |
On Google Chrome developper tools : | |
copy(id.join("\n")) | |
Delete a message, copy the ajax request and export as CURL (bash) (on network tools maybe end by "softDelete") | |
On notepad ++ on replace regex mode | |
REPLACE (.*) | |
Your CURL shell command find the id curl 'https://emea.[...]/121545326566?behavior=softDelete by $1 like this 'https://emea.[...]/$1?behavior=softDelete | |
lauch on linux terminal all lines | |
*/ |
@alexpeter-pen cool! its was easy than the solutions i was looking. its is running on 5 minutes and without messages of rate limit. i've changed 1000 to 2000. I have 3 years of messages and rate limit bothers a lot because i have to restart a 20 or 30 times from the beginning to try do delete messages that cannot be deleted before. Now on 2000 it is running and deleting all. Many thanks!!! Ops. To many requests now. I think that has a limit on total of deletes. Refresh and start again and here he goes more 5 minutes without any errors.
This is great, thanks. Does anyone have something similar for Skype?
Script stopped working and shows errors
Uncaught TypeError: Cannot read properties of undefined (reading 'ownerDocument')
and TypeError: Cannot read properties of undefined (reading 'ownerDocument')
Here is an updated working version of the script as of 17/07/2023:
https://github.com/dsci4-hacks/Delete-Teams-Messages/blob/main/delete_my_teams_messages.js
Hello everyone.
Script does not work with New Teams. The option to go back to Old Teams is not available anymore. Can the experts revise the code to work with New Teams?
Regards!
Hello
I'm quitting in 2 months, guys, I need you :D
Yeah, i am also kinda desparate 😅
@geoginho I think I explained it in my comment about the rate limit, what is actually happening. I had to go twice about it over the same chat. But it is still faster than the initial solution overall and more reliable. If it bothers anyone the only way to try fixing the rate limit is to increase 1000 to something higher, but even then there is no guarantee that it will not happen.