The DiscordDebug
plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.
Discord connector name.
+discord
+The ID of the channel to log events to.
+
667741905228136459
+A list of events to dump.
+[]
[
+ "PLAYER_DIED"
+]
+ DiscordDebug
plugin can be used to help debug SquadJS by dumping SquadJS events to a ' +
+ 'Discord channel.'
+ );
+ }
+
+ static get defaultEnabled() {
+ return false;
+ }
+
+ static get optionsSpecification() {
+ return {
+ ...DiscordBasePlugin.optionsSpecification,
+ channelID: {
+ required: true,
+ description: 'The ID of the channel to log events to.',
+ default: '',
+ example: '667741905228136459'
+ },
+ events: {
+ required: true,
+ description: 'A list of events to dump.',
+ default: [],
+ example: ['PLAYER_DIED']
+ }
+ };
+ }
+
+ constructor(server, options) {
+ super(server, options);
+
+ for (const event of options.events) {
+ server.on(event, async (info) => {
+ await this.sendDiscordMessage(`\`\`\`${JSON.stringify({ ...info, event }, null, 2)}\`\`\``);
+ });
+ }
+ }
+}
diff --git a/squad-server/plugins/index.js b/squad-server/plugins/index.js
index 5e3ec98..0e32f45 100644
--- a/squad-server/plugins/index.js
+++ b/squad-server/plugins/index.js
@@ -4,6 +4,7 @@ import DiscordAdminBroadcast from './discord-admin-broadcast.js';
import DiscordAdminCamLogs from './discord-admin-cam-logs.js';
import DiscordAdminRequest from './discord-admin-request.js';
import DiscordChat from './discord-chat.js';
+import DiscordDebug from './discord-debug.js';
import DiscordPlaceholder from './discord-placeholder.js';
import DiscordRcon from './discord-rcon.js';
import DiscordSubsystemRestarter from './discord-subsystem-restarter.js';
@@ -17,6 +18,7 @@ const plugins = [
DiscordAdminCamLogs,
DiscordAdminRequest,
DiscordChat,
+ DiscordDebug,
DiscordPlaceholder,
DiscordRcon,
DiscordSubsystemRestarter,