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.
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
Every 5 minutes, ClickRuntime collects the new messages posted in your Discord channel.
It remembers the last message it checked, so each message is only checked once.
AI compares each message with the rules in your Mod rules sheet.
Any message that breaks a rule is added to the Violations tab with the user, rule and time.
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
Build your own
Need it to work differently?
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
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?
How should I write the rules in the sheet?
Can it watch more than one channel?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Post new and changed sheet rows to Discord
Whenever a row in your sheet is added or changed, a formatted message appears in your Discord channel.
See how it worksCreate a Discord channel for each new project in your sheet
Add a project row to your sheet and a Discord channel is created, its members are tagged in a welcome message, and the channel ID is saved back.
See how it worksWork through a content queue in Sheets and post results to Discord
Every hour, the next ready idea in your sheet becomes a draft script or caption, is saved back to the row and is posted to your Discord channel.
See how it worksKeep exploring
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.