Created
November 21, 2017 02:44
-
-
Save SamRH/0d512afa319b2fe1b5ef542f9614655c to your computer and use it in GitHub Desktop.
Slack Auto-Delete Specific Users Messsages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Execute this in the slack developer console - can access it by spam clicking team icons | |
* - make sure to replace TEAM_ID, USER_ID, and CHANNEL_ID first | |
* - requires you have permissions to delete ofc | |
*/ | |
TS.channels.addMsg = function e(t, n) { | |
/* begin message check and delete */ | |
if (n.type == "message" && n.source_team_id == "TEAM_ID" && n.user == "USER_ID") { | |
TS.api.call("chat.delete", {_attempts: 0, _delay_ms: 100, channel: "CHANNEL_ID", ts: n.ts}) | |
} | |
/* end message check and delete */ | |
/* this is the default code - could change with slack version */ | |
var r = TS.channels.getChannelById(t); | |
if (!r) { | |
if (!TS.channels.temp_list_of_removed_channels[t]) | |
TS.error('unknown channel "' + t + '"'); | |
return | |
} | |
if (TS.useReactMessages() && !TS.utility.msgs.isMsgReply(n)) { | |
if (!TS.redux.messages.addMessage(n, true)) | |
return | |
} else if (!TS.shared.addMsg(r, n)) | |
return; | |
var i = !TS.utility.msgs.isTempMsg(n); | |
TS.channels.calcUnreadCnts(r, i); | |
TS.utility.msgs.maybeTruncateMsgs(r); | |
TS.channels.message_received_sig.dispatch(r, n) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment