Memact AutoMod is a nextcord-powered Discord management bot for the Memact
server. It combines moderation tools, automod protection, queue and ticket
workflows, embed utilities, and optional Bluesky relay posting in one long
running bot service.
This repository is focused on running a practical all-in-one server bot rather than a single-feature integration. The core of the bot is moderation and community operations:
- compact
/staffmoderation console for bans, kicks, timeouts, warnings, purge, locks, slowmode, case history, and raid cleanup - Discord-native AutoMod protection for spam, mention raids, hate-speech presets, and scam-link patterns backed by Memact's local deletion guard
- Memact local deletion guard for strong profanity, offensive extremist or dictator references, untrusted external links, unsolicited invites, promo links, bot/app spam, and repeated message bursts
- silent Sentinel intelligence for raids, scams, harassment, hate-speech patterns, and rolling member risk review
- security guardrails for anti-nuke detection, audit logging, and SQLite backups
- SQLite-backed case history, warning points, scheduled actions, queue entries, and server configuration
- rules posting, reusable embed templates, and staff-facing logging
- member reports, appeals, and ticket flows with abuse protection
- optional Bluesky relay posting for announcements and social updates
This repository's source code is open source under the MIT license. See LICENSE.
- compact
/staffslash commands for bans, kicks, timeouts, warnings, purge, locks, slowmode, case history, and raid cleanup - SQLite-backed case history, warning points, temp-ban scheduling, and server config
- personalized welcome and intro-channel acknowledgement messages so new members do not all get the same canned response
- native Discord AutoMod rules for spam, mention raids, hate-speech presets, and known scam-link patterns
- local Memact Guard deletion for strong profanity, offensive extremist or dictator references, protected-class slurs, untrusted external links, suspicious promos, unsolicited invites, URL shorteners, and repeated spam, including messages from installed bots/apps and webhooks
- media-friendly moderation: normal image uploads, GIFs, stickers, embeds, and attachment-only messages are allowed, while suspicious text links are still evaluated
- silent Sentinel detection for protected-class hate patterns, self-harm harassment, scam links, homoglyph domains, misleading markdown links, new-account bursts, and mention raids
- persistent Sentinel event history and member risk profiles for staff review
- anti-nuke protection for destructive server bursts such as mass bans, kicks, channel deletes, and role deletes
- richer audit logging for message edits/deletes, role changes, channel changes, bans, unbans, and kicks
- automatic and manual SQLite backups with retention controls
- rules management and rules embed posting
- generic embed creation and reusable embed templates
- member report, appeal, and ticket flows
- optional Bluesky relay with automatic posting to a configured Discord channel and moderator-picked reposts for older posts
- Create a Discord bot in the Discord developer portal.
- Enable the
SERVER MEMBERS INTENTandMESSAGE CONTENT INTENT. - Give the bot the permissions it needs for moderation and safety features, including View Audit Log, Moderate Members, Manage Messages, Kick Members, Ban Members, Manage Roles, and Manage Channels.
- Copy
.env.exampleto.envand fill inMEMACT_TOKEN. - If you are not running the current Memact server, set the optional channel/role ID environment variables listed below so welcome, intro, ticket, log, join-role, and Bluesky relay behavior points at your server.
- Install dependencies with
pip install -r requirements.txt. - Run the bot with
python main.py. - Run
/automod installonce in Discord to create or refresh native Memact Guard rules, including the hate-speech preset. - Use
/security sentinel_recentor/security sentinelto review silent risk intelligence after the bot has seen real traffic.
The Bluesky relay is optional. When enabled, the bot can mirror posts from one
public Bluesky account into the configured relay channel. Memact's default
relay channel is 1490277253949558975, and other servers can override it with
MEMACT_BLUESKY_RELAY_CHANNEL_ID.
- Start the bot normally.
- Make sure the Discord server contains the configured relay text channel.
- In Discord, run
/bluesky setup handle:<account>. - The bot saves the current latest Bluesky post as its sync point and starts auto-posting only new posts from that moment onward. The relay checks for new posts every five minutes.
/bluesky view: show the selected account, relay status, configured relay channel, and last synced post/bluesky sync_now: immediately catch up on posts that arrived while the bot was offline/bluesky history: open a Discord picker that lets moderators browse and manually send older Bluesky posts into the relay channel/bluesky disable: pause automatic posting/bluesky enable: resume automatic posting/bluesky remove: clear the saved Bluesky account configuration
The relay uses Bluesky's public AppView HTTP endpoint, so no extra Bluesky credentials are required for read-only mirroring.
Memact AutoMod uses a layered moderation model. Discord's own AutoMod handles the raw hard-block layer, while the bot focuses on staff workflow, cases, appeals, audit logs, anti-raid behavior, backups, and silent intelligence.
In practice:
- the bot does not warn members for ordinary profanity or casual keywords
- GIFs, all-caps messages, memes, and normal chat are not judged by a custom keyword engine
- image uploads, GIFs, stickers, embeds, and attachment-only messages are not violations by themselves; if suspicious or untrusted links appear beside that media, the links are still evaluated and can be deleted
- native Discord AutoMod blocks spam, mention raids, hate-speech slur presets, and known scam-link patterns before they become moderation cases
- Memact's local guard deletes public strong-profanity and offensive-reference
messages while intentionally allowing casual terms such as
shit,wtf,tf, andwth - protected-class slurs are hard-blocked locally with punctuation and leetspeak variants, so targeted racism does not depend only on Discord's native preset
- public links use an allowlist-first posture: known safe hosts stay normal,
memact.comlinks stay allowed, while unknown external links, shorteners, suspicious TLDs, invite spam, and random-looking hosts are treated as spam-risk and logged - installed bots/apps and webhooks are moderated too, so compromised or spammy integrations cannot freely post abusive text, invite links, or promo scams
- staff-only channels are treated with lighter friction for human moderators, but high-risk scam, hate, raid, and bot/app spam still gets caught and logged
- every local delete attempt is logged to the moderation log channel with the actor, channel, scope, category, severity, confidence, signals, and excerpt
- Sentinel quietly records high-signal suspicious messages without deleting, warning, timing out, or publicly interrupting the member
- Sentinel watches for protected-class violent targeting, dehumanization, self-harm harassment, scam phrasing, lookalike domains, misleading markdown links, mention bursts, and new-account raid patterns
- Sentinel keeps content hashes, clipped excerpts, signals, confidence, severity, action, actor type, channel scope, deletion status, and decaying member risk scores in SQLite so restarts do not erase the review trail
- manual warnings are staff decisions through
/staff warn - warning revokes are member-friendly through
/staff unwarn_latest - appeals work with or without a case ID
Useful staff commands:
/automod install: create or refresh native Discord AutoMod rules/automod view: show Memact Guard native-rule status/automod toggle: enable or disable Memact Guard/automod mention_limit: tune native mention-raid protection/security sentinel: show a member's risk profile plus recent Sentinel and local guard events/security sentinel_recent: show the latest high-signal Sentinel and local guard events/staff warnings: show a member's active warning points and active warning cases/staff unwarn_latest: revoke the latest active warning for a member without hunting for a case ID/staff clearwarns: clear all active warnings for a member/appeal reason:<text>: appeal the user's latest active moderation case/appeal reason:<text> case_id:<id>: appeal a specific case
Cases, warning points, scheduled actions, security events, Sentinel events,
Sentinel risk profiles, queue state, and Bluesky catch-up cursors are stored in
the same SQLite database. If you want moderation intelligence and relay state
to survive deploys and restarts, store MEMACT_DATABASE somewhere that
JustRunMy.App keeps between restarts and deployments.
This bot is ready for JustRunMy.App Git deployment. The root Dockerfile
installs requirements.txt, copies the repo, and starts the long-running bot
with python main.py.
Recommended settings:
- Push this repository to GitHub.
- In JustRunMy.App, create a Discord bot or container app and choose the Git deployment method.
- Connect the repository or add the JustRunMy.App Git remote shown in the
dashboard, then deploy from the
mainbranch. - Use the root
Dockerfileas the build target. - Add the environment variables:
MEMACT_TOKENMEMACT_GUILD_ID(optional but recommended if this bot should stay locked to one server)MEMACT_DATABASEMEMACT_BACKUP_DIR(optional, recommended on persistent storage)MEMACT_BACKUP_INTERVAL_HOURS(optional, default12)MEMACT_BACKUP_RETENTION(optional, default14)MEMACT_BOT_JOIN_ROLE_ID(optional, defaults to Memact's bot role)MEMACT_MEMBER_JOIN_ROLE_ID(optional, defaults to Memact's member role)MEMACT_ACTION_LOG_CHANNEL_ID(optional, defaults to Memact's action log)MEMACT_WELCOME_CHANNEL_ID(optional, defaults to Memact's welcome channel)MEMACT_INTRO_CHANNEL_ID(optional, defaults to Memact's intro channel)MEMACT_TICKET_CHANNEL_ID(optional, defaults to Memact's ticket channel)MEMACT_BLUESKY_RELAY_CHANNEL_ID(optional, defaults to Memact's Bluesky relay channel)
- Start the app and watch the JustRunMy.App logs until the bot prints that it logged in and synced commands.
- Run
/automod installafter the bot is online if Discord native AutoMod rules have not been created yet.
Important JustRunMy.App notes:
- Discord bots do not need a public HTTP port. Add one only if you want to use
the optional
/healthzendpoint. - Keep secrets such as
MEMACT_TOKENin JustRunMy.App environment variables, not in.env. - Server-specific IDs are normal runtime environment variables. Defaults match the current Memact server, but other servers should configure them explicitly.
- If GitHub Actions is used for deployment, store sensitive deployment values as GitHub Secrets and inject them into the deployment/runtime environment; the bot code reads only normal environment variables.
- You can enable Discord permissions for everyone to send images, GIFs, stickers, and embeds. Memact Guard will leave media-only messages alone while still filtering scam, invite, shortener, suspicious-domain, promo-link, and spam links found in message text.
- Use the dashboard logs, web shell, and auto-restart controls for debugging and recovery.
- For durable SQLite data, set
MEMACT_DATABASEto a path that lives on persistent app storage. This preserves moderation cases, queue state, and Bluesky sync cursors across restarts and Git deploys. - For defense in depth, set
MEMACT_BACKUP_DIRto persistent app storage too. The bot automatically creates SQLite backups and keeps the latest configured number of backup files.
Memact AutoMod includes built-in safety controls that follow the same SQLite-backed configuration style as the rest of the bot.
/security view: show anti-nuke, audit logging, and backup status/security settings: tune anti-nuke thresholds, audit logs, and the master security switch/security sentinel: review one member's Sentinel and local guard profile/security sentinel_recent: review recent Sentinel detections and local guard actions/security backup_create: create an immediate SQLite backup/security backup_list: show recent backup files
Anti-nuke protection watches for bursts of destructive manual server actions. If one actor crosses the configured threshold, the bot enables raid mode, logs a security case, and attempts to timeout the actor when Discord permissions and role hierarchy allow it.
The included Dockerfile is ready for JustRunMy.App and other Docker-based
hosts.
This repo includes a lightweight HTTP endpoint for hosts that need a health
check or public status route. For normal JustRunMy.App Discord bot hosting, no
public port is required. If you do enable the endpoint, it serves / and
/healthz.
Useful optional environment variables:
MEMACT_KEEPALIVE_PORT=10000MEMACT_KEEPALIVE_HOST=0.0.0.0MEMACT_ENABLE_KEEPALIVE=true