Skip to content

Connect your SquadJS instance to BattleMetrics using the BattleMetrics API.

License

Notifications You must be signed in to change notification settings

magicoflolis/SquadJS-BattleMetricsAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SquadJS-BattleMetricsAPI

GitHub License GitHub Issues or Pull Requests

Connect your SquadJS instance to BattleMetrics using the BattleMetrics API. For any issues, see issue tracker.

Default config.json:

Be sure to add a , to the end of the connector before it.

{
  "connectors": {
    "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": "BM"
    }
  }
}

Pre-requirements

Token must not be limited by organization, why? BattleMetrics tokens can be a bit funky...

  • A BattleMetrics token.
    • Navigate to Developer Area
    • Select "New Token"
    • Give it a name at the top.
    • Minimum:
      • "Ban Lists"
      • "Bans"
      • "Player Notes"
    • Recommended:
      • "Ban Lists"
      • "Bans"
      • "Player Flags"
      • "Player Notes"
      • "RCON"
      • "Triggers"
    • If you are having trouble, toggle everything except "Account" or toggle that too if needed.
    • Why? BattleMetrics tokens can be a bit funky...

The connector can be used for anything BattleMetrics related, if you plan to do more than ban players or lookup players then toggle what you need.

Connector Options

Anything with ? at the end means it is optional and can be removed from the config.

BanLists:

If your going to use just one ban list, set BanLists to []

  • name? - Name this ban list.
    • If removed name becomes this listID
  • listID - Ban list ID
    • Select RCON > Bans > Ban List > View Bans > Look at that URL
    • That URL would be the listID /rcon/bans/?filter[banList]=${ listID }
  • UUID? - When a ban is created, use this string at the start of the bans UUID
    • Useful when trying to identify SquadJS created bans.
    • Example: If MYORG is the UUID then all bans will begin with it, MYORG990CE5576D3
    • Defaults to global UUID
    • UUIDs become capitalized during ban creation, do not include any special characters
  • orgID? - Org ID for specified ban list, only use if token has access to that orgs ban list.
    • Defaults to global orgID
  • serverID? - Server ID for specified ban list, only use if token has access to that orgs ban list.
    • Defaults to global serverID

Globals:

  • listID - Ban list ID
    • In BattleMetrics, select RCON > Bans > Ban List > View Bans > Look at that URL
    • That URL would be the listID /rcon/bans/?filter[banList]=${ listID }
  • orgID - Org ID for the default ban list.
    • Select RCON > Orgs > "Select your Org" > Look at that URL
    • Example: /rcon/orgs/edit/${ orgID }
  • serverID - Server ID for the default ban list.
    • Example: /servers/squad/${ serverID }
  • token - Your BattleMetrics API token, see Pre-requirements
  • UUID - When a ban is created, use this string at the start of the bans UUID
    • Useful when trying to identify SquadJS created bans.
    • Example: If MYORG is the UUID then all bans will begin with it, MYORG990CE5576D3
    • UUIDs become capitalized during ban creation, do not include any special characters
    • To disable, set this to ""

Install

  • Copy n paste config.json with your SquadJS config.
  • In your SquadJS instance, replace /squad-server/factory.js with the one from this repo.
    • If you have modified your factory.js, then manually add and import this connector.
  • From this repo add /squad-server/utils/battlemetrics-api.js and /squad-server/utils/battlemetrics-api.d.ts to your /squad-server/utils directory.
    • battlemetrics-api.d.ts is used if you are going to create plugins or wanna know what each function does. Otherwise you can safely ignore adding this file.

Plugins

I have also included a example plugin found in this repos /squad-server/plugins directory. Remove its .txt file extension. Try not to enable it on a live SquadJS instance ❤️

Plugins using this connector.

About

Connect your SquadJS instance to BattleMetrics using the BattleMetrics API.

Topics

Resources

License

Stars

Watchers

Forks