@helyx/bot 1.4.0 → 1.5.1
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/CHANGELOG.md +33 -0
- package/dist/channel-audit-configuration.d.ts +7 -0
- package/dist/channel-audit-configuration.js +40 -0
- package/dist/channel-audit-control.d.ts +14 -0
- package/dist/channel-audit-control.js +61 -0
- package/dist/channel-audit-permissions.d.ts +56 -0
- package/dist/channel-audit-permissions.js +417 -0
- package/dist/channel-audit-routes.d.ts +4 -0
- package/dist/channel-audit-routes.js +42 -0
- package/dist/cloud-connector.js +2 -0
- package/dist/cloud-control-dispatcher.js +22 -0
- package/dist/command-registration-policy.js +1 -0
- package/dist/control-errors.d.ts +8 -0
- package/dist/control-errors.js +24 -0
- package/dist/control-server-schemas.d.ts +2 -2
- package/dist/control-server.d.ts +4 -1
- package/dist/control-server.js +18 -25
- package/dist/diagnostic-command.d.ts +76 -0
- package/dist/diagnostic-command.js +1962 -0
- package/dist/discord-channel-audit.d.ts +9 -0
- package/dist/discord-channel-audit.js +195 -0
- package/dist/discord-guild-health.d.ts +2 -2
- package/dist/discord-role-safety.d.ts +4 -0
- package/dist/discord-role-safety.js +30 -0
- package/dist/events.d.ts +2 -0
- package/dist/events.js +5 -20
- package/dist/hosted-server-moderation.d.ts +2 -2
- package/dist/index.js +30 -1
- package/dist/shard-contracts.d.ts +87 -0
- package/dist/shard-contracts.js +39 -0
- package/dist/shard-router.d.ts +2 -0
- package/dist/shard-router.js +12 -0
- package/dist/shard-supervisor.js +7 -0
- package/dist/shard-worker.d.ts +1 -0
- package/dist/shard-worker.js +38 -1
- package/documentation/reference/environment.md +1 -1
- package/package.json +7 -7
package/dist/shard-worker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseBotEnvironment } from "@helyx/config";
|
|
2
2
|
import { safeError, ServiceRegistry } from "@helyx/core";
|
|
3
|
-
import { checkDatabaseConnection, createDatabasePool, PremiumAllocationRepository, } from "@helyx/database";
|
|
3
|
+
import { checkDatabaseConnection, createDatabasePool, PremiumAllocationRepository, InstallationRepository, } from "@helyx/database";
|
|
4
4
|
import { assertRepositoryEngineSupported } from "@helyx/database/adapters";
|
|
5
5
|
import { REVIEWED_PREMIUM_MODULE_IDS } from "@helyx/module-manifest";
|
|
6
6
|
import { createRuntime } from "@helyx/framework";
|
|
@@ -18,6 +18,8 @@ import { installCreatorInvitePlatform } from "./creator-onboarding-platform.js";
|
|
|
18
18
|
import { installGuildTracking, } from "./guilds.js";
|
|
19
19
|
import { installInteractions, } from "./interactions.js";
|
|
20
20
|
import { createManagementModule } from "./management-module.js";
|
|
21
|
+
import { createDiagnosticModule, createPostgresDiagnosticLock, } from "./diagnostic-command.js";
|
|
22
|
+
import { GuildCommandReadService } from "./guild-command-read-service.js";
|
|
21
23
|
import { DiscordModuleLoggingService } from "./module-logging.js";
|
|
22
24
|
import { resolveModulePackageSpecifiers } from "./module-configuration.js";
|
|
23
25
|
import { loadConfiguredModulePackages, platformServiceOptions, secureRandomSelectionWorkerKeyName, } from "./modules.js";
|
|
@@ -158,6 +160,35 @@ export async function startShardWorker(processEnvironment = process.env, identit
|
|
|
158
160
|
const guildResources = new DiscordGuildResourceDirectory(client);
|
|
159
161
|
const permissionsModule = createPermissionsModule(featureModules);
|
|
160
162
|
const managementModule = createManagementModule(featureModules, guildResources);
|
|
163
|
+
const diagnosticInstallations = new InstallationRepository(database);
|
|
164
|
+
const diagnosticModule = createDiagnosticModule({
|
|
165
|
+
client,
|
|
166
|
+
modules: featureModules,
|
|
167
|
+
runExclusive: createPostgresDiagnosticLock(database),
|
|
168
|
+
assertGuildAvailable: async (guildId) => {
|
|
169
|
+
if (shuttingDown ||
|
|
170
|
+
guildIdToShardId(guildId, identity.shardCount) !== identity.shardId)
|
|
171
|
+
throw new Error("The server is no longer owned by this shard");
|
|
172
|
+
const installation = await diagnosticInstallations.getActiveGuild(guildId);
|
|
173
|
+
if (!installation ||
|
|
174
|
+
installation.shardGeneration !== identity.generation ||
|
|
175
|
+
installation.shardDeploymentOrder !==
|
|
176
|
+
BigInt(identity.deploymentOrder ?? 1) ||
|
|
177
|
+
installation.shardSupervisorId !== identity.supervisorId ||
|
|
178
|
+
installation.shardId !== identity.shardId ||
|
|
179
|
+
installation.shardFencingToken !== BigInt(identity.fencingToken))
|
|
180
|
+
throw new Error("The server installation or shard ownership changed");
|
|
181
|
+
},
|
|
182
|
+
listEnabledModules: (guildId) => diagnosticInstallations.listEnabledModules(guildId),
|
|
183
|
+
commandStatus: {
|
|
184
|
+
get: (guildId) => {
|
|
185
|
+
return guildCommandReads.getStatus(guildId);
|
|
186
|
+
},
|
|
187
|
+
refresh: (input) => {
|
|
188
|
+
return guildCommandReads.refreshStatus(input);
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
});
|
|
161
192
|
cloudProxy = new WorkerCloudConnectorProxy();
|
|
162
193
|
const cloudManagementModule = environment.HELYX_CLOUD_CONNECT_ENABLED
|
|
163
194
|
? createCloudManagementModule({
|
|
@@ -184,6 +215,7 @@ export async function startShardWorker(processEnvironment = process.env, identit
|
|
|
184
215
|
: undefined;
|
|
185
216
|
const publicModules = [
|
|
186
217
|
managementModule,
|
|
218
|
+
diagnosticModule,
|
|
187
219
|
permissionsModule,
|
|
188
220
|
supportModule,
|
|
189
221
|
privacyModule,
|
|
@@ -206,6 +238,7 @@ export async function startShardWorker(processEnvironment = process.env, identit
|
|
|
206
238
|
: {}),
|
|
207
239
|
coreFunctions: [
|
|
208
240
|
managementModule,
|
|
241
|
+
diagnosticModule,
|
|
209
242
|
permissionsModule,
|
|
210
243
|
supportModule,
|
|
211
244
|
privacyModule,
|
|
@@ -224,6 +257,7 @@ export async function startShardWorker(processEnvironment = process.env, identit
|
|
|
224
257
|
...publicModules,
|
|
225
258
|
...(operationsModule ? [operationsModule] : []),
|
|
226
259
|
];
|
|
260
|
+
const guildCommandReads = new GuildCommandReadService(database, environment.DISCORD_CLIENT_ID, undefined, environment.DISCORD_TOKEN, environment.HELYX_GUILD_COMMAND_WRITES_ENABLED, environment.HELYX_GUILD_COMMAND_WRITE_GUILD_IDS, environment.HELYX_GUILD_COMMAND_WRITE_SCOPE === "all", modules);
|
|
227
261
|
const platformServices = new Map();
|
|
228
262
|
const serviceAccess = new ServiceRegistry(platformServices);
|
|
229
263
|
const serviceOptions = platformServiceOptions(environment, publicModules);
|
|
@@ -328,6 +362,7 @@ export async function startShardWorker(processEnvironment = process.env, identit
|
|
|
328
362
|
runtime = createRuntime({ modules, logger, services: platformServices });
|
|
329
363
|
const enabledCoreModuleIds = new Set([
|
|
330
364
|
managementModule.manifest.id,
|
|
365
|
+
diagnosticModule.manifest.id,
|
|
331
366
|
permissionsModule.manifest.id,
|
|
332
367
|
supportModule.manifest.id,
|
|
333
368
|
...(premiumActivationModule ? [premiumActivationModule.manifest.id] : []),
|
|
@@ -359,6 +394,7 @@ export async function startShardWorker(processEnvironment = process.env, identit
|
|
|
359
394
|
? { operationsModuleId: operationsModule.manifest.id }
|
|
360
395
|
: {}),
|
|
361
396
|
supportModuleId: supportModule.manifest.id,
|
|
397
|
+
diagnosticModuleId: diagnosticModule.manifest.id,
|
|
362
398
|
...(premiumActivationModule
|
|
363
399
|
? { premiumActivationModuleId: premiumActivationModule.manifest.id }
|
|
364
400
|
: {}),
|
|
@@ -563,6 +599,7 @@ export function shardWorkerCommandRegistration(input) {
|
|
|
563
599
|
synchronise: false,
|
|
564
600
|
selfAuthorizingGuildModuleIds: new Set([
|
|
565
601
|
input.supportModuleId,
|
|
602
|
+
...(input.diagnosticModuleId ? [input.diagnosticModuleId] : []),
|
|
566
603
|
...(input.premiumActivationModuleId
|
|
567
604
|
? [input.premiumActivationModuleId]
|
|
568
605
|
: []),
|
|
@@ -37,7 +37,7 @@ commented.
|
|
|
37
37
|
|
|
38
38
|
Enable privileged intents in the Discord Developer Portal as well as the bot
|
|
39
39
|
environment when required: Counting needs Message Content, Welcome and Access
|
|
40
|
-
Control need Guild Members, and
|
|
40
|
+
Control need Guild Members. Levels needs Guild Members, and Message Content only when using **Custom message types** rather than **All messages**. Access Control's Password
|
|
41
41
|
Entry also needs Message Content. The corresponding variables are
|
|
42
42
|
`HELYX_MESSAGE_CONTENT_ENABLED` and `HELYX_GUILD_MEMBERS_ENABLED`.
|
|
43
43
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helyx/bot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Production Discord runtime for the modular Helyx platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"helyx",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@helyx/config": ">=1.4.0 <2.0.0",
|
|
54
|
-
"@helyx/control-protocol": ">=0.
|
|
54
|
+
"@helyx/control-protocol": ">=0.8.0 <0.9.0",
|
|
55
55
|
"@helyx/core": ">=0.2.0 <0.3.0",
|
|
56
|
-
"@helyx/database": ">=2.4.
|
|
56
|
+
"@helyx/database": ">=2.4.1 <3.0.0",
|
|
57
57
|
"@helyx/database-contracts": ">=0.2.0 <0.3.0",
|
|
58
58
|
"@helyx/framework": ">=0.2.0 <0.3.0",
|
|
59
59
|
"@helyx/module-manifest": ">=0.13.0 <0.14.0",
|
|
60
60
|
"@helyx/platform": ">=1.3.0 <2.0.0",
|
|
61
|
-
"@helyx/sdk": ">=0.
|
|
61
|
+
"@helyx/sdk": ">=0.16.0 <0.17.0",
|
|
62
62
|
"@helyx/status-client": ">=0.3.0 <0.4.0",
|
|
63
63
|
"@helyx/verification-contracts": ">=0.4.0 <0.5.0",
|
|
64
64
|
"discord.js": "14.27.0",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"zod": "4.4.3"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"@helyx/database-mysql": ">=0.2.
|
|
73
|
+
"@helyx/database-mysql": ">=0.2.1 <0.3.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@helyx/module-automod": ">=1.1.
|
|
77
|
-
"@helyx/module-moderation": ">=1.1.
|
|
76
|
+
"@helyx/module-automod": ">=1.1.1 <2.0.0",
|
|
77
|
+
"@helyx/module-moderation": ">=1.1.1 <2.0.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"@helyx/module-automod": {
|