SquadJS/plugins/discord-debug
2020-05-21 22:04:16 +01:00
..
index.js Remove unused function names. 2020-05-21 22:04:16 +01:00
README.md SquadJS v1 2020-05-15 18:42:39 +01:00

Logo

SquadJS - Discord Debug

About

The Discord Debug plugin logs all server events in a raw format for monitoring/debugging/testing purposes.

Installation

// Place the following two lines at the top of your index.js file.
import Discord from 'discord.js';
import { discordDebug } from 'plugins';

// Import the events you wish to log in your index.js file. A full list can be found in the directory specified below.
import {
  LOG_PARSER_PLAYER_CONNECTED,
  LOG_PARSER_PLAYER_WOUNDED,
} from 'squad-server/events/log-parser';

// Place the following two lines in your index.js file before using an Discord plugins.
const discordClient = new Discord.Client();
await discordClient.login('Discord Login Token'); // insert your Discord bot's login token here.

// Place the following lines after all of the above.
await discordDebug(
  server,
  discordClient,
  'discordChannelID', 
  [LOG_PARSER_PLAYER_CONNECTED, LOG_PARSER_PLAYER_WOUNDED] // List the events you wish to log.
);