From 8ea54b9f4fc4e9adec86190d6524c84a76f5982b Mon Sep 17 00:00:00 2001 From: werewolfboy13 Date: Thu, 14 Jan 2021 14:09:21 -0600 Subject: [PATCH 01/38] Updated Year For Copyright Message --- squad-server/utils/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/utils/constants.js b/squad-server/utils/constants.js index 036d0c7..db52043 100644 --- a/squad-server/utils/constants.js +++ b/squad-server/utils/constants.js @@ -9,6 +9,6 @@ const SQUADJS_VERSION = JSON.parse( ).version; /* As set out by the terms of the license, the following should not be modified. */ -const COPYRIGHT_MESSAGE = 'Powered by SquadJS, Copyright © 2020'; +const COPYRIGHT_MESSAGE = 'Powered by SquadJS, Copyright © 2021'; export { SQUADJS_VERSION, COPYRIGHT_MESSAGE }; From dad56897f6c6e8e3a0740b5c825bde379a6fbfd1 Mon Sep 17 00:00:00 2001 From: Marek Date: Fri, 15 Jan 2021 02:23:37 +0600 Subject: [PATCH 02/38] fixed terminology --- squad-server/utils/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/utils/constants.js b/squad-server/utils/constants.js index db52043..fe623ee 100644 --- a/squad-server/utils/constants.js +++ b/squad-server/utils/constants.js @@ -9,6 +9,6 @@ const SQUADJS_VERSION = JSON.parse( ).version; /* As set out by the terms of the license, the following should not be modified. */ -const COPYRIGHT_MESSAGE = 'Powered by SquadJS, Copyright © 2021'; +const COPYRIGHT_MESSAGE = 'Powered by SquadJS, Copyright © ${new Date().getFullYear()}'; export { SQUADJS_VERSION, COPYRIGHT_MESSAGE }; From 6f2c9507e35c7e105e37a30258a846705bf6637b Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 14 Jan 2021 21:43:51 +0000 Subject: [PATCH 03/38] Fix template literals for copyright message --- squad-server/utils/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/utils/constants.js b/squad-server/utils/constants.js index fe623ee..b019b16 100644 --- a/squad-server/utils/constants.js +++ b/squad-server/utils/constants.js @@ -9,6 +9,6 @@ const SQUADJS_VERSION = JSON.parse( ).version; /* As set out by the terms of the license, the following should not be modified. */ -const COPYRIGHT_MESSAGE = 'Powered by SquadJS, Copyright © ${new Date().getFullYear()}'; +const COPYRIGHT_MESSAGE = `Powered by SquadJS, Copyright © ${new Date().getFullYear()}`; export { SQUADJS_VERSION, COPYRIGHT_MESSAGE }; From a5f35d5915a5308c1ce01dcad19ba885f5ce1f37 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Fri, 15 Jan 2021 09:55:10 +0000 Subject: [PATCH 04/38] Fix SCBL Info plugin's threshold option --- squad-server/plugins/scbl-info.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/squad-server/plugins/scbl-info.js b/squad-server/plugins/scbl-info.js index ca69200..e72d196 100644 --- a/squad-server/plugins/scbl-info.js +++ b/squad-server/plugins/scbl-info.js @@ -92,11 +92,14 @@ export default class SCBLInfo extends DiscordBasePlugin { 2, `Player ${info.name} (Steam ID: ${info.steamID}) is not listed in the Squad Community Ban List.` ); - if (data.steamUser.reputationPoints < this.options.threshold) + + if (data.steamUser.reputationPoints < this.options.threshold) { this.verbose( 2, `Player ${info.name} (Steam ID: ${info.steamID}) has a reputation below the threshold.` ); + return; + } await this.sendDiscordMessage({ embed: { From f2717e0f629f2366d72b347e11ae364a1c1a32a3 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Fri, 15 Jan 2021 10:27:58 +0000 Subject: [PATCH 05/38] Wrap SCBL API call in try catch --- squad-server/plugins/scbl-info.js | 186 ++++++++++++++++-------------- 1 file changed, 97 insertions(+), 89 deletions(-) diff --git a/squad-server/plugins/scbl-info.js b/squad-server/plugins/scbl-info.js index e72d196..1afe5aa 100644 --- a/squad-server/plugins/scbl-info.js +++ b/squad-server/plugins/scbl-info.js @@ -51,104 +51,112 @@ export default class SCBLInfo extends DiscordBasePlugin { } async onPlayerConnected(info) { - const data = await request( - 'https://squad-community-ban-list.com/graphql', - gql` - query Search($id: String!) { - steamUser(id: $id) { - id - name - avatarFull - reputationPoints - riskRating - reputationRank - lastRefreshedInfo - lastRefreshedReputationPoints - lastRefreshedReputationRank - activeBans: bans(orderBy: "created", orderDirection: DESC, expired: false) { - edges { - cursor - node { - id + try { + const data = await request( + 'https://squad-community-ban-list.com/graphql', + gql` + query Search($id: String!) { + steamUser(id: $id) { + id + name + avatarFull + reputationPoints + riskRating + reputationRank + lastRefreshedInfo + lastRefreshedReputationPoints + lastRefreshedReputationRank + activeBans: bans(orderBy: "created", orderDirection: DESC, expired: false) { + edges { + cursor + node { + id + } } } - } - expiredBans: bans(orderBy: "created", orderDirection: DESC, expired: true) { - edges { - cursor - node { - id + expiredBans: bans(orderBy: "created", orderDirection: DESC, expired: true) { + edges { + cursor + node { + id + } } } } } - } - `, - { id: info.player.steamID } - ); - - if (!data.steamUser) - this.verbose( - 2, - `Player ${info.name} (Steam ID: ${info.steamID}) is not listed in the Squad Community Ban List.` + `, + { id: info.player.steamID } ); - if (data.steamUser.reputationPoints < this.options.threshold) { - this.verbose( - 2, - `Player ${info.name} (Steam ID: ${info.steamID}) has a reputation below the threshold.` - ); - return; - } + if (!data.steamUser) + this.verbose( + 2, + `Player ${info.name} (Steam ID: ${info.steamID}) is not listed in the Squad Community Ban List.` + ); - await this.sendDiscordMessage({ - embed: { - title: `${info.player.name} is a potentially harmful player!`, - author: { - name: 'Squad Community Ban List', - url: 'https://squad-community-ban-list.com/', - icon_url: - 'https://raw.githubusercontent.com/Thomas-Smyth/Squad-Community-Ban-List/master/client/src/assets/img/brand/scbl-logo-square.png' - }, - thumbnail: { - url: data.steamUser.avatarFull - }, - description: `[${info.player.name}](https://squad-community-ban-list.com/search/${info.player.steamID}) has ${data.steamUser.reputationPoints} reputation points on the Squad Community Ban List and is therefore a potentially harmful player.`, - fields: [ - { - name: 'Reputation Points', - value: `${data.steamUser.reputationPoints} (${ - data.steamUser.reputationPointsMonthChange || 0 - } from this month)`, - inline: true - }, - { - name: 'Risk Rating', - value: `${data.steamUser.riskRating} / 10`, - inline: true - }, - { - name: 'Reputation Rank', - value: `#${data.steamUser.reputationRank}`, - inline: true - }, - { - name: 'Active Bans', - value: `${data.steamUser.activeBans.edges.length}`, - inline: true - }, - { - name: 'Expired Bans', - value: `${data.steamUser.expiredBans.edges.length}`, - inline: true - } - ], - color: '#ffc40b', - timestamp: info.time.toISOString(), - footer: { - text: 'Powered by SquadJS and the Squad Community Ban List' - } + if (data.steamUser.reputationPoints < this.options.threshold) { + this.verbose( + 2, + `Player ${info.name} (Steam ID: ${info.steamID}) has a reputation below the threshold.` + ); + return; } - }); + + await this.sendDiscordMessage({ + embed: { + title: `${info.player.name} is a potentially harmful player!`, + author: { + name: 'Squad Community Ban List', + url: 'https://squad-community-ban-list.com/', + icon_url: + 'https://raw.githubusercontent.com/Thomas-Smyth/Squad-Community-Ban-List/master/client/src/assets/img/brand/scbl-logo-square.png' + }, + thumbnail: { + url: data.steamUser.avatarFull + }, + description: `[${info.player.name}](https://squad-community-ban-list.com/search/${info.player.steamID}) has ${data.steamUser.reputationPoints} reputation points on the Squad Community Ban List and is therefore a potentially harmful player.`, + fields: [ + { + name: 'Reputation Points', + value: `${data.steamUser.reputationPoints} (${ + data.steamUser.reputationPointsMonthChange || 0 + } from this month)`, + inline: true + }, + { + name: 'Risk Rating', + value: `${data.steamUser.riskRating} / 10`, + inline: true + }, + { + name: 'Reputation Rank', + value: `#${data.steamUser.reputationRank}`, + inline: true + }, + { + name: 'Active Bans', + value: `${data.steamUser.activeBans.edges.length}`, + inline: true + }, + { + name: 'Expired Bans', + value: `${data.steamUser.expiredBans.edges.length}`, + inline: true + } + ], + color: '#ffc40b', + timestamp: info.time.toISOString(), + footer: { + text: 'Powered by SquadJS and the Squad Community Ban List' + } + } + }); + } catch (err) { + this.verbose( + 1, + `Failed to fetch Squad Community Ban List data for player ${info.name} (Steam ID: ${info.steamID}): `, + err + ); + } } } From c98d58864ebf8aeaf644b6fb92deecf8adb36f04 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Fri, 15 Jan 2021 10:33:04 +0000 Subject: [PATCH 06/38] Update license --- LICENSE | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 292fa82..fbb9d82 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Boost Software License - Version 1.0 - August 17th, 2003 -Copyright (c) 2020 Thomas Smyth +Copyright (c) 2021 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 diff --git a/README.md b/README.md index c2c767b..bead0c1 100644 --- a/README.md +++ b/README.md @@ -788,7 +788,7 @@ SquadJS would not be possible without the support of so many individuals and org ``` Boost Software License - Version 1.0 - August 17th, 2003 -Copyright (c) 2020 Thomas Smyth +Copyright (c) 2021 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 From 2125eb8a713f31d3eb69bbeaa32d347f6e22eb7a Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Fri, 15 Jan 2021 10:41:21 +0000 Subject: [PATCH 07/38] ESLint & README Generation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bead0c1..c2c767b 100644 --- a/README.md +++ b/README.md @@ -788,7 +788,7 @@ SquadJS would not be possible without the support of so many individuals and org ``` Boost Software License - Version 1.0 - August 17th, 2003 -Copyright (c) 2021 Thomas Smyth +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 From f4733a2464cd665be4d9f648ef95c441e9a20dff Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Fri, 15 Jan 2021 10:43:24 +0000 Subject: [PATCH 08/38] Run Action on pull request --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2394e19..0722cc6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,5 @@ name: Build Yarn docs & lint source code -on: push - +on: [push, pull_request] jobs: run: name: Lint and build templates From b965e4a1d6ef4e12d272d214244852deff6b7d63 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Thu, 28 Jan 2021 12:41:13 -0500 Subject: [PATCH 09/38] admin list parse improvements --- squad-server/utils/admin-lists.js | 53 +++++++++++++++++++------------ 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/squad-server/utils/admin-lists.js b/squad-server/utils/admin-lists.js index 76cb066..e801f71 100644 --- a/squad-server/utils/admin-lists.js +++ b/squad-server/utils/admin-lists.js @@ -13,11 +13,9 @@ export default async function fetchAdminLists(adminLists) { const groups = {}; const admins = {}; - for (let idx = 0; idx < adminLists.length; idx++) { - const list = adminLists[idx]; + for (const [idx, list] of adminLists.entries()) { + let data = ''; try { - let data = ''; - switch (list.type) { case 'remote': { const resp = await axios({ @@ -36,18 +34,32 @@ export default async function fetchAdminLists(adminLists) { default: throw new Error(`Unsupported AdminList type:${list.type}`); } + } catch (error) { + Logger.verbose( + 'SquadServer', + 1, + `Error fetching ${list.type} admin list: ${list.source}`, + error + ); + } - const groupRgx = /(?<=Group=)(.*?):(.*)(?=(?:\r\n|\r|\n))/g; - const adminRgx = /(?<=Admin=)(\d+):(\S+)(?=\s)/g; + const groupRgx = /(?<=^Group=)(?.*?):(?.*?)(?=(?:\r\n|\r|\n|\s+\/\/))/gm; + const adminRgx = /(?<=^Admin=)(?\d+):(?\S+)/gm; - /* eslint-disable no-unused-vars */ - for (const [match, groupID, groupPerms] of data.matchAll(groupRgx)) { - groups[`${idx}-${groupID}`] = groupPerms.split(','); - } - for (const [match, steamID, groupID] of data.matchAll(adminRgx)) { - const perms = {}; - for (const perm of groups[`${idx}-${groupID}`]) perms[perm] = true; + for (const m of data.matchAll(groupRgx)) { + groups[`${idx}-${m.groups.groupID}`] = m.groups.groupPerms.split(','); + } + for (const m of data.matchAll(adminRgx)) { + try { + const group = groups[`${idx}-${m.groups.groupID}`]; + const perms = Object.assign( + {}, + ...group.map((p) => { + return { [p]: true }; + }) + ); + const steamID = m.groups.steamID; if (steamID in admins) { admins[steamID] = Object.assign(admins[steamID], perms); Logger.verbose( @@ -63,15 +75,14 @@ export default async function fetchAdminLists(adminLists) { `Added Admin ${steamID} with ${Object.keys(admins[steamID])}` ); } + } catch (error) { + Logger.verbose( + 'SquadServer', + 1, + `Error parsing admin group ${m.groups.groupID} from admin list: ${list.source}`, + error + ); } - /* eslint-enable no-unused-vars */ - } catch (error) { - Logger.verbose( - 'SquadServer', - 1, - `Error fetching ${list.type} admin list: ${list.source}`, - error - ); } } Logger.verbose('SquadServer', 1, `${Object.keys(admins).length} admins loaded...`); From 6a1cce87202413e9c3a996a25f19e63ad87a64c7 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Thu, 28 Jan 2021 12:47:08 -0500 Subject: [PATCH 10/38] prefer for loop for readability --- squad-server/utils/admin-lists.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/squad-server/utils/admin-lists.js b/squad-server/utils/admin-lists.js index e801f71..5593b1b 100644 --- a/squad-server/utils/admin-lists.js +++ b/squad-server/utils/admin-lists.js @@ -52,12 +52,8 @@ export default async function fetchAdminLists(adminLists) { for (const m of data.matchAll(adminRgx)) { try { const group = groups[`${idx}-${m.groups.groupID}`]; - const perms = Object.assign( - {}, - ...group.map((p) => { - return { [p]: true }; - }) - ); + const perms = {}; + for (const groupPerm of group) perms[groupPerm] = true; const steamID = m.groups.steamID; if (steamID in admins) { From 5becf0473e678d329f5c45c394bc83756fe3cf45 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Thu, 28 Jan 2021 12:49:24 -0500 Subject: [PATCH 11/38] Delete pull.yml --- .github/pull.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .github/pull.yml diff --git a/.github/pull.yml b/.github/pull.yml deleted file mode 100644 index d4faee7..0000000 --- a/.github/pull.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: "1" -rules: - - base: master - upstream: Thomas-Smyth:beta - mergeMethod: squash -conflictLabel: "merge-conflict" From 90540f0e09aab84bc9ffe23169e0db14798aa4b2 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 28 Jan 2021 20:13:53 +0000 Subject: [PATCH 12/38] Fix error in auto-tk-warn --- squad-server/plugins/auto-tk-warn.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index 8bda2db..a0d7a76 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -34,6 +34,8 @@ export default class AutoTKWarn extends BasePlugin { } async onTeamkill(info) { + if (!info.attacker) return; + await this.server.rcon.warn(info.attacker.steamID, this.options.message); } } From 95b8baf560638afc23425f1261a48aa7f3354cf0 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Sat, 30 Jan 2021 14:39:56 +0000 Subject: [PATCH 13/38] Dynamically load plugins --- squad-server/factory.js | 20 ++++-- squad-server/plugins/index.js | 74 ++++++++++------------- squad-server/scripts/build-config-file.js | 7 ++- squad-server/scripts/build-readme.js | 7 ++- 4 files changed, 56 insertions(+), 52 deletions(-) diff --git a/squad-server/factory.js b/squad-server/factory.js index f611b59..074bf08 100644 --- a/squad-server/factory.js +++ b/squad-server/factory.js @@ -8,7 +8,7 @@ import sequelize from 'sequelize'; import Logger from 'core/logger'; import SquadServer from './index.js'; -import plugins from './plugins/index.js'; +import Plugins from './plugins/index.js'; const { Sequelize } = sequelize; @@ -16,6 +16,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default class SquadServerFactory { static async buildFromConfig(config) { + const plugins = await Plugins.getPlugins(); + for (const plugin of Object.keys(plugins)) { Logger.setColor(plugin, 'magentaBright'); } @@ -160,7 +162,9 @@ export default class SquadServerFactory { return SquadServerFactory.buildFromConfigString(SquadServerFactory.readConfigFile(configPath)); } - static buildConfig() { + static async buildConfig() { + const plugins = await Plugins.getPlugins(); + const templatePath = path.resolve(__dirname, './templates/config-template.json'); const templateString = fs.readFileSync(templatePath, 'utf8'); const template = SquadServerFactory.parseConfig(templateString); @@ -183,13 +187,17 @@ export default class SquadServerFactory { return template; } - static buildConfigFile() { + static async buildConfigFile() { const configPath = path.resolve(__dirname, '../config.json'); - const config = JSON.stringify(SquadServerFactory.buildConfig(), null, 2); - fs.writeFileSync(configPath, config); + const config = await SquadServerFactory.buildConfig(); + + const configString = JSON.stringify(config, null, 2); + fs.writeFileSync(configPath, configString); } - static buildReadmeFile() { + static async buildReadmeFile() { + const plugins = await Plugins.getPlugins(); + const pluginKeys = Object.keys(plugins).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0 ); diff --git a/squad-server/plugins/index.js b/squad-server/plugins/index.js index df2e098..e52a676 100644 --- a/squad-server/plugins/index.js +++ b/squad-server/plugins/index.js @@ -1,46 +1,36 @@ -import AutoKickUnassigned from './auto-kick-unassigned.js'; -import AutoTKWarn from './auto-tk-warn.js'; -import ChatCommands from './chat-commands.js'; -import DBLog from './db-log.js'; -import DiscordAdminBroadcast from './discord-admin-broadcast.js'; -import DiscordAdminCamLogs from './discord-admin-cam-logs.js'; -import DiscordAdminRequest from './discord-admin-request.js'; -import DiscordChat from './discord-chat.js'; -import DiscordDebug from './discord-debug.js'; -import DiscordRcon from './discord-rcon.js'; -import DiscordRoundWinner from './discord-round-winner.js'; -import DiscordServerStatus from './discord-server-status.js'; -import DiscordSubsystemRestarter from './discord-subsystem-restarter.js'; -import DiscordTeamkill from './discord-teamkill.js'; -import IntervalledBroadcasts from './intervalled-broadcasts.js'; -import SCBLInfo from './scbl-info.js'; -import SeedingMode from './seeding-mode.js'; -import TeamRandomizer from './team-randomizer.js'; +import fs from 'fs'; -const plugins = [ - AutoKickUnassigned, - AutoTKWarn, - ChatCommands, - DBLog, - DiscordAdminBroadcast, - DiscordAdminCamLogs, - DiscordAdminRequest, - DiscordChat, - DiscordDebug, - DiscordRcon, - DiscordRoundWinner, - DiscordServerStatus, - DiscordSubsystemRestarter, - DiscordTeamkill, - IntervalledBroadcasts, - SCBLInfo, - SeedingMode, - TeamRandomizer -]; +import Logger from 'core/logger'; +import path from 'path'; +import { fileURLToPath } from 'url'; -const pluginsByName = {}; -for (const plugin of plugins) { - pluginsByName[plugin.name] = plugin; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +class Plugins { + constructor() { + this.plugins = null; + } + + async getPlugins(force = false) { + if (this.plugins && !force) return this.plugins; + + this.plugins = {}; + + const dir = await fs.promises.opendir(path.join(__dirname, './')); + for await (const dirent of dir) { + if (!dirent.isFile()) continue; + if ( + ['index.js', 'base-plugin.js', 'discord-base-plugin.js', 'readme.md'].includes(dirent.name) + ) + continue; + Logger.verbose('Plugins', 1, `Loading plugin file ${dirent.name}...`); + const { default: Plugin } = await import(`./${dirent.name}`); + + this.plugins[Plugin.name] = Plugin; + } + + return this.plugins; + } } -export default pluginsByName; +export default new Plugins(); diff --git a/squad-server/scripts/build-config-file.js b/squad-server/scripts/build-config-file.js index 6f9501a..e6cfc7b 100644 --- a/squad-server/scripts/build-config-file.js +++ b/squad-server/scripts/build-config-file.js @@ -1,5 +1,8 @@ import SquadServerFactory from '../factory.js'; console.log('Building config...'); -SquadServerFactory.buildConfigFile(); -console.log('Done.'); +SquadServerFactory.buildConfigFile() + .then(() => { + console.log('Done.'); + }) + .catch(console.log); diff --git a/squad-server/scripts/build-readme.js b/squad-server/scripts/build-readme.js index 66e025d..f471c91 100644 --- a/squad-server/scripts/build-readme.js +++ b/squad-server/scripts/build-readme.js @@ -1,5 +1,8 @@ import SquadServerFactory from '../factory.js'; console.log('Building readme...'); -SquadServerFactory.buildReadmeFile(); -console.log('Done.'); +SquadServerFactory.buildReadmeFile() + .then(() => { + console.log('Done.'); + }) + .catch(console.log); From f29ee5a5d93e994d721b4e3624934edf9ff57f03 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Sat, 30 Jan 2021 14:41:54 +0000 Subject: [PATCH 14/38] ESLint & README Generation --- README.md | 566 ++++++++++++++++++++++++++-------------------------- config.json | 156 +++++++-------- 2 files changed, 361 insertions(+), 361 deletions(-) diff --git a/README.md b/README.md index c2c767b..ce58ed8 100644 --- a/README.md +++ b/README.md @@ -266,48 +266,66 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
- AutoKickUnassigned -

AutoKickUnassigned

-

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

+ SeedingMode +

SeedingMode

+

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.

Options

-
  • warningMessage

    +
    • interval

      Description
      -

      Message SquadJS will send to players warning them they will be kicked

      +

      Frequency of seeding messages in milliseconds.

      Default
      -
      Join a squad, you are are unassigned and will be kicked
    • -
    • kickMessage

      +
      150000
    • +
    • seedingThreshold

      Description
      -

      Message to send to players when they are kicked

      +

      Player count required for server not to be in seeding mode.

      Default
      -
      Unassigned - automatically removed
    • -
    • frequencyOfWarnings

      +
      50
    • +
    • seedingMessage

      Description
      -

      How often in Seconds should we warn the player about being unassigned?

      +

      Seeding message to display.

      Default
      -
      30
    • -
    • unassignedTimer

      +
      Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
    • +
    • liveEnabled

      Description
      -

      How long in Seconds to wait before a unassigned player is kicked

      +

      Enable "Live" messages for when the server goes live.

      Default
      -
      360
    • -
    • playerThreshold

      +
      true
    • +
    • liveThreshold

      Description
      -

      Player count required for AutoKick to start kicking players, set to -1 to disable

      +

      Player count required for "Live" messages to not bee displayed.

      Default
      -
      93
    • -
    • roundStartDelay

      +
      52
    • +
    • liveMessage

      Description
      -

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      +

      "Live" message to display.

      Default
      -
      900
    • -
    • ignoreAdmins

      +
      Live!
    +
