Skip to content

Commit 6015fe0

Browse files
committed
Rebuild moderation around native AutoMod
1 parent 4d279f0 commit 6015fe0

6 files changed

Lines changed: 627 additions & 1796 deletions

File tree

README.md

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ This repository is focused on running a practical all-in-one server bot rather
1313
than a single-feature integration. The core of the bot is moderation and
1414
community operations:
1515

16-
- slash-command moderation for bans, kicks, timeouts, warnings, purge, locks,
17-
slowmode, nicknames, and role tools
18-
- context-aware automod protections for spam, duplicate messages, suspicious
19-
links, invite abuse, blocked words, mention flooding, and raid-mode responses
16+
- compact `/staff` moderation console for bans, kicks, timeouts, warnings,
17+
purge, locks, slowmode, case history, and raid cleanup
18+
- Discord-native AutoMod protection for spam, mention raids, and scam-link
19+
patterns without bot-side profanity policing
2020
- security guardrails for anti-nuke detection, audit logging, and SQLite
2121
backups
22-
- startup seeding for bundled and curated automod datasets after deploys or
23-
restarts
2422
- SQLite-backed case history, warning points, scheduled actions, queue entries,
2523
and server configuration
2624
- rules posting, reusable embed templates, and staff-facing logging
@@ -34,12 +32,12 @@ This repository's source code is open source under the MIT license. See
3432

3533
## Features
3634

37-
- moderation slash commands for bans, kicks, timeouts, warnings, purge, locks,
38-
slowmode, nicknames, and role tools
35+
- compact `/staff` slash commands for bans, kicks, timeouts, warnings, purge,
36+
locks, slowmode, case history, and raid cleanup
3937
- SQLite-backed case history, warning points, temp-ban scheduling, and server
4038
config
41-
- scoring-based automod for spam, duplicate messages, suspicious links, invite
42-
abuse, blocked words, caps context, and mention flooding
39+
- native Discord AutoMod rules for spam, mention raids, and known scam-link
40+
patterns
4341
- anti-nuke protection for destructive server bursts such as mass bans, kicks,
4442
channel deletes, and role deletes
4543
- richer audit logging for message edits/deletes, role changes, channel
@@ -61,8 +59,8 @@ This repository's source code is open source under the MIT license. See
6159
4. Copy `.env.example` to `.env` and fill in `MEMACT_TOKEN`.
6260
5. Install dependencies with `pip install -r requirements.txt`.
6361
6. Run the bot with `python main.py`.
64-
7. Optional: set `MEMACT_STREAM_TITLE` and `MEMACT_STREAM_URL` to control the
65-
streaming presence. Default title is `Moderating this server`.
62+
7. Run `/automod install` once in Discord to create or refresh the native
63+
Memact Guard rules.
6664

6765
## Bluesky Relay
6866

@@ -96,33 +94,32 @@ credentials are required for read-only mirroring.
9694

9795
## Moderation Model
9896

99-
Memact AutoMod uses a conservative scoring model instead of warning members for
100-
every single keyword or formatting trigger. The bot weighs message context,
101-
member trust, account age, join age, links, mentions, repeated behavior, and
102-
raid mode before deciding what to do.
97+
Memact AutoMod now uses a native-first moderation model. Discord's own AutoMod
98+
handles the raw message protection layer, while the bot focuses on staff
99+
workflow, cases, appeals, audit logs, anti-raid behavior, and backups.
103100

104101
In practice:
105102

