PerBonomi
7 years agoBoss
Note/PM ID - Delete scam PMs
Hey everyone, I'm thinking about making a tool to remove scam PMs sent by bad users from the inboxes of their recipients.
I had a look and it seems that the unique id of a note is identical both in sent of the sender and the inbox of the receiver, so it would seem I should be able to match up sent items and received items.
Has anyone looked at this or does anyone want to have a look at their community, if this assumption is correct?
Basically the script would do something like this:
<#assign test = true/> <#assign delete = false/> <#assign scammer_user_id = 146/> <#assign limit = 10/> <#assign query_notes_sent = restadmin("2.0","/search?q=" + "SELECT id,recipients FROM outbox_notes WHERE user.id = '${scammer_user_id}' LIMIT ${limit}"?url)/> <#list query_notes_sent.data.items as note> <#assign note_id = note.id/> <#assign recipient = note.recipients.items[0].user/> <#assign recipient_id = recipient.id/> <#assign recipient_login = recipient.login/> <#if test == true> <#assign note_subject = restadmin("/users/id/${recipient_id}/mailbox/notes/id/${note_id}/subject").value/> <#assign note_body = restadmin("/users/id/${recipient_id}/mailbox/notes/id/${note_id}/body").value/> Note ID: ${note_id}, Recipient ID: ${recipient_id}, Recipient Login: ${recipient_login}<br/> <textarea>${note_subject} ${note_body}</textarea><br/> </#if> <#if delete == true> <#assign result = restadmin("/users/id/${recipient_id}/mailbox/notes/id/${note_id}/delete")/> </#if> </#list>