+ +
+ DiscordTeamkill +

DiscordTeamkill

+

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

+

Options

+
  • discordClient (Required)

    Description
    -

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    +

    Discord connector name.

    Default
    -
    false
  • -
  • ignoreWhitelist

    +
    discord
  • +
  • channelID (Required)

    Description
    -

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    +

    The ID of the channel to log teamkills to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embeds.

    +
    Default
    +
    16761867
  • +
  • disableSCBL

    +
    Description
    +

    Disable Squad Community Ban List information.

    Default
    false
@@ -324,6 +342,59 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
Please apologise for ALL TKs in ALL chat!
+
+ DiscordServerStatus +

DiscordServerStatus

+

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • messageIDs (Required)

    +
    Description
    +

    ID of messages to update.

    +
    Default
    +
    []
  • Example
    +
    [
    +  {
    +    "channelID": "667741905228136459",
    +    "messageID": "766688383043895387"
    +  }
    +]
    +
  • updateInterval

    +
    Description
    +

    How frequently to update the status in Discord.

    +
    Default
    +
    60000
  • +
  • disableStatus

    +
    Description
    +

    Disable the bot status.

    +
    Default
    +
    false
+
+ +
+ IntervalledBroadcasts +

IntervalledBroadcasts

+

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

+

Options

+
  • broadcasts

    +
    Description
    +

    Messages to broadcast.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "This server is powered by SquadJS."
    +]
    +
  • interval

    +
    Description
    +

    Frequency of the broadcasts in milliseconds.

    +
    Default
    +
    300000
+
+
ChatCommands

ChatCommands

@@ -344,33 +415,9 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
- DBLog -

DBLog

-

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): -

  • Grafana is a cool way of viewing server statistics stored in the database.
  • -
  • Install Grafana.
  • -
  • Add your database as a datasource named SquadJS.
  • -
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • -
  • Install any missing Grafana plugins.

-

Options

-
  • database (Required)

    -
    Description
    -

    The Sequelize connector to log server information to.

    -
    Default
    -
    mysql
  • -
  • overrideServerID

    -
    Description
    -

    A overridden server ID.

    -
    Default
    -
    null
-
- -
- DiscordAdminBroadcast -

DiscordAdminBroadcast

-

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

+ SCBLInfo +

SCBLInfo

+

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

Options

  • discordClient (Required)

    Description
    @@ -379,95 +426,15 @@ Grafana (NOT YET WORKING WITH V2):
    discord
  • channelID (Required)

    Description
    -

    The ID of the channel to log admin broadcasts to.

    +

    The ID of the channel to alert admins through.

    Default
  • Example
    667741905228136459
    -
  • color

    +
  • threshold

    Description
    -

    The color of the embed.

    +

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    Default
    -
    16761867
-
- -
- DiscordAdminCamLogs -

DiscordAdminCamLogs

-

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin camera usage to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
- -
- DiscordAdminRequest -

DiscordAdminRequest

-

The DiscordAdminRequest plugin will ping admins in a Discord channel when a player requests an admin via the !admin command in in-game chat.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • ignoreChats

    -
    Description
    -

    A list of chat names to ignore.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "ChatSquad"
    -]
    -
  • ignorePhrases

    -
    Description
    -

    A list of phrases to ignore.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "switch"
    -]
    -
  • command

    -
    Description
    -

    The command that calls an admin.

    -
    Default
    -
    admin
  • -
  • pingGroups

    -
    Description
    -

    A list of Discord role IDs to ping.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "500455137626554379"
    -]
    -
  • pingDelay

    -
    Description
    -

    Cooldown for pings in milliseconds.

    -
    Default
    -
    60000
  • -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
+
6
@@ -534,6 +501,109 @@ Grafana (NOT YET WORKING WITH V2): ]
+
+ DiscordAdminRequest +

DiscordAdminRequest

+

The DiscordAdminRequest plugin will ping admins in a Discord channel when a player requests an admin via the !admin command in in-game chat.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • ignoreChats

    +
    Description
    +

    A list of chat names to ignore.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "ChatSquad"
    +]
    +
  • ignorePhrases

    +
    Description
    +

    A list of phrases to ignore.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "switch"
    +]
    +
  • command

    +
    Description
    +

    The command that calls an admin.

    +
    Default
    +
    admin
  • +
  • pingGroups

    +
    Description
    +

    A list of Discord role IDs to ping.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "500455137626554379"
    +]
    +
  • pingDelay

    +
    Description
    +

    Cooldown for pings in milliseconds.

    +
    Default
    +
    60000
  • +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+ +
+ DiscordAdminBroadcast +

DiscordAdminBroadcast

+

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+ +
+ DiscordAdminCamLogs +

DiscordAdminCamLogs

+

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin camera usage to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+
DiscordRcon

DiscordRcon

@@ -569,6 +639,48 @@ Grafana (NOT YET WORKING WITH V2):
false
+
+ DiscordSubsystemRestarter +

DiscordSubsystemRestarter

+

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • role (Required)

    +
    Description
    +

    ID of role required to run the sub system restart commands.

    +
    Default
    +
  • Example
    +
    667741905228136459
+
+ +
+ DBLog +

DBLog

+

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): +

  • Grafana is a cool way of viewing server statistics stored in the database.
  • +
  • Install Grafana.
  • +
  • Add your database as a datasource named SquadJS.
  • +
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • +
  • Install any missing Grafana plugins.

+

Options

+
  • database (Required)

    +
    Description
    +

    The Sequelize connector to log server information to.

    +
    Default
    +
    mysql
  • +
  • overrideServerID

    +
    Description
    +

    A overridden server ID.

    +
    Default
    +
    null
+
+
DiscordRoundWinner

DiscordRoundWinner

@@ -593,164 +705,52 @@ Grafana (NOT YET WORKING WITH V2):
- DiscordServerStatus -

DiscordServerStatus

-

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

+ AutoKickUnassigned +

AutoKickUnassigned

+

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

Options

-
  • discordClient (Required)

    +
    • warningMessage

      Description
      -

      Discord connector name.

      +

      Message SquadJS will send to players warning them they will be kicked

      Default
      -
      discord
    • -
    • messageIDs (Required)

      +
      Join a squad, you are are unassigned and will be kicked
    • +
    • kickMessage

      Description
      -

      ID of messages to update.

      +

      Message to send to players when they are kicked

      Default
      -
      []
    • Example
      -
      [
      -  {
      -    "channelID": "667741905228136459",
      -    "messageID": "766688383043895387"
      -  }
      -]
      -
    • updateInterval

      +
      Unassigned - automatically removed
    • +
    • frequencyOfWarnings

      Description
      -

      How frequently to update the status in Discord.

      +

      How often in Seconds should we warn the player about being unassigned?

      Default
      -
      60000
    • -
    • disableStatus

      +
      30
    • +
    • unassignedTimer

      Description
      -

      Disable the bot status.

      +

      How long in Seconds to wait before a unassigned player is kicked

      +
      Default
      +
      360
    • +
    • playerThreshold

      +
      Description
      +

      Player count required for AutoKick to start kicking players, set to -1 to disable

      +
      Default
      +
      93
    • +
    • roundStartDelay

      +
      Description
      +

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      +
      Default
      +
      900
    • +
    • ignoreAdmins

      +
      Description
      +

      • true: Admins will NOT be kicked
      • false: Admins WILL be kicked

      +
      Default
      +
      false
    • +
    • ignoreWhitelist

      +
      Description
      +

      • true: Reserve slot players will NOT be kicked
      • false: Reserve slot players WILL be kicked

      Default
      false
-
- DiscordSubsystemRestarter -

DiscordSubsystemRestarter

-

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • role (Required)

    -
    Description
    -

    ID of role required to run the sub system restart commands.

    -
    Default
    -
  • Example
    -
    667741905228136459
-
- -
- DiscordTeamkill -

DiscordTeamkill

-

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log teamkills to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embeds.

    -
    Default
    -
    16761867
  • -
  • disableSCBL

    -
    Description
    -

    Disable Squad Community Ban List information.

    -
    Default
    -
    false
-
- -
- IntervalledBroadcasts -

IntervalledBroadcasts

-

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

-

Options

-
  • broadcasts

    -
    Description
    -

    Messages to broadcast.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "This server is powered by SquadJS."
    -]
    -
  • interval

    -
    Description
    -

    Frequency of the broadcasts in milliseconds.

    -
    Default
    -
    300000
-
- -
- SCBLInfo -

SCBLInfo

-

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to alert admins through.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • threshold

    -
    Description
    -

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    -
    Default
    -
    6
-
- -
- SeedingMode -

SeedingMode

-

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.

-

Options

-
  • interval

    -
    Description
    -

    Frequency of seeding messages in milliseconds.

    -
    Default
    -
    150000
  • -
  • seedingThreshold

    -
    Description
    -

    Player count required for server not to be in seeding mode.

    -
    Default
    -
    50
  • -
  • seedingMessage

    -
    Description
    -

    Seeding message to display.

    -
    Default
    -
    Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
  • -
  • liveEnabled

    -
    Description
    -

    Enable "Live" messages for when the server goes live.

    -
    Default
    -
    true
  • -
  • liveThreshold

    -
    Description
    -

    Player count required for "Live" messages to not bee displayed.

    -
    Default
    -
    52
  • -
  • liveMessage

    -
    Description
    -

    "Live" message to display.

    -
    Default
    -
    Live!
-
-
TeamRandomizer

TeamRandomizer

diff --git a/config.json b/config.json index aba8196..b7e420d 100644 --- a/config.json +++ b/config.json @@ -70,22 +70,42 @@ }, "plugins": [ { - "plugin": "AutoKickUnassigned", + "plugin": "SeedingMode", "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false + "interval": 150000, + "seedingThreshold": 50, + "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", + "liveEnabled": true, + "liveThreshold": 52, + "liveMessage": "Live!" + }, + { + "plugin": "DiscordTeamkill", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "color": 16761867, + "disableSCBL": false }, { "plugin": "AutoTKWarn", "enabled": true, "message": "Please apologise for ALL TKs in ALL chat!" }, + { + "plugin": "DiscordServerStatus", + "enabled": false, + "discordClient": "discord", + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "IntervalledBroadcasts", + "enabled": false, + "broadcasts": [], + "interval": 300000 + }, { "plugin": "ChatCommands", "enabled": true, @@ -99,36 +119,11 @@ ] }, { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, - { - "plugin": "DiscordAdminBroadcast", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordAdminCamLogs", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordAdminRequest", + "plugin": "SCBLInfo", "enabled": true, "discordClient": "discord", "channelID": "", - "ignoreChats": [], - "ignorePhrases": [], - "command": "admin", - "pingGroups": [], - "pingDelay": 60000, - "color": 16761867 + "threshold": 6 }, { "plugin": "DiscordChat", @@ -148,6 +143,32 @@ "channelID": "", "events": [] }, + { + "plugin": "DiscordAdminRequest", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "ignoreChats": [], + "ignorePhrases": [], + "command": "admin", + "pingGroups": [], + "pingDelay": 60000, + "color": 16761867 + }, + { + "plugin": "DiscordAdminBroadcast", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordAdminCamLogs", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, { "plugin": "DiscordRcon", "enabled": false, @@ -156,6 +177,18 @@ "permissions": {}, "prependAdminNameInBroadcast": false }, + { + "plugin": "DiscordSubsystemRestarter", + "enabled": false, + "discordClient": "discord", + "role": "" + }, + { + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, { "plugin": "DiscordRoundWinner", "enabled": true, @@ -164,49 +197,16 @@ "color": 16761867 }, { - "plugin": "DiscordServerStatus", - "enabled": false, - "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" - }, - { - "plugin": "DiscordTeamkill", + "plugin": "AutoKickUnassigned", "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867, - "disableSCBL": false - }, - { - "plugin": "IntervalledBroadcasts", - "enabled": false, - "broadcasts": [], - "interval": 300000 - }, - { - "plugin": "SCBLInfo", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "threshold": 6 - }, - { - "plugin": "SeedingMode", - "enabled": true, - "interval": 150000, - "seedingThreshold": 50, - "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", - "liveEnabled": true, - "liveThreshold": 52, - "liveMessage": "Live!" + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false }, { "plugin": "TeamRandomizer", From 3d464cb4c7d8404c36bf82a717ab819c1ad2fcad Mon Sep 17 00:00:00 2001 From: 11T Studio Date: Sat, 30 Jan 2021 16:38:14 +0100 Subject: [PATCH 15/38] Update scbl-info.js if we have no info about the user than it should stop the code there. --- squad-server/plugins/scbl-info.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/squad-server/plugins/scbl-info.js b/squad-server/plugins/scbl-info.js index 1afe5aa..d99fc12 100644 --- a/squad-server/plugins/scbl-info.js +++ b/squad-server/plugins/scbl-info.js @@ -88,11 +88,13 @@ export default class SCBLInfo extends DiscordBasePlugin { { id: info.player.steamID } ); - if (!data.steamUser) + if (!data.steamUser){ this.verbose( 2, `Player ${info.name} (Steam ID: ${info.steamID}) is not listed in the Squad Community Ban List.` ); + return; + } if (data.steamUser.reputationPoints < this.options.threshold) { this.verbose( From 8b84eaae7673bb679fa49b716887d541cd6b9555 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Sat, 30 Jan 2021 16:56:38 +0000 Subject: [PATCH 16/38] Update description --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index c2c767b..1b67fd0 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,7 @@ ## **About** -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 is an open source framework, designed for Squad servers, that aims to make communicating with Squad servers simple. Unlike other tools, that only collect data through limited means, SquadJS employs a more advanced data collection techniques allowing it to expose a greater variety of data points, such as kill logs. Shipped with SquadJS are a number of different plugins, built by our community, that do a range of different tasks, such as map voting and player statistics. However, SquadJS is designed to be easy to build upon allowing you to easily create plugins for tasks you want automated.
## **Using SquadJS** From 2da73e58d228de863f5f711289a95c159275aa57 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Sat, 30 Jan 2021 17:01:52 +0000 Subject: [PATCH 17/38] Sort plugins alphabetically --- README.md | 569 +++++++++++++++++----------------- config.json | 156 +++++----- squad-server/plugins/index.js | 9 +- 3 files changed, 370 insertions(+), 364 deletions(-) diff --git a/README.md b/README.md index 3b9d052..c2c767b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ ## **About** -SquadJS is an open source framework, designed for Squad servers, that aims to make communicating with Squad servers simple. Unlike other tools, that only collect data through limited means, SquadJS employs a more advanced data collection techniques allowing it to expose a greater variety of data points, such as kill logs. Shipped with SquadJS are a number of different plugins, built by our community, that do a range of different tasks, such as map voting and player statistics. However, SquadJS is designed to be easy to build upon allowing you to easily create plugins for tasks you want automated. +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. +
## **Using SquadJS** @@ -265,66 +266,48 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
- SeedingMode -

SeedingMode

-

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.

+ AutoKickUnassigned +

AutoKickUnassigned

+

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

Options

-
  • interval

    +
    • warningMessage

      Description
      -

      Frequency of seeding messages in milliseconds.

      +

      Message SquadJS will send to players warning them they will be kicked

      Default
      -
      150000
    • -
    • seedingThreshold

      +
      Join a squad, you are are unassigned and will be kicked
    • +
    • kickMessage

      Description
      -

      Player count required for server not to be in seeding mode.

      +

      Message to send to players when they are kicked

      Default
      -
      50
    • -
    • seedingMessage

      +
      Unassigned - automatically removed
    • +
    • frequencyOfWarnings

      Description
      -

      Seeding message to display.

      +

      How often in Seconds should we warn the player about being unassigned?

      Default
      -
      Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
    • -
    • liveEnabled

      +
      30
    • +
    • unassignedTimer

      Description
      -

      Enable "Live" messages for when the server goes live.

      +

      How long in Seconds to wait before a unassigned player is kicked

      Default
      -
      true
    • -
    • liveThreshold

      +
      360
    • +
    • playerThreshold

      Description
      -

      Player count required for "Live" messages to not bee displayed.

      +

      Player count required for AutoKick to start kicking players, set to -1 to disable

      Default
      -
      52
    • -
    • liveMessage

      +
      93
    • +
    • roundStartDelay

      Description
      -

      "Live" message to display.

      +

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      Default
      -
      Live!
    -
- -
- DiscordTeamkill -

DiscordTeamkill

-

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

-

Options

-
  • discordClient (Required)

    +
    900
  • +
  • ignoreAdmins

    Description
    -

    Discord connector name.

    +

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    Default
    -
    discord
  • -
  • channelID (Required)

    +
    false
  • +
  • ignoreWhitelist

    Description
    -

    The ID of the channel to log teamkills to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embeds.

    -
    Default
    -
    16761867
  • -
  • disableSCBL

    -
    Description
    -

    Disable Squad Community Ban List information.

    +

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    Default
    false
@@ -341,59 +324,6 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
Please apologise for ALL TKs in ALL chat!
-
- DiscordServerStatus -

DiscordServerStatus

-

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • messageIDs (Required)

    -
    Description
    -

    ID of messages to update.

    -
    Default
    -
    []
  • Example
    -
    [
    -  {
    -    "channelID": "667741905228136459",
    -    "messageID": "766688383043895387"
    -  }
    -]
    -
  • updateInterval

    -
    Description
    -

    How frequently to update the status in Discord.

    -
    Default
    -
    60000
  • -
  • disableStatus

    -
    Description
    -

    Disable the bot status.

    -
    Default
    -
    false
-
- -
- IntervalledBroadcasts -

IntervalledBroadcasts

-

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

-

Options

-
  • broadcasts

    -
    Description
    -

    Messages to broadcast.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "This server is powered by SquadJS."
    -]
    -
  • interval

    -
    Description
    -

    Frequency of the broadcasts in milliseconds.

    -
    Default
    -
    300000
-
-
ChatCommands

ChatCommands

@@ -414,9 +344,33 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
- SCBLInfo -

SCBLInfo

-

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

+ DBLog +

DBLog

+

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): +

  • Grafana is a cool way of viewing server statistics stored in the database.
  • +
  • Install Grafana.
  • +
  • Add your database as a datasource named SquadJS.
  • +
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • +
  • Install any missing Grafana plugins.

+

Options

+
  • database (Required)

    +
    Description
    +

    The Sequelize connector to log server information to.

    +
    Default
    +
    mysql
  • +
  • overrideServerID

    +
    Description
    +

    A overridden server ID.

    +
    Default
    +
    null
+
+ +
+ DiscordAdminBroadcast +

DiscordAdminBroadcast

+

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

Options

  • discordClient (Required)

    Description
    @@ -425,15 +379,95 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    discord
  • channelID (Required)

    Description
    -

    The ID of the channel to alert admins through.

    +

    The ID of the channel to log admin broadcasts to.

    Default
  • Example
    667741905228136459
    -
  • threshold

    +
  • color

    Description
    -

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    +

    The color of the embed.

    Default
    -
    6
+
16761867
+
+ +
+ DiscordAdminCamLogs +

DiscordAdminCamLogs

+

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin camera usage to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+ +
+ DiscordAdminRequest +

DiscordAdminRequest

+

The DiscordAdminRequest plugin will ping admins in a Discord channel when a player requests an admin via the !admin command in in-game chat.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • ignoreChats

    +
    Description
    +

    A list of chat names to ignore.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "ChatSquad"
    +]
    +
  • ignorePhrases

    +
    Description
    +

    A list of phrases to ignore.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "switch"
    +]
    +
  • command

    +
    Description
    +

    The command that calls an admin.

    +
    Default
    +
    admin
  • +
  • pingGroups

    +
    Description
    +

    A list of Discord role IDs to ping.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "500455137626554379"
    +]
    +
  • pingDelay

    +
    Description
    +

    Cooldown for pings in milliseconds.

    +
    Default
    +
    60000
  • +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
@@ -500,109 +534,6 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r ]
-
- DiscordAdminRequest -

DiscordAdminRequest

-

The DiscordAdminRequest plugin will ping admins in a Discord channel when a player requests an admin via the !admin command in in-game chat.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • ignoreChats

    -
    Description
    -

    A list of chat names to ignore.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "ChatSquad"
    -]
    -
  • ignorePhrases

    -
    Description
    -

    A list of phrases to ignore.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "switch"
    -]
    -
  • command

    -
    Description
    -

    The command that calls an admin.

    -
    Default
    -
    admin
  • -
  • pingGroups

    -
    Description
    -

    A list of Discord role IDs to ping.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "500455137626554379"
    -]
    -
  • pingDelay

    -
    Description
    -

    Cooldown for pings in milliseconds.

    -
    Default
    -
    60000
  • -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
- -
- DiscordAdminBroadcast -

DiscordAdminBroadcast

-

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
- -
- DiscordAdminCamLogs -

DiscordAdminCamLogs

-

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin camera usage to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
-
DiscordRcon

DiscordRcon

@@ -638,48 +569,6 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
false
-
- DiscordSubsystemRestarter -

DiscordSubsystemRestarter

-

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • role (Required)

    -
    Description
    -

    ID of role required to run the sub system restart commands.

    -
    Default
    -
  • Example
    -
    667741905228136459
-
- -
- DBLog -

DBLog

-

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): -

  • Grafana is a cool way of viewing server statistics stored in the database.
  • -
  • Install Grafana.
  • -
  • Add your database as a datasource named SquadJS.
  • -
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • -
  • Install any missing Grafana plugins.

-

Options

-
  • database (Required)

    -
    Description
    -

    The Sequelize connector to log server information to.

    -
    Default
    -
    mysql
  • -
  • overrideServerID

    -
    Description
    -

    A overridden server ID.

    -
    Default
    -
    null
-
-
DiscordRoundWinner

DiscordRoundWinner

@@ -704,52 +593,164 @@ Grafana (NOT YET WORKING WITH V2):
- AutoKickUnassigned -

AutoKickUnassigned

-

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

+ DiscordServerStatus +

DiscordServerStatus

+

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

Options

-
  • warningMessage

    +
    • discordClient (Required)

      Description
      -

      Message SquadJS will send to players warning them they will be kicked

      +

      Discord connector name.

      Default
      -
      Join a squad, you are are unassigned and will be kicked
    • -
    • kickMessage

      +
      discord
    • +
    • messageIDs (Required)

      Description
      -

      Message to send to players when they are kicked

      +

      ID of messages to update.

      Default
      -
      Unassigned - automatically removed
    • -
    • frequencyOfWarnings

      +
      []
    • Example
      +
      [
      +  {
      +    "channelID": "667741905228136459",
      +    "messageID": "766688383043895387"
      +  }
      +]
      +
    • updateInterval

      Description
      -

      How often in Seconds should we warn the player about being unassigned?

      +

      How frequently to update the status in Discord.

      Default
      -
      30
    • -
    • unassignedTimer

      +
      60000
    • +
    • disableStatus

      Description
      -

      How long in Seconds to wait before a unassigned player is kicked

      -
      Default
      -
      360
    • -
    • playerThreshold

      -
      Description
      -

      Player count required for AutoKick to start kicking players, set to -1 to disable

      -
      Default
      -
      93
    • -
    • roundStartDelay

      -
      Description
      -

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      -
      Default
      -
      900
    • -
    • ignoreAdmins

      -
      Description
      -

      • true: Admins will NOT be kicked
      • false: Admins WILL be kicked

      -
      Default
      -
      false
    • -
    • ignoreWhitelist

      -
      Description
      -

      • true: Reserve slot players will NOT be kicked
      • false: Reserve slot players WILL be kicked

      +

      Disable the bot status.

      Default
      false
