Skip to main content

Bot

What's a bot?

Bots allow you to perform automated actions on your chat. They can help with moderation, respond automatically to select words/phrases, play games and much more.

Minnit includes a built in bot with many commands, but you can also create your own bot.

Enabling the Bot

Chat owners can access the bot panel by going to the chat settings page (click the menu above the text box, then click "Chat Settings"). You will see a list of Bot Settings in the menu.

Bots have two tiers: Free Bots, and Premium Bots.

On the Basic plan and higher, premium bots can automatically moderate your chatroom for you, support custom responses and post scheduled messages.

On the Community plan and higher, premium bots also feature support for games.

Commands

NameDescriptionParametersExampleDefault Minimum RankMinimum Plan Required
!sayRepeats your message in main chat or direct message[message to say]!say Hey guys!OwnerFree
!saymainRepeats your message in main chat[message to say]!say Hi everyone!OwnerFree
!nicknameChanges the bot's nickname[nickname]!nickname CoolBotOwnerFree
!exitTurns off the bot. You can turn the bot back on via bot settingsNone!exitOwnerFree
!minrankChanges the minimum rank to use a specified command[command name]  [rank]!minrank say visitorOwnerFree
!defineReturns the definition of the word or phrase.[word/phrase]!define robotVisitorFree
!weatherReturns the weather for the given location.[country/city/zip code]!weather MiamiVisitorFree
!autoregularTurn automatically make visitors a regular on or off. This option can be fine tuned in bot settings.[on/off]!autoregular onOwnerBasic and higher
!autobanTurn automatically kicking/banning users for bad words on or off. This option can be fine tuned in bot settings.[on/off]!autoban onOwnerBasic and higher
!typeraceStarts the Typerace game.[easy/medium/hard]!typerace mediumModeratorCommunity and higher
!numraceStarts the Numrace game.[10-1000000]!numrace 100ModeratorCommunity and higher
!triviaStarts the Trivia game.[Category number: 9-32] [Number of questions: 1-50] [Difficulty: easy/medium/hard/any] [Type: multiple/trueorfalse]!trivia 9 25 easy multipleModeratorCommunity and higher
!endEnd a Trivia game that's currently progressNone!endModeratorCommunity and higher
!playPlay the game that's running[message]!play [message]VisitorCommunity and higher
!commandsSends link to this pageNone!commandsVisitorFree
!8ballProvides a fun response to a yes/no question[question here]!8ball Are you sentient?VisitorFree
!liedetectorProvides a fun lie detector to check if a statement is true or false[statement here]!liedetector I did not eat the last slice of pie.VisitorFree
!betterChooses whether option 1 or 2 is better[option 1] or [option 2]!better Snapchat or InstagramVisitorFree
!chooseChooses an option[option 1][option 2] [option 3] etc...!choose Twitter Facebook Google+VisitorFree
!urbanReturns the definition of a word or phrase from urban dictionary[word/phrase]!urban botModeratorFree
!usersReturns how many users are connected to the chat in all channels (if applicable)None!usersVisitorFree
!slap[user you want to slap][user you want to slap]!slap JohnVisitorFree
!lovetestWill provide a percentage chance that a relationship would work out between two users[user 1] and [user 2]!lovetest Brian and AshleyVisitorFree
!coinflipFlips a coin and gives you the result (heads or tails)None!coinflipVisitorFree
!diceRolls a dice and tells you what number was rolled.[type of dice to roll e.g. a number (2, 6, 10) or a dice syntax (d20, 2d6, 6d10+4)]!dice 6VisitorFree
!countdownProvides the time remaining until the given date[date December 31st, 12/25/30 (MM/DD/YY)]!countdown 12/25/30VisitorFree
!jokeGives a random joke. Submit your own at minnit.chat/jokes!None!jokeVisitorFree

Premium Functions

The functions listed below are available on the Basic plan and higher.

Auto Regular

