4

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

1 Answer 1

7

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)

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.