Blocking bad words / inappropiate pics in Slack
Asked Answered
N

1

5

I am looking to black swears, bad words in a slack channel. I found a "swearjar" bot that does not block, it only donates to some charity when its mentioned.

What could be the alternatives to do such thing? (I do have a long list of words to block). I am looking either for format the bad word into black color + black background, or transform the string into something like "#%#&!!".

Also: is there a way to block adult rated pictures and adult related website links to be posted in slack??

Thanks

Namedropping answered 12/6, 2017 at 14:49 Comment(0)
P
8

Sure, a Slack bot could do that.

You just need to create a Slack app with a bot user and an event subscription to all messages via the Events API. The bot will then automatically receive all message that are posted to a channel, which the bot is a member of. He can then review each message and decide on an actions according to content (e.g. check the message content against a blacklist of words). I made a similar bot for my team that instantly deletes every message (using chat.delete) in a specific channel, that is submitted by unauthorized user.

It is my understanding though that your bot will not be able to edit messages from users directly (that only works for your own messages). But you can e.g. delete the original message and repost it by the bot with corrections or the bot could delete the original message and then send a DM to the user who did the violation etc.

The same approach could be used to block unwanted images. Either based on the URL (assuming you have a url blacklist) or using an image recognition API to identify adult content (e.g. Google Cloud API, see here)

Phyllotaxis answered 12/6, 2017 at 19:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.