You can turn on this feature under the "General Settings" option in bot settings.

This option makes visitors a regular automatically when they join, or if they talk (depending on your settings).

You also have the option to only make visitors who are registered a regular.

Auto Moderation

Auto Moderation (also known as Auto Ban) is a feature that makes the bot automatically kick/ban users when their message contains a bad word.

You can use Minnit's default list of bad words, your chat's existing list of bad words, or both. You can also add up to 100 additional bad words to the bot.

You can also adjust the sensitivity of the filter to avoid false positives. The default sensitivity is medium.

You can use the command !autoban [on/off] to turn this feature on or off.

AI Moderation

AI Moderation is a feature that allows you to moderate your chat automatically using AI.

Sensitivity

You can kick or ban users for sending offensive messages, or sending offensive messages excluding swearing.

Offensive messages include but are not limited to: insults, racism, inappropriate or inflammatory content

Accuracy

AI is not 100% accurate. While we've observed a low error rate, false positives and negatives are always possible.

AI Moderation performs best with messages in English, however it also works well with other major languages such as Spanish and French.

We recommend periodically reviewing AI moderation actions via the action log.

Usage

AI Moderation is a usage based product and is based on characters monitored and is available on the Business plan and via an add-on to your existing subscription.

The add-on starts at $25 USD/month (price may vary in your local currency) and includes 250,000 characters.

Usage is shared across all chats under your organization.

You can monitor usage in your chat settings under the AI Moderation category.

If your chat is busy, you can purchase additional characters via the AI Moderation add-on at any time.

Phrase Reponses

Phrase Responses (also known as Auto Responses) is a feature that makes the bot send a specific message in public and/or direct message to a user whose message contains a specific word or phrases.

You can add up to 25 responses.

You can also adjust the sensitivity of the filter to avoid false positives. The default sensitivity is low.

You can use the command !autoresp [on/off] to turn this feature on or off.

Personal Responses

You can make your responses more personal by referring to the user's username or nickname in the response.

Simply include %username% or %nickname% in the response and it will be replaced with the user's corresponding username or nickname. For example, a response of "Hey %nickname%." would be replaced with "Hey John." if the user's nickname was set to "John".

Scheduled Messages

Scheduled Messages allow you to add up to 10 messages that repeat themselves on a set timer. The timer stops when everyone signs out, so the bot won't spam the chat while no one is signed in.

The minimum time to repeat a scheduled message is 1 minute and the maximum is 9999 minutes.

The timer also resets when you make changes to your scheduled messages.

Announce Current Song

This option announces the current song that's playing on the radio when it changes.

The supported radio types are:

  • Shoutcast V1
  • Shoutcast V2
  • Icecast V2

If you're not sure what radio type to use, you can try all of the radio types and use the Test button until you find one that works.

If you're still having issues, contact us and we'll try to help.

Games

The functions listed below are available on the Community plan and higher.

Typerace

Get ready, get set, type! Typerace is the first game featured in the Bot. All users in the chat may play. Simply type !typerace to start a match. Players will read a sentence, and have to type it exactly as it's displayed, without a single mistake. First to send the proper response wins!

Learn more about Typerace

Numrace

Get ready, get set, guess! All users in the chat may play. Simply type !numrace to start a match. A random number between 1-10 will be picked by the bot. Players will have to guess the bot's number. The player whose guess is closest to the bot's number is the winner!

Learn more about Numrace

Trivia

Prove your knowledge with a fun Trivia game. Simply type !trivia to start a game. 10 questions will be asked by default in any category. Users get a point by answering a question correctly. Users with the most points win.

Learn more about Trivia

Creating your own bot

You can create your own bot using a combination of webhooks and using our API.

Using webhooks requires the Community plan or higher.

You can receive webhooks when messages are sent, when users join and leave the chat, and you can send messages, kick, ban, unban and much more using the API.

Here's some sample code of a Bot written in Node.js to get you started:

