How to use api or other to manage ban/unban

Bots like Streamelement are able to timeout or ban people automatically. Am I supposed to create a bot?