+
+ DiscordSubsystemRestarter +

DiscordSubsystemRestarter

+

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • role (Required)

    +
    Description
    +

    ID of role required to run the sub system restart commands.

    +
    Default
    +
  • Example
    +
    667741905228136459
+
+ +
+ DiscordTeamkill +

DiscordTeamkill

+

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log teamkills to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embeds.

    +
    Default
    +
    16761867
  • +
  • disableSCBL

    +
    Description
    +

    Disable Squad Community Ban List information.

    +
    Default
    +
    false
+
+ +
+ IntervalledBroadcasts +

IntervalledBroadcasts

+

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

+

Options

+
  • broadcasts

    +
    Description
    +

    Messages to broadcast.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "This server is powered by SquadJS."
    +]
    +
  • interval

    +
    Description
    +

    Frequency of the broadcasts in milliseconds.

    +
    Default
    +
    300000
+
+ +
+ SCBLInfo +

SCBLInfo

+

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to alert admins through.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • threshold

    +
    Description
    +

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    +
    Default
    +
    6
+
+ +
+ SeedingMode +

SeedingMode

+

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.

+

Options

+
  • interval

    +
    Description
    +

    Frequency of seeding messages in milliseconds.

    +
    Default
    +
    150000
  • +
  • seedingThreshold

    +
    Description
    +

    Player count required for server not to be in seeding mode.

    +
    Default
    +
    50
  • +
  • seedingMessage

    +
    Description
    +

    Seeding message to display.

    +
    Default
    +
    Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
  • +
  • liveEnabled

    +
    Description
    +

    Enable "Live" messages for when the server goes live.

    +
    Default
    +
    true
  • +
  • liveThreshold

    +
    Description
    +

    Player count required for "Live" messages to not bee displayed.

    +
    Default
    +
    52
  • +
  • liveMessage

    +
    Description
    +

    "Live" message to display.

    +
    Default
    +
    Live!
+
+
TeamRandomizer

TeamRandomizer

diff --git a/config.json b/config.json index b7e420d..aba8196 100644 --- a/config.json +++ b/config.json @@ -70,42 +70,22 @@ }, "plugins": [ { - "plugin": "SeedingMode", + "plugin": "AutoKickUnassigned", "enabled": true, - "interval": 150000, - "seedingThreshold": 50, - "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", - "liveEnabled": true, - "liveThreshold": 52, - "liveMessage": "Live!" - }, - { - "plugin": "DiscordTeamkill", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867, - "disableSCBL": false + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false }, { "plugin": "AutoTKWarn", "enabled": true, "message": "Please apologise for ALL TKs in ALL chat!" }, - { - "plugin": "DiscordServerStatus", - "enabled": false, - "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "IntervalledBroadcasts", - "enabled": false, - "broadcasts": [], - "interval": 300000 - }, { "plugin": "ChatCommands", "enabled": true, @@ -119,11 +99,36 @@ ] }, { - "plugin": "SCBLInfo", + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, + { + "plugin": "DiscordAdminBroadcast", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordAdminCamLogs", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordAdminRequest", "enabled": true, "discordClient": "discord", "channelID": "", - "threshold": 6 + "ignoreChats": [], + "ignorePhrases": [], + "command": "admin", + "pingGroups": [], + "pingDelay": 60000, + "color": 16761867 }, { "plugin": "DiscordChat", @@ -143,32 +148,6 @@ "channelID": "", "events": [] }, - { - "plugin": "DiscordAdminRequest", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "ignoreChats": [], - "ignorePhrases": [], - "command": "admin", - "pingGroups": [], - "pingDelay": 60000, - "color": 16761867 - }, - { - "plugin": "DiscordAdminBroadcast", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordAdminCamLogs", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, { "plugin": "DiscordRcon", "enabled": false, @@ -177,18 +156,6 @@ "permissions": {}, "prependAdminNameInBroadcast": false }, - { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" - }, - { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, { "plugin": "DiscordRoundWinner", "enabled": true, @@ -197,16 +164,49 @@ "color": 16761867 }, { - "plugin": "AutoKickUnassigned", + "plugin": "DiscordServerStatus", + "enabled": false, + "discordClient": "discord", + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "DiscordSubsystemRestarter", + "enabled": false, + "discordClient": "discord", + "role": "" + }, + { + "plugin": "DiscordTeamkill", "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false + "discordClient": "discord", + "channelID": "", + "color": 16761867, + "disableSCBL": false + }, + { + "plugin": "IntervalledBroadcasts", + "enabled": false, + "broadcasts": [], + "interval": 300000 + }, + { + "plugin": "SCBLInfo", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "threshold": 6 + }, + { + "plugin": "SeedingMode", + "enabled": true, + "interval": 150000, + "seedingThreshold": 50, + "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", + "liveEnabled": true, + "liveThreshold": 52, + "liveMessage": "Live!" }, { "plugin": "TeamRandomizer", diff --git a/squad-server/plugins/index.js b/squad-server/plugins/index.js index e52a676..78bb765 100644 --- a/squad-server/plugins/index.js +++ b/squad-server/plugins/index.js @@ -17,15 +17,20 @@ class Plugins { this.plugins = {}; const dir = await fs.promises.opendir(path.join(__dirname, './')); + + const pluginFilenames = []; for await (const dirent of dir) { if (!dirent.isFile()) continue; if ( ['index.js', 'base-plugin.js', 'discord-base-plugin.js', 'readme.md'].includes(dirent.name) ) continue; - Logger.verbose('Plugins', 1, `Loading plugin file ${dirent.name}...`); - const { default: Plugin } = await import(`./${dirent.name}`); + pluginFilenames.push(dirent.name); + } + for (const pluginFilename of pluginFilenames) { + Logger.verbose('Plugins', 1, `Loading plugin file ${pluginFilename}...`); + const { default: Plugin } = await import(`./${pluginFilename}`); this.plugins[Plugin.name] = Plugin; } From 2cf8eee1250b6641e008c2f012a3f88c82422d62 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Sat, 30 Jan 2021 17:03:50 +0000 Subject: [PATCH 18/38] ESLint & README Generation --- README.md | 566 ++++++++++++++++++++++++++-------------------------- config.json | 156 +++++++-------- 2 files changed, 361 insertions(+), 361 deletions(-) diff --git a/README.md b/README.md index c2c767b..ce58ed8 100644 --- a/README.md +++ b/README.md @@ -266,48 +266,66 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
- AutoKickUnassigned -

AutoKickUnassigned

-

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

+ SeedingMode +

SeedingMode

+

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.

Options

-
  • warningMessage

    +
    • interval

      Description
      -

      Message SquadJS will send to players warning them they will be kicked

      +

      Frequency of seeding messages in milliseconds.

      Default
      -
      Join a squad, you are are unassigned and will be kicked
    • -
    • kickMessage

      +
      150000
    • +
    • seedingThreshold

      Description
      -

      Message to send to players when they are kicked

      +

      Player count required for server not to be in seeding mode.

      Default
      -
      Unassigned - automatically removed
    • -
    • frequencyOfWarnings

      +
      50
    • +
    • seedingMessage

      Description
      -

      How often in Seconds should we warn the player about being unassigned?

      +

      Seeding message to display.

      Default
      -
      30
    • -
    • unassignedTimer

      +
      Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
    • +
    • liveEnabled

      Description
      -

      How long in Seconds to wait before a unassigned player is kicked

      +

      Enable "Live" messages for when the server goes live.

      Default
      -
      360
    • -
    • playerThreshold

      +
      true
    • +
    • liveThreshold

      Description
      -

      Player count required for AutoKick to start kicking players, set to -1 to disable

      +

      Player count required for "Live" messages to not bee displayed.

      Default
      -
      93
    • -
    • roundStartDelay

      +
      52
    • +
    • liveMessage

      Description
      -

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      +

      "Live" message to display.

      Default
      -
      900
    • -
    • ignoreAdmins

      +
      Live!
    +
+ +
+ DiscordTeamkill +

DiscordTeamkill

+

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

+

Options

+
  • discordClient (Required)

    Description
    -

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    +

    Discord connector name.

    Default
    -
    false
  • -
  • ignoreWhitelist

    +
    discord
  • +
  • channelID (Required)

    Description
    -

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    +

    The ID of the channel to log teamkills to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embeds.

    +
    Default
    +
    16761867
  • +
  • disableSCBL

    +
    Description
    +

    Disable Squad Community Ban List information.

    Default
    false
@@ -324,6 +342,59 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
Please apologise for ALL TKs in ALL chat!
+
+ DiscordServerStatus +

DiscordServerStatus

+

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • messageIDs (Required)

    +
    Description
    +

    ID of messages to update.

    +
    Default
    +
    []
  • Example
    +
    [
    +  {
    +    "channelID": "667741905228136459",
    +    "messageID": "766688383043895387"
    +  }
    +]
    +
  • updateInterval

    +
    Description
    +

    How frequently to update the status in Discord.

    +
    Default
    +
    60000
  • +
  • disableStatus

    +
    Description
    +

    Disable the bot status.

    +
    Default
    +
    false
+
+ +
+ IntervalledBroadcasts +

IntervalledBroadcasts

+

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

+

Options

+
  • broadcasts

    +
    Description
    +

    Messages to broadcast.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "This server is powered by SquadJS."
    +]
    +
  • interval

    +
    Description
    +

    Frequency of the broadcasts in milliseconds.

    +
    Default
    +
    300000
+
+
ChatCommands

ChatCommands

@@ -344,33 +415,9 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
- DBLog -

DBLog

-

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): -

  • Grafana is a cool way of viewing server statistics stored in the database.
  • -
  • Install Grafana.
  • -
  • Add your database as a datasource named SquadJS.
  • -
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • -
  • Install any missing Grafana plugins.

-

Options

-
  • database (Required)

    -
    Description
    -

    The Sequelize connector to log server information to.

    -
    Default
    -
    mysql
  • -
  • overrideServerID

    -
    Description
    -

    A overridden server ID.

    -
    Default
    -
    null
-
- -
- DiscordAdminBroadcast -

DiscordAdminBroadcast

-

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

+ SCBLInfo +

SCBLInfo

+

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

Options

  • discordClient (Required)

    Description
    @@ -379,95 +426,15 @@ Grafana (NOT YET WORKING WITH V2):
    discord
  • channelID (Required)

    Description
    -

    The ID of the channel to log admin broadcasts to.

    +

    The ID of the channel to alert admins through.

    Default
  • Example
    667741905228136459
    -
  • color

    +
  • threshold

    Description
    -

    The color of the embed.

    +

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    Default
    -
    16761867
-
- -
- DiscordAdminCamLogs -

DiscordAdminCamLogs

-

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin camera usage to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
- -
- DiscordAdminRequest -

DiscordAdminRequest

-

The DiscordAdminRequest plugin will ping admins in a Discord channel when a player requests an admin via the !admin command in in-game chat.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • ignoreChats

    -
    Description
    -

    A list of chat names to ignore.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "ChatSquad"
    -]
    -
  • ignorePhrases

    -
    Description
    -

    A list of phrases to ignore.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "switch"
    -]
    -
  • command

    -
    Description
    -

    The command that calls an admin.

    -
    Default
    -
    admin
  • -
  • pingGroups

    -
    Description
    -

    A list of Discord role IDs to ping.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "500455137626554379"
    -]
    -
  • pingDelay

    -
    Description
    -

    Cooldown for pings in milliseconds.

    -
    Default
    -
    60000
  • -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
+
6
@@ -534,6 +501,109 @@ Grafana (NOT YET WORKING WITH V2): ]
+
+ DiscordAdminRequest +

DiscordAdminRequest

+

The DiscordAdminRequest plugin will ping admins in a Discord channel when a player requests an admin via the !admin command in in-game chat.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • ignoreChats

    +
    Description
    +

    A list of chat names to ignore.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "ChatSquad"
    +]
    +
  • ignorePhrases

    +
    Description
    +

    A list of phrases to ignore.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "switch"
    +]
    +
  • command

    +
    Description
    +

    The command that calls an admin.

    +
    Default
    +
    admin
  • +
  • pingGroups

    +
    Description
    +

    A list of Discord role IDs to ping.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "500455137626554379"
    +]
    +
  • pingDelay

    +
    Description
    +

    Cooldown for pings in milliseconds.

    +
    Default
    +
    60000
  • +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+ +
+ DiscordAdminBroadcast +

DiscordAdminBroadcast

+

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+ +
+ DiscordAdminCamLogs +

DiscordAdminCamLogs

+

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin camera usage to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+
DiscordRcon

DiscordRcon

@@ -569,6 +639,48 @@ Grafana (NOT YET WORKING WITH V2):
false
+
+ DiscordSubsystemRestarter +

DiscordSubsystemRestarter

+

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • role (Required)

    +
    Description
    +

    ID of role required to run the sub system restart commands.

    +
    Default
    +
  • Example
    +
    667741905228136459
+
+ +
+ DBLog +

DBLog

+

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): +

  • Grafana is a cool way of viewing server statistics stored in the database.
  • +
  • Install Grafana.
  • +
  • Add your database as a datasource named SquadJS.
  • +
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • +
  • Install any missing Grafana plugins.

+

Options

+
  • database (Required)

    +
    Description
    +

    The Sequelize connector to log server information to.

    +
    Default
    +
    mysql
  • +
  • overrideServerID

    +
    Description
    +

    A overridden server ID.

    +
    Default
    +
    null
+
+
DiscordRoundWinner

DiscordRoundWinner

@@ -593,164 +705,52 @@ Grafana (NOT YET WORKING WITH V2):
- DiscordServerStatus -

DiscordServerStatus

-

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

+ AutoKickUnassigned +

AutoKickUnassigned

+

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

Options

-
  • discordClient (Required)

    +
    • warningMessage

      Description
      -

      Discord connector name.

      +

      Message SquadJS will send to players warning them they will be kicked

      Default
      -
      discord
    • -
    • messageIDs (Required)

      +
      Join a squad, you are are unassigned and will be kicked
    • +
    • kickMessage

      Description
      -

      ID of messages to update.

      +

      Message to send to players when they are kicked

      Default
      -
      []
    • Example
      -
      [
      -  {
      -    "channelID": "667741905228136459",
      -    "messageID": "766688383043895387"
      -  }
      -]
      -
    • updateInterval

      +
      Unassigned - automatically removed
    • +
    • frequencyOfWarnings

      Description
      -

      How frequently to update the status in Discord.

      +

      How often in Seconds should we warn the player about being unassigned?

      Default
      -
      60000
    • -
    • disableStatus

      +
      30
    • +
    • unassignedTimer

      Description
      -

      Disable the bot status.

      +

      How long in Seconds to wait before a unassigned player is kicked

      +
      Default
      +
      360
    • +
    • playerThreshold

      +
      Description
      +

      Player count required for AutoKick to start kicking players, set to -1 to disable

      +
      Default
      +
      93
    • +
    • roundStartDelay

      +
      Description
      +

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      +
      Default
      +
      900
    • +
    • ignoreAdmins

      +
      Description
      +

      • true: Admins will NOT be kicked
      • false: Admins WILL be kicked

      +
      Default
      +
      false
    • +
    • ignoreWhitelist

      +
      Description
      +

      • true: Reserve slot players will NOT be kicked
      • false: Reserve slot players WILL be kicked

      Default
      false
-
- DiscordSubsystemRestarter -

DiscordSubsystemRestarter

-

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • role (Required)

    -
    Description
    -

    ID of role required to run the sub system restart commands.

    -
    Default
    -
  • Example
    -
    667741905228136459
-
- -
- DiscordTeamkill -

DiscordTeamkill

-

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log teamkills to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embeds.

    -
    Default
    -
    16761867
  • -
  • disableSCBL

    -
    Description
    -

    Disable Squad Community Ban List information.

    -
    Default
    -
    false
-
- -
- IntervalledBroadcasts -

IntervalledBroadcasts

-

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

-

Options

-
  • broadcasts

    -
    Description
    -

    Messages to broadcast.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "This server is powered by SquadJS."
    -]
    -
  • interval

    -
    Description
    -

    Frequency of the broadcasts in milliseconds.

    -
    Default
    -
    300000
-
- -
- SCBLInfo -

SCBLInfo

-

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to alert admins through.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • threshold

    -
    Description
    -

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    -
    Default
    -
    6
-
- -
- SeedingMode -

SeedingMode

-

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.

-

Options

-
  • interval

    -
    Description
    -

    Frequency of seeding messages in milliseconds.

    -
    Default
    -
    150000
  • -
  • seedingThreshold

    -
    Description
    -

    Player count required for server not to be in seeding mode.

    -
    Default
    -
    50
  • -
  • seedingMessage

    -
    Description
    -

    Seeding message to display.

    -
    Default
    -
    Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
  • -
  • liveEnabled

    -
    Description
    -

    Enable "Live" messages for when the server goes live.

    -
    Default
    -
    true
  • -
  • liveThreshold

    -
    Description
    -

    Player count required for "Live" messages to not bee displayed.

    -
    Default
    -
    52
  • -
  • liveMessage

    -
    Description
    -

    "Live" message to display.

    -
    Default
    -
    Live!
-
-
TeamRandomizer

TeamRandomizer

diff --git a/config.json b/config.json index aba8196..b7e420d 100644 --- a/config.json +++ b/config.json @@ -70,22 +70,42 @@ }, "plugins": [ { - "plugin": "AutoKickUnassigned", + "plugin": "SeedingMode", "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false + "interval": 150000, + "seedingThreshold": 50, + "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", + "liveEnabled": true, + "liveThreshold": 52, + "liveMessage": "Live!" + }, + { + "plugin": "DiscordTeamkill", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "color": 16761867, + "disableSCBL": false }, { "plugin": "AutoTKWarn", "enabled": true, "message": "Please apologise for ALL TKs in ALL chat!" }, + { + "plugin": "DiscordServerStatus", + "enabled": false, + "discordClient": "discord", + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "IntervalledBroadcasts", + "enabled": false, + "broadcasts": [], + "interval": 300000 + }, { "plugin": "ChatCommands", "enabled": true, @@ -99,36 +119,11 @@ ] }, { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, - { - "plugin": "DiscordAdminBroadcast", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordAdminCamLogs", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordAdminRequest", + "plugin": "SCBLInfo", "enabled": true, "discordClient": "discord", "channelID": "", - "ignoreChats": [], - "ignorePhrases": [], - "command": "admin", - "pingGroups": [], - "pingDelay": 60000, - "color": 16761867 + "threshold": 6 }, { "plugin": "DiscordChat", @@ -148,6 +143,32 @@ "channelID": "", "events": [] }, + { + "plugin": "DiscordAdminRequest", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "ignoreChats": [], + "ignorePhrases": [], + "command": "admin", + "pingGroups": [], + "pingDelay": 60000, + "color": 16761867 + }, + { + "plugin": "DiscordAdminBroadcast", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordAdminCamLogs", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, { "plugin": "DiscordRcon", "enabled": false, @@ -156,6 +177,18 @@ "permissions": {}, "prependAdminNameInBroadcast": false }, + { + "plugin": "DiscordSubsystemRestarter", + "enabled": false, + "discordClient": "discord", + "role": "" + }, + { + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, { "plugin": "DiscordRoundWinner", "enabled": true, @@ -164,49 +197,16 @@ "color": 16761867 }, { - "plugin": "DiscordServerStatus", - "enabled": false, - "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" - }, - { - "plugin": "DiscordTeamkill", + "plugin": "AutoKickUnassigned", "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867, - "disableSCBL": false - }, - { - "plugin": "IntervalledBroadcasts", - "enabled": false, - "broadcasts": [], - "interval": 300000 - }, - { - "plugin": "SCBLInfo", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "threshold": 6 - }, - { - "plugin": "SeedingMode", - "enabled": true, - "interval": 150000, - "seedingThreshold": 50, - "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", - "liveEnabled": true, - "liveThreshold": 52, - "liveMessage": "Live!" + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false }, { "plugin": "TeamRandomizer", From 69096b00af3b4ccd16d39e8fc461cd0e9c60f973 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Sat, 30 Jan 2021 17:23:25 +0000 Subject: [PATCH 19/38] ESLint & README Generation --- squad-server/plugins/scbl-info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/plugins/scbl-info.js b/squad-server/plugins/scbl-info.js index d99fc12..180ad3c 100644 --- a/squad-server/plugins/scbl-info.js +++ b/squad-server/plugins/scbl-info.js @@ -88,7 +88,7 @@ export default class SCBLInfo extends DiscordBasePlugin { { id: info.player.steamID } ); - if (!data.steamUser){ + if (!data.steamUser) { this.verbose( 2, `Player ${info.name} (Steam ID: ${info.steamID}) is not listed in the Squad Community Ban List.` From b5a3f4c59b7d716757dd48775336a9d00dcbbf1b Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 17:33:01 +0000 Subject: [PATCH 20/38] Initial Squad v2 Layer Support --- squad-server/factory.js | 10 - squad-server/index.js | 31 +- squad-server/layers/index.js | 4 + squad-server/layers/layer.js | 47 +++ squad-server/layers/layers.js | 44 +++ squad-server/plugins/discord-round-winner.js | 2 +- squad-server/plugins/discord-server-status.js | 6 +- squad-server/rcon.js | 19 +- squad-server/templates/config-template.json | 35 --- squad-server/utils/squad-layers.js | 274 ------------------ 10 files changed, 133 insertions(+), 339 deletions(-) create mode 100644 squad-server/layers/index.js create mode 100644 squad-server/layers/layer.js create mode 100644 squad-server/layers/layers.js delete mode 100644 squad-server/utils/squad-layers.js diff --git a/squad-server/factory.js b/squad-server/factory.js index 074bf08..d68cd15 100644 --- a/squad-server/factory.js +++ b/squad-server/factory.js @@ -35,9 +35,6 @@ export default class SquadServerFactory { Logger.verbose('SquadServerFactory', 1, 'Creating SquadServer...'); const server = new SquadServer(config.server); - // pull layers read to use to create layer filter connectors - await server.squadLayers.pull(); - // initialise connectors Logger.verbose('SquadServerFactory', 1, 'Preparing connectors...'); const connectors = {}; @@ -102,13 +99,6 @@ export default class SquadServerFactory { static async createConnector(server, type, connectorName, connectorConfig) { Logger.verbose('SquadServerFactory', 1, `Starting ${type} connector ${connectorName}...`); - if (type === 'squadlayerpool') { - return server.squadLayers[connectorConfig.type]( - connectorConfig.filter, - connectorConfig.activeLayerFilter - ); - } - if (type === 'discord') { const connector = new Discord.Client(); await connector.login(connectorConfig); diff --git a/squad-server/index.js b/squad-server/index.js index 5e2ef2f..5e56619 100644 --- a/squad-server/index.js +++ b/squad-server/index.js @@ -6,11 +6,12 @@ import Gamedig from 'gamedig'; import Logger from 'core/logger'; import { SQUADJS_API_DOMAIN } from 'core/constants'; +import { Layers } from './layers/index.js'; + import LogParser from './log-parser/index.js'; import Rcon from './rcon.js'; import { SQUADJS_VERSION } from './utils/constants.js'; -import { SquadLayers } from './utils/squad-layers.js'; import fetchAdminLists from './utils/admin-lists.js'; @@ -33,8 +34,6 @@ export default class SquadServer extends EventEmitter { this.plugins = []; - this.squadLayers = new SquadLayers(options.squadLayersSource); - this.setupRCON(); this.setupLogParser(); @@ -61,7 +60,9 @@ export default class SquadServer extends EventEmitter { 1, `Beginning to watch ${this.options.host}:${this.options.queryPort}...` ); - await this.squadLayers.pull(); + + await Layers.pull(); + this.admins = await fetchAdminLists(this.options.adminLists); await this.rcon.connect(); @@ -131,12 +132,13 @@ export default class SquadServer extends EventEmitter { this.emit('ADMIN_BROADCAST', data); }); - this.logParser.on('NEW_GAME', (data) => { - data.layer = this.squadLayers.getLayerByLayerClassname(data.layerClassname); + this.logParser.on('NEW_GAME', async (data) => { + data.layer = await Layers.getLayerByClassname(data.layerClassname); - this.layerHistory.unshift({ ...data.layer, time: data.time }); + this.layerHistory.unshift({ layer: data.layer, time: data.time }); this.layerHistory = this.layerHistory.slice(0, this.layerHistoryMaxLength); + this.currentLayer = data.layer; this.emit('NEW_GAME', data); }); @@ -301,16 +303,21 @@ export default class SquadServer extends EventEmitter { Logger.verbose('SquadServer', 1, `Updating layer information...`); try { - const layerInfo = await this.rcon.getLayerInfo(); + const currentMap = await this.rcon.getCurrentMap(); + const nextMap = await this.rcon.getNextMap(); + const nextMapToBeVoted = nextMap === 'To be voted'; + + const currentLayer = await Layers.getLayerByName(currentMap.layer); + const nextLayer = nextMapToBeVoted ? null : await Layers.getLayerByName(nextMap.layer); if (this.layerHistory.length === 0) { - const layer = this.squadLayers.getLayerByLayerName(layerInfo.currentLayer); - - this.layerHistory.unshift({ ...layer, time: Date.now() }); + this.layerHistory.unshift({ layer: currentLayer, time: Date.now() }); this.layerHistory = this.layerHistory.slice(0, this.layerHistoryMaxLength); } - this.nextLayer = layerInfo.nextLayer; + this.currentLayer = currentLayer; + this.nextLayer = nextLayer; + this.nextLayerToBeVoted = nextMapToBeVoted; this.emit('UPDATED_LAYER_INFORMATION'); } catch (err) { diff --git a/squad-server/layers/index.js b/squad-server/layers/index.js new file mode 100644 index 0000000..43d99bd --- /dev/null +++ b/squad-server/layers/index.js @@ -0,0 +1,4 @@ +import Layer from './layer.js'; +import Layers from './layers.js'; + +export { Layer, Layers }; diff --git a/squad-server/layers/layer.js b/squad-server/layers/layer.js new file mode 100644 index 0000000..5ddc713 --- /dev/null +++ b/squad-server/layers/layer.js @@ -0,0 +1,47 @@ +export default class Layer { + constructor(data) { + this.name = data.Name; + this.classname = data.rawName; + this.map = { + name: data.mapName + }; + this.gamemode = data.gamemode; + this.gamemodeType = data.type; + this.version = data.layerVersion; + this.size = data.mapSize; + this.sizeType = data.mapSizeType; + this.numberOfCapturePoints = parseInt(data.capturePoints); + this.lighting = { + name: data.lighting, + classname: data.lightingLevel + }; + this.teams = [ + { + faction: data.team1.faction, + name: data.team1.teamSetupName, + tickets: data.team1.tickets, + commander: data.team1.commander, + vehicles: (data.team1.vehicles || []).map((vehicle) => ({ + name: vehicle.type, + classname: vehicle.rawType, + count: vehicle.count, + spawnDelay: vehicle.delay, + respawnDelay: vehicle.respawnTime + })) + }, + { + faction: data.team2.faction, + name: data.team2.teamSetupName, + tickets: data.team2.tickets, + commander: data.team2.commander, + vehicles: (data.team2.vehicles || []).map((vehicle) => ({ + name: vehicle.type, + classname: vehicle.rawType, + count: vehicle.count, + spawnDelay: vehicle.delay, + respawnDelay: vehicle.respawnTime + })) + } + ]; + } +} diff --git a/squad-server/layers/layers.js b/squad-server/layers/layers.js new file mode 100644 index 0000000..8a6a5bd --- /dev/null +++ b/squad-server/layers/layers.js @@ -0,0 +1,44 @@ +import axios from 'axios'; + +import Layer from './layer.js'; + +class Layers { + constructor() { + this.layers = []; + + this.pulled = false; + } + + async pull(force = false) { + if (this.pulled && !force) return; + + const response = await axios.get( + 'https://raw.githubusercontent.com/Squad-Wiki-Editorial/squad-wiki-pipeline-map-data/dev/completed_output/2.0/finished_2.0.json' + ); + + for (const layer of response.data.Maps) { + this.layers.push(new Layer(layer)); + } + + return this.layers; + } + + async getLayerByCondition(condition) { + await this.pull(); + + const matches = this.layers.filter(condition); + if (matches.length === 1) return matches[0]; + + return null; + } + + getLayerByName(name) { + return this.getLayerByCondition((layer) => layer.name === name); + } + + getLayerByClassname(classname) { + return this.getLayerByCondition((layer) => layer.classname === classname); + } +} + +export default new Layers(); diff --git a/squad-server/plugins/discord-round-winner.js b/squad-server/plugins/discord-round-winner.js index 954fcd3..960f3e7 100644 --- a/squad-server/plugins/discord-round-winner.js +++ b/squad-server/plugins/discord-round-winner.js @@ -48,7 +48,7 @@ export default class DiscordRoundWinner extends DiscordBasePlugin { fields: [ { name: 'Message', - value: `${info.winner} won on ${info.layer}.` + value: `${info.winner} won on ${info.layer.name}.` } ], timestamp: info.time.toISOString() diff --git a/squad-server/plugins/discord-server-status.js b/squad-server/plugins/discord-server-status.js index 03028b7..29c1968 100644 --- a/squad-server/plugins/discord-server-status.js +++ b/squad-server/plugins/discord-server-status.js @@ -92,12 +92,14 @@ export default class DiscordServerStatus extends BasePlugin { }, { name: 'Current Layer', - value: `\`\`\`${this.server.layerHistory[0].layer || 'Unknown'}\`\`\``, + value: `\`\`\`${this.server.currentLayer.name || 'Unknown'}\`\`\``, inline: true }, { name: 'Next Layer', - value: `\`\`\`${this.server.nextLayer || 'Unknown'}\`\`\``, + value: `\`\`\`${ + this.server.nextLayer.name || (this.server.nextLayerToBeVoted ? 'To be voted' : 'Unknown') + }\`\`\``, inline: true } ]; diff --git a/squad-server/rcon.js b/squad-server/rcon.js index 2928b59..b5c6ee2 100644 --- a/squad-server/rcon.js +++ b/squad-server/rcon.js @@ -16,14 +16,19 @@ export default class SquadRcon extends Rcon { }); } - async broadcast(message) { - await this.execute(`AdminBroadcast ${message}`); + async getCurrentMap() { + const response = await this.execute('ShowCurrentMap'); + const match = response.match(/^Current level is (.*), layer is (.*)/); + return { level: match[1], layer: match[2] }; } - async getLayerInfo() { + async getNextMap() { const response = await this.execute('ShowNextMap'); - const match = response.match(/^Current map is (.+), Next map is (.*)/); - return { currentLayer: match[1], nextLayer: match[2].length === 0 ? null : match[2] }; + const match = response.match(/^Next level is (.*), layer is (.*)/); + return { + level: match[1] !== '' ? match[1] : null, + layer: match[2] !== 'To be voted' ? match[2] : null + }; } async getListPlayers() { @@ -49,6 +54,10 @@ export default class SquadRcon extends Rcon { return players; } + async broadcast(message) { + await this.execute(`AdminBroadcast ${message}`); + } + async warn(steamID, message) { await this.execute(`AdminWarn "${steamID}" ${message}`); } diff --git a/squad-server/templates/config-template.json b/squad-server/templates/config-template.json index de3b39e..32c8d52 100644 --- a/squad-server/templates/config-template.json +++ b/squad-server/templates/config-template.json @@ -22,41 +22,6 @@ }, "connectors": { "discord": "Discord Login Token", - "squadlayerpool": { - "type": "buildPoolFromFilter", - "filter": { - "whitelistedLayers": null, - "blacklistedLayers": null, - "whitelistedMaps": null, - "blacklistedMaps": null, - "whitelistedGamemodes": null, - "blacklistedGamemodes": ["Training"], - "flagCountMin": null, - "flagCountMax": null, - "hasCommander": null, - "hasTanks": null, - "hasHelicopters": null - }, - "activeLayerFilter": { - "historyResetTime": 18000000, - "layerHistoryTolerance": 8, - "mapHistoryTolerance": 4, - "gamemodeHistoryTolerance": { - "Invasion": 4 - }, - "gamemodeRepetitiveTolerance": { - "Invasion": 4 - }, - "playerCountComplianceEnabled": true, - "factionComplianceEnabled": true, - "factionHistoryTolerance": { - "RUS": 4 - }, - "factionRepetitiveTolerance": { - "RUS": 4 - } - } - }, "mysql": { "host": "host", "port": 3306, diff --git a/squad-server/utils/squad-layers.js b/squad-server/utils/squad-layers.js deleted file mode 100644 index feb0a1d..0000000 --- a/squad-server/utils/squad-layers.js +++ /dev/null @@ -1,274 +0,0 @@ -import axios from 'axios'; -import didYouMean from 'didyoumean'; -import fs from 'fs'; - -class SquadLayersBase { - get layerNames() { - return this.layers.map((layer) => layer.name); - } - - getLayerByCondition(condition) { - const results = this.layers.filter(condition); - return results.length === 1 ? results[0] : null; - } - - getLayerByLayerName(layerName) { - return this.getLayerByCondition((layer) => layer.layer === layerName); - } - - getLayerByLayerClassname(layerClassname) { - return this.getLayerByCondition((layer) => layer.layerClassname === layerClassname); - } - - getLayerByLayerNameAutoCorrection(layerName) { - return this.getLayerByLayerName(didYouMean(layerName, this.layerNames())); - } - - getLayerByNumber(layerNumber) { - return this.getLayerByCondition((layer) => layer.layerNumber === layerNumber); - } -} - -class SquadLayers extends SquadLayersBase { - constructor(source) { - super(); - - this.source = - source || 'https://raw.githubusercontent.com/Thomas-Smyth/squad-layers/master/layers.json'; - this.pulled = false; - } - - async pull(force = false) { - if (this.pulled && !force) return; - - this.layers = (await axios.get(this.source)).data; - for (let i = 0; i < this.layers.length; i++) this.layers[i].layerNumber = i + 1; - } - - buildPoolFromLayerNames(layerNames, activeFilter) { - return new SquadLayersPool( - this.layers.filter((layer) => layerNames.includes(layer.layer)), - activeFilter - ); - } - - buildPoolFromLayerNamesAutoCorrection(layerNames, activeFilter) { - return this.buildPoolFromLayerNames( - layerNames.map((layerName) => this.getLayerByLayerNameAutoCorrection(layerName)), - activeFilter - ); - } - - buildPoolFromFile(path, activeFilter, delimiter = '\n') { - return this.buildPoolFromLayerNames( - fs.readFileSync(path, 'utf8').split(delimiter), - activeFilter - ); - } - - buildPoolFromFilter(filter, activeFilter) { - const whitelistedLayers = filter.whitelistedLayers || null; - const blacklistedLayers = filter.blacklistedLayers || null; - const whitelistedMaps = filter.whitelistedMaps || null; - const blacklistedMaps = filter.blacklistedMaps || null; - const whitelistedGamemodes = filter.whitelistedGamemodes || null; - const blacklistedGamemodes = filter.blacklistedGamemodes || ['Training']; - const flagCountMin = filter.flagCountMin || null; - const flagCountMax = filter.flagCountMax || null; - const hasCommander = filter.hasCommander || null; - const hasTanks = filter.hasTanks || null; - const hasHelicopters = filter.hasHelicopters || null; - - const layers = []; - - for (const layer of this.layers) { - // Whitelist / Blacklist Layers - if (whitelistedLayers !== null && !whitelistedLayers.includes(layer.layer)) continue; - if (blacklistedLayers !== null && blacklistedLayers.includes(layer.layer)) continue; - - // Whitelist / Blacklist Maps - if (whitelistedMaps !== null && !whitelistedMaps.includes(layer.map)) continue; - if (blacklistedMaps !== null && blacklistedMaps.includes(layer.map)) continue; - - // Whitelist / Blacklist Gamemodes - if (whitelistedGamemodes !== null && !whitelistedGamemodes.includes(layer.gamemode)) continue; - if (blacklistedGamemodes !== null && blacklistedGamemodes.includes(layer.gamemode)) continue; - - // Flag Count - if (flagCountMin !== null && layer.flagCount < flagCountMin) continue; - if (flagCountMax !== null && layer.flagCount > flagCountMax) continue; - - // Other Properties - if (hasCommander !== null && layer.commander !== hasCommander) continue; - if (hasTanks !== null && (layer.tanks !== 'N/A') !== hasTanks) continue; - if (hasHelicopters !== null && (layer.helicopters !== 'N/A') !== hasHelicopters) continue; - - layers.push(layer); - } - - return new SquadLayersPool(layers, activeFilter); - } -} - -class SquadLayersPool extends SquadLayersBase { - constructor(layers, activeFilter = null) { - super(); - - this.layers = layers; - for (let i = 0; i < this.layers.length; i++) this.layers[i].layerNumber = i + 1; - this.activeFilter = activeFilter; - } - - inPool(layer) { - if (typeof layer === 'object') layer = layer.layer; - return super.layerNames.includes(layer); - } - - isHistoryCompliant(layerHistory, layer) { - if (this.activeFilter === null) return true; - - if (typeof layer === 'object') layer = layer.layer; - - for ( - let i = 0; - i < Math.min(layerHistory.length, this.activeFilter.layerHistoryTolerance); - i++ - ) { - if (new Date() - layerHistory[i].time > this.activeFilter.historyResetTime) return true; - if (layerHistory[i].layer === layer) return false; - } - - return true; - } - - isMapHistoryCompliant(layerHistory, layer) { - if (this.activeFilter === null) return true; - - if (typeof layer === 'string') layer = this.getLayerByLayerName(layer); - - for (let i = 0; i < Math.min(layerHistory.length, this.activeFilter.mapHistoryTolerance); i++) { - if (new Date() - layerHistory[i].time > this.activeFilter.historyResetTime) return true; - if (layerHistory[i].map === layer.map) return false; - } - - return true; - } - - isGamemodeHistoryCompliant(layerHistory, layer) { - if (this.activeFilter === null) return true; - - if (typeof layer === 'string') layer = this.getLayerByLayerName(layer); - - const gamemodeHistoryTolerance = this.activeFilter.gamemodeHistoryTolerance[layer.gamemode]; - if (!gamemodeHistoryTolerance) return true; - - for (let i = 0; i < Math.min(layerHistory.length, gamemodeHistoryTolerance); i++) { - if (new Date() - layerHistory[i].time > this.activeFilter.historyResetTime) return true; - if (layerHistory[i].gamemode === layer.gamemode) return false; - } - - return true; - } - - isGamemodeRepetitiveCompliant(layerHistory, layer) { - if (this.activeFilter === null) return true; - - if (typeof layer === 'string') layer = this.getLayerByLayerName(layer); - - const gamemodeRepetitiveTolerance = this.activeFilter.gamemodeRepetitiveTolerance[ - layer.gamemode - ]; - if (!gamemodeRepetitiveTolerance) return true; - - for (let i = 0; i < Math.min(layerHistory.length, gamemodeRepetitiveTolerance); i++) { - if (new Date() - layerHistory[i].time > this.activeFilter.historyResetTime) return true; - - if (layerHistory[i].gamemode.gamemode !== layer.gamemode) return true; - } - return false; - } - - isFactionCompliant(layerHistory, layer) { - if (this.activeFilter === null || this.activeFilter.factionComplianceEnabled === false) - return true; - - if (layerHistory.length === 0) return true; - - if (typeof layer === 'string') layer = this.getLayerByLayerName(layer); - - return ( - !layerHistory[0] || - (layerHistory[0].teamOne.faction !== layer.teamTwo.faction && - layerHistory[0].teamTwo.faction !== layer.teamOne.faction) - ); - } - - isFactionHistoryCompliant(layerHistory, layer, faction = null) { - if (this.activeFilter === null) return true; - - if (typeof layer === 'string') layer = SquadLayers.getLayerByLayerName(layer); - - if (faction === null) { - return ( - this.isFactionHistoryCompliant(layerHistory, layer, layer.teamOne.faction) && - this.isFactionHistoryCompliant(layerHistory, layer, layer.teamTwo.faction) - ); - } else { - const factionThreshold = this.activeFilter.factionHistoryTolerance[faction]; - if (!factionThreshold) return true; - - for (let i = 0; i < Math.min(layerHistory.length, factionThreshold); i++) { - if (new Date() - layerHistory[i].time > this.activeFilter.historyResetTime) return true; - if ( - layerHistory[i].teamOne.faction === faction || - layerHistory[i].teamTwo.faction === faction - ) - return false; - } - - return true; - } - } - - isFactionRepetitiveCompliant(layerHistory, layer, faction = null) { - if (this.activeFilter === null) return true; - - if (typeof layer === 'string') layer = SquadLayers.getLayerByLayerName(layer); - - if (faction === null) { - return ( - this.isFactionRepetitiveCompliant(layerHistory, layer, layer.teamOne.faction) && - this.isFactionRepetitiveCompliant(layerHistory, layer, layer.teamTwo.faction) - ); - } else { - const factionThreshold = this.activeFilter.factionRepetitiveTolerance[faction]; - if (!factionThreshold) return true; - - for (let i = 0; i < Math.min(layerHistory.length, factionThreshold); i++) { - if (new Date() - layerHistory[i].time > this.activeFilter.historyResetTime) return true; - - if ( - layerHistory[i].teamOne.faction !== faction && - layerHistory[i].teamTwo.faction !== faction - ) - return true; - } - - return false; - } - } - - isPlayerCountCompliant(server, layer) { - if (this.activeFilter === null || this.activeFilter.playerCountComplianceEnabled === false) - return true; - - if (typeof layer === 'string') layer = this.getLayerByLayerName(layer); - - return !( - server.players.length > layer.estimatedSuitablePlayerCount.max || - server.players.length < layer.estimatedSuitablePlayerCount.min - ); - } -} - -export { SquadLayers, SquadLayersPool }; From 4da7ea8006d3e741939ec79e03d416f6ee918380 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 17:35:45 +0000 Subject: [PATCH 21/38] ESLint & README Generation --- config.json | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/config.json b/config.json index b7e420d..d5feb48 100644 --- a/config.json +++ b/config.json @@ -22,43 +22,6 @@ }, "connectors": { "discord": "Discord Login Token", - "squadlayerpool": { - "type": "buildPoolFromFilter", - "filter": { - "whitelistedLayers": null, - "blacklistedLayers": null, - "whitelistedMaps": null, - "blacklistedMaps": null, - "whitelistedGamemodes": null, - "blacklistedGamemodes": [ - "Training" - ], - "flagCountMin": null, - "flagCountMax": null, - "hasCommander": null, - "hasTanks": null, - "hasHelicopters": null - }, - "activeLayerFilter": { - "historyResetTime": 18000000, - "layerHistoryTolerance": 8, - "mapHistoryTolerance": 4, - "gamemodeHistoryTolerance": { - "Invasion": 4 - }, - "gamemodeRepetitiveTolerance": { - "Invasion": 4 - }, - "playerCountComplianceEnabled": true, - "factionComplianceEnabled": true, - "factionHistoryTolerance": { - "RUS": 4 - }, - "factionRepetitiveTolerance": { - "RUS": 4 - } - } - }, "mysql": { "host": "host", "port": 3306, From a289188dfa3137db58c524e539b0b2bb0356b5f0 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 18:41:35 +0000 Subject: [PATCH 22/38] Initial Squad v2 Layer Support Bug Fixes --- squad-server/layers/layers.js | 2 ++ squad-server/plugins/discord-server-status.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/squad-server/layers/layers.js b/squad-server/layers/layers.js index 8a6a5bd..75813cf 100644 --- a/squad-server/layers/layers.js +++ b/squad-server/layers/layers.js @@ -12,6 +12,8 @@ class Layers { async pull(force = false) { if (this.pulled && !force) return; + this.layers = []; + const response = await axios.get( 'https://raw.githubusercontent.com/Squad-Wiki-Editorial/squad-wiki-pipeline-map-data/dev/completed_output/2.0/finished_2.0.json' ); diff --git a/squad-server/plugins/discord-server-status.js b/squad-server/plugins/discord-server-status.js index 29c1968..9372e14 100644 --- a/squad-server/plugins/discord-server-status.js +++ b/squad-server/plugins/discord-server-status.js @@ -98,7 +98,8 @@ export default class DiscordServerStatus extends BasePlugin { { name: 'Next Layer', value: `\`\`\`${ - this.server.nextLayer.name || (this.server.nextLayerToBeVoted ? 'To be voted' : 'Unknown') + this.server.nextLayer?.name || + (this.server.nextLayerToBeVoted ? 'To be voted' : 'Unknown') }\`\`\``, inline: true } From 476afc068871a3e5b46c6a46fb63cafbf2e71782 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 19:17:25 +0000 Subject: [PATCH 23/38] Track admin cam usage over RCON instead of logs --- squad-server/index.js | 18 +++++++ .../plugins/discord-admin-cam-logs.js | 33 ++++-------- squad-server/rcon.js | 52 +++++++++++++++---- 3 files changed, 70 insertions(+), 33 deletions(-) diff --git a/squad-server/index.js b/squad-server/index.js index 5e56619..09d3ae2 100644 --- a/squad-server/index.js +++ b/squad-server/index.js @@ -31,6 +31,7 @@ export default class SquadServer extends EventEmitter { this.players = []; this.admins = {}; + this.adminsInAdminCam = {}; this.plugins = []; @@ -102,6 +103,23 @@ export default class SquadServer extends EventEmitter { }); }); + this.rcon.on('POSSESSED_ADMIN_CAMERA', async (data) => { + data.player = await this.getPlayerBySteamID(data.steamID); + + this.adminsInAdminCam[data.steamID] = data.time; + + this.emit('POSSESSED_ADMIN_CAMERA', data); + }); + + this.rcon.on('UNPOSSESSED_ADMIN_CAMERA', async (data) => { + data.player = await this.getPlayerBySteamID(data.steamID); + data.duration = data.time.getTime() - this.adminsInAdminCam[data.steamID].getTime(); + + delete this.adminsInAdminCam[data.steamID]; + + this.emit('UNPOSSESSED_ADMIN_CAMERA', data); + }); + this.rcon.on('RCON_ERROR', (data) => { this.emit('RCON_ERROR', data); }); diff --git a/squad-server/plugins/discord-admin-cam-logs.js b/squad-server/plugins/discord-admin-cam-logs.js index 9bc27a2..8cbbaac 100644 --- a/squad-server/plugins/discord-admin-cam-logs.js +++ b/squad-server/plugins/discord-admin-cam-logs.js @@ -31,25 +31,21 @@ export default class DiscordAdminCamLogs extends DiscordBasePlugin { this.adminsInCam = {}; - this.onPlayerPossess = this.onPlayerPossess.bind(this); - this.onPlayerUnPossess = this.onPlayerUnPossess.bind(this); + this.onEntry = this.onEntry.bind(this); + this.onExit = this.onExit.bind(this); } async mount() { - this.server.on('PLAYER_POSSESS', this.onPlayerPossess); - this.server.on('PLAYER_UNPOSSESS', this.onPlayerUnPossess); + this.server.on('POSSESSED_ADMIN_CAMERA', this.onEntry); + this.server.on('UNPOSSESSED_ADMIN_CAMERA', this.onExit); } async unmount() { - this.server.removeEventListener('PLAYER_POSSESS', this.onPlayerPossess); - this.server.removeEventListener('PLAYER_UNPOSSESS', this.onPlayerUnPossess); + this.server.removeEventListener('POSSESSED_ADMIN_CAMERA', this.onEntry); + this.server.removeEventListener('UNPOSSESSED_ADMIN_CAMERA', this.onExit); } - async onPlayerPossess(info) { - if (info.player === null || info.possessClassname !== 'CameraMan') return; - - this.adminsInCam[info.player.steamID] = info.time; - + async onEntry(info) { await this.sendDiscordMessage({ embed: { title: `Admin Entered Admin Camera`, @@ -71,14 +67,7 @@ export default class DiscordAdminCamLogs extends DiscordBasePlugin { }); } - async onPlayerUnPossess(info) { - if ( - info.player === null || - info.switchPossess === true || - !(info.player.steamID in this.adminsInCam) - ) - return; - + async onExit(info) { await this.sendDiscordMessage({ embed: { title: `Admin Left Admin Camera`, @@ -96,15 +85,11 @@ export default class DiscordAdminCamLogs extends DiscordBasePlugin { }, { name: 'Time in Admin Camera', - value: `${Math.round( - (info.time.getTime() - this.adminsInCam[info.player.steamID].getTime()) / 60000 - )} mins` + value: `${Math.round(info.duration / 60000)} mins` } ], timestamp: info.time.toISOString() } }); - - delete this.adminsInCam[info.player.steamID]; } } diff --git a/squad-server/rcon.js b/squad-server/rcon.js index b5c6ee2..14f793a 100644 --- a/squad-server/rcon.js +++ b/squad-server/rcon.js @@ -1,19 +1,53 @@ +import Logger from 'core/logger'; import Rcon from 'core/rcon'; export default class SquadRcon extends Rcon { processChatPacket(decodedPacket) { - const match = decodedPacket.body.match( + const matchChat = decodedPacket.body.match( /\[(ChatAll|ChatTeam|ChatSquad|ChatAdmin)] \[SteamID:([0-9]{17})] (.+?) : (.*)/ ); + if (matchChat) { + Logger.verbose('SquadRcon', 2, `Matched chat message: ${decodedPacket.body}`); - this.emit('CHAT_MESSAGE', { - raw: decodedPacket.body, - chat: match[1], - steamID: match[2], - name: match[3], - message: match[4], - time: new Date() - }); + this.emit('CHAT_MESSAGE', { + raw: decodedPacket.body, + chat: matchChat[1], + steamID: matchChat[2], + name: matchChat[3], + message: matchChat[4], + time: new Date() + }); + + return; + } + + const matchPossessedAdminCam = decodedPacket.body.match( + /\[SteamID:([0-9]{17})] (.+?) has possessed admin camera./ + ); + if (matchPossessedAdminCam) { + Logger.verbose('SquadRcon', 2, `Matched admin camera possessed: ${decodedPacket.body}`); + this.emit('POSSESSED_ADMIN_CAMERA', { + raw: decodedPacket.body, + steamID: matchPossessedAdminCam[1], + name: matchPossessedAdminCam[2], + time: new Date() + }); + + return; + } + + const matchUnpossessedAdminCam = decodedPacket.body.match( + /\[SteamID:([0-9]{17})] (.+?) has unpossessed admin camera./ + ); + if (matchUnpossessedAdminCam) { + Logger.verbose('SquadRcon', 2, `Matched admin camera possessed: ${decodedPacket.body}`); + this.emit('UNPOSSESSED_ADMIN_CAMERA', { + raw: decodedPacket.body, + steamID: matchUnpossessedAdminCam[1], + name: matchUnpossessedAdminCam[2], + time: new Date() + }); + } } async getCurrentMap() { From 2ba79210f604b9981da539c61ca13c4959b6333e Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 20:44:55 +0000 Subject: [PATCH 24/38] Fix round winner layer name --- squad-server/plugins/discord-round-winner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/plugins/discord-round-winner.js b/squad-server/plugins/discord-round-winner.js index 960f3e7..1515340 100644 --- a/squad-server/plugins/discord-round-winner.js +++ b/squad-server/plugins/discord-round-winner.js @@ -48,7 +48,7 @@ export default class DiscordRoundWinner extends DiscordBasePlugin { fields: [ { name: 'Message', - value: `${info.winner} won on ${info.layer.name}.` + value: `${info.winner} won on ${this.server.layerHistory[1].layer.name}.` } ], timestamp: info.time.toISOString() From 86a8b89ef90cf7469089f92db67d67ed09ed1fc3 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 22:29:42 +0000 Subject: [PATCH 25/38] Initial Squad v2 Layer Support Bug Fixes --- squad-server/plugins/db-log.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squad-server/plugins/db-log.js b/squad-server/plugins/db-log.js index 4a48cc9..a0cd72b 100644 --- a/squad-server/plugins/db-log.js +++ b/squad-server/plugins/db-log.js @@ -443,8 +443,8 @@ export default class DBLog extends BasePlugin { dlc: info.dlc, mapClassname: info.mapClassname, layerClassname: info.layerClassname, - map: info.layer ? info.layer.map : null, - layer: info.layer ? info.layer.layer : null, + map: info.layer ? info.layer.map.name : null, + layer: info.layer ? info.layer.name : null, startTime: info.time }); } From 28540fce26869b30c7e921faed57328ec177aa06 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 22:31:38 +0000 Subject: [PATCH 26/38] Add deployable take damage event --- squad-server/index.js | 8 ++++++++ .../log-parser/deployable-take-damage.js | 20 +++++++++++++++++++ squad-server/log-parser/index.js | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 squad-server/log-parser/deployable-take-damage.js diff --git a/squad-server/index.js b/squad-server/index.js index 09d3ae2..a280fca 100644 --- a/squad-server/index.js +++ b/squad-server/index.js @@ -150,6 +150,14 @@ export default class SquadServer extends EventEmitter { this.emit('ADMIN_BROADCAST', data); }); + this.logParser.on('DEPLOYABLE_TAKE_DAMAGE', async (data) => { + data.player = await this.getPlayerByNameSuffix(data.playerSuffix); + + delete data.playerSuffix; + + this.emit('DEPLOYABLE_TAKE_DAMAGE', data); + }); + this.logParser.on('NEW_GAME', async (data) => { data.layer = await Layers.getLayerByClassname(data.layerClassname); diff --git a/squad-server/log-parser/deployable-take-damage.js b/squad-server/log-parser/deployable-take-damage.js new file mode 100644 index 0000000..71be876 --- /dev/null +++ b/squad-server/log-parser/deployable-take-damage.js @@ -0,0 +1,20 @@ +export default { + regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQDeployable::)TakeDamage\(\): ([A-z0-9_]+)_C_[0-9]+: ([0-9.]+) damage attempt by causer ([A-z0-9_]+)_C_[0-9]+ instigator (.+) with damage type ([A-z0-9_]+)_C health remaining ([0-9.]+)/, + onMatch: (args, logParser) => { + const data = { + raw: args[0], + time: args[1], + chainID: args[2], + deployable: args[3], + damage: parseFloat(args[4]), + weapon: args[5], + playerSuffix: args[6], + damageType: args[7], + healthRemaining: args[8] + }; + + logParser.eventStore[args[3]] = data; + + logParser.emit('DEPLOYABLE_TAKE_DAMAGE', data); + } +}; diff --git a/squad-server/log-parser/index.js b/squad-server/log-parser/index.js index 8327702..5dc1aec 100644 --- a/squad-server/log-parser/index.js +++ b/squad-server/log-parser/index.js @@ -1,6 +1,7 @@ import LogParser from 'core/log-parser'; import AdminBroadcast from './admin-broadcast.js'; +import DeployableTakeDamage from './deployable-take-damage.js'; import NewGame from './new-game.js'; import PlayerConnected from './player-connected.js'; import PlayerDamaged from './player-damaged.js'; @@ -21,6 +22,7 @@ export default class SquadLogParser extends LogParser { getRules() { return [ AdminBroadcast, + DeployableTakeDamage, NewGame, PlayerConnected, PlayerDamaged, From 19f5b8f879bb855acca1f6b617d4f862b9df3bf3 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 3 Feb 2021 23:30:54 +0000 Subject: [PATCH 27/38] Rename deployable take damage event --- squad-server/index.js | 4 ++-- .../{deployable-take-damage.js => deployable-damaged.js} | 4 ++-- squad-server/log-parser/index.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename squad-server/log-parser/{deployable-take-damage.js => deployable-damaged.js} (63%) diff --git a/squad-server/index.js b/squad-server/index.js index a280fca..886c15e 100644 --- a/squad-server/index.js +++ b/squad-server/index.js @@ -150,12 +150,12 @@ export default class SquadServer extends EventEmitter { this.emit('ADMIN_BROADCAST', data); }); - this.logParser.on('DEPLOYABLE_TAKE_DAMAGE', async (data) => { + this.logParser.on('DEPLOYABLE_DAMAGED', async (data) => { data.player = await this.getPlayerByNameSuffix(data.playerSuffix); delete data.playerSuffix; - this.emit('DEPLOYABLE_TAKE_DAMAGE', data); + this.emit('DEPLOYABLE_DAMAGED', data); }); this.logParser.on('NEW_GAME', async (data) => { diff --git a/squad-server/log-parser/deployable-take-damage.js b/squad-server/log-parser/deployable-damaged.js similarity index 63% rename from squad-server/log-parser/deployable-take-damage.js rename to squad-server/log-parser/deployable-damaged.js index 71be876..c073244 100644 --- a/squad-server/log-parser/deployable-take-damage.js +++ b/squad-server/log-parser/deployable-damaged.js @@ -1,5 +1,5 @@ export default { - regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQDeployable::)TakeDamage\(\): ([A-z0-9_]+)_C_[0-9]+: ([0-9.]+) damage attempt by causer ([A-z0-9_]+)_C_[0-9]+ instigator (.+) with damage type ([A-z0-9_]+)_C health remaining ([0-9.]+)/, + regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQDeployable::)?TakeDamage\(\): ([A-z0-9_]+)_C_[0-9]+: ([0-9.]+) damage attempt by causer ([A-z0-9_]+)_C_[0-9]+ instigator (.+) with damage type ([A-z0-9_]+)_C health remaining ([0-9.]+)/, onMatch: (args, logParser) => { const data = { raw: args[0], @@ -15,6 +15,6 @@ export default { logParser.eventStore[args[3]] = data; - logParser.emit('DEPLOYABLE_TAKE_DAMAGE', data); + logParser.emit('DEPLOYABLE_DAMAGED', data); } }; diff --git a/squad-server/log-parser/index.js b/squad-server/log-parser/index.js index 5dc1aec..5c91255 100644 --- a/squad-server/log-parser/index.js +++ b/squad-server/log-parser/index.js @@ -1,7 +1,7 @@ import LogParser from 'core/log-parser'; import AdminBroadcast from './admin-broadcast.js'; -import DeployableTakeDamage from './deployable-take-damage.js'; +import DeployableDamaged from './deployable-damaged.js'; import NewGame from './new-game.js'; import PlayerConnected from './player-connected.js'; import PlayerDamaged from './player-damaged.js'; @@ -22,7 +22,7 @@ export default class SquadLogParser extends LogParser { getRules() { return [ AdminBroadcast, - DeployableTakeDamage, + DeployableDamaged, NewGame, PlayerConnected, PlayerDamaged, From 7d3daf5449458781d5dcf41d67def5d1057bf929 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 24 Feb 2021 19:52:35 +0000 Subject: [PATCH 28/38] ESLint & README Generation --- README.md | 570 ++++++++++++++++++++++++++-------------------------- config.json | 172 ++++++++-------- 2 files changed, 371 insertions(+), 371 deletions(-) diff --git a/README.md b/README.md index ce58ed8..d92ad97 100644 --- a/README.md +++ b/README.md @@ -266,175 +266,21 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
- SeedingMode -

SeedingMode

-

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.

-

Options

-
  • interval

    -
    Description
    -

    Frequency of seeding messages in milliseconds.

    -
    Default
    -
    150000
  • -
  • seedingThreshold

    -
    Description
    -

    Player count required for server not to be in seeding mode.

    -
    Default
    -
    50
  • -
  • seedingMessage

    -
    Description
    -

    Seeding message to display.

    -
    Default
    -
    Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
  • -
  • liveEnabled

    -
    Description
    -

    Enable "Live" messages for when the server goes live.

    -
    Default
    -
    true
  • -
  • liveThreshold

    -
    Description
    -

    Player count required for "Live" messages to not bee displayed.

    -
    Default
    -
    52
  • -
  • liveMessage

    -
    Description
    -

    "Live" message to display.

    -
    Default
    -
    Live!
-
- -
- DiscordTeamkill -

DiscordTeamkill

-

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

+ DiscordSubsystemRestarter +

DiscordSubsystemRestarter

+

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

Options

  • discordClient (Required)

    Description

    Discord connector name.

    Default
    discord
  • -
  • channelID (Required)

    +
  • role (Required)

    Description
    -

    The ID of the channel to log teamkills to.

    +

    ID of role required to run the sub system restart commands.

    Default
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embeds.

    -
    Default
    -
    16761867
  • -
  • disableSCBL

    -
    Description
    -

    Disable Squad Community Ban List information.

    -
    Default
    -
    false
-
- -
- AutoTKWarn -

AutoTKWarn

-

The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

-

Options

-
  • message

    -
    Description
    -

    The message to warn players with.

    -
    Default
    -
    Please apologise for ALL TKs in ALL chat!
-
- -
- DiscordServerStatus -

DiscordServerStatus

-

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • messageIDs (Required)

    -
    Description
    -

    ID of messages to update.

    -
    Default
    -
    []
  • Example
    -
    [
    -  {
    -    "channelID": "667741905228136459",
    -    "messageID": "766688383043895387"
    -  }
    -]
    -
  • updateInterval

    -
    Description
    -

    How frequently to update the status in Discord.

    -
    Default
    -
    60000
  • -
  • disableStatus

    -
    Description
    -

    Disable the bot status.

    -
    Default
    -
    false
-
- -
- IntervalledBroadcasts -

IntervalledBroadcasts

-

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

-

Options

-
  • broadcasts

    -
    Description
    -

    Messages to broadcast.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "This server is powered by SquadJS."
    -]
    -
  • interval

    -
    Description
    -

    Frequency of the broadcasts in milliseconds.

    -
    Default
    -
    300000
-
- -
- ChatCommands -

ChatCommands

-

The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

-

Options

-
  • commands

    -
    Description
    -

    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.

    -
    Default
    -
    [
    -  {
    -    "command": "squadjs",
    -    "type": "warn",
    -    "response": "This server is powered by SquadJS.",
    -    "ignoreChats": []
    -  }
    -]
-
- -
- SCBLInfo -

SCBLInfo

-

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to alert admins through.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • threshold

    -
    Description
    -

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    -
    Default
    -
    6
+
667741905228136459
@@ -476,9 +322,9 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
- DiscordDebug -

DiscordDebug

-

The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

+ DiscordAdminBroadcast +

DiscordAdminBroadcast

+

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

Options

  • discordClient (Required)

    Description
    @@ -487,18 +333,15 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    discord
  • channelID (Required)

    Description
    -

    The ID of the channel to log events to.

    +

    The ID of the channel to log admin broadcasts to.

    Default
  • Example
    667741905228136459
    -
  • events (Required)

    +
  • color

    Description
    -

    A list of events to dump.

    +

    The color of the embed.

    Default
    -
    []
  • Example
    -
    [
    -  "PLAYER_DIED"
    -]
+
16761867
@@ -559,9 +402,236 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
- DiscordAdminBroadcast -

DiscordAdminBroadcast

-

The DiscordAdminBroadcast plugin will send a copy of admin broadcasts made in game to a Discord channel.

+ DiscordServerStatus +

DiscordServerStatus

+

The DiscordServerStatus plugin updates a message in Discord with current server information, e.g. player count.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • messageIDs (Required)

    +
    Description
    +

    ID of messages to update.

    +
    Default
    +
    []
  • Example
    +
    [
    +  {
    +    "channelID": "667741905228136459",
    +    "messageID": "766688383043895387"
    +  }
    +]
    +
  • updateInterval

    +
    Description
    +

    How frequently to update the status in Discord.

    +
    Default
    +
    60000
  • +
  • disableStatus

    +
    Description
    +

    Disable the bot status.

    +
    Default
    +
    false
+
+ +
+ AutoKickUnassigned +

AutoKickUnassigned

+

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

+

Options

+
  • warningMessage

    +
    Description
    +

    Message SquadJS will send to players warning them they will be kicked

    +
    Default
    +
    Join a squad, you are are unassigned and will be kicked
  • +
  • kickMessage

    +
    Description
    +

    Message to send to players when they are kicked

    +
    Default
    +
    Unassigned - automatically removed
  • +
  • frequencyOfWarnings

    +
    Description
    +

    How often in Seconds should we warn the player about being unassigned?

    +
    Default
    +
    30
  • +
  • unassignedTimer

    +
    Description
    +

    How long in Seconds to wait before a unassigned player is kicked

    +
    Default
    +
    360
  • +
  • playerThreshold

    +
    Description
    +

    Player count required for AutoKick to start kicking players, set to -1 to disable

    +
    Default
    +
    93
  • +
  • roundStartDelay

    +
    Description
    +

    Time delay in Seconds from start of the round before AutoKick starts kicking again

    +
    Default
    +
    900
  • +
  • ignoreAdmins

    +
    Description
    +

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    +
    Default
    +
    false
  • +
  • ignoreWhitelist

    +
    Description
    +

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    +
    Default
    +
    false
+
+ +
+ DiscordDebug +

DiscordDebug

+

The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log events to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • events (Required)

    +
    Description
    +

    A list of events to dump.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "PLAYER_DIED"
    +]
+
+ +
+ IntervalledBroadcasts +

IntervalledBroadcasts

+

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

+

Options

+
  • broadcasts

    +
    Description
    +

    Messages to broadcast.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "This server is powered by SquadJS."
    +]
    +
  • interval

    +
    Description
    +

    Frequency of the broadcasts in milliseconds.

    +
    Default
    +
    300000
+
+ +
+ DiscordTeamkill +

DiscordTeamkill

+

The DiscordTeamkill plugin logs teamkills and related information to a Discord channel for admins to review.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log teamkills to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embeds.

    +
    Default
    +
    16761867
  • +
  • disableSCBL

    +
    Description
    +

    Disable Squad Community Ban List information.

    +
    Default
    +
    false
+
+ +
+ SeedingMode +

SeedingMode

+

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.

+

Options

+
  • interval

    +
    Description
    +

    Frequency of seeding messages in milliseconds.

    +
    Default
    +
    150000
  • +
  • seedingThreshold

    +
    Description
    +

    Player count required for server not to be in seeding mode.

    +
    Default
    +
    50
  • +
  • seedingMessage

    +
    Description
    +

    Seeding message to display.

    +
    Default
    +
    Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!
  • +
  • liveEnabled

    +
    Description
    +

    Enable "Live" messages for when the server goes live.

    +
    Default
    +
    true
  • +
  • liveThreshold

    +
    Description
    +

    Player count required for "Live" messages to not bee displayed.

    +
    Default
    +
    52
  • +
  • liveMessage

    +
    Description
    +

    "Live" message to display.

    +
    Default
    +
    Live!
+
+ +
+ AutoTKWarn +

AutoTKWarn

+

The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

+

Options

+
  • message

    +
    Description
    +

    The message to warn players with.

    +
    Default
    +
    Please apologise for ALL TKs in ALL chat!
+
+ +
+ DBLog +

DBLog

+

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): +

  • Grafana is a cool way of viewing server statistics stored in the database.
  • +
  • Install Grafana.
  • +
  • Add your database as a datasource named SquadJS.
  • +
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • +
  • Install any missing Grafana plugins.