const express = require('express');
const bodyParser = require('body-parser');
const app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.post('/webhook', (req, res) => {
processWebhook(req.body);
res.send('OK');
});

const apiURL = 'YOUR_API_URL_HERE';
const apiKey = 'YOUR_API_PASSWORD_HERE';
const apiHeaders = {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Key': apiKey
};

const processWebhook = (body) => {
//process chat messages only
if (!body.hasOwnProperty("type") || body.type != "chat_message") {
return;
}
for (let index = 0; index < body.data.length; index++) {
let messageObject = body.data[index];
let msgContent = messageObject.message;
//moderate messages if user is not moderator or higher
if (!isChatStaff(messageObject.rank)) {
if (containsBadWord(messageObject.message)) {
//ban user
fetch(apiURL, {
method: 'POST',
headers: apiHeaders,
body: new URLSearchParams({
"action": "ban",
"chatname": messageObject.chat_name,
"channel": messageObject.channel,
"userid": messageObject.user_id,
"reason": "Inappropriate language",
"duration": 6 //ban the user for 6 hours
})
});
return;
}
}
//analyze for command
if (msgContent.startsWith('!')) {
let command;
if (msgContent.includes(' ')) {
command = msgContent.split(' ');
command = command[0].substring(1);
} else {
command = msgContent.substring(1);
}
command = command.toLowerCase();
switch (command) {
case "say":
processSayCommand(messageObject);
break;
case "8ball":
process8ballCommand(messageObject);
break;
default:
return;
}
}
}
}

const processSayCommand = (messageObject) => {
let messageToSay = messageObject.message.substring(5);
if (!messageToSay) {
return;
}
fetch(apiURL, {
method: 'POST',
headers: apiHeaders,
body: new URLSearchParams({
"action": "sendmessage",
"message": messageToSay,
"username": "Bot",
"chatname": messageObject.chat_name,
"channel": messageObject.channel
})
});
}

const process8ballCommand = (messageObject) => {
let question = messageObject.message.substring(7);
if (!question) {
return;
}
const responses = ["It's a no from me. :frown:", "Not in a thousand years! :rofl:", "Yes! :smile:", "Of course. :nod:", "No way! :smh:", "Not a chance. :thumbsdown:", "Signs point to yes. :thumbsup:", "You bet! :cool:", "Come on, everyone knows it's a no. :lol:", "You know it! :wink:"];
let randomNumber = Math.floor(Math.random() * 10);
fetch(apiURL, {
method: 'POST',
headers: apiHeaders,
body: new URLSearchParams({
"action": "sendmessage",
"message": generateMention(messageObject) + responses[randomNumber],
"username": "Bot",
"chatname": messageObject.chat_name,
"channel": messageObject.channel
})
});
}

const generateMention = (messageObject) => {
return "@" + messageObject.user_id + "|" + encodeURIComponent(messageObject.nickname) + " ";
}

const isChatStaff = (rank) => {
return ["moderator", "manager", "owner"].indexOf(rank) > -1;
}

const containsBadWord = (msg) => {
const badWords = ["test", "bad"];
for (let index = 0; index < badWords.length; index++) {
const badWord = badWords[index];
const spmsg = " " + msg + " ";
if (badWord == msg || spmsg.includes(" " + badWord + " ")) {
return true;
}
}
return false
}

const port = 3000;
app.listen(port, () => {
console.log(`Server is listening on port ${port}`);
});

This is a basic bot that handles moderating the chat (bans for bad words contained in chat messages), and supports the !say and !8ball command.

You'll need to:

  • Get your own server to run the code
  • Add the webhook URL to your Webhooks Settings for chat messages.
  • Set an API key in your organization settings
  • Update the API URL in the code and API Key
  • Update the list of bad words in the code (currently it bans for the words "bad" and "test")

This is a great starting point for a bot and you can update it to support more advanced moderation (e.g. by reading bad usernames/nicknames with the user_join webhook) and additional commands.