Squad Server Script Framework
SquadJS is a scripting framework, designed for Squad servers, that aims to handle all communication and data collection to and from the servers. Using SquadJS as the base to any of your scripting projects allows you to easily write complex plugins without having to worry about the hassle of RCON or log parsing. However, for your convenience SquadJS comes shipped with multiple plugins already built for you allowing you to experience the power of SquadJS right away.
SquadJS relies on being able to access the Squad server log directory in order to parse logs live to collect information. Thus, SquadJS must be hosted on the same server box as your Squad server or be connected to your Squad server via FTP.
yarn install
in your terminal. Due to the use of Yarn Workspaces it is important to use yarn install
and not npm install
as this will not work and will break stuff.config.json
file. See below for more details.node index.js
in your terminal.Note - If you are interested in testing versions of SquadJS not yet released please download/clone the master
branch. Please also see here for more information on our versions and release procedures.
SquadJS can be configured via a JSON configuration file which, by default, is located in the SquadJS and is named config.json.
The config file needs to be valid JSON syntax. If an error is thrown saying the config cannot be parsed then try putting the config into a JSON syntax checker (there’s plenty to choose from that can be found via Google).
json
"server": {
"id": 1,
"host": "xxx.xxx.xxx.xxx",
"queryPort": 27165,
"rconPort": 21114,
"rconPassword": "password",
"logReaderMode": "tail",
"logDir": "C:/path/to/squad/log/folder",
"ftp": {
"host": "xxx.xxx.xxx.xxx",
"port": 21,
"user": "FTP Username",
"password": "FTP Password"
},
"sftp": {
"host": "xxx.xxx.xxx.xxx",
"port": 22,
"username": "SFTP Username",
"password": "SFTP Password"
},
"adminLists": [
{
"type": "local",
"source": "C:/Users/Administrator/Desktop/Servers/sq_arty_party/SquadGame/ServerConfig/Admins.cfg",
},
{
"type": "remote",
"source": "http://yourWebsite.com/Server1/Admins.cfg",
},
{
"type": "ftp",
"source": "ftp://<user>:<password>@<host>:<port>/<url-path>",
}
]
},
id
- An integer ID to uniquely identify the server.
host
- The IP of the server.queryPort
- The query port of the server.
rconPort
- The RCON port of the server.rconPassword
- The RCON password of the server.
logReaderMode
- tail
will read from a local log file, ftp
will read from a remote log file using the FTP protocol, sftp
will read from a remote log file using the SFTP protocol.logDir
- The folder where your Squad logs are saved. Most likely will be C:/servers/squad_server/SquadGame/Saved/Logs
.
ftp
- FTP configuration for reading logs remotely.sftp
- SFTP configuration for reading logs remotely.
adminLists
- Sources for identifying an admins on the server, either remote or local.json
"connectors": {
"discord": "Discord Login Token",
},
discord
, and should have the associated config against it. Configs can be specified by name in plugin options. Should a connector not be needed by any plugin then the default values can be left or you can remove it from your config file.discord.js
.json
"discord": "Discord Login Token",
json
"mysql": "mysql://user:pass@example.com:5432/dbname"
json
"sqlite": {
"dialect": "sqlite",
"storage": "path/to/database.sqlite"
}
plugins
section in your config file lists all plugins built into SquadJSjson
"plugins": [
{
"plugin": "auto-tk-warn",
"disabled": false,
"message": "Please apologise for ALL TKs in ALL chat!"
}
]
disabled
field can be toggled between true
/ false
to enabled/disable the plugin.logger
section configures how verbose a module of SquadJS will be as well as the displayed color.json
"logger": {
"verboseness": {
"SquadServer": 1,
"LogParser": 1,
"RCON": 1
},
"colors": {
"SquadServer": "yellowBright",
"SquadServerFactory": "yellowBright",
"LogParser": "blueBright",
"RCON": "redBright"
}
}
verboseness
section for a specified module the more it will print to the console.The following is a list of plugins built into SquadJS, you can click their title for more information:
Interested in creating your own plugin? See more here
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 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
93
Time delay in Seconds from start of the round before AutoKick starts kicking again
900
true
: Admins will NOT be kickedfalse
: Admins WILL be kicked
false
true
: Reserve slot players will NOT be kickedfalse
: Reserve slot players WILL be kicked
false
The AutoTkWarn
plugin will automatically warn players with a message when they teamkill.
The message to warn attacking players with.
Please apologise for ALL TKs in ALL chat!
The message that will be sent to the victim.
null
The CBLInfo
plugin alerts admins when a harmful player is detected joining their server based on data from the Community Ban List.
Discord connector name.
discord
The ID of the channel to alert admins through.
667741905228136459
Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Community Ban List’s FAQ
6
The ChatCommands
plugin can be configured to make chat commands that broadcast or warn the caller with present messages.
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.
[
{
“command”: “squadjs”,
“type”: “warn”,
“response”: “This server is powered by SquadJS.”,
“ignoreChats”: []
}
]
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:
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.
Discord connector name.
discord
The ID of the channel to log admin broadcasts to.
667741905228136459
The color of the embed.
16761867
The DiscordAdminCamLogs
plugin will log in game admin camera usage to a Discord channel.
Discord connector name.
discord
The ID of the channel to log admin camera usage to.
667741905228136459
The color of the embed.
16761867
The DiscordAdminRequest
plugin will ping admins in a Discord channel when a player requests an admin via the !admin
command in in-game chat.
Discord connector name.
discord
The ID of the channel to log admin broadcasts to.
667741905228136459
A list of chat names to ignore.
[]
[
“ChatSquad”
]
A list of phrases to ignore.
[]
[
“switch”
]
The command that calls an admin.
admin
A list of Discord role IDs to ping.
[]
[
“500455137626554379”
]
Ping @here. Great if Admin Requests are posted to a Squad Admin ONLY channel, allows pinging only Online Admins.
false
Cooldown for pings in milliseconds.
60000
The color of the embed.
16761867
Should in-game admins be warned after a players uses the command and should we tell how much admins are active in-game right now.
false
Should players know how much in-game admins there are active/online?
true
The DiscordChat
plugin will log in-game chat to a Discord channel.
Discord connector name.
discord
The ID of the channel to log admin broadcasts to.
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”
]
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”
]
The DiscordFOBHABExplosionDamage
plugin logs damage done to FOBs and HABs by explosions to help identify engineers blowing up friendly FOBs and HABs.
Discord connector name.
discord
The ID of the channel to log FOB/HAB explosion damage to.
667741905228136459
The color of the embeds.
16761867
The DiscordKillFeed
plugin logs all wounds and related information to a Discord channel for admins to review.
Discord connector name.
discord
The ID of the channel to log teamkills to.
667741905228136459
The color of the embeds.
16761867
Disable Community Ban List information.
false
The DiscordPlaceholder
plugin allows you to make your bot create placeholder messages that can be used when configuring other plugins.
Discord connector name.
discord
Command to create Discord placeholder.
!placeholder
The bot will only answer with a placeholder on this channel
The DiscordRcon
plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.
Discord connector name.
discord
ID of channel to turn into RCON console.
667741905228136459
{}
) permissions will be disabled
{}
{
“123456789123456789”: [
“AdminBroadcast”,
“AdminForceTeamChange”,
“AdminDemoteCommander”
]
}
Prepend admin names when making announcements.
false
The DiscordRoundWinner
plugin will send the round winner to a Discord channel.
Discord connector name.
discord
The ID of the channel to log admin broadcasts to.
667741905228136459
The color of the embed.
16761867
The DiscordRoundEnded
plugin will send the round winner to a Discord channel.
Discord connector name.
discord
The ID of the channel to log round end events to.
667741905228136459
The color of the embed.
16761867
The DiscordServerStatus
plugin can be used to get the server status in Discord.
Discord connector name.
discord
Sequelize connector name.
sqlite
Command name to get message.
!status
Whether to allow messages to be subscribed to automatic updates.
false
How frequently to update the time in Discord.
60000
Whether to update the bot’s status with server information.
true
The SquadCreated
plugin will log Squad Creation events to a Discord channel.
Discord connector name.
discord
The ID of the channel to log Squad Creation events to.
667741905228136459
The color of the embed.
16761867
Send message as Embed
true
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
ID of role required to run the sub system restart commands.
667741905228136459
The DiscordTeamkill
plugin logs teamkills and related information to a Discord channel for admins to review.
Discord connector name.
discord
The ID of the channel to log teamkills to.
667741905228136459
The color of the embeds.
16761867
Disable Community Ban List information.
false
The FogOfWar
plugin can be used to automate setting fog of war mode.
Fog of war mode to set.
1
Delay before setting fog of war mode.
10000
The IntervalledBroadcasts
plugin allows you to set broadcasts, which will be broadcasted at preset intervals
Messages to broadcast.
[]
[
“This server is powered by SquadJS.”
]
Frequency of the broadcasts in milliseconds.
300000
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!
Should the plugin wait to be executed on NEW_GAME event.
true
The time to wait before check player counts in seconds.
30
The SocketIOAPI
plugin allows remote access to a SquadJS instance via Socket.IO
As a client example you can use this to connect to the socket.io server;
If you need more documentation about socket.io please go ahead and read the following;
const socket = io.connect(‘ws://IP:PORT’, {
auth: {
token: “MySecretPassword”
}
})
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
Some information SquadJS collects from Squad servers was never intended or designed to be collected. As a result, it is impossible for any framework to collect the same information with 100% accuracy. SquadJS aims to get as close as possible to that figure, however, it acknowledges that this is not possible in some specific scenarios.
Below is a list of scenarios we know may cause some information to be inaccurate:
null
.null
. Be on the watch for groups of players who try to abuse this in order to TK or complete other malicious actions without being detected by SquadJS plugins.SquadJS pings the following data to the SquadJS API at regular intervals to assist with its development:
tail
or ftp
.At this time, this cannot be disabled.
Please note, plugin configurations do not and should not contain any sensitive information which allows us to collect this information. Any sensitive information, e.g. Discord login tokens, should be included in the connectors
section of the config which is not sent to our API. It is important that developers of custom plugins maintain this approach to avoid submitting confidential information to our API.
Whilst installing SquadJS you may do the following to obtain slightly different versions:
master
branch - To get the most up to date version of SquadJS.All changes proposed to SquadJS will be merged into the master
branch prior to being released in the next stable version to allow for a period of larger-scale testing to occur. Therefore, we only recommend individuals who are willing to update regularly and partake in testing/bug reporting use the master
branch. Please note, updates to the master
branch will not be advertised in the SquadJS startup information, however, notifications of merged pull requests into the master
branch may be found in our Discord. Once the master
branch is deemed stable a release will be published and advertised via the SquadJS startup information and our Discord.
Releases will be given a version number with the format v{major}.{minor}.{patch}
, e.g. v3.1.4
. Changes to {major}
/{minor}
/{patch}
will imply the following:
{major}
- The release contains a new/updated feature that is (potentially) breaking, e.g. changes to event outputs that may cause custom plugins to break.{minor}
- The release contains a new/updated feature.{patch}
- The release contains a bug fix.Please note, {minor}
/{patch}
releases may still break SquadJS installations, however, this may be prevented with configuration changes and should not require custom plugins to be updated.
Release version numbers and changelogs are managed by Release Drafter which relies on the appropriate labels being applied to pull requests. Version numbers are updated in the package.json
file manually prior to publishing the release draft.
The above policy was written and put into effect after the release of SquadJS v2.0.5. A major version bump to SquadJS v3.0.0 was made to signify this policy taking affect and to draw a line under the previous poor management of releases and version numbers.
SquadJS would not be possible without the support of so many individuals and organisations. Our thanks goes out to:
Boost Software License - Version 1.0 - August 17th, 2003
Copyright (c) 2020 Thomas Smyth
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.