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:
- slash-command moderation for bans, kicks, timeouts, warnings, purge, locks, slowmode, nicknames, and role tools
- automod protections for spam, duplicate messages, invite links, blocked words, caps abuse, mention flooding, and raid-mode responses
- 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 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, appeal, and ticket flows
- optional Bluesky relay with automatic posting to a fixed 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. - 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.
The Bluesky relay is optional. When enabled, the bot can mirror posts from one
public Bluesky account into the fixed Discord channel 1490277253949558975.
- Start the bot normally.
- Make sure the Discord server contains the text channel with ID
1490277253949558975. - 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.
/bluesky view: show the selected account, relay status, fixed 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.
The catch-up state is stored in the same SQLite database as the rest of the
bot's data. If you want the Bluesky relay to survive deploys and restarts,
store MEMACT_DATABASE on persistent storage such as a Railway volume.
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