Memact AutoMod is a nextcord moderation bot for a private Discord server.
This repository's source code is open source under the Apache-2.0 license. See LICENSE.
Memact branding and assets are not open source. The Memact name, logos,
icons, artwork, banners, screenshots, and other Memact-owned brand assets are
excluded from the code license unless a file explicitly says otherwise. See
NOTICE and BRANDING.md.
- moderation slash commands for bans, kicks, timeouts, warnings, purge, locks, slowmode, nicknames, and role tools
- SQLite-backed case history, warning points, temp-ban scheduling, and server config
- automod for spam, duplicate messages, invite links, blocked words, caps, and mention flooding
- rules management and rules embed posting
- generic embed creation and reusable embed templates
- member report and appeal flows
- Create a Discord bot in the Discord developer portal.
- Enable the
SERVER MEMBERS INTENTandMESSAGE CONTENT INTENT. - Copy
.env.exampleto.envand fill inMEMACT_TOKEN. - Install dependencies with
pip install -r requirements.txt. - Run the bot with
python main.py. - Optional: set
MEMACT_STREAM_TITLEandMEMACT_STREAM_URLto control the streaming presence. Default title isModerating this server.
Railway is a better fit for this bot than a Replit keepalive loop because it supports persistent long-running services without requiring a public uptime ping.
Recommended settings:
- Push this repository to GitHub.
- In Railway, create a new
Servicefrom the repository. - Let Railway use the root
Dockerfileautomatically. - Keep this as a persistent service and leave
Serverlessdisabled. - Add the environment variables:
MEMACT_TOKENMEMACT_GUILD_ID(optional but recommended if this bot should stay locked to one server)MEMACT_DATABASEMEMACT_STREAM_TITLE(optional)MEMACT_STREAM_URL(optional but required for streaming presence)
- Skip
Public Networkingunless you specifically want to expose the optional/healthzendpoint.
Important Railway notes:
- Railway services are persistent by default.
Serverlessis a separate opt-in feature that sleeps inactive services, so it should stay off for a 24/7 Discord bot. - Every service gets ephemeral storage, but it does not persist across
deployments. The default
memact_automod.dbpath is only safe for testing. - If you want to keep using SQLite, attach a volume at
/dataand setMEMACT_DATABASE=/data/memact_automod.db. - Railway volumes are persistent, but each service can only have one volume and replicas cannot be used with attached volumes.
- Railway trial and free accounts do not support the
Alwaysrestart policy. On those plans,On Failureis limited to 10 restarts. - Railway's Limited Trial has restricted outbound networking. If your account is not fully verified, that can interfere with a Discord bot connecting out to Discord.
Practical deployment options:
- Quick test: deploy the service with default ephemeral storage
- Better 24/7 setup: add a Railway volume, set
MEMACT_DATABASE=/data/memact_automod.db, and use a paid plan with restart policy set toAlways
The included Dockerfile is ready for Railway and other container-based hosts.
This repo includes a lightweight keepalive HTTP endpoint for Replit-style
hosting workarounds. When the app detects Replit environment variables, or when
MEMACT_KEEPALIVE_PORT is set, it opens a tiny HTTP server on / and
/healthz.
.replitmaps internal port10000to external port80- the keepalive server listens on
0.0.0.0 - UptimeRobot can ping the published app URL to help keep an Autoscale app warm
Important caveats:
- this is a workaround, not true always-on bot hosting
- Replit Starter currently includes one free published app, and the published app expires after 30 days but can be re-published
- published app storage is not persistent, so SQLite data can reset
Useful optional environment variables:
MEMACT_KEEPALIVE_PORT=10000MEMACT_KEEPALIVE_HOST=0.0.0.0MEMACT_ENABLE_KEEPALIVE=true