From e37f6aad08fa3bb76c65af68d54853040d343adc Mon Sep 17 00:00:00 2001
From: Levent007 The The Discord connector name. Message SquadJS will send to players warning them they will be kicked Command to create Discord placeholder. Message to send to players when they are kicked How often in Seconds should we warn the player about being unassigned? How long in Seconds to wait before a unassigned player is kicked Player count required for AutoKick to start kicking players, set to -1 to disable Time delay in Seconds from start of the round before AutoKick starts kicking againDiscordPlaceholder
- DiscordPlaceholder
- DiscordPlaceholder
plugin allows you to make your bot create placeholder messages that can be used when configuring other plugins.AutoKickUnassigned
+ AutoKickUnassigned
+ AutoKickUnassigned
plugin will automatically kick players that are not in a squad after a specified ammount of time.Options
- discordClient (Required)
+
+ warningMessage
Description
- Default
- discord
command
+ Join a squad, you are are unassigned and will be kicked
kickMessage
Description
- Default
- !placeholder
Unassigned - automatically removed
frequencyOfWarnings
+ Description
+ Default
+ 30
unassignedTimer
+ Description
+ Default
+ 360
playerThreshold
+ Description
+ Default
+ 93
roundStartDelay
+ Description
+ Default
+ 900
ignoreAdmins
+ Description
+ true
: Admins will NOT be kickedfalse
: Admins WILL be kicked
false
+true
: Reserve slot players will NOT be kickedfalse
: Reserve slot players WILL be kickedfalse
The DiscordSubSystemRestarter
plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.
!squadjs restartsubsystem rcon
!squadjs restartsubsystem logparser
The AutoTkWarn
plugin will automatically warn players with a message when they teamkill.
Discord connector name.
+The message to warn players with.
discord
Please apologise for ALL TKs in ALL chat!
The ChatCommands
plugin can be configured to make chat commands that broadcast or warn the caller with present messages.
ID of role required to run the sub system restart commands.
+An array of objects containing the following properties:
command
- The command that initiates the message.type
- Either warn
or broadcast
.response
- The message to respond with.ignoreChats
- A list of chats to ignore the commands in. Use this to limit it to admins.
667741905228136459
+ [
+ {
+ "command": "squadjs",
+ "type": "warn",
+ "response": "This server is powered by SquadJS.",
+ "ignoreChats": []
+ }
+]
The DiscordChat
plugin will log in-game chat to a Discord channel.
The mysql-log
plugin will log various server statistics and events to a database. This is great for server performance monitoring and/or player stat tracking.
+
+Grafana (NOT YET WORKING WITH V2):
+
SquadJS
.The Sequelize connector to log server information to.
+mysql
A overridden server ID.
+null
The DiscordAdminBroadcast
plugin will send a copy of admin broadcasts made in game to a Discord channel.
667741905228136459
-The color of the embed for each chat.
-{}
{
- "ChatAll": 16761867
-}
The color of the embed.
16761867
A list of chat names to ignore.
-[
- "ChatSquad"
-]
16761867
The DiscordAdminBroadcast
plugin will send a copy of admin broadcasts made in game to a Discord channel.
The DiscordAdminCamLogs
plugin will log in game admin camera usage to a Discord channel.
discord
The ID of the channel to log admin broadcasts to.
+The ID of the channel to log admin camera usage to.
667741905228136459
@@ -421,83 +473,41 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
The DiscordServerStatus
plugin updates a message in Discord with current server information, e.g. player count.
The DiscordChat
plugin will log in-game chat to a Discord channel.
Discord connector name.
discord
ID of messages to update.
-[]
[
- {
- "channelID": "667741905228136459",
- "messageID": "766688383043895387"
- }
-]
-How frequently to update the status in Discord.
-60000
Disable the bot status.
-false
The AutoKickUnassigned
plugin will automatically kick players that are not in a squad after a specified ammount of time.
Message SquadJS will send to players warning them they will be kicked
-Join a squad, you are are unassigned and will be kicked
Message to send to players when they are kicked
-Unassigned - automatically removed
How often in Seconds should we warn the player about being unassigned?
-30
How long in Seconds to wait before a unassigned player is kicked
-360
Player count required for AutoKick to start kicking players, set to -1 to disable
+The ID of the channel to log admin broadcasts to.
93
667741905228136459
+Time delay in Seconds from start of the round before AutoKick starts kicking again
+The color of the embed for each chat.
900
{}
{
+ "ChatAll": 16761867
+}
+true
: Admins will NOT be kickedfalse
: Admins WILL be kickedThe color of the embed.
false
16761867
true
: Reserve slot players will NOT be kickedfalse
: Reserve slot players WILL be kickedA list of chat names to ignore.
false
[
+ "ChatSquad"
+]
The IntervalledBroadcasts
plugin allows you to set broadcasts, which will be broadcasted at preset intervals
The DiscordPlaceholder
plugin allows you to make your bot create placeholder messages that can be used when configuring other plugins.
Messages to broadcast.
+Discord connector name.
[]
[
- "This server is powered by SquadJS."
-]
-discord
Frequency of the broadcasts in milliseconds.
+Command to create Discord placeholder.
300000
!placeholder
The DiscordTeamkill
plugin logs teamkills and related information to a Discord channel for admins to review.
The DiscordRcon
plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.
discord
The ID of the channel to log teamkills to.
+ID of channel to turn into RCON console.
667741905228136459
-The color of the embeds.
+{}
) permissions will be disabled16761867
{}
{
+ "123456789123456789": [
+ "AdminBroadcast",
+ "AdminForceTeamChange",
+ "AdminDemoteCommander"
+ ]
+}
+Disable Squad Community Ban List information.
+Prepend admin names when making announcements.
false
The SeedingMode
plugin broadcasts seeding rule messages to players at regular intervals when the server is below a specified player count. It can also be configured to display "Live" messages when the server goes live.
Frequency of seeding messages in milliseconds.
-150000
Player count required for server not to be in seeding mode.
-50
Seeding message to display.
-Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
Enable "Live" messages for when the server goes live.
-true
Player count required for "Live" messages to not bee displayed.
-52
"Live" message to display.
-Live!
The AutoTkWarn
plugin will automatically warn players with a message when they teamkill.
The message to warn players with.
-Please apologise for ALL TKs in ALL chat!
The mysql-log
plugin will log various server statistics and events to a database. This is great for server performance monitoring and/or player stat tracking.
-
-Grafana (NOT YET WORKING WITH V2):
-
SquadJS
.The Sequelize connector to log server information to.
-mysql
A overridden server ID.
-null
The ChatCommands
plugin can be configured to make chat commands that broadcast or warn the caller with present messages.
The DiscordServerStatus
plugin updates a message in Discord with current server information, e.g. player count.
An array of objects containing the following properties:
command
- The command that initiates the message.type
- Either warn
or broadcast
.response
- The message to respond with.ignoreChats
- A list of chats to ignore the commands in. Use this to limit it to admins.Discord connector name.
+discord
ID of messages to update.
[]
[
{
- "command": "squadjs",
- "type": "warn",
- "response": "This server is powered by SquadJS.",
- "ignoreChats": []
+ "channelID": "667741905228136459",
+ "messageID": "766688383043895387"
}
-]
How frequently to update the status in Discord.
+60000
Disable the bot status.
+false
The DiscordAdminCamLogs
plugin will log in game admin camera usage to a Discord channel.
The DiscordSubSystemRestarter
plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.
!squadjs restartsubsystem rcon
!squadjs restartsubsystem logparser
Discord connector name.
discord
The ID of the channel to log admin camera usage to.
+ID of role required to run the sub system restart commands.
667741905228136459
-The color of the embed.
-16761867
667741905228136459
The DiscordRcon
plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.
The DiscordTeamkill
plugin logs teamkills and related information to a Discord channel for admins to review.
discord
ID of channel to turn into RCON console.
+The ID of the channel to log teamkills to.
667741905228136459
-{}
) permissions will be disabledThe color of the embeds.
{}
{
- "123456789123456789": [
- "AdminBroadcast",
- "AdminForceTeamChange",
- "AdminDemoteCommander"
- ]
-}
-16761867
Prepend admin names when making announcements.
+Disable Squad Community Ban List information.
false
The TeamRandomizer
can be used to randomize teams. It's great for destroying clan stacks or for social events. It can be run by typing, by default, !randomize
into in-game admin chat
The IntervalledBroadcasts
plugin allows you to set broadcasts, which will be broadcasted at preset intervals
The command used to randomize the teams.
+Messages to broadcast.
randomize
[]
[
+ "This server is powered by SquadJS."
+]
+Frequency of the broadcasts in milliseconds.
+300000
6
The SeedingMode
plugin broadcasts seeding rule messages to players at regular intervals when the server is below a specified player count. It can also be configured to display "Live" messages when the server goes live.
Frequency of seeding messages in milliseconds.
+150000
Player count required for server not to be in seeding mode.
+50
Seeding message to display.
+Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
Enable "Live" messages for when the server goes live.
+true
Player count required for "Live" messages to not bee displayed.
+52
"Live" message to display.
+Live!
The SquadIOAPI
plugin allows remote access to a SquadJS instance via Socket.IO
The port for the websocket.
+
3000
+Your secret token/password for connecting.
+
MySecretPassword
+ The TeamRandomizer
can be used to randomize teams. It's great for destroying clan stacks or for social events. It can be run by typing, by default, !randomize
into in-game admin chat
The command used to randomize the teams.
+randomize
SquadIOAPI
plugin allows remote access to a SquadJS instance via Socket.IO';
+ }
+
+ static get defaultEnabled() {
+ return false;
+ }
+
+ static get optionsSpecification() {
+ return {
+ websocketPort: {
+ required: true,
+ description: 'The port for the websocket.',
+ default: '',
+ example: '3000'
+ },
+ securityToken: {
+ required: true,
+ description: 'Your secret token/password for connecting.',
+ default: '',
+ example: 'MySecretPassword'
+ }
+ };
+ }
+
+ constructor(server, options, connectors) {
+ super(server, options, connectors);
+
+ this.httpServer = createServer();
+
+ this.io = new Server(this.httpServer, {
+ cors: {
+ origin: 'http://localhost:3000',
+ methods: ['GET', 'POST'],
+ allowedHeaders: ['squadJS-connection-panel'],
+ credentials: true
+ }
+ });
+
+ this.io.use((socket, next) => {
+ if (socket.handshake.auth && socket.handshake.auth.token === this.options.securityToken) {
+ next();
+ } else {
+ next(new Error('Invalid token.'));
+ }
+ });
+
+ this.io.on('connection', (socket) => {
+ this.verbose(1, 'New Connection Made.');
+ this.bindListeners(socket, this.server);
+ this.bindListeners(socket, this.server.rcon, 'rcon.');
+ });
+ }
+
+ async mount() {
+ this.httpServer.listen(this.options.websocketPort);
+ }
+
+ async unmount() {
+ this.httpServer.close();
+ }
+
+ bindListeners(socket, obj, prefix = '') {
+ const ignore = [
+ 'options',
+ 'constructor',
+ 'watch',
+ 'unwatch',
+ 'setupRCON',
+ 'setupLogParser',
+ 'getPlayerByCondition',
+ 'pingSquadJSAPI',
+ '_events',
+ '_eventsCount',
+ '_maxListeners',
+ 'plugins',
+ 'rcon',
+ 'logParser',
+ 'updatePlayerListInterval',
+ 'updatePlayerListTimeout',
+ 'updateLayerInformationInterval',
+ 'updateLayerInformationTimeout',
+ 'updateA2SInformationInterval',
+ 'updateA2SInformationTimeout',
+ 'pingSquadJSAPIInterval',
+ 'pingSquadJSAPI',
+ 'pingSquadJSAPITimeout',
+ 'rcon.constructor',
+ 'rcon.processChatPacket',
+ 'rcon._events',
+ 'rcon._eventsCount',
+ 'rcon._maxListeners',
+ 'rcon.password',
+ 'rcon.connect',
+ 'rcon.onData',
+ 'rcon.onClose',
+ 'rcon.onError',
+ 'rcon.client',
+ 'rcon.autoReconnect',
+ 'rcon.autoReconnectTimeout',
+ 'rcon.incomingData',
+ 'rcon.incomingResponse',
+ 'rcon.responseCallbackQueue'
+ ];
+ for (const key of Object.getOwnPropertyNames(Object.getPrototypeOf(obj))) {
+ if (ignore.includes(`${prefix}${key}`)) continue;
+ this.verbose(1, `Setting method listener for ${prefix}${key}...`);
+ socket.on(`${prefix}${key}`, async (...rawArgs) => {
+ const args = rawArgs.slice(0, rawArgs.length - 1);
+ const callback = rawArgs[rawArgs.length - 1];
+ this.verbose(1, `Call to ${prefix}${key}(${args.join(', ')})`);
+ const reponse = await obj[key](...args);
+ callback(reponse);
+ });
+ }
+
+ for (const key of Object.getOwnPropertyNames(obj)) {
+ if (ignore.includes(`${prefix}${key}`)) continue;
+ this.verbose(1, `Setting properties listener for ${prefix}${key}...`);
+ socket.on(`${prefix}${key}`, (callback) => {
+ this.verbose(1, `Call to ${prefix}${key}...`);
+ const reponse = obj[key];
+ callback(reponse);
+ });
+ }
+ }
+}