106-
- all-caps text alone does not create warning points
107-
- GIFs and normal media-only messages are ignored by automod
108-
- words such as casino, sale, promo, or giveaway are not punished by themselves
109-
- invite links and promotional links are usually deleted/logged first, not
110-
instantly converted into warning points
111-
- repeated soft violations can become a warning if the same member keeps doing
112-
it in a short window
113-
- scam-link patterns, message floods, repeated spam, and mass mentions still
114-
trigger stronger actions
103+
- the bot does not warn members for ordinary profanity or casual keywords
104+
- GIFs, all-caps messages, memes, and normal chat are not judged by a custom
105+
keyword engine
106+
- native Discord AutoMod blocks spam, mention raids, and known scam-link
107+
patterns before they become moderation cases
108+
- manual warnings are staff decisions through `/staff warn`
109+
- warning revokes are member-friendly through `/staff unwarn_latest`
110+
- appeals work with or without a case ID
115111

116112
Useful staff commands:
117113

118-
- `/automod view`: show current automod mode and thresholds
119-
- `/automod toggle`: enable or disable specific filters
120-
- `/mod warnings`: show a member's active warning points and active warning
114+
- `/automod install`: create or refresh native Discord AutoMod rules
115+
- `/automod view`: show Memact Guard native-rule status
116+
- `/automod toggle`: enable or disable Memact Guard
117+
- `/automod mention_limit`: tune native mention-raid protection
118+
- `/staff warnings`: show a member's active warning points and active warning
121119
cases
122-
- `/mod unwarn_latest`: revoke the latest active warning for a member without
120+
- `/staff unwarn_latest`: revoke the latest active warning for a member without
123121
hunting for a case ID
124-
- `/mod unwarn`: revoke a specific warning when staff already know the case ID
125-
- `/mod clearwarns`: clear all active warnings for a member
122+
- `/staff clearwarns`: clear all active warnings for a member
126123
- `/appeal reason:<text>`: appeal the user's latest active moderation case
127124
- `/appeal reason:<text> case_id:<id>`: appeal a specific case
128125

@@ -152,13 +149,13 @@ Recommended settings:
152149
- `MEMACT_GUILD_ID` (optional but recommended if this bot should stay locked
153150
to one server)
154151
- `MEMACT_DATABASE`
155-
- `MEMACT_STREAM_TITLE` (optional)
156-
- `MEMACT_STREAM_URL` (optional but required for streaming presence)
157152
- `MEMACT_BACKUP_DIR` (optional, recommended on persistent storage)
158153
- `MEMACT_BACKUP_INTERVAL_HOURS` (optional, default `12`)
159154
- `MEMACT_BACKUP_RETENTION` (optional, default `14`)
160155
6. Start the app and watch the JustRunMy.App logs until the bot prints that it
161156
logged in and synced commands.
157+
7. Run `/automod install` after the bot is online if Discord native AutoMod
158+
rules have not been created yet.
162159

163160
Important JustRunMy.App notes:
164161

bot.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def __init__(self, settings: Settings) -> None:
2323
intents.message_content = True
2424
intents.guild_messages = True
2525
intents.bans = True
26+
intents.auto_moderation = True
2627

2728
super().__init__(
2829
command_prefix=commands.when_mentioned,
@@ -39,7 +40,7 @@ def __init__(self, settings: Settings) -> None:
3940
self._commands_synced = False
4041
self.add_application_command_check(self._allowed_guild_check)
4142
for extension in (
42-
"cogs.moderation",
43+
"cogs.staff",
4344
"cogs.configuration",
4445
"cogs.automod",
4546
"cogs.safety",
@@ -70,12 +71,7 @@ async def on_ready(self) -> None:
7071
if self.keepalive_state is not None:
7172
self.keepalive_state.set_status("ready", f"Connected as {self.user}.")
7273
try:
73-
await self.change_presence(
74-
activity=nextcord.Streaming(
75-
name=self.settings.stream_title,
76-
url=self.settings.stream_url,
77-
)
78-
)
74+
await self.change_presence(status=nextcord.Status.online, activity=None)
7975
except Exception as error:
8076
print(f"Failed to set streaming presence: {type(error).__name__}: {error}")
8177
print(f"Loaded {local_command_count} local application command groups.")

0 commit comments

Comments
 (0)