|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+# Commands
|
|
|
2
|
+
|
|
|
3
|
+Rocketbot's functionality is broken into different functional areas that
|
|
|
4
|
+typically have a master switch to enable/disable it and some other configuration.
|
|
|
5
|
+Configuration is specific to each server the bot is invited to.
|
|
|
6
|
+
|
|
|
7
|
+For all the examples here, I'm assuming the default command prefix of `$rb_`.
|
|
|
8
|
+If you set a different one in `config.py`, translate accordingly.
|
|
|
9
|
+
|
|
|
10
|
+## Log channel
|
|
|
11
|
+
|
|
|
12
|
+The first thing you'll want to do is configure a channel where bot messages
|
|
|
13
|
+can go. This should be a channel only mods can see. Go into that channel and
|
|
|
14
|
+type
|
|
|
15
|
+
|
|
|
16
|
+```
|
|
|
17
|
+$rb_config setwarningchannel
|
|
|
18
|
+```
|
|
|
19
|
+
|
|
|
20
|
+This ensures warnings will go somewhere appropriate.
|
|
|
21
|
+
|
|
|
22
|
+You will probably also want to set a role to tag for important warnings to get
|
|
|
23
|
+their attention. E.g. to tag the `@Mod` role type
|
|
|
24
|
+
|
|
|
25
|
+```
|
|
|
26
|
+$rb_config setwarningmention @Mod
|
|
|
27
|
+```
|
|
|
28
|
+
|
|
|
29
|
+Entering that will configure who to mention, and it will also mention them right
|
|
|
30
|
+now in that message you just typed. Apologize to all the mods who you just
|
|
|
31
|
+bothered and explain you were just configuring a cool new bot.
|
|
|
32
|
+
|
|
|
33
|
+## Help!!
|
|
|
34
|
+
|
|
|
35
|
+I don't remember the commands for my own bot, so I don't expect you will either.
|
|
|
36
|
+The only thing you need to remember is `$rb_help`. The bot will reply with a
|
|
|
37
|
+summary of all the top-level commands available. As an example:
|
|
|
38
|
+
|
|
|
39
|
+```
|
|
|
40
|
+Auto Kick:
|
|
|
41
|
+ autokick Automatically kicks all new users as soon as they join
|
|
|
42
|
+Configuration:
|
|
|
43
|
+ config Manages general bot configuration
|
|
|
44
|
+Crosspost Detection:
|
|
|
45
|
+ crosspost Manages crosspost detection and handling
|
|
|
46
|
+General:
|
|
|
47
|
+ deletemessages Mass deletes messages
|
|
|
48
|
+ hello Simple test reply
|
|
|
49
|
+ shutdown Shuts down the bot
|
|
|
50
|
+ testwarn Posts a test warning
|
|
|
51
|
+Join Age:
|
|
|
52
|
+ joinage Tracks recently joined users with options to mass kick or ban
|
|
|
53
|
+Join Raids:
|
|
|
54
|
+ joinraid Manages join raid detection and handling
|
|
|
55
|
+Logging:
|
|
|
56
|
+ logging Manages event logging
|
|
|
57
|
+Pattern Matching:
|
|
|
58
|
+ pattern Manages message pattern matching
|
|
|
59
|
+URL Spam:
|
|
|
60
|
+ urlspam Manages URL spam detection
|
|
|
61
|
+Username Pattern:
|
|
|
62
|
+ username Manages username pattern detection
|
|
|
63
|
+No Category:
|
|
|
64
|
+ help Shows this message
|
|
|
65
|
+
|
|
|
66
|
+Type $rb_help command for more info on a command.
|
|
|
67
|
+You can also type $rb_help category for more info on a category.
|
|
|
68
|
+```
|
|
|
69
|
+
|
|
|
70
|
+Each section is known internally as a "cog". If you're mucking around in the code,
|
|
|
71
|
+each cog is its own source file in the `rocketbot/cogs` directory. But you can
|
|
|
72
|
+just think of them as categories. Some of these are commands of their own (e.g.
|
|
|
73
|
+`hello`, invoked with `$rb_hello`) but most have subcommands. You can find out
|
|
|
74
|
+more using `$rb_help commandname`, e.g. `$rb_help config` will show subcommands for
|
|
|
75
|
+config.
|
|
|
76
|
+
|
|
|
77
|
+```
|
|
|
78
|
+$rb_config
|
|
|
79
|
+
|
|
|
80
|
+General guild configuration command group
|
|
|
81
|
+
|
|
|
82
|
+Commands:
|
|
|
83
|
+ getwarningchannel Shows the mod warning channel
|
|
|
84
|
+ getwarningmention Shows the user/role to mention in warning messages
|
|
|
85
|
+ setwarningchannel Sets the mod warning channel
|
|
|
86
|
+ setwarningmention Sets a user/role to mention in warning messages
|
|
|
87
|
+
|
|
|
88
|
+Type $rb_help command for more info on a command.
|
|
|
89
|
+You can also type $rb_help category for more info on a category.
|
|
|
90
|
+```
|
|
|
91
|
+
|
|
|
92
|
+And then you can invoke a subcommand with `$rb_commandname subcommandname`. e.g.
|
|
|
93
|
+`$rb_config setwarningchannel`. To get more info about a subcommand, use `$rb_help`
|
|
|
94
|
+again. e.g. `$rb_help config setwarningchannel`.
|
|
|
95
|
+
|
|
|
96
|
+## Cogs
|
|
|
97
|
+
|
|
|
98
|
+This section goes through each cog, what it does, and how to use it.
|
|
|
99
|
+
|
|
|
100
|
+### Autokick
|
|
|
101
|
+
|
|
|
102
|
+Autokick is a feature of last resort, a sort of lockdown mode that immediately
|
|
|
103
|
+kicks all new users who join. (Users who joined before enabling this are fine.)
|
|
|
104
|
+We have on one occasion had some kind of bot that was doing tons and tons of
|
|
|
105
|
+joins, and there was no other way to stop them. Obviously something you want to
|
|
|
106
|
+supervise and disable as soon as the threat has passed.
|
|
|
107
|
+
|
|
|
108
|
+Subcommands
|
|
|
109
|
+- `enable`/`disable` - Toggle autokicking
|
|
|
110
|
+- `getbancount`/`setbancount` - If the same person keeps rejoining after being
|
|
|
111
|
+ kicked, ban them after this many rejoins.
|
|
|
112
|
+- `getofflineonly`/`setofflineonly` - Whether to only kick users who join with
|
|
|
113
|
+ a status of offline. That's not impossible in ordinary use, but it's
|
|
|
114
|
+ suspect and likely indicative of bots versus real users.
|
|
|
115
|
+
|
|
|
116
|
+### Config
|
|
|
117
|
+
|
|
|
118
|
+General config that isn't specific to one cog.
|
|
|
119
|
+
|
|
|
120
|
+Subcommands
|
|
|
121
|
+- `getwarningchannel`/`setwarningchannel` - Determines the channel where log
|
|
|
122
|
+ messages are posted. Setting the warning channel doesn't take an argument; it
|
|
|
123
|
+ uses the current channel you typed the command in.
|
|
|
124
|
+- `getwarningmention`/`setwarningmention` - The user or role you want tagged when
|
|
|
125
|
+ the bot needs to alert someone of suspicious activity. Needs to be a proper
|
|
|
126
|
+ autocompleted @ mention, not just the name.
|
|
|
127
|
+
|
|
|
128
|
+### Crosspost detection
|
|
|
129
|
+
|
|
|
130
|
+Detects an extremely common pattern we see of someone joining and copy/pasting
|
|
|
131
|
+the exact same message in as many channels as possible. This cog will look at
|
|
|
132
|
+recent messages from a user and see which ones contain the exact same text in
|
|
|
133
|
+multiple channels, and if it exceeds the configured number within the configured
|
|
|
134
|
+time span, it's ban hammer time.
|
|
|
135
|
+
|
|
|
136
|
+Subcommands
|
|
|
137
|
+- `enable`/`disable` - Master toggle for this entire feature.
|
|
|
138
|
+- `getwarncount`/`setwarncount` - How many duplicate messages will cause a
|
|
|
139
|
+ warning message to be posted that alerts the mods.
|
|
|
140
|
+- `getbancount`/`setbancount` - How many duplicate messages should result in an
|
|
|
141
|
+ automatic ban. Should be greater than the warning count.
|
|
|
142
|
+- `gettimespan`/`settimespan` - Sets the time window within which to look for
|
|
|
143
|
+ duplicates. Value is in seconds. Spammers usually fire these off very quickly,
|
|
|
144
|
+ so a minute or less is more than enough.
|
|
|
145
|
+- `getminlength`/`setminlength` - For text-only messages, sets the minimum length
|
|
|
146
|
+ to be considered for duplicate detection. Maybe a benign (but annoying) user
|
|
|
147
|
+ posts "lol" at everything in multiple channels. Use this to filter for that
|
|
|
148
|
+ case.
|
|
|
149
|
+
|
|
|
150
|
+### General
|
|
|
151
|
+
|
|
|
152
|
+These are just general top-level commands, not subcommands.
|
|
|
153
|
+
|
|
|
154
|
+Commands
|
|
|
155
|
+- `deletemessages <@user> <timespan>` - Manually deletes a bunch of messages by a
|
|
|
156
|
+ particular user. Useful if you banned but accidentally forgot to delete
|
|
|
157
|
+ recent history, or to clean up after someone had a bit of a manic posting
|
|
|
158
|
+ spree. The timespan is a value like "30s" for 30 seconds, "5m" for 5
|
|
|
159
|
+ minutes, or "1h30m" for an hour and a half. NOTE: This only works for fairly
|
|
|
160
|
+ recent messages. You can't use it to delete things posted way back in the
|
|
|
161
|
+ scrollback.
|
|
|
162
|
+- `hello` - Just for testing bot responsiveness. Or a desperate need to be seen.
|
|
|
163
|
+- `shutdown` - Terminates the bot. I forgot this was here. I've never needed it.
|
|
|
164
|
+ If somehow the bot goes rogue and you're not there to ctrl+C it, use this.
|
|
|
165
|
+- `testwarn` - Posts a test mod warning in the configured warning channel with
|
|
|
166
|
+ the configured mention user/role.
|
|
|
167
|
+
|
|
|
168
|
+### Join age
|
|
|
169
|
+
|
|
|
170
|
+This cog isn't really needed any more since the Members tab was added to Discord.
|
|
|
171
|
+It's used for seeing who joined most recently. The list of recent joins is only
|
|
|
172
|
+kept in memory, and it keeps a limited number, so it's really only useful for
|
|
|
173
|
+the past few days.
|
|
|
174
|
+
|
|
|
175
|
+Subcommands
|
|
|
176
|
+- `enable`/`disable` - Toggle join tracking.
|
|
|
177
|
+- `getjointime`/`setjointime` - How long to track a join, in seconds.
|
|
|
178
|
+- `search <timespan>` - Shows all users who joined in the last x length of time.
|
|
|
179
|
+ Values are like `30s` for 30 seconds, `5m` for 5 minutes, `1h30m` for an hour
|
|
|
180
|
+ and a half, etc.
|
|
|
181
|
+
|
|
|
182
|
+### Join raids
|
|
|
183
|
+
|
|
|
184
|
+While not as common in the past year or two, we used to get a suspicious number
|
|
|
185
|
+of users all joining in very close succession with no obvious cause, followed
|
|
|
186
|
+by users being spammed in DMs by them. This cog attempts to alert us to such
|
|
|
187
|
+spikes in joins.
|
|
|
188
|
+
|
|
|
189
|
+Subcommands
|
|
|
190
|
+- `enable`/`disable` - Toggle the feature.
|
|
|
191
|
+- `getjoincount`/`setjoincount` - Sets the minimum number of suspicious joins.
|
|
|
192
|
+- `getjointime`/`setjointime` - Sets the span of time that number of joins must
|
|
|
193
|
+ occur to be suspicious, in seconds.
|
|
|
194
|
+
|
|
|
195
|
+### Logging
|
|
|
196
|
+
|
|
|
197
|
+We found it valuable to log certain events, namely message edits and deletions,
|
|
|
198
|
+due to some users frequently saying something questionable and then covering
|
|
|
199
|
+their tracks. We used to use another bot to do that until it silently just
|
|
|
200
|
+decided to stop being maintained. Thanks. So this cog attempts to reproduce
|
|
|
201
|
+that, logging as many meaningful events as possible.
|
|
|
202
|
+
|
|
|
203
|
+Subcommands
|
|
|
204
|
+- `enable`/`disable` - You get the full firehose or you get nothing.
|
|
|
205
|
+
|
|
|
206
|
+### Patterns
|
|
|
207
|
+
|
|
|
208
|
+This is the most flexible cog. It can match arbitrary messages with complex
|
|
|
209
|
+criteria and take a number of automatic actions on them. The full syntax is kind
|
|
|
210
|
+of complex and is detailed in its [own document](patterns.md).
|
|
|
211
|
+
|
|
|
212
|
+Subcommands
|
|
|
213
|
+- `add ...` - Adds a new pattern to look for (see [Patterns](patterns.md)).
|
|
|
214
|
+- `remove <name>` - Removes a previously added pattern by name.
|
|
|
215
|
+- `list` - Show all configured patterns.
|
|
|
216
|
+- `setpriority <name> <priority>` - Alters the priority of a pattern. The
|
|
|
217
|
+ priority is a unitless value used to pick which pattern wins if a message
|
|
|
218
|
+ matches more than one. Patterns without priorities set have a default value
|
|
|
219
|
+ of 100. The highest value wins.
|
|
|
220
|
+
|
|
|
221
|
+### URL spam
|
|
|
222
|
+
|
|
|
223
|
+This cog detects two kinds of suspicious link post behaviors.
|
|
|
224
|
+
|
|
|
225
|
+The first is posting a link suspiciously soon after joining. Honestly, this has
|
|
|
226
|
+had a pretty low hit rate. Join age seems unreliable. Supposedly, Discord
|
|
|
227
|
+imposes a 10m cooldown after joining a server before you can post, but I've
|
|
|
228
|
+seen people post within the first minute. And they are usually benign, like a
|
|
|
229
|
+reaction GIF or relevant Twitch clip. While the actual spammers don't seem to
|
|
|
230
|
+get flagged, as they seem to use accounts that have been lying in wait a long
|
|
|
231
|
+time. YMMV.
|
|
|
232
|
+
|
|
|
233
|
+The second is deceptive links. Discord added the ability in 2024 or 25 to change
|
|
|
234
|
+the text of a link instead of it always just showing the URL using the markdown
|
|
|
235
|
+syntax `[link text](https://urlhere)` which shows up as "link text" in blue.
|
|
|
236
|
+While Discord does warn users whenever they click a link where the text isn't
|
|
|
237
|
+exactly the same as the URL, this happens in benign circumstances often enough
|
|
|
238
|
+that users may ignore it. Discord prevents posting mismatching URLs like
|
|
|
239
|
+`[https://goodsite.com](https://badsite.com)`, however it doesn't prevent posting
|
|
|
240
|
+things that are URL-like, like `[goodsite.com](https://badsite.com)` (without
|
|
|
241
|
+the `https://`). Our deceptive link detection catches these URL-like link labels.
|
|
|
242
|
+
|
|
|
243
|
+Subcommands
|
|
|
244
|
+- `enable`/`disable` - Toggle the feature.
|
|
|
245
|
+- `getjoinage`/`setjoinage` - Sets the length of time after joining when posted
|
|
|
246
|
+ links are considered suspicious, in seconds.
|
|
|
247
|
+- `getaction`/`setaction` - Action to take when a join age link is detected.
|
|
|
248
|
+ One of these values:
|
|
|
249
|
+ - `nothing` - Ignore
|
|
|
250
|
+ - `modwarn` - Post a warning message in the log channel and tag mods.
|
|
|
251
|
+ - `delete` - Delete the message.
|
|
|
252
|
+ - `kick` - Kick the user.
|
|
|
253
|
+ - `ban` - Ban the user.
|
|
|
254
|
+- `getdeceptiveaction`/`setdeceptiveaction` - Action to take when a deceptive
|
|
|
255
|
+ link is detected. One of these values:
|
|
|
256
|
+ - `nothing` - Ignore
|
|
|
257
|
+ - `modwarn` - Post a warning message in the log channel and tag mods.
|
|
|
258
|
+ - `modwarndelete` - Post a mod warning message and delete the message.
|
|
|
259
|
+ - `chatwarn` - Reply to the message in the same channel calling out the
|
|
|
260
|
+ suspicious link.
|
|
|
261
|
+ - `chatwarndelete` - Reply to the message and delete it.
|
|
|
262
|
+ - `delete` - Delete the message.
|
|
|
263
|
+ - `kick` - Kick the user.
|
|
|
264
|
+ - `ban` - Ban the user.
|
|
|
265
|
+
|
|
|
266
|
+### Username patterns
|
|
|
267
|
+
|
|
|
268
|
+Notifies us when users with certain usernames join a server. Problem users will
|
|
|
269
|
+often get banned and just create another similarly named account, so this
|
|
|
270
|
+helps us catch ban evasion. When a matching username joins the server, a mod
|
|
|
271
|
+warning message will be posted in the log channel. The pattern is just a simple
|
|
|
272
|
+substring matched case-insensitively.
|
|
|
273
|
+
|
|
|
274
|
+Subcommands
|
|
|
275
|
+- `enable`/`disable` - Toggle the feature.
|
|
|
276
|
+- `add <pattern>` - Adds a substring to look for in usernames of newly joined members.
|
|
|
277
|
+- `remove <pattern>` - Removes a pattern.
|
|
|
278
|
+- `list` - Lists all tracked patterns.
|