+

Options

+
  • database (Required)

    +
    Description
    +

    The Sequelize connector to log server information to.

    +
    Default
    +
    mysql
  • +
  • overrideServerID

    +
    Description
    +

    A overridden server ID.

    +
    Default
    +
    null
+
+ +
+ DiscordRoundWinner +

DiscordRoundWinner

+

The DiscordRoundWinner plugin will send the round winner to a Discord channel.

Options

  • discordClient (Required)

    Description
    @@ -581,6 +651,25 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    16761867
+
+ ChatCommands +

ChatCommands

+

The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

+

Options

+
  • commands

    +
    Description
    +

    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.

    +
    Default
    +
    [
    +  {
    +    "command": "squadjs",
    +    "type": "warn",
    +    "response": "This server is powered by SquadJS.",
    +    "ignoreChats": []
    +  }
    +]
+
+
DiscordAdminCamLogs

DiscordAdminCamLogs

@@ -639,118 +728,6 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
false
-
- DiscordSubsystemRestarter -

DiscordSubsystemRestarter

-

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • role (Required)

    -
    Description
    -

    ID of role required to run the sub system restart commands.

    -
    Default
    -
  • Example
    -
    667741905228136459
-
- -
- DBLog -

DBLog

-

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): -

  • Grafana is a cool way of viewing server statistics stored in the database.
  • -
  • Install Grafana.
  • -
  • Add your database as a datasource named SquadJS.
  • -
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • -
  • Install any missing Grafana plugins.

-

Options

-
  • database (Required)

    -
    Description
    -

    The Sequelize connector to log server information to.

    -
    Default
    -
    mysql
  • -
  • overrideServerID

    -
    Description
    -

    A overridden server ID.

    -
    Default
    -
    null
-
- -
- DiscordRoundWinner -

DiscordRoundWinner

-

The DiscordRoundWinner plugin will send the round winner to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
- -
- AutoKickUnassigned -

AutoKickUnassigned

-

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

-

Options

-
  • warningMessage

    -
    Description
    -

    Message SquadJS will send to players warning them they will be kicked

    -
    Default
    -
    Join a squad, you are are unassigned and will be kicked
  • -
  • kickMessage

    -
    Description
    -

    Message to send to players when they are kicked

    -
    Default
    -
    Unassigned - automatically removed
  • -
  • frequencyOfWarnings

    -
    Description
    -

    How often in Seconds should we warn the player about being unassigned?

    -
    Default
    -
    30
  • -
  • unassignedTimer

    -
    Description
    -

    How long in Seconds to wait before a unassigned player is kicked

    -
    Default
    -
    360
  • -
  • playerThreshold

    -
    Description
    -

    Player count required for AutoKick to start kicking players, set to -1 to disable

    -
    Default
    -
    93
  • -
  • roundStartDelay

    -
    Description
    -

    Time delay in Seconds from start of the round before AutoKick starts kicking again

    -
    Default
    -
    900
  • -
  • ignoreAdmins

    -
    Description
    -

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    -
    Default
    -
    false
  • -
  • ignoreWhitelist

    -
    Description
    -

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    -
    Default
    -
    false
-
-
TeamRandomizer

TeamRandomizer

@@ -763,6 +740,29 @@ Grafana (NOT YET WORKING WITH V2):
randomize
+
+ SCBLInfo +

SCBLInfo

+

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to alert admins through.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • threshold

    +
    Description
    +

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    +
    Default
    +
    6
+
+
## Statement on Accuracy diff --git a/config.json b/config.json index d5feb48..9043cc9 100644 --- a/config.json +++ b/config.json @@ -33,60 +33,10 @@ }, "plugins": [ { - "plugin": "SeedingMode", - "enabled": true, - "interval": 150000, - "seedingThreshold": 50, - "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", - "liveEnabled": true, - "liveThreshold": 52, - "liveMessage": "Live!" - }, - { - "plugin": "DiscordTeamkill", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867, - "disableSCBL": false - }, - { - "plugin": "AutoTKWarn", - "enabled": true, - "message": "Please apologise for ALL TKs in ALL chat!" - }, - { - "plugin": "DiscordServerStatus", + "plugin": "DiscordSubsystemRestarter", "enabled": false, "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "IntervalledBroadcasts", - "enabled": false, - "broadcasts": [], - "interval": 300000 - }, - { - "plugin": "ChatCommands", - "enabled": true, - "commands": [ - { - "command": "squadjs", - "type": "warn", - "response": "This server is powered by SquadJS.", - "ignoreChats": [] - } - ] - }, - { - "plugin": "SCBLInfo", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "threshold": 6 + "role": "" }, { "plugin": "DiscordChat", @@ -100,11 +50,11 @@ ] }, { - "plugin": "DiscordDebug", + "plugin": "DiscordAdminBroadcast", "enabled": false, "discordClient": "discord", "channelID": "", - "events": [] + "color": 16761867 }, { "plugin": "DiscordAdminRequest", @@ -119,12 +69,86 @@ "color": 16761867 }, { - "plugin": "DiscordAdminBroadcast", + "plugin": "DiscordServerStatus", + "enabled": false, + "discordClient": "discord", + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "AutoKickUnassigned", + "enabled": true, + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false + }, + { + "plugin": "DiscordDebug", "enabled": false, "discordClient": "discord", "channelID": "", + "events": [] + }, + { + "plugin": "IntervalledBroadcasts", + "enabled": false, + "broadcasts": [], + "interval": 300000 + }, + { + "plugin": "DiscordTeamkill", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "color": 16761867, + "disableSCBL": false + }, + { + "plugin": "SeedingMode", + "enabled": true, + "interval": 150000, + "seedingThreshold": 50, + "seedingMessage": "Seeding Rules Active! Fight only over the middle flags! No FOB Hunting!", + "liveEnabled": true, + "liveThreshold": 52, + "liveMessage": "Live!" + }, + { + "plugin": "AutoTKWarn", + "enabled": true, + "message": "Please apologise for ALL TKs in ALL chat!" + }, + { + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, + { + "plugin": "DiscordRoundWinner", + "enabled": true, + "discordClient": "discord", + "channelID": "", "color": 16761867 }, + { + "plugin": "ChatCommands", + "enabled": true, + "commands": [ + { + "command": "squadjs", + "type": "warn", + "response": "This server is powered by SquadJS.", + "ignoreChats": [] + } + ] + }, { "plugin": "DiscordAdminCamLogs", "enabled": false, @@ -140,41 +164,17 @@ "permissions": {}, "prependAdminNameInBroadcast": false }, - { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" - }, - { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, - { - "plugin": "DiscordRoundWinner", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "AutoKickUnassigned", - "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false - }, { "plugin": "TeamRandomizer", "enabled": true, "command": "randomize" + }, + { + "plugin": "SCBLInfo", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "threshold": 6 } ], "logger": { From 3ba32b6d5d7341aa0047f41a1697b530d4a73344 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 24 Feb 2021 19:53:46 +0000 Subject: [PATCH 29/38] SquadJS v2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac762a1..6801e0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "2.0.0-beta1", + "version": "2.0.0", "repository": "https://github.com/Thomas-Smyth/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0", From 219820ee394d083cba66076df4a1cd06bc7d87cb Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Wed, 24 Feb 2021 19:55:51 +0000 Subject: [PATCH 30/38] SquadJS v2.0.1-beta1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6801e0d..97e9188 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "2.0.0", + "version": "2.0.1-beta1", "repository": "https://github.com/Thomas-Smyth/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0", From 687875d2ac92cc976b82796a029c299166d456a2 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 10:56:09 +0000 Subject: [PATCH 31/38] Reoorder plugins --- README.md | 556 ++++++++++++++++++++++++++-------------------------- config.json | 166 ++++++++-------- 2 files changed, 361 insertions(+), 361 deletions(-) diff --git a/README.md b/README.md index d92ad97..c2c767b 100644 --- a/README.md +++ b/README.md @@ -266,61 +266,107 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
- DiscordSubsystemRestarter -

DiscordSubsystemRestarter

-

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

+ AutoKickUnassigned +

AutoKickUnassigned

+

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

Options

-
  • discordClient (Required)

    +
    • warningMessage

      Description
      -

      Discord connector name.

      +

      Message SquadJS will send to players warning them they will be kicked

      Default
      -
      discord
    • -
    • role (Required)

      +
      Join a squad, you are are unassigned and will be kicked
    • +
    • kickMessage

      Description
      -

      ID of role required to run the sub system restart commands.

      +

      Message to send to players when they are kicked

      Default
      -
    • Example
      -
      667741905228136459
    +
    Unassigned - automatically removed
  • +
  • frequencyOfWarnings

    +
    Description
    +

    How often in Seconds should we warn the player about being unassigned?

    +
    Default
    +
    30
  • +
  • unassignedTimer

    +
    Description
    +

    How long in Seconds to wait before a unassigned player is kicked

    +
    Default
    +
    360
  • +
  • playerThreshold

    +
    Description
    +

    Player count required for AutoKick to start kicking players, set to -1 to disable

    +
    Default
    +
    93
  • +
  • roundStartDelay

    +
    Description
    +

    Time delay in Seconds from start of the round before AutoKick starts kicking again

    +
    Default
    +
    900
  • +
  • ignoreAdmins

    +
    Description
    +

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    +
    Default
    +
    false
  • +
  • ignoreWhitelist

    +
    Description
    +

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    +
    Default
    +
    false
- DiscordChat -

DiscordChat

-

The DiscordChat plugin will log in-game chat to a Discord channel.

+ AutoTKWarn +

AutoTKWarn

+

The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

Options

-
  • discordClient (Required)

    +
    • message

      Description
      -

      Discord connector name.

      +

      The message to warn players with.

      Default
      -
      discord
    • -
    • channelID (Required)

      +
      Please apologise for ALL TKs in ALL chat!
    +
+ +
+ ChatCommands +

ChatCommands

+

The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

+

Options

+
  • commands

    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • chatColors

    -
    Description
    -

    The color of the embed for each chat.

    -
    Default
    -
    {}
  • Example
    -
    {
    -  "ChatAll": 16761867
    -}
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
  • -
  • ignoreChats

    -
    Description
    -

    A list of chat names to ignore.

    +

    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.

    Default
    [
    -  "ChatSquad"
    +  {
    +    "command": "squadjs",
    +    "type": "warn",
    +    "response": "This server is powered by SquadJS.",
    +    "ignoreChats": []
    +  }
     ]
+
+ DBLog +

DBLog

+

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): +

  • Grafana is a cool way of viewing server statistics stored in the database.
  • +
  • Install Grafana.
  • +
  • Add your database as a datasource named SquadJS.
  • +
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • +
  • Install any missing Grafana plugins.

+

Options

+
  • database (Required)

    +
    Description
    +

    The Sequelize connector to log server information to.

    +
    Default
    +
    mysql
  • +
  • overrideServerID

    +
    Description
    +

    A overridden server ID.

    +
    Default
    +
    null
+
+
DiscordAdminBroadcast

DiscordAdminBroadcast

@@ -344,6 +390,29 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
16761867
+
+ DiscordAdminCamLogs +

DiscordAdminCamLogs

+

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin camera usage to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+
DiscordAdminRequest

DiscordAdminRequest

@@ -401,6 +470,128 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
16761867
+
+ DiscordChat +

DiscordChat

+

The DiscordChat plugin will log in-game chat to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • chatColors

    +
    Description
    +

    The color of the embed for each chat.

    +
    Default
    +
    {}
  • Example
    +
    {
    +  "ChatAll": 16761867
    +}
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
  • +
  • ignoreChats

    +
    Description
    +

    A list of chat names to ignore.

    +
    Default
    +
    [
    +  "ChatSquad"
    +]
+
+ +
+ DiscordDebug +

DiscordDebug

+

The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log events to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • events (Required)

    +
    Description
    +

    A list of events to dump.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "PLAYER_DIED"
    +]
+
+ +
+ DiscordRcon +

DiscordRcon

+

The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    ID of channel to turn into RCON console.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • permissions

    +
    Description
    +

    +
    Default
    +
    {}
  • Example
    +
    {
    +  "123456789123456789": [
    +    "AdminBroadcast",
    +    "AdminForceTeamChange",
    +    "AdminDemoteCommander"
    +  ]
    +}
    +
  • prependAdminNameInBroadcast

    +
    Description
    +

    Prepend admin names when making announcements.

    +
    Default
    +
    false
+
+ +
+ DiscordRoundWinner +

DiscordRoundWinner

+

The DiscordRoundWinner plugin will send the round winner to a Discord channel.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
+
+
DiscordServerStatus

DiscordServerStatus

@@ -435,96 +626,21 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
- AutoKickUnassigned -

AutoKickUnassigned

-

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

-

Options

-
  • warningMessage

    -
    Description
    -

    Message SquadJS will send to players warning them they will be kicked

    -
    Default
    -
    Join a squad, you are are unassigned and will be kicked
  • -
  • kickMessage

    -
    Description
    -

    Message to send to players when they are kicked

    -
    Default
    -
    Unassigned - automatically removed
  • -
  • frequencyOfWarnings

    -
    Description
    -

    How often in Seconds should we warn the player about being unassigned?

    -
    Default
    -
    30
  • -
  • unassignedTimer

    -
    Description
    -

    How long in Seconds to wait before a unassigned player is kicked

    -
    Default
    -
    360
  • -
  • playerThreshold

    -
    Description
    -

    Player count required for AutoKick to start kicking players, set to -1 to disable

    -
    Default
    -
    93
  • -
  • roundStartDelay

    -
    Description
    -

    Time delay in Seconds from start of the round before AutoKick starts kicking again

    -
    Default
    -
    900
  • -
  • ignoreAdmins

    -
    Description
    -

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    -
    Default
    -
    false
  • -
  • ignoreWhitelist

    -
    Description
    -

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    -
    Default
    -
    false
-
- -
- DiscordDebug -

DiscordDebug

-

The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

+ DiscordSubsystemRestarter +

DiscordSubsystemRestarter

+

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

Options

  • discordClient (Required)

    Description

    Discord connector name.

    Default
    discord
  • -
  • channelID (Required)

    +
  • role (Required)

    Description
    -

    The ID of the channel to log events to.

    +

    ID of role required to run the sub system restart commands.

    Default
  • Example
    -
    667741905228136459
    -
  • events (Required)

    -
    Description
    -

    A list of events to dump.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "PLAYER_DIED"
    -]
-
- -
- IntervalledBroadcasts -

IntervalledBroadcasts

-

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

-

Options

-
  • broadcasts

    -
    Description
    -

    Messages to broadcast.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "This server is powered by SquadJS."
    -]
    -
  • interval

    -
    Description
    -

    Frequency of the broadcasts in milliseconds.

    -
    Default
    -
    300000
+
667741905228136459
@@ -555,6 +671,49 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
false
+
+ IntervalledBroadcasts +

IntervalledBroadcasts

+

The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

+

Options

+
  • broadcasts

    +
    Description
    +

    Messages to broadcast.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "This server is powered by SquadJS."
    +]
    +
  • interval

    +
    Description
    +

    Frequency of the broadcasts in milliseconds.

    +
    Default
    +
    300000
+
+ +
+ SCBLInfo +

SCBLInfo

+

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

+

Options

+
  • discordClient (Required)

    +
    Description
    +

    Discord connector name.

    +
    Default
    +
    discord
  • +
  • channelID (Required)

    +
    Description
    +

    The ID of the channel to alert admins through.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • threshold

    +
    Description
    +

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    +
    Default
    +
    6
+
+
SeedingMode

SeedingMode

@@ -592,142 +751,6 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
Live!
-
- AutoTKWarn -

AutoTKWarn

-

The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

-

Options

-
  • message

    -
    Description
    -

    The message to warn players with.

    -
    Default
    -
    Please apologise for ALL TKs in ALL chat!
-
- -
- DBLog -

DBLog

-

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): -

  • Grafana is a cool way of viewing server statistics stored in the database.
  • -
  • Install Grafana.
  • -
  • Add your database as a datasource named SquadJS.
  • -
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • -
  • Install any missing Grafana plugins.

-

Options

-
  • database (Required)

    -
    Description
    -

    The Sequelize connector to log server information to.

    -
    Default
    -
    mysql
  • -
  • overrideServerID

    -
    Description
    -

    A overridden server ID.

    -
    Default
    -
    null
-
- -
- DiscordRoundWinner -

DiscordRoundWinner

-

The DiscordRoundWinner plugin will send the round winner to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
- -
- ChatCommands -

ChatCommands

-

The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

-

Options

-
  • commands

    -
    Description
    -

    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.

    -
    Default
    -
    [
    -  {
    -    "command": "squadjs",
    -    "type": "warn",
    -    "response": "This server is powered by SquadJS.",
    -    "ignoreChats": []
    -  }
    -]
-
- -
- DiscordAdminCamLogs -

DiscordAdminCamLogs

-

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin camera usage to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
- -
- DiscordRcon -

DiscordRcon

-

The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    ID of channel to turn into RCON console.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • permissions

    -
    Description
    -

    -
    Default
    -
    {}
  • Example
    -
    {
    -  "123456789123456789": [
    -    "AdminBroadcast",
    -    "AdminForceTeamChange",
    -    "AdminDemoteCommander"
    -  ]
    -}
    -
  • prependAdminNameInBroadcast

    -
    Description
    -

    Prepend admin names when making announcements.

    -
    Default
    -
    false
-
-
TeamRandomizer

TeamRandomizer

@@ -740,29 +763,6 @@ Grafana (NOT YET WORKING WITH V2):
randomize
-
- SCBLInfo -

SCBLInfo

-

The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to alert admins through.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • threshold

    -
    Description
    -

    Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

    -
    Default
    -
    6
-
-
## Statement on Accuracy diff --git a/config.json b/config.json index 9043cc9..05aba60 100644 --- a/config.json +++ b/config.json @@ -33,22 +33,40 @@ }, "plugins": [ { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" + "plugin": "AutoKickUnassigned", + "enabled": true, + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false }, { - "plugin": "DiscordChat", + "plugin": "AutoTKWarn", "enabled": true, - "discordClient": "discord", - "channelID": "", - "chatColors": {}, - "color": 16761867, - "ignoreChats": [ - "ChatSquad" + "message": "Please apologise for ALL TKs in ALL chat!" + }, + { + "plugin": "ChatCommands", + "enabled": true, + "commands": [ + { + "command": "squadjs", + "type": "warn", + "response": "This server is powered by SquadJS.", + "ignoreChats": [] + } ] }, + { + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, { "plugin": "DiscordAdminBroadcast", "enabled": false, @@ -56,6 +74,13 @@ "channelID": "", "color": 16761867 }, + { + "plugin": "DiscordAdminCamLogs", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, { "plugin": "DiscordAdminRequest", "enabled": true, @@ -69,24 +94,15 @@ "color": 16761867 }, { - "plugin": "DiscordServerStatus", - "enabled": false, - "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "AutoKickUnassigned", + "plugin": "DiscordChat", "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false + "discordClient": "discord", + "channelID": "", + "chatColors": {}, + "color": 16761867, + "ignoreChats": [ + "ChatSquad" + ] }, { "plugin": "DiscordDebug", @@ -96,10 +112,33 @@ "events": [] }, { - "plugin": "IntervalledBroadcasts", + "plugin": "DiscordRcon", "enabled": false, - "broadcasts": [], - "interval": 300000 + "discordClient": "discord", + "channelID": "", + "permissions": {}, + "prependAdminNameInBroadcast": false + }, + { + "plugin": "DiscordRoundWinner", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordServerStatus", + "enabled": false, + "discordClient": "discord", + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "DiscordSubsystemRestarter", + "enabled": false, + "discordClient": "discord", + "role": "" }, { "plugin": "DiscordTeamkill", @@ -109,6 +148,19 @@ "color": 16761867, "disableSCBL": false }, + { + "plugin": "IntervalledBroadcasts", + "enabled": false, + "broadcasts": [], + "interval": 300000 + }, + { + "plugin": "SCBLInfo", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "threshold": 6 + }, { "plugin": "SeedingMode", "enabled": true, @@ -119,62 +171,10 @@ "liveThreshold": 52, "liveMessage": "Live!" }, - { - "plugin": "AutoTKWarn", - "enabled": true, - "message": "Please apologise for ALL TKs in ALL chat!" - }, - { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, - { - "plugin": "DiscordRoundWinner", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "ChatCommands", - "enabled": true, - "commands": [ - { - "command": "squadjs", - "type": "warn", - "response": "This server is powered by SquadJS.", - "ignoreChats": [] - } - ] - }, - { - "plugin": "DiscordAdminCamLogs", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordRcon", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "permissions": {}, - "prependAdminNameInBroadcast": false - }, { "plugin": "TeamRandomizer", "enabled": true, "command": "randomize" - }, - { - "plugin": "SCBLInfo", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "threshold": 6 } ], "logger": { From c4ea1f79f3c511c85bbbc60001c171a49cad8609 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 10:57:15 +0000 Subject: [PATCH 32/38] ESLint & README Generation --- README.md | 556 ++++++++++++++++++++++++++-------------------------- config.json | 166 ++++++++-------- 2 files changed, 361 insertions(+), 361 deletions(-) diff --git a/README.md b/README.md index c2c767b..d92ad97 100644 --- a/README.md +++ b/README.md @@ -266,107 +266,61 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
- AutoKickUnassigned -

AutoKickUnassigned

-

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

+ DiscordSubsystemRestarter +

DiscordSubsystemRestarter

+

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

Options

-
  • warningMessage

    +
    • discordClient (Required)

      Description
      -

      Message SquadJS will send to players warning them they will be kicked

      +

      Discord connector name.

      Default
      -
      Join a squad, you are are unassigned and will be kicked
    • -
    • kickMessage

      +
      discord
    • +
    • role (Required)

      Description
      -

      Message to send to players when they are kicked

      +

      ID of role required to run the sub system restart commands.

      Default
      -
      Unassigned - automatically removed
    • -
    • frequencyOfWarnings

      -
      Description
      -

      How often in Seconds should we warn the player about being unassigned?

      -
      Default
      -
      30
    • -
    • unassignedTimer

      -
      Description
      -

      How long in Seconds to wait before a unassigned player is kicked

      -
      Default
      -
      360
    • -
    • playerThreshold

      -
      Description
      -

      Player count required for AutoKick to start kicking players, set to -1 to disable

      -
      Default
      -
      93
    • -
    • roundStartDelay

      -
      Description
      -

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      -
      Default
      -
      900
    • -
    • ignoreAdmins

      -
      Description
      -

      • true: Admins will NOT be kicked
      • false: Admins WILL be kicked

      -
      Default
      -
      false
    • -
    • ignoreWhitelist

      -
      Description
      -

      • true: Reserve slot players will NOT be kicked
      • false: Reserve slot players WILL be kicked

      -
      Default
      -
      false
    +
  • Example
    +
    667741905228136459
- AutoTKWarn -

AutoTKWarn

-

The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

+ DiscordChat +

DiscordChat

+

The DiscordChat plugin will log in-game chat to a Discord channel.

Options

-
  • message

    +
    • discordClient (Required)

      Description
      -

      The message to warn players with.

      +

      Discord connector name.

      Default
      -
      Please apologise for ALL TKs in ALL chat!
    -
- -
- ChatCommands -

ChatCommands

-

The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

-

Options

-
  • commands

    +
    discord
  • +
  • channelID (Required)

    Description
    -

    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.

    +

    The ID of the channel to log admin broadcasts to.

    +
    Default
    +
  • Example
    +
    667741905228136459
    +
  • chatColors

    +
    Description
    +

    The color of the embed for each chat.

    +
    Default
    +
    {}
  • Example
    +
    {
    +  "ChatAll": 16761867
    +}
    +
  • color

    +
    Description
    +

    The color of the embed.

    +
    Default
    +
    16761867
  • +
  • ignoreChats

    +
    Description
    +

    A list of chat names to ignore.

    Default
    [
    -  {
    -    "command": "squadjs",
    -    "type": "warn",
    -    "response": "This server is powered by SquadJS.",
    -    "ignoreChats": []
    -  }
    +  "ChatSquad"
     ]
-
- DBLog -

DBLog

-

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): -

  • Grafana is a cool way of viewing server statistics stored in the database.
  • -
  • Install Grafana.
  • -
  • Add your database as a datasource named SquadJS.
  • -
  • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
  • -
  • Install any missing Grafana plugins.

-

Options

-
  • database (Required)

    -
    Description
    -

    The Sequelize connector to log server information to.

    -
    Default
    -
    mysql
  • -
  • overrideServerID

    -
    Description
    -

    A overridden server ID.

    -
    Default
    -
    null
-
-
DiscordAdminBroadcast

DiscordAdminBroadcast

@@ -390,29 +344,6 @@ Grafana (NOT YET WORKING WITH V2):
16761867
-
- DiscordAdminCamLogs -

DiscordAdminCamLogs

-

The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin camera usage to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
-
DiscordAdminRequest

DiscordAdminRequest

@@ -470,128 +401,6 @@ Grafana (NOT YET WORKING WITH V2):
16761867
-
- DiscordChat -

DiscordChat

-

The DiscordChat plugin will log in-game chat to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • chatColors

    -
    Description
    -

    The color of the embed for each chat.

    -
    Default
    -
    {}
  • Example
    -
    {
    -  "ChatAll": 16761867
    -}
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
  • -
  • ignoreChats

    -
    Description
    -

    A list of chat names to ignore.

    -
    Default
    -
    [
    -  "ChatSquad"
    -]
-
- -
- DiscordDebug -

DiscordDebug

-

The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log events to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • events (Required)

    -
    Description
    -

    A list of events to dump.

    -
    Default
    -
    []
  • Example
    -
    [
    -  "PLAYER_DIED"
    -]
-
- -
- DiscordRcon -

DiscordRcon

-

The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    ID of channel to turn into RCON console.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • permissions

    -
    Description
    -

    -
    Default
    -
    {}
  • Example
    -
    {
    -  "123456789123456789": [
    -    "AdminBroadcast",
    -    "AdminForceTeamChange",
    -    "AdminDemoteCommander"
    -  ]
    -}
    -
  • prependAdminNameInBroadcast

    -
    Description
    -

    Prepend admin names when making announcements.

    -
    Default
    -
    false
-
- -
- DiscordRoundWinner -

DiscordRoundWinner

-

The DiscordRoundWinner plugin will send the round winner to a Discord channel.

-

Options

-
  • discordClient (Required)

    -
    Description
    -

    Discord connector name.

    -
    Default
    -
    discord
  • -
  • channelID (Required)

    -
    Description
    -

    The ID of the channel to log admin broadcasts to.

    -
    Default
    -
  • Example
    -
    667741905228136459
    -
  • color

    -
    Description
    -

    The color of the embed.

    -
    Default
    -
    16761867
-
-
DiscordServerStatus

DiscordServerStatus

@@ -626,21 +435,96 @@ Grafana (NOT YET WORKING WITH V2):
- DiscordSubsystemRestarter -

DiscordSubsystemRestarter

-

The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

  • !squadjs restartsubsystem rcon
  • !squadjs restartsubsystem logparser

+ AutoKickUnassigned +

AutoKickUnassigned

+

The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

+

Options

+
  • warningMessage

    +
    Description
    +

    Message SquadJS will send to players warning them they will be kicked

    +
    Default
    +
    Join a squad, you are are unassigned and will be kicked
  • +
  • kickMessage

    +
    Description
    +

    Message to send to players when they are kicked

    +
    Default
    +
    Unassigned - automatically removed
  • +
  • frequencyOfWarnings

    +
    Description
    +

    How often in Seconds should we warn the player about being unassigned?

    +
    Default
    +
    30
  • +
  • unassignedTimer

    +
    Description
    +

    How long in Seconds to wait before a unassigned player is kicked

    +
    Default
    +
    360
  • +
  • playerThreshold

    +
    Description
    +

    Player count required for AutoKick to start kicking players, set to -1 to disable

    +
    Default
    +
    93
  • +
  • roundStartDelay

    +
    Description
    +

    Time delay in Seconds from start of the round before AutoKick starts kicking again

    +
    Default
    +
    900
  • +
  • ignoreAdmins

    +
    Description
    +

    • true: Admins will NOT be kicked
    • false: Admins WILL be kicked

    +
    Default
    +
    false
  • +
  • ignoreWhitelist

    +
    Description
    +

    • true: Reserve slot players will NOT be kicked
    • false: Reserve slot players WILL be kicked

    +
    Default
    +
    false
+
+ +
+ DiscordDebug +

DiscordDebug

+

The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

Options

  • discordClient (Required)

    Description

    Discord connector name.

    Default
    discord
  • -
  • role (Required)

    +
  • channelID (Required)

    Description
    -

    ID of role required to run the sub system restart commands.

    +

    The ID of the channel to log events to.

    Default
  • Example
    -
    667741905228136459
+
667741905228136459
+
  • events (Required)

    +
    Description
    +

    A list of events to dump.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "PLAYER_DIED"
    +]
    +
    + +
    + IntervalledBroadcasts +

    IntervalledBroadcasts

    +

    The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

    +

    Options

    +
    • broadcasts

      +
      Description
      +

      Messages to broadcast.

      +
      Default
      +
      []
    • Example
      +
      [
      +  "This server is powered by SquadJS."
      +]
      +
    • interval

      +
      Description
      +

      Frequency of the broadcasts in milliseconds.

      +
      Default
      +
      300000
    @@ -671,49 +555,6 @@ Grafana (NOT YET WORKING WITH V2):
    false
    -
    - IntervalledBroadcasts -

    IntervalledBroadcasts

    -

    The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

    -

    Options

    -
    • broadcasts

      -
      Description
      -

      Messages to broadcast.

      -
      Default
      -
      []
    • Example
      -
      [
      -  "This server is powered by SquadJS."
      -]
      -
    • interval

      -
      Description
      -

      Frequency of the broadcasts in milliseconds.

      -
      Default
      -
      300000
    -
    - -
    - SCBLInfo -

    SCBLInfo

    -

    The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to alert admins through.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • threshold

      -
      Description
      -

      Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

      -
      Default
      -
      6
    -
    -
    SeedingMode

    SeedingMode

    @@ -751,6 +592,142 @@ Grafana (NOT YET WORKING WITH V2):
    Live!
    +
    + AutoTKWarn +

    AutoTKWarn

    +

    The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

    +

    Options

    +
    • message

      +
      Description
      +

      The message to warn players with.

      +
      Default
      +
      Please apologise for ALL TKs in ALL chat!
    +
    + +
    + DBLog +

    DBLog

    +

    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): +

    • Grafana is a cool way of viewing server statistics stored in the database.
    • +
    • Install Grafana.
    • +
    • Add your database as a datasource named SquadJS.
    • +
    • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
    • +
    • Install any missing Grafana plugins.

    +

    Options

    +
    • database (Required)

      +
      Description
      +

      The Sequelize connector to log server information to.

      +
      Default
      +
      mysql
    • +
    • overrideServerID

      +
      Description
      +

      A overridden server ID.

      +
      Default
      +
      null
    +
    + +
    + DiscordRoundWinner +

    DiscordRoundWinner

    +

    The DiscordRoundWinner plugin will send the round winner to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log admin broadcasts to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    +
    + +
    + ChatCommands +

    ChatCommands

    +

    The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

    +

    Options

    +
    • commands

      +
      Description
      +

      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.

      +
      Default
      +
      [
      +  {
      +    "command": "squadjs",
      +    "type": "warn",
      +    "response": "This server is powered by SquadJS.",
      +    "ignoreChats": []
      +  }
      +]
    +
    + +
    + DiscordAdminCamLogs +

    DiscordAdminCamLogs

    +

    The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log admin camera usage to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    +
    + +
    + DiscordRcon +

    DiscordRcon

    +

    The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      ID of channel to turn into RCON console.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • permissions

      +
      Description
      +

      +
      Default
      +
      {}
    • Example
      +
      {
      +  "123456789123456789": [
      +    "AdminBroadcast",
      +    "AdminForceTeamChange",
      +    "AdminDemoteCommander"
      +  ]
      +}
      +
    • prependAdminNameInBroadcast

      +
      Description
      +

      Prepend admin names when making announcements.

      +
      Default
      +
      false
    +
    +
    TeamRandomizer

    TeamRandomizer

    @@ -763,6 +740,29 @@ Grafana (NOT YET WORKING WITH V2):
    randomize
    +
    + SCBLInfo +

    SCBLInfo

    +

    The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to alert admins through.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • threshold

      +
      Description
      +

      Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

      +
      Default
      +
      6
    +
    +
    ## Statement on Accuracy diff --git a/config.json b/config.json index 05aba60..9043cc9 100644 --- a/config.json +++ b/config.json @@ -33,40 +33,22 @@ }, "plugins": [ { - "plugin": "AutoKickUnassigned", - "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false + "plugin": "DiscordSubsystemRestarter", + "enabled": false, + "discordClient": "discord", + "role": "" }, { - "plugin": "AutoTKWarn", + "plugin": "DiscordChat", "enabled": true, - "message": "Please apologise for ALL TKs in ALL chat!" - }, - { - "plugin": "ChatCommands", - "enabled": true, - "commands": [ - { - "command": "squadjs", - "type": "warn", - "response": "This server is powered by SquadJS.", - "ignoreChats": [] - } + "discordClient": "discord", + "channelID": "", + "chatColors": {}, + "color": 16761867, + "ignoreChats": [ + "ChatSquad" ] }, - { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, { "plugin": "DiscordAdminBroadcast", "enabled": false, @@ -74,13 +56,6 @@ "channelID": "", "color": 16761867 }, - { - "plugin": "DiscordAdminCamLogs", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, { "plugin": "DiscordAdminRequest", "enabled": true, @@ -94,15 +69,24 @@ "color": 16761867 }, { - "plugin": "DiscordChat", - "enabled": true, + "plugin": "DiscordServerStatus", + "enabled": false, "discordClient": "discord", - "channelID": "", - "chatColors": {}, - "color": 16761867, - "ignoreChats": [ - "ChatSquad" - ] + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "AutoKickUnassigned", + "enabled": true, + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false }, { "plugin": "DiscordDebug", @@ -112,33 +96,10 @@ "events": [] }, { - "plugin": "DiscordRcon", + "plugin": "IntervalledBroadcasts", "enabled": false, - "discordClient": "discord", - "channelID": "", - "permissions": {}, - "prependAdminNameInBroadcast": false - }, - { - "plugin": "DiscordRoundWinner", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordServerStatus", - "enabled": false, - "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" + "broadcasts": [], + "interval": 300000 }, { "plugin": "DiscordTeamkill", @@ -148,19 +109,6 @@ "color": 16761867, "disableSCBL": false }, - { - "plugin": "IntervalledBroadcasts", - "enabled": false, - "broadcasts": [], - "interval": 300000 - }, - { - "plugin": "SCBLInfo", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "threshold": 6 - }, { "plugin": "SeedingMode", "enabled": true, @@ -171,10 +119,62 @@ "liveThreshold": 52, "liveMessage": "Live!" }, + { + "plugin": "AutoTKWarn", + "enabled": true, + "message": "Please apologise for ALL TKs in ALL chat!" + }, + { + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, + { + "plugin": "DiscordRoundWinner", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "ChatCommands", + "enabled": true, + "commands": [ + { + "command": "squadjs", + "type": "warn", + "response": "This server is powered by SquadJS.", + "ignoreChats": [] + } + ] + }, + { + "plugin": "DiscordAdminCamLogs", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordRcon", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "permissions": {}, + "prependAdminNameInBroadcast": false + }, { "plugin": "TeamRandomizer", "enabled": true, "command": "randomize" + }, + { + "plugin": "SCBLInfo", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "threshold": 6 } ], "logger": { From ae23c448bd38301863b7fecba85089d49ea5d397 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 11:24:52 +0000 Subject: [PATCH 33/38] npm install warning --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c2c767b..960e007 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ SquadJS relies on being able to access the Squad server log directory in order t 3. Configure the `config.json` file. See below for more details. 4. Start SquadJS: `node index.js`. +**Note** - We use Yarn Workspaces so `npm install` will not work and will break stuff! +
    ## **Configuring SquadJS** From 636282236f6bb3c5a8394f4c9cfdbe5ee9a09d98 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 11:59:34 +0000 Subject: [PATCH 34/38] Fix Discord bot status --- squad-server/plugins/discord-server-status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/plugins/discord-server-status.js b/squad-server/plugins/discord-server-status.js index 9372e14..6763727 100644 --- a/squad-server/plugins/discord-server-status.js +++ b/squad-server/plugins/discord-server-status.js @@ -69,7 +69,7 @@ export default class DiscordServerStatus extends BasePlugin { await this.options.discordClient.user.setActivity( `(${this.server.a2sPlayerCount}/${this.server.publicSlots}) ${ - this.server.layerHistory[0].layer || 'Unknown' + this.server.layerHistory[0].layer.name || 'Unknown' }`, { type: 'WATCHING' } ); From a1c32d47dfd656f54fd7b8ea51f82393376f9152 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 12:00:59 +0000 Subject: [PATCH 35/38] ESLint & README Generation --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 108b494..d92ad97 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,6 @@ SquadJS relies on being able to access the Squad server log directory in order t 3. Configure the `config.json` file. See below for more details. 4. Start SquadJS: `node index.js`. -**Note** - We use Yarn Workspaces so `npm install` will not work and will break stuff! -
    ## **Configuring SquadJS** From 2703afbd7d093375648048145fa72de47ae4d2db Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 13:02:08 +0000 Subject: [PATCH 36/38] Add additional logging --- README.md | 556 +++++++++++++++--------------- config.json | 166 ++++----- squad-server/layers/layers.js | 13 +- squad-server/utils/admin-lists.js | 2 +- 4 files changed, 372 insertions(+), 365 deletions(-) diff --git a/README.md b/README.md index d92ad97..c2c767b 100644 --- a/README.md +++ b/README.md @@ -266,61 +266,107 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
    - DiscordSubsystemRestarter -

    DiscordSubsystemRestarter

    -

    The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

    • !squadjs restartsubsystem rcon
    • !squadjs restartsubsystem logparser

    + AutoKickUnassigned +

    AutoKickUnassigned

    +

    The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

    Options

    -
    • discordClient (Required)

      +
      • warningMessage

        Description
        -

        Discord connector name.

        +

        Message SquadJS will send to players warning them they will be kicked

        Default
        -
        discord
      • -
      • role (Required)

        +
        Join a squad, you are are unassigned and will be kicked
      • +
      • kickMessage

        Description
        -

        ID of role required to run the sub system restart commands.

        +

        Message to send to players when they are kicked

        Default
        -
      • Example
        -
        667741905228136459
      +
      Unassigned - automatically removed
    • +
    • frequencyOfWarnings

      +
      Description
      +

      How often in Seconds should we warn the player about being unassigned?

      +
      Default
      +
      30
    • +
    • unassignedTimer

      +
      Description
      +

      How long in Seconds to wait before a unassigned player is kicked

      +
      Default
      +
      360
    • +
    • playerThreshold

      +
      Description
      +

      Player count required for AutoKick to start kicking players, set to -1 to disable

      +
      Default
      +
      93
    • +
    • roundStartDelay

      +
      Description
      +

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      +
      Default
      +
      900
    • +
    • ignoreAdmins

      +
      Description
      +

      • true: Admins will NOT be kicked
      • false: Admins WILL be kicked

      +
      Default
      +
      false
    • +
    • ignoreWhitelist

      +
      Description
      +

      • true: Reserve slot players will NOT be kicked
      • false: Reserve slot players WILL be kicked

      +
      Default
      +
      false
    - DiscordChat -

    DiscordChat

    -

    The DiscordChat plugin will log in-game chat to a Discord channel.

    + AutoTKWarn +

    AutoTKWarn

    +

    The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

    Options

    -
    • discordClient (Required)

      +
      • message

        Description
        -

        Discord connector name.

        +

        The message to warn players with.

        Default
        -
        discord
      • -
      • channelID (Required)

        +
        Please apologise for ALL TKs in ALL chat!
      +
    + +
    + ChatCommands +

    ChatCommands

    +

    The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

    +

    Options

    +
    • commands

      Description
      -

      The ID of the channel to log admin broadcasts to.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • chatColors

      -
      Description
      -

      The color of the embed for each chat.

      -
      Default
      -
      {}
    • Example
      -
      {
      -  "ChatAll": 16761867
      -}
      -
    • color

      -
      Description
      -

      The color of the embed.

      -
      Default
      -
      16761867
    • -
    • ignoreChats

      -
      Description
      -

      A list of chat names to ignore.

      +

      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.

      Default
      [
      -  "ChatSquad"
      +  {
      +    "command": "squadjs",
      +    "type": "warn",
      +    "response": "This server is powered by SquadJS.",
      +    "ignoreChats": []
      +  }
       ]
    +
    + DBLog +

    DBLog

    +

    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): +

    • Grafana is a cool way of viewing server statistics stored in the database.
    • +
    • Install Grafana.
    • +
    • Add your database as a datasource named SquadJS.
    • +
    • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
    • +
    • Install any missing Grafana plugins.

    +

    Options

    +
    • database (Required)

      +
      Description
      +

      The Sequelize connector to log server information to.

      +
      Default
      +
      mysql
    • +
    • overrideServerID

      +
      Description
      +

      A overridden server ID.

      +
      Default
      +
      null
    +
    +
    DiscordAdminBroadcast

    DiscordAdminBroadcast

    @@ -344,6 +390,29 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    16761867
    +
    + DiscordAdminCamLogs +

    DiscordAdminCamLogs

    +

    The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log admin camera usage to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    +
    +
    DiscordAdminRequest

    DiscordAdminRequest

    @@ -401,6 +470,128 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    16761867
    +
    + DiscordChat +

    DiscordChat

    +

    The DiscordChat plugin will log in-game chat to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log admin broadcasts to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • chatColors

      +
      Description
      +

      The color of the embed for each chat.

      +
      Default
      +
      {}
    • Example
      +
      {
      +  "ChatAll": 16761867
      +}
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    • +
    • ignoreChats

      +
      Description
      +

      A list of chat names to ignore.

      +
      Default
      +
      [
      +  "ChatSquad"
      +]
    +
    + +
    + DiscordDebug +

    DiscordDebug

    +

    The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log events to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • events (Required)

      +
      Description
      +

      A list of events to dump.

      +
      Default
      +
      []
    • Example
      +
      [
      +  "PLAYER_DIED"
      +]
    +
    + +
    + DiscordRcon +

    DiscordRcon

    +

    The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      ID of channel to turn into RCON console.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • permissions

      +
      Description
      +

      +
      Default
      +
      {}
    • Example
      +
      {
      +  "123456789123456789": [
      +    "AdminBroadcast",
      +    "AdminForceTeamChange",
      +    "AdminDemoteCommander"
      +  ]
      +}
      +
    • prependAdminNameInBroadcast

      +
      Description
      +

      Prepend admin names when making announcements.

      +
      Default
      +
      false
    +
    + +
    + DiscordRoundWinner +

    DiscordRoundWinner

    +

    The DiscordRoundWinner plugin will send the round winner to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log admin broadcasts to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    +
    +
    DiscordServerStatus

    DiscordServerStatus

    @@ -435,96 +626,21 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    - AutoKickUnassigned -

    AutoKickUnassigned

    -

    The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

    -

    Options

    -
    • warningMessage

      -
      Description
      -

      Message SquadJS will send to players warning them they will be kicked

      -
      Default
      -
      Join a squad, you are are unassigned and will be kicked
    • -
    • kickMessage

      -
      Description
      -

      Message to send to players when they are kicked

      -
      Default
      -
      Unassigned - automatically removed
    • -
    • frequencyOfWarnings

      -
      Description
      -

      How often in Seconds should we warn the player about being unassigned?

      -
      Default
      -
      30
    • -
    • unassignedTimer

      -
      Description
      -

      How long in Seconds to wait before a unassigned player is kicked

      -
      Default
      -
      360
    • -
    • playerThreshold

      -
      Description
      -

      Player count required for AutoKick to start kicking players, set to -1 to disable

      -
      Default
      -
      93
    • -
    • roundStartDelay

      -
      Description
      -

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      -
      Default
      -
      900
    • -
    • ignoreAdmins

      -
      Description
      -

      • true: Admins will NOT be kicked
      • false: Admins WILL be kicked

      -
      Default
      -
      false
    • -
    • ignoreWhitelist

      -
      Description
      -

      • true: Reserve slot players will NOT be kicked
      • false: Reserve slot players WILL be kicked

      -
      Default
      -
      false
    -
    - -
    - DiscordDebug -

    DiscordDebug

    -

    The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

    + DiscordSubsystemRestarter +

    DiscordSubsystemRestarter

    +

    The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

    • !squadjs restartsubsystem rcon
    • !squadjs restartsubsystem logparser

    Options

    • discordClient (Required)

      Description

      Discord connector name.

      Default
      discord
    • -
    • channelID (Required)

      +
    • role (Required)

      Description
      -

      The ID of the channel to log events to.

      +

      ID of role required to run the sub system restart commands.

      Default
    • Example
      -
      667741905228136459
      -
    • events (Required)

      -
      Description
      -

      A list of events to dump.

      -
      Default
      -
      []
    • Example
      -
      [
      -  "PLAYER_DIED"
      -]
    -
    - -
    - IntervalledBroadcasts -

    IntervalledBroadcasts

    -

    The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

    -

    Options

    -
    • broadcasts

      -
      Description
      -

      Messages to broadcast.

      -
      Default
      -
      []
    • Example
      -
      [
      -  "This server is powered by SquadJS."
      -]
      -
    • interval

      -
      Description
      -

      Frequency of the broadcasts in milliseconds.

      -
      Default
      -
      300000
    +
    667741905228136459
    @@ -555,6 +671,49 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    false
    +
    + IntervalledBroadcasts +

    IntervalledBroadcasts

    +

    The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

    +

    Options

    +
    • broadcasts

      +
      Description
      +

      Messages to broadcast.

      +
      Default
      +
      []
    • Example
      +
      [
      +  "This server is powered by SquadJS."
      +]
      +
    • interval

      +
      Description
      +

      Frequency of the broadcasts in milliseconds.

      +
      Default
      +
      300000
    +
    + +
    + SCBLInfo +

    SCBLInfo

    +

    The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to alert admins through.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • threshold

      +
      Description
      +

      Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

      +
      Default
      +
      6
    +
    +
    SeedingMode

    SeedingMode

    @@ -592,142 +751,6 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
    Live!
    -
    - AutoTKWarn -

    AutoTKWarn

    -

    The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

    -

    Options

    -
    • message

      -
      Description
      -

      The message to warn players with.

      -
      Default
      -
      Please apologise for ALL TKs in ALL chat!
    -
    - -
    - DBLog -

    DBLog

    -

    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): -

    • Grafana is a cool way of viewing server statistics stored in the database.
    • -
    • Install Grafana.
    • -
    • Add your database as a datasource named SquadJS.
    • -
    • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
    • -
    • Install any missing Grafana plugins.

    -

    Options

    -
    • database (Required)

      -
      Description
      -

      The Sequelize connector to log server information to.

      -
      Default
      -
      mysql
    • -
    • overrideServerID

      -
      Description
      -

      A overridden server ID.

      -
      Default
      -
      null
    -
    - -
    - DiscordRoundWinner -

    DiscordRoundWinner

    -

    The DiscordRoundWinner plugin will send the round winner to a Discord channel.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to log admin broadcasts to.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • color

      -
      Description
      -

      The color of the embed.

      -
      Default
      -
      16761867
    -
    - -
    - ChatCommands -

    ChatCommands

    -

    The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

    -

    Options

    -
    • commands

      -
      Description
      -

      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.

      -
      Default
      -
      [
      -  {
      -    "command": "squadjs",
      -    "type": "warn",
      -    "response": "This server is powered by SquadJS.",
      -    "ignoreChats": []
      -  }
      -]
    -
    - -
    - DiscordAdminCamLogs -

    DiscordAdminCamLogs

    -

    The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to log admin camera usage to.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • color

      -
      Description
      -

      The color of the embed.

      -
      Default
      -
      16761867
    -
    - -
    - DiscordRcon -

    DiscordRcon

    -

    The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      ID of channel to turn into RCON console.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • permissions

      -
      Description
      -

      -
      Default
      -
      {}
    • Example
      -
      {
      -  "123456789123456789": [
      -    "AdminBroadcast",
      -    "AdminForceTeamChange",
      -    "AdminDemoteCommander"
      -  ]
      -}
      -
    • prependAdminNameInBroadcast

      -
      Description
      -

      Prepend admin names when making announcements.

      -
      Default
      -
      false
    -
    -
    TeamRandomizer

    TeamRandomizer

    @@ -740,29 +763,6 @@ Grafana (NOT YET WORKING WITH V2):
    randomize
    -
    - SCBLInfo -

    SCBLInfo

    -

    The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to alert admins through.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • threshold

      -
      Description
      -

      Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

      -
      Default
      -
      6
    -
    -
    ## Statement on Accuracy diff --git a/config.json b/config.json index 9043cc9..05aba60 100644 --- a/config.json +++ b/config.json @@ -33,22 +33,40 @@ }, "plugins": [ { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" + "plugin": "AutoKickUnassigned", + "enabled": true, + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false }, { - "plugin": "DiscordChat", + "plugin": "AutoTKWarn", "enabled": true, - "discordClient": "discord", - "channelID": "", - "chatColors": {}, - "color": 16761867, - "ignoreChats": [ - "ChatSquad" + "message": "Please apologise for ALL TKs in ALL chat!" + }, + { + "plugin": "ChatCommands", + "enabled": true, + "commands": [ + { + "command": "squadjs", + "type": "warn", + "response": "This server is powered by SquadJS.", + "ignoreChats": [] + } ] }, + { + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, { "plugin": "DiscordAdminBroadcast", "enabled": false, @@ -56,6 +74,13 @@ "channelID": "", "color": 16761867 }, + { + "plugin": "DiscordAdminCamLogs", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, { "plugin": "DiscordAdminRequest", "enabled": true, @@ -69,24 +94,15 @@ "color": 16761867 }, { - "plugin": "DiscordServerStatus", - "enabled": false, - "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "AutoKickUnassigned", + "plugin": "DiscordChat", "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false + "discordClient": "discord", + "channelID": "", + "chatColors": {}, + "color": 16761867, + "ignoreChats": [ + "ChatSquad" + ] }, { "plugin": "DiscordDebug", @@ -96,10 +112,33 @@ "events": [] }, { - "plugin": "IntervalledBroadcasts", + "plugin": "DiscordRcon", "enabled": false, - "broadcasts": [], - "interval": 300000 + "discordClient": "discord", + "channelID": "", + "permissions": {}, + "prependAdminNameInBroadcast": false + }, + { + "plugin": "DiscordRoundWinner", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordServerStatus", + "enabled": false, + "discordClient": "discord", + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "DiscordSubsystemRestarter", + "enabled": false, + "discordClient": "discord", + "role": "" }, { "plugin": "DiscordTeamkill", @@ -109,6 +148,19 @@ "color": 16761867, "disableSCBL": false }, + { + "plugin": "IntervalledBroadcasts", + "enabled": false, + "broadcasts": [], + "interval": 300000 + }, + { + "plugin": "SCBLInfo", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "threshold": 6 + }, { "plugin": "SeedingMode", "enabled": true, @@ -119,62 +171,10 @@ "liveThreshold": 52, "liveMessage": "Live!" }, - { - "plugin": "AutoTKWarn", - "enabled": true, - "message": "Please apologise for ALL TKs in ALL chat!" - }, - { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, - { - "plugin": "DiscordRoundWinner", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "ChatCommands", - "enabled": true, - "commands": [ - { - "command": "squadjs", - "type": "warn", - "response": "This server is powered by SquadJS.", - "ignoreChats": [] - } - ] - }, - { - "plugin": "DiscordAdminCamLogs", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordRcon", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "permissions": {}, - "prependAdminNameInBroadcast": false - }, { "plugin": "TeamRandomizer", "enabled": true, "command": "randomize" - }, - { - "plugin": "SCBLInfo", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "threshold": 6 } ], "logger": { diff --git a/squad-server/layers/layers.js b/squad-server/layers/layers.js index 75813cf..607b733 100644 --- a/squad-server/layers/layers.js +++ b/squad-server/layers/layers.js @@ -1,5 +1,7 @@ import axios from 'axios'; +import Logger from 'core/logger'; + import Layer from './layer.js'; class Layers { @@ -10,18 +12,23 @@ class Layers { } async pull(force = false) { - if (this.pulled && !force) return; - - this.layers = []; + if (this.pulled && !force) { + Logger.verbose('Layers', 1, 'Already pulled layers.'); + return; + } + Logger.verbose('Layers', 1, 'Pulling layers...'); const response = await axios.get( 'https://raw.githubusercontent.com/Squad-Wiki-Editorial/squad-wiki-pipeline-map-data/dev/completed_output/2.0/finished_2.0.json' ); + this.layers = []; for (const layer of response.data.Maps) { this.layers.push(new Layer(layer)); } + Logger.verbose('Layers', 1, `Pulled ${this.layers.length} layers.`); + return this.layers; } diff --git a/squad-server/utils/admin-lists.js b/squad-server/utils/admin-lists.js index 5593b1b..de70cd5 100644 --- a/squad-server/utils/admin-lists.js +++ b/squad-server/utils/admin-lists.js @@ -8,7 +8,7 @@ import Logger from 'core/logger'; const __dirname = fileURLToPath(import.meta.url); export default async function fetchAdminLists(adminLists) { - Logger.verbose('SquadServer', 2, `Fetching Admin Lists...`); + Logger.verbose('SquadServer', 1, `Fetching Admin Lists...`); const groups = {}; const admins = {}; From 8a67563c6a5347699dca71d4d10665f3ac703668 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 13:02:21 +0000 Subject: [PATCH 37/38] SquadJS v2.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 97e9188..2056a71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "2.0.1-beta1", + "version": "2.0.1", "repository": "https://github.com/Thomas-Smyth/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0", From 31164c4bae70f2bc81d81d358e91600fd89c8507 Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Thu, 25 Feb 2021 13:04:14 +0000 Subject: [PATCH 38/38] ESLint & README Generation --- README.md | 556 ++++++++++++++++++++++++++-------------------------- config.json | 166 ++++++++-------- 2 files changed, 361 insertions(+), 361 deletions(-) diff --git a/README.md b/README.md index c2c767b..d92ad97 100644 --- a/README.md +++ b/README.md @@ -266,107 +266,61 @@ The following is a list of plugins built into SquadJS, you can click their title Interested in creating your own plugin? [See more here](./squad-server/plugins/readme.md)
    - AutoKickUnassigned -

    AutoKickUnassigned

    -

    The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

    + DiscordSubsystemRestarter +

    DiscordSubsystemRestarter

    +

    The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

    • !squadjs restartsubsystem rcon
    • !squadjs restartsubsystem logparser

    Options

    -
    • warningMessage

      +
      • discordClient (Required)

        Description
        -

        Message SquadJS will send to players warning them they will be kicked

        +

        Discord connector name.

        Default
        -
        Join a squad, you are are unassigned and will be kicked
      • -
      • kickMessage

        +
        discord
      • +
      • role (Required)

        Description
        -

        Message to send to players when they are kicked

        +

        ID of role required to run the sub system restart commands.

        Default
        -
        Unassigned - automatically removed
      • -
      • frequencyOfWarnings

        -
        Description
        -

        How often in Seconds should we warn the player about being unassigned?

        -
        Default
        -
        30
      • -
      • unassignedTimer

        -
        Description
        -

        How long in Seconds to wait before a unassigned player is kicked

        -
        Default
        -
        360
      • -
      • playerThreshold

        -
        Description
        -

        Player count required for AutoKick to start kicking players, set to -1 to disable

        -
        Default
        -
        93
      • -
      • roundStartDelay

        -
        Description
        -

        Time delay in Seconds from start of the round before AutoKick starts kicking again

        -
        Default
        -
        900
      • -
      • ignoreAdmins

        -
        Description
        -

        • true: Admins will NOT be kicked
        • false: Admins WILL be kicked

        -
        Default
        -
        false
      • -
      • ignoreWhitelist

        -
        Description
        -

        • true: Reserve slot players will NOT be kicked
        • false: Reserve slot players WILL be kicked

        -
        Default
        -
        false
      +
    • Example
      +
      667741905228136459
    - AutoTKWarn -

    AutoTKWarn

    -

    The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

    + DiscordChat +

    DiscordChat

    +

    The DiscordChat plugin will log in-game chat to a Discord channel.

    Options

    -
    • message

      +
      • discordClient (Required)

        Description
        -

        The message to warn players with.

        +

        Discord connector name.

        Default
        -
        Please apologise for ALL TKs in ALL chat!
      -
    - -
    - ChatCommands -

    ChatCommands

    -

    The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

    -

    Options

    -
    • commands

      +
      discord
    • +
    • channelID (Required)

      Description
      -

      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.

      +

      The ID of the channel to log admin broadcasts to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • chatColors

      +
      Description
      +

      The color of the embed for each chat.

      +
      Default
      +
      {}
    • Example
      +
      {
      +  "ChatAll": 16761867
      +}
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    • +
    • ignoreChats

      +
      Description
      +

      A list of chat names to ignore.

      Default
      [
      -  {
      -    "command": "squadjs",
      -    "type": "warn",
      -    "response": "This server is powered by SquadJS.",
      -    "ignoreChats": []
      -  }
      +  "ChatSquad"
       ]
    -
    - DBLog -

    DBLog

    -

    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): -

    • Grafana is a cool way of viewing server statistics stored in the database.
    • -
    • Install Grafana.
    • -
    • Add your database as a datasource named SquadJS.
    • -
    • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
    • -
    • Install any missing Grafana plugins.

    -

    Options

    -
    • database (Required)

      -
      Description
      -

      The Sequelize connector to log server information to.

      -
      Default
      -
      mysql
    • -
    • overrideServerID

      -
      Description
      -

      A overridden server ID.

      -
      Default
      -
      null
    -
    -
    DiscordAdminBroadcast

    DiscordAdminBroadcast

    @@ -390,29 +344,6 @@ Grafana (NOT YET WORKING WITH V2):
    16761867
    -
    - DiscordAdminCamLogs -

    DiscordAdminCamLogs

    -

    The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to log admin camera usage to.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • color

      -
      Description
      -

      The color of the embed.

      -
      Default
      -
      16761867
    -
    -
    DiscordAdminRequest

    DiscordAdminRequest

    @@ -470,128 +401,6 @@ Grafana (NOT YET WORKING WITH V2):
    16761867
    -
    - DiscordChat -

    DiscordChat

    -

    The DiscordChat plugin will log in-game chat to a Discord channel.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to log admin broadcasts to.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • chatColors

      -
      Description
      -

      The color of the embed for each chat.

      -
      Default
      -
      {}
    • Example
      -
      {
      -  "ChatAll": 16761867
      -}
      -
    • color

      -
      Description
      -

      The color of the embed.

      -
      Default
      -
      16761867
    • -
    • ignoreChats

      -
      Description
      -

      A list of chat names to ignore.

      -
      Default
      -
      [
      -  "ChatSquad"
      -]
    -
    - -
    - DiscordDebug -

    DiscordDebug

    -

    The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to log events to.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • events (Required)

      -
      Description
      -

      A list of events to dump.

      -
      Default
      -
      []
    • Example
      -
      [
      -  "PLAYER_DIED"
      -]
    -
    - -
    - DiscordRcon -

    DiscordRcon

    -

    The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      ID of channel to turn into RCON console.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • permissions

      -
      Description
      -

      -
      Default
      -
      {}
    • Example
      -
      {
      -  "123456789123456789": [
      -    "AdminBroadcast",
      -    "AdminForceTeamChange",
      -    "AdminDemoteCommander"
      -  ]
      -}
      -
    • prependAdminNameInBroadcast

      -
      Description
      -

      Prepend admin names when making announcements.

      -
      Default
      -
      false
    -
    - -
    - DiscordRoundWinner -

    DiscordRoundWinner

    -

    The DiscordRoundWinner plugin will send the round winner to a Discord channel.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to log admin broadcasts to.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • color

      -
      Description
      -

      The color of the embed.

      -
      Default
      -
      16761867
    -
    -
    DiscordServerStatus

    DiscordServerStatus

    @@ -626,21 +435,96 @@ Grafana (NOT YET WORKING WITH V2):
    - DiscordSubsystemRestarter -

    DiscordSubsystemRestarter

    -

    The DiscordSubSystemRestarter plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.

    • !squadjs restartsubsystem rcon
    • !squadjs restartsubsystem logparser

    + AutoKickUnassigned +

    AutoKickUnassigned

    +

    The AutoKickUnassigned plugin will automatically kick players that are not in a squad after a specified ammount of time.

    +

    Options

    +
    • warningMessage

      +
      Description
      +

      Message SquadJS will send to players warning them they will be kicked

      +
      Default
      +
      Join a squad, you are are unassigned and will be kicked
    • +
    • kickMessage

      +
      Description
      +

      Message to send to players when they are kicked

      +
      Default
      +
      Unassigned - automatically removed
    • +
    • frequencyOfWarnings

      +
      Description
      +

      How often in Seconds should we warn the player about being unassigned?

      +
      Default
      +
      30
    • +
    • unassignedTimer

      +
      Description
      +

      How long in Seconds to wait before a unassigned player is kicked

      +
      Default
      +
      360
    • +
    • playerThreshold

      +
      Description
      +

      Player count required for AutoKick to start kicking players, set to -1 to disable

      +
      Default
      +
      93
    • +
    • roundStartDelay

      +
      Description
      +

      Time delay in Seconds from start of the round before AutoKick starts kicking again

      +
      Default
      +
      900
    • +
    • ignoreAdmins

      +
      Description
      +

      • true: Admins will NOT be kicked
      • false: Admins WILL be kicked

      +
      Default
      +
      false
    • +
    • ignoreWhitelist

      +
      Description
      +

      • true: Reserve slot players will NOT be kicked
      • false: Reserve slot players WILL be kicked

      +
      Default
      +
      false
    +
    + +
    + DiscordDebug +

    DiscordDebug

    +

    The DiscordDebug plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.

    Options

    • discordClient (Required)

      Description

      Discord connector name.

      Default
      discord
    • -
    • role (Required)

      +
    • channelID (Required)

      Description
      -

      ID of role required to run the sub system restart commands.

      +

      The ID of the channel to log events to.

      Default
    • Example
      -
      667741905228136459
    +
    667741905228136459
    +
  • events (Required)

    +
    Description
    +

    A list of events to dump.

    +
    Default
    +
    []
  • Example
    +
    [
    +  "PLAYER_DIED"
    +]
    +
    + +
    + IntervalledBroadcasts +

    IntervalledBroadcasts

    +

    The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

    +

    Options

    +
    • broadcasts

      +
      Description
      +

      Messages to broadcast.

      +
      Default
      +
      []
    • Example
      +
      [
      +  "This server is powered by SquadJS."
      +]
      +
    • interval

      +
      Description
      +

      Frequency of the broadcasts in milliseconds.

      +
      Default
      +
      300000
    @@ -671,49 +555,6 @@ Grafana (NOT YET WORKING WITH V2):
    false
    -
    - IntervalledBroadcasts -

    IntervalledBroadcasts

    -

    The IntervalledBroadcasts plugin allows you to set broadcasts, which will be broadcasted at preset intervals

    -

    Options

    -
    • broadcasts

      -
      Description
      -

      Messages to broadcast.

      -
      Default
      -
      []
    • Example
      -
      [
      -  "This server is powered by SquadJS."
      -]
      -
    • interval

      -
      Description
      -

      Frequency of the broadcasts in milliseconds.

      -
      Default
      -
      300000
    -
    - -
    - SCBLInfo -

    SCBLInfo

    -

    The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

    -

    Options

    -
    • discordClient (Required)

      -
      Description
      -

      Discord connector name.

      -
      Default
      -
      discord
    • -
    • channelID (Required)

      -
      Description
      -

      The ID of the channel to alert admins through.

      -
      Default
      -
    • Example
      -
      667741905228136459
      -
    • threshold

      -
      Description
      -

      Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

      -
      Default
      -
      6
    -
    -
    SeedingMode

    SeedingMode

    @@ -751,6 +592,142 @@ Grafana (NOT YET WORKING WITH V2):
    Live!
    +
    + AutoTKWarn +

    AutoTKWarn

    +

    The AutoTkWarn plugin will automatically warn players with a message when they teamkill.

    +

    Options

    +
    • message

      +
      Description
      +

      The message to warn players with.

      +
      Default
      +
      Please apologise for ALL TKs in ALL chat!
    +
    + +
    + DBLog +

    DBLog

    +

    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): +

    • Grafana is a cool way of viewing server statistics stored in the database.
    • +
    • Install Grafana.
    • +
    • Add your database as a datasource named SquadJS.
    • +
    • Import the SquadJS Dashboard to get a preconfigured MySQL only Grafana dashboard.
    • +
    • Install any missing Grafana plugins.

    +

    Options

    +
    • database (Required)

      +
      Description
      +

      The Sequelize connector to log server information to.

      +
      Default
      +
      mysql
    • +
    • overrideServerID

      +
      Description
      +

      A overridden server ID.

      +
      Default
      +
      null
    +
    + +
    + DiscordRoundWinner +

    DiscordRoundWinner

    +

    The DiscordRoundWinner plugin will send the round winner to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log admin broadcasts to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    +
    + +
    + ChatCommands +

    ChatCommands

    +

    The ChatCommands plugin can be configured to make chat commands that broadcast or warn the caller with present messages.

    +

    Options

    +
    • commands

      +
      Description
      +

      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.

      +
      Default
      +
      [
      +  {
      +    "command": "squadjs",
      +    "type": "warn",
      +    "response": "This server is powered by SquadJS.",
      +    "ignoreChats": []
      +  }
      +]
    +
    + +
    + DiscordAdminCamLogs +

    DiscordAdminCamLogs

    +

    The DiscordAdminCamLogs plugin will log in game admin camera usage to a Discord channel.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to log admin camera usage to.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • color

      +
      Description
      +

      The color of the embed.

      +
      Default
      +
      16761867
    +
    + +
    + DiscordRcon +

    DiscordRcon

    +

    The DiscordRcon plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      ID of channel to turn into RCON console.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • permissions

      +
      Description
      +

      +
      Default
      +
      {}
    • Example
      +
      {
      +  "123456789123456789": [
      +    "AdminBroadcast",
      +    "AdminForceTeamChange",
      +    "AdminDemoteCommander"
      +  ]
      +}
      +
    • prependAdminNameInBroadcast

      +
      Description
      +

      Prepend admin names when making announcements.

      +
      Default
      +
      false
    +
    +
    TeamRandomizer

    TeamRandomizer

    @@ -763,6 +740,29 @@ Grafana (NOT YET WORKING WITH V2):
    randomize
    +
    + SCBLInfo +

    SCBLInfo

    +

    The SCBLInfo plugin alerts admins when a harmful player is detected joining their server based on data from the Squad Community Ban List.

    +

    Options

    +
    • discordClient (Required)

      +
      Description
      +

      Discord connector name.

      +
      Default
      +
      discord
    • +
    • channelID (Required)

      +
      Description
      +

      The ID of the channel to alert admins through.

      +
      Default
      +
    • Example
      +
      667741905228136459
      +
    • threshold

      +
      Description
      +

      Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the Squad Community Ban List's FAQ

      +
      Default
      +
      6
    +
    +
    ## Statement on Accuracy diff --git a/config.json b/config.json index 05aba60..9043cc9 100644 --- a/config.json +++ b/config.json @@ -33,40 +33,22 @@ }, "plugins": [ { - "plugin": "AutoKickUnassigned", - "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", - "kickMessage": "Unassigned - automatically removed", - "frequencyOfWarnings": 30, - "unassignedTimer": 360, - "playerThreshold": 93, - "roundStartDelay": 900, - "ignoreAdmins": false, - "ignoreWhitelist": false + "plugin": "DiscordSubsystemRestarter", + "enabled": false, + "discordClient": "discord", + "role": "" }, { - "plugin": "AutoTKWarn", + "plugin": "DiscordChat", "enabled": true, - "message": "Please apologise for ALL TKs in ALL chat!" - }, - { - "plugin": "ChatCommands", - "enabled": true, - "commands": [ - { - "command": "squadjs", - "type": "warn", - "response": "This server is powered by SquadJS.", - "ignoreChats": [] - } + "discordClient": "discord", + "channelID": "", + "chatColors": {}, + "color": 16761867, + "ignoreChats": [ + "ChatSquad" ] }, - { - "plugin": "DBLog", - "enabled": false, - "database": "mysql", - "overrideServerID": null - }, { "plugin": "DiscordAdminBroadcast", "enabled": false, @@ -74,13 +56,6 @@ "channelID": "", "color": 16761867 }, - { - "plugin": "DiscordAdminCamLogs", - "enabled": false, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, { "plugin": "DiscordAdminRequest", "enabled": true, @@ -94,15 +69,24 @@ "color": 16761867 }, { - "plugin": "DiscordChat", - "enabled": true, + "plugin": "DiscordServerStatus", + "enabled": false, "discordClient": "discord", - "channelID": "", - "chatColors": {}, - "color": 16761867, - "ignoreChats": [ - "ChatSquad" - ] + "messageIDs": [], + "updateInterval": 60000, + "disableStatus": false + }, + { + "plugin": "AutoKickUnassigned", + "enabled": true, + "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "kickMessage": "Unassigned - automatically removed", + "frequencyOfWarnings": 30, + "unassignedTimer": 360, + "playerThreshold": 93, + "roundStartDelay": 900, + "ignoreAdmins": false, + "ignoreWhitelist": false }, { "plugin": "DiscordDebug", @@ -112,33 +96,10 @@ "events": [] }, { - "plugin": "DiscordRcon", + "plugin": "IntervalledBroadcasts", "enabled": false, - "discordClient": "discord", - "channelID": "", - "permissions": {}, - "prependAdminNameInBroadcast": false - }, - { - "plugin": "DiscordRoundWinner", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "color": 16761867 - }, - { - "plugin": "DiscordServerStatus", - "enabled": false, - "discordClient": "discord", - "messageIDs": [], - "updateInterval": 60000, - "disableStatus": false - }, - { - "plugin": "DiscordSubsystemRestarter", - "enabled": false, - "discordClient": "discord", - "role": "" + "broadcasts": [], + "interval": 300000 }, { "plugin": "DiscordTeamkill", @@ -148,19 +109,6 @@ "color": 16761867, "disableSCBL": false }, - { - "plugin": "IntervalledBroadcasts", - "enabled": false, - "broadcasts": [], - "interval": 300000 - }, - { - "plugin": "SCBLInfo", - "enabled": true, - "discordClient": "discord", - "channelID": "", - "threshold": 6 - }, { "plugin": "SeedingMode", "enabled": true, @@ -171,10 +119,62 @@ "liveThreshold": 52, "liveMessage": "Live!" }, + { + "plugin": "AutoTKWarn", + "enabled": true, + "message": "Please apologise for ALL TKs in ALL chat!" + }, + { + "plugin": "DBLog", + "enabled": false, + "database": "mysql", + "overrideServerID": null + }, + { + "plugin": "DiscordRoundWinner", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "ChatCommands", + "enabled": true, + "commands": [ + { + "command": "squadjs", + "type": "warn", + "response": "This server is powered by SquadJS.", + "ignoreChats": [] + } + ] + }, + { + "plugin": "DiscordAdminCamLogs", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "color": 16761867 + }, + { + "plugin": "DiscordRcon", + "enabled": false, + "discordClient": "discord", + "channelID": "", + "permissions": {}, + "prependAdminNameInBroadcast": false + }, { "plugin": "TeamRandomizer", "enabled": true, "command": "randomize" + }, + { + "plugin": "SCBLInfo", + "enabled": true, + "discordClient": "discord", + "channelID": "", + "threshold": 6 } ], "logger": {