adb-plugin-moderation 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/logCase.js CHANGED
@@ -29,6 +29,7 @@ async function createCase(CaseModel, { guildId, type, targetId, moderatorId, rea
29
29
  caseNumber,
30
30
  type,
31
31
  targetUserId: targetId,
32
+ userId: targetId,
32
33
  moderatorId,
33
34
  reason: reason || "No reason provided",
34
35
  duration: duration || null,
package/models/case.js CHANGED
@@ -11,6 +11,9 @@ const CaseSchema = new Schema({
11
11
  required: true,
12
12
  },
13
13
  targetUserId: { type: String, required: true },
14
+ // Same value as targetUserId; duplicated so the platform's member-scope
15
+ // query ({guildId, userId}) can find a member's own cases.
16
+ userId: { type: String, default: null, index: true },
14
17
  moderatorId: { type: String, required: true },
15
18
  reason: { type: String, default: "No reason provided" },
16
19
  duration: { type: String, default: null },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adb-plugin-moderation",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Core moderation commands for Advanced Discord Bot",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -29,4 +29,4 @@
29
29
  "devDependencies": {
30
30
  "mongoose": "^8.0.0"
31
31
  }
32
- }
32
+ }
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adb-plugin-moderation",
3
3
  "displayName": "Basic Moderation",
4
- "version": "1.1.0",
4
+ "version": "1.3.0",
5
5
  "description": "Core moderation commands: ban, kick, timeout, warn, purge, tickets, and case logging.",
6
6
  "author": "DeadIndian",
7
7
  "main": "index.js",
@@ -12,11 +12,15 @@
12
12
  "model": "persistent",
13
13
  "maxExecutionMs": 15000,
14
14
  "memoryMb": 256,
15
- "persistentReason": "Runs un-isolated (system:raw-client) for bulk message purge, channel lock/slowmode, ticket channel creation, and live guild/member lookups direct discord.js operations the sandboxed RPC surface cannot express."
15
+ "persistentReason": "Runs un-isolated (system:raw-client) for bulk message purge, channel lock/slowmode, ticket channel creation, and live guild/member lookups \u2014 direct discord.js operations the sandboxed RPC surface cannot express."
16
16
  },
17
17
  "capabilities": {
18
- "system": ["raw-client"],
19
- "storage": ["own-collection"],
18
+ "system": [
19
+ "raw-client"
20
+ ],
21
+ "storage": [
22
+ "own-collection"
23
+ ],
20
24
  "discord": [
21
25
  "BanMembers",
22
26
  "KickMembers",
@@ -26,11 +30,17 @@
26
30
  "SendMessages",
27
31
  "GuildInfo"
28
32
  ],
29
- "hooks": ["subscribe"]
33
+ "hooks": [
34
+ "subscribe"
35
+ ]
30
36
  },
31
37
  "permissions": {
32
- "system": ["raw-client"],
33
- "storage": ["own-collection"],
38
+ "system": [
39
+ "raw-client"
40
+ ],
41
+ "storage": [
42
+ "own-collection"
43
+ ],
34
44
  "discord": [
35
45
  "BanMembers",
36
46
  "KickMembers",
@@ -40,12 +50,56 @@
40
50
  "SendMessages",
41
51
  "GuildInfo"
42
52
  ],
43
- "hooks": ["subscribe"],
44
- "network": { "outbound": [] },
45
- "filesystem": { "read": [], "write": [] },
53
+ "hooks": [
54
+ "subscribe"
55
+ ],
56
+ "network": {
57
+ "outbound": []
58
+ },
59
+ "filesystem": {
60
+ "read": [],
61
+ "write": []
62
+ },
46
63
  "childProcess": false,
47
64
  "nativeAddons": false
48
65
  },
66
+ "engines": {
67
+ "core": ">=2.0.0",
68
+ "plugins": {
69
+ "administration": ">=2.0.0"
70
+ }
71
+ },
72
+ "settings": {
73
+ "commandPermissions": true,
74
+ "schema": [
75
+ {
76
+ "key": "log_channel_id",
77
+ "type": "channel",
78
+ "label": "Mod log channel"
79
+ },
80
+ {
81
+ "key": "ticket_category_id",
82
+ "type": "string",
83
+ "label": "Ticket category ID"
84
+ },
85
+ {
86
+ "key": "ticket_support_role_id",
87
+ "type": "role",
88
+ "label": "Ticket support role"
89
+ },
90
+ {
91
+ "key": "ticket_log_channel_id",
92
+ "type": "channel",
93
+ "label": "Ticket log channel"
94
+ },
95
+ {
96
+ "key": "dm_on_action",
97
+ "type": "boolean",
98
+ "label": "DM user on mod action",
99
+ "default": true
100
+ }
101
+ ]
102
+ },
49
103
  "declaredDependencies": [],
50
104
  "discordPermissions": [
51
105
  "BanMembers",
@@ -54,23 +108,85 @@
54
108
  "ManageMessages",
55
109
  "ManageChannels"
56
110
  ],
111
+ "webUi": {
112
+ "memberPages": [
113
+ {
114
+ "path": "/me/mod-record",
115
+ "label": "My Mod Record",
116
+ "icon": "Shield",
117
+ "source": { "model": "Case", "scope": "member", "sort": { "createdAt": -1 }, "limit": 100 },
118
+ "view": {
119
+ "type": "table",
120
+ "empty": "You have a clean record in this server.",
121
+ "columns": [
122
+ { "field": "caseNumber", "label": "Case" },
123
+ { "field": "type", "label": "Type" },
124
+ { "field": "reason", "label": "Reason" },
125
+ { "field": "active", "label": "Active" },
126
+ { "field": "createdAt", "label": "Date" }
127
+ ]
128
+ }
129
+ },
130
+ {
131
+ "path": "/me/tickets",
132
+ "label": "My Tickets",
133
+ "icon": "LifeBuoy",
134
+ "source": { "model": "Ticket", "scope": "member", "sort": { "createdAt": -1 }, "limit": 50 },
135
+ "view": {
136
+ "type": "table",
137
+ "empty": "You have no tickets in this server.",
138
+ "columns": [
139
+ { "field": "reason", "label": "Reason" },
140
+ { "field": "status", "label": "Status" },
141
+ { "field": "createdAt", "label": "Opened" },
142
+ { "field": "closedAt", "label": "Closed" }
143
+ ]
144
+ }
145
+ }
146
+ ]
147
+ },
57
148
  "configSchema": {
58
149
  "type": "object",
59
150
  "properties": {
60
- "log_channel_id": { "type": "string", "default": null },
61
- "ticket_category_id": { "type": "string", "default": null },
62
- "ticket_support_role_id": { "type": "string", "default": null },
63
- "ticket_log_channel_id": { "type": "string", "default": null },
151
+ "log_channel_id": {
152
+ "type": "string",
153
+ "default": null
154
+ },
155
+ "ticket_category_id": {
156
+ "type": "string",
157
+ "default": null
158
+ },
159
+ "ticket_support_role_id": {
160
+ "type": "string",
161
+ "default": null
162
+ },
163
+ "ticket_log_channel_id": {
164
+ "type": "string",
165
+ "default": null
166
+ },
64
167
  "warn_thresholds": {
65
168
  "type": "object",
66
169
  "default": {
67
- "3": { "action": "timeout", "duration": "1h" },
68
- "5": { "action": "timeout", "duration": "24h" },
69
- "7": { "action": "kick" },
70
- "10": { "action": "ban" }
170
+ "3": {
171
+ "action": "timeout",
172
+ "duration": "1h"
173
+ },
174
+ "5": {
175
+ "action": "timeout",
176
+ "duration": "24h"
177
+ },
178
+ "7": {
179
+ "action": "kick"
180
+ },
181
+ "10": {
182
+ "action": "ban"
183
+ }
71
184
  }
72
185
  },
73
- "dm_on_action": { "type": "boolean", "default": true }
186
+ "dm_on_action": {
187
+ "type": "boolean",
188
+ "default": true
189
+ }
74
190
  }
75
191
  }
76
192
  }