For Discord

A moderation API for your Discord bot

Your bot sends each message with the last few of the channel. VigiMod answers with a score per category and per rule, and your bot decides what to do: delete, time out, or warn the moderators.

Why bots use it

It reads the conversation

Send the previous messages as context: a reply, a joke or a spoiler is judged on what came before, not on a single line.

Your server's rules

Write rules in plain language, like “no spoilers” or “no selling accounts”, and get a score for each one. No keyword lists to maintain.

26 languages

Communities mix languages. The model was trained on 26 and works best in Italian, English, Spanish, French, German and Portuguese.

Spam per user and server

Pass the author id and the server id: repeated messages and floods get a spam score, kept separate for each server.

How to connect it

  1. 1

    Get a key

    Create a free account and an API key in the dashboard. Keep it on the machine that runs the bot.

  2. 2

    Send each message

    On every new message, send its text, the last messages of the channel and your rules to POST /moderate.

  3. 3

    Act on the answer

    Read flagged and flags. Delete or hide the message, time out the author, or post it to a moderators' channel.

Example with discord.js

import { Client, GatewayIntentBits } from "discord.js";

const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
});
// your server's rules, in plain language
const RULES = { "no-spoilers": "No spoilers about movies or series" };

client.on("messageCreate", async (message) => {
  if (message.author.bot || !message.content) return;
  // the last messages of the channel, oldest first
  const previous = await message.channel.messages.fetch({ limit: 5, before: message.id });
  const context = [...previous.values()].reverse().map((m) => m.content).filter(Boolean);

  const res = await fetch("https://api.vigimod.com/moderate", {
    method: "POST",
    headers: { "X-API-Key": process.env.VIGIMOD_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({
      text: message.content.slice(0, 2000),
      context,
      rules: RULES,
      user_id: message.author.id,   // turns on the spam score
      scope: message.guildId,       // spam is counted per server
    }),
  });
  if (!res.ok) return;              // the API did not answer: the message stays
  const result = await res.json();
  if (!result.flagged) return;

  const why = Object.keys(result.flags).filter((k) => result.flags[k]).join(", ");
  await message.delete();
  await message.channel.send(`${message.author}, your message was removed (${why}).`);
});

client.login(process.env.DISCORD_TOKEN);

The bot needs the Message Content intent, turned on in the Discord developer portal. If the API does not answer, the message stays: moderation never blocks the chat.

Good practice

  • Start with the default thresholds, then raise them if the bot removes too much, or lower them if it misses too much.
  • Leave bans and other serious actions to a human: VigiMod 1.2 is a beta model and can be wrong on ambiguous messages.
  • Messages are checked and discarded: VigiMod does not store them and does not use them to train models.

Questions

Is it free?

Yes, during the beta: all features, 120 messages per minute per key, up to 10 keys.

Can I use it on many servers?

Yes. One key can serve every server of the bot; pass the server id as scope so spam is counted per server.

Does it work with discord.py and other libraries?

Yes. It is a plain HTTP API: any language or library that can send a JSON request can use it.

Add moderation to your bot

Free during the beta. An API key takes a minute.