Skip to content

Every 5 minutes

Moderate a Discord channel against rules in a Google Sheet

New messages in your channel are checked against your rules sheet, and any that break a rule are logged and flagged to your moderators.

Runs
Every 5 minutes
Apps
Discord, Google Sheets
AI
Yes, uses the built-in AI allowance
Access
Discord Read Message History, Manage Messages (Message Content intent); Sheets edit

Send this to your assistant

Create a ClickRuntime automation: every 5 minutes, check new messages in #general against the rules in my Mod rules sheet, log any violations to the sheet and alert #mods.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A volunteer moderator team runs a community Discord server of a few thousand members. Most of the time things are friendly, but spam links, harassment and off-topic selling turn up at all hours, often when every moderator is asleep or at work. By the time someone notices, the message has been seen by hundreds of people and members are complaining.

This automation checks each new message against the community's own written rules, logs every violation in a shared sheet and alerts the moderators' channel, so problems are handled quickly and consistently.

What you get out of it

  • Problems are spotted within minutes

    Messages that break a rule are flagged soon after they are posted, at any hour. Moderators can act before a thread gets out of hand. Members see that the rules are taken seriously.

  • Your rules, in plain language

    The rules live in a Google Sheet the moderators already understand and can edit. Changing a rule takes effect on the next check. There is no keyword list to maintain.

  • Consistent decisions

    Every message is checked against the same written rules, whoever is on duty. That reduces arguments about moderators being unfair. Decisions can point back to a specific rule.

  • A log for repeat offenders

    Each violation is recorded with the user, the message, the rule and the time. Moderators can see patterns before deciding on a ban. Appeals can be reviewed with the facts.

  • Volunteers get time back

    Moderators no longer need to read every message to catch the few that matter. They review flagged messages instead. That makes volunteering easier to keep up.

How it works

What happens, step by step

  1. Every 5 minutes, ClickRuntime collects the new messages posted in your Discord channel.

  2. It remembers the last message it checked, so each message is only checked once.

  3. AI compares each message with the rules in your Mod rules sheet.

  4. Any message that breaks a rule is added to the Violations tab with the user, rule and time.

  5. Your moderators get an alert in #mods with a link to the message.

Before it runs live

  • Connect Discord
  • Connect your Google Sheets account and pick the spreadsheets it may use

What you get

RunsEvery 5 minutes
Moderate a Discord channel against rules in a Google Sheettoday, 9:00Succeeded
Discord · #modsPossible violation by quickdeals42 (No selling outside #marketplace): link to message

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Discord and Google Sheets steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
ai_moderation_of_a_discord_channel_with_rules_in_sheets.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched

SHEET_ID = "your-spreadsheet-id"
GUILD_ID, CHANNEL_ID, MODS_ID = "your-server-id", "your-general-channel-id", "your-mods-channel-id"
API = "https://discord.com/api/v10/channels"

@on_trigger
def run(event):
    auth = {"Authorization": f"Bot {credentials.secret('DISCORD_BOT_TOKEN')}"}
    after = state.get("after")
    msgs = http.get(f"{API}/{CHANNEL_ID}/messages", headers=auth, params={"limit": 100, **({"after": after} if after else {})}).json()
    report_fetched(len(msgs))
    if not msgs:
        return {"summary": "Nothing new"}
    sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    rules = [r[0] for r in sheets.spreadsheets().values().get(spreadsheetId=SHEET_ID, range="Rules!A2:A").execute().get("values", []) if r]
    numbered = "\n".join(f"{i + 1}. {m['author']['username']}: {m['content'][:500]}" for i, m in enumerate(msgs))
    verdicts = ai.generate([f"Rules:\n" + "\n".join(rules), f"Messages:\n{numbered}",
                            "For each message number that breaks a rule, write 'number | rule'. Write NONE if none do."], max_output_tokens=300).text
    rows = []
    for line in verdicts.splitlines():
        if "|" in line and line.split("|")[0].strip().isdigit():
            m, rule = msgs[int(line.split("|")[0]) - 1], line.split("|", 1)[1].strip()
            rows.append([m["timestamp"], m["author"]["username"], m["content"][:500], rule])
            http.post(f"{API}/{MODS_ID}/messages", headers=auth, json={"content": f"Possible violation by {m['author']['username']} ({rule}): https://discord.com/channels/{GUILD_ID}/{CHANNEL_ID}/{m['id']}"})
    if rows:
        sheets.spreadsheets().values().append(spreadsheetId=SHEET_ID, range="Violations!A:D", valueInputOption="RAW", body={"values": rows}).execute()
    state.set("after", max(msgs, key=lambda m: int(m["id"]))["id"])
    return {"checked": len(msgs), "flagged": len(rows)}

FAQ

Common questions

Does it delete messages on its own?
By default it only flags them for a moderator to decide. Automatic deletion can be turned on for clear-cut cases such as spam links, and those are still logged.
How should I write the rules in the sheet?
One rule per row, written as you would explain it to a new moderator, for example "No selling or promoting paid services outside #marketplace". Short, specific rules give the best results.
Can it watch more than one channel?
Yes. Each channel can be added to the list, and the alert says which channel the message came from.
What permissions does it need?
Discord Read Message History, Manage Messages (Message Content intent); Sheets edit. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Moderate a Discord channel against rules in a Google Sheet” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.