Extends SquadJS functionality
This
README.md
is a copy paste of SquadJS readme so expect similarities.
Due to creating this script long ago, my org & I have parted ways, so I have decided to open source my SquadJS code after 2 years of being apart of the Squad community.
- Download & extract SquadJS.
- Overwrite SquadJS contents.
- Run
npm install -g yarn
to update the global yarn version to latest v1. - Run
yarn set version berry
to enable v2. - Run
yarn config set nodeLinker node-modules
. - Run
yarn install
to migrate the lockfile.
Single line code:
npm install -g yarn && yarn set version berry && yarn config set nodeLinker node-modules && yarn install
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).
Server
The following section of the configuration contains information about your Squad server.
"server": {
"...": "...",
"webURL": "https://www.battlemetrics.com/servers/squad/YOUR_SQUAD_SERVER"
},
-
webURL
- Your Squad servers website or BattleMetrics page.
Connectors
Discord:
Connects to Discord via discord.js
.
{
"discord": {
"clientID": "Discord Application ID",
"guidID": "Discord Server ID",
"token": "Discord Login Token",
"intents": ["Guilds", "GuildMessages", "MessageContent"],
"channelIDs": [
{
"label": "Channel Name",
"channelID": "Chanel ID"
}
],
"embedDefaults": {
"clan": "[SquadJS] ",
"name": "Cerberus",
"iconURL": "https://i.imgur.com/HHEX79K.png",
"url": "https://www.battlemetrics.com/servers/squad",
"format": {
"player": "[[{{name}}](https://www.battlemetrics.com/rcon/players?filter[search]={{EOSID}}&method=quick&redirect=1 'Go to BattleMetrics')] - [[{{steamID}}](https://steamcommunity.com/profiles/{{steamID}} 'Go to Steam Profile')]",
"squad": "{{squadID}} : {{squadName}}",
"team": "{{teamID}} : {{teamName}}"
}
},
"webhook": {
"id": "Webhook ID",
"token": "Webhook Token"
}
}
}
clientID
- Your discord bots IDguidID
- Your discord server IDtoken
- Your discord bots "Reset Token"intents
- Your discord bots intents, see Gateway IntentschannelIDs
- An array of channels you would like to use.channelIDs:label
- A label to use when callingsendDiscordMessage(message, {{LABELS}})
, examplesendDiscordMessage('My discord message', 'admin-alerts')
channelIDs:channelID
- Discord Channel IDembedDefaults
- The default layout for embed messages, see EmbedsembedDefaults:clan
- Your server clan, can be an empty string.embedDefaults:name
- Embeded message title, can be an empty string.embedDefaults:iconURL
- Embeded message iconURL, can benull
.embedDefaults:url
- Embeded message URL, can benull
.embedDefaults:format
- Embeded message fields, will convert player data.embedDefaults:format:player
- Player string.embedDefaults:format:squad
- Player squad string.embedDefaults:format:team
- Team string.webhook
- Optional, see Webhookswebhook:id
- Enter the ID part ofhttps://discord.com/api/webhooks/{{ID}}/token
webhook:token
- Enter the TOKEN part ofhttps://discord.com/api/webhooks/id/{{TOKEN}}
BattleMetrics:
Connects to the BattleMetrics API.
{
"BattleMetrics": {
"BanLists": [
{
"name": "Ban List Name",
"listID": "Ban List ID",
"UUID": "Ban List UUID"
}
],
"listID": "Ban List ID",
"orgID": "Org ID",
"serverID": "Server ID",
"token": "BattleMetrics Token",
"UUID": "OWI"
}
}
BanLists
- Array of Ban Lists to use, can be an empty Array!BanLists:name
- A name to useBanLists:listID
- A Ban List IDBanLists:UUID
- (OPTIONAL) A UUID to use when creating bans, can be an empty string.listID
- Default Ban List ID to useorgID
- BattleMetrics Org IDserverID
- BattleMetrics Server IDtoken
- BattleMetrics TokenUUID
- A default UUID to use when creating bans, can be an empty string.
Verboseness
The logger
section configures how verbose a module of SquadJS will be as well as the displayed color.
"logger": {
"verboseness": {
"SquadServer": 1,
"LogParser": 1,
"RCON": 1
},
"colors": {
"Toolkit": "cyanBright",
"DiscordJS": "cyanBright",
"Err": "redBright",
"SquadServer": "yellowBright",
"SquadServerFactory": "yellowBright",
"LogParser": "blueBright",
"RCON": "redBright"
}
}
The larger the number set in the verboseness
section for a specified module the more it will print to the console.
Plugins
Profanity Filter:
{
"plugin": "ToolkitProfanity",
"enabled": true,
"bmClient": "BattleMetrics",
"discordClient": "discord",
"Ban": {
"note": "Banned by Cerberus System",
"reason": "{{reason}} | {{timeLeft}}"
},
"embedInfo": {
"clan": "[SquadJS] ",
"name": "Cerberus",
"iconURL": "https://i.imgur.com/HHEX79K.png",
"url": "https://www.battlemetrics.com/servers/squad",
"format": {
"player": "[[{{name}}](https://www.battlemetrics.com/rcon/players?filter[search]={{EOSID}}&method=quick&redirect=1 'Go to BattleMetrics')] - [[{{steamID}}](https://steamcommunity.com/profiles/{{steamID}} 'Go to Steam Profile')]",
"squad": "{{squadID}} : {{squadName}}",
"team": "{{teamID}} : {{teamName}}"
}
},
"ignoreChats": []
}
-
bmClient
- Name of the BattleMetrics connector. -
discordClient
- Name of the Discord connector. -
Ban:note
- Added to the beginning of ban notes. -
Ban:reason
- Default ban reason. -
embedInfo
- Overwritesdiscord:embedDefaults
. -
ignoreChats
- Ignore certain chats.