Merge pull request #158 from 11TStudio/beta

Squad IO Api plugin
This commit is contained in:
Thomas Smyth 2021-03-05 17:19:27 +00:00 committed by GitHub
commit 0f28d4db04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 560 additions and 368 deletions

592
README.md
View File

@ -268,78 +268,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)
<details>
<summary>DiscordPlaceholder</summary>
<h2>DiscordPlaceholder</h2>
<p>The <code>DiscordPlaceholder</code> plugin allows you to make your bot create placeholder messages that can be used when configuring other plugins.</p>
<summary>AutoKickUnassigned</summary>
<h2>AutoKickUnassigned</h2>
<p>The <code>AutoKickUnassigned</code> plugin will automatically kick players that are not in a squad after a specified ammount of time.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<ul><li><h4>warningMessage</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<p>Message SquadJS will send to players warning them they will be kicked</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>command</h4>
<pre><code>Join a squad, you are are unassigned and will be kicked</code></pre></li>
<li><h4>kickMessage</h4>
<h6>Description</h6>
<p>Command to create Discord placeholder.</p>
<p>Message to send to players when they are kicked</p>
<h6>Default</h6>
<pre><code>!placeholder</code></pre></li></ul>
<pre><code>Unassigned - automatically removed</code></pre></li>
<li><h4>frequencyOfWarnings</h4>
<h6>Description</h6>
<p>How often in <b>Seconds</b> should we warn the player about being unassigned?</p>
<h6>Default</h6>
<pre><code>30</code></pre></li>
<li><h4>unassignedTimer</h4>
<h6>Description</h6>
<p>How long in <b>Seconds</b> to wait before a unassigned player is kicked</p>
<h6>Default</h6>
<pre><code>360</code></pre></li>
<li><h4>playerThreshold</h4>
<h6>Description</h6>
<p>Player count required for AutoKick to start kicking players, set to -1 to disable</p>
<h6>Default</h6>
<pre><code>93</code></pre></li>
<li><h4>roundStartDelay</h4>
<h6>Description</h6>
<p>Time delay in <b>Seconds</b> from start of the round before AutoKick starts kicking again</p>
<h6>Default</h6>
<pre><code>900</code></pre></li>
<li><h4>ignoreAdmins</h4>
<h6>Description</h6>
<p><ul><li><code>true</code>: Admins will <b>NOT</b> be kicked</li><li><code>false</code>: Admins <b>WILL</b> be kicked</li></ul></p>
<h6>Default</h6>
<pre><code>false</code></pre></li>
<li><h4>ignoreWhitelist</h4>
<h6>Description</h6>
<p><ul><li><code>true</code>: Reserve slot players will <b>NOT</b> be kicked</li><li><code>false</code>: Reserve slot players <b>WILL</b> be kicked</li></ul></p>
<h6>Default</h6>
<pre><code>false</code></pre></li></ul>
</details>
<details>
<summary>DiscordSubsystemRestarter</summary>
<h2>DiscordSubsystemRestarter</h2>
<p>The <code>DiscordSubSystemRestarter</code> plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.<ul><li><code>!squadjs restartsubsystem rcon</code></li><li><code>!squadjs restartsubsystem logparser</code></li></ul></p>
<summary>AutoTKWarn</summary>
<h2>AutoTKWarn</h2>
<p>The <code>AutoTkWarn</code> plugin will automatically warn players with a message when they teamkill.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<ul><li><h4>message</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<p>The message to warn players with.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>role (Required)</h4>
<h6>Description</h6>
<p>ID of role required to run the sub system restart commands.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre></ul>
<pre><code>Please apologise for ALL TKs in ALL chat!</code></pre></li></ul>
</details>
<details>
<summary>DiscordChat</summary>
<h2>DiscordChat</h2>
<p>The <code>DiscordChat</code> plugin will log in-game chat to a Discord channel.</p>
<summary>ChatCommands</summary>
<h2>ChatCommands</h2>
<p>The <code>ChatCommands</code> plugin can be configured to make chat commands that broadcast or warn the caller with present messages.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<ul><li><h4>commands</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log admin broadcasts to.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>chatColors</h4>
<h6>Description</h6>
<p>The color of the embed for each chat.</p>
<h6>Default</h6>
<pre><code>{}</code></pre></li><h6>Example</h6>
<pre><code>{
"ChatAll": 16761867
}</code></pre>
<li><h4>color</h4>
<h6>Description</h6>
<p>The color of the embed.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li>
<li><h4>ignoreChats</h4>
<h6>Description</h6>
<p>A list of chat names to ignore.</p>
<p>An array of objects containing the following properties: <ul><li><code>command</code> - The command that initiates the message.</li><li><code>type</code> - Either <code>warn</code> or <code>broadcast</code>.</li><li><code>response</code> - The message to respond with.</li><li><code>ignoreChats</code> - A list of chats to ignore the commands in. Use this to limit it to admins.</li></ul></p>
<h6>Default</h6>
<pre><code>[
"ChatSquad"
{
"command": "squadjs",
"type": "warn",
"response": "This server is powered by SquadJS.",
"ignoreChats": []
}
]</code></pre></li></ul>
</details>
<details>
<summary>DBLog</summary>
<h2>DBLog</h2>
<p>The <code>mysql-log</code> 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):
<ul><li> <a href="https://grafana.com/">Grafana</a> is a cool way of viewing server statistics stored in the database.</li>
<li>Install Grafana.</li>
<li>Add your database as a datasource named <code>SquadJS</code>.</li>
<li>Import the <a href="https://github.com/Thomas-Smyth/SquadJS/blob/master/squad-server/templates/SquadJS-Dashboard-v2.json">SquadJS Dashboard</a> to get a preconfigured MySQL only Grafana dashboard.</li>
<li>Install any missing Grafana plugins.</li></ul></p>
<h3>Options</h3>
<ul><li><h4>database (Required)</h4>
<h6>Description</h6>
<p>The Sequelize connector to log server information to.</p>
<h6>Default</h6>
<pre><code>mysql</code></pre></li>
<li><h4>overrideServerID</h4>
<h6>Description</h6>
<p>A overridden server ID.</p>
<h6>Default</h6>
<pre><code>null</code></pre></li></ul>
</details>
<details>
<summary>DiscordAdminBroadcast</summary>
<h2>DiscordAdminBroadcast</h2>
@ -363,6 +392,29 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
<pre><code>16761867</code></pre></li></ul>
</details>
<details>
<summary>DiscordAdminCamLogs</summary>
<h2>DiscordAdminCamLogs</h2>
<p>The <code>DiscordAdminCamLogs</code> plugin will log in game admin camera usage to a Discord channel.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log admin camera usage to.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>color</h4>
<h6>Description</h6>
<p>The color of the embed.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li></ul>
</details>
<details>
<summary>DiscordAdminRequest</summary>
<h2>DiscordAdminRequest</h2>
@ -420,6 +472,150 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
<pre><code>16761867</code></pre></li></ul>
</details>
<details>
<summary>DiscordChat</summary>
<h2>DiscordChat</h2>
<p>The <code>DiscordChat</code> plugin will log in-game chat to a Discord channel.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log admin broadcasts to.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>chatColors</h4>
<h6>Description</h6>
<p>The color of the embed for each chat.</p>
<h6>Default</h6>
<pre><code>{}</code></pre></li><h6>Example</h6>
<pre><code>{
"ChatAll": 16761867
}</code></pre>
<li><h4>color</h4>
<h6>Description</h6>
<p>The color of the embed.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li>
<li><h4>ignoreChats</h4>
<h6>Description</h6>
<p>A list of chat names to ignore.</p>
<h6>Default</h6>
<pre><code>[
"ChatSquad"
]</code></pre></li></ul>
</details>
<details>
<summary>DiscordDebug</summary>
<h2>DiscordDebug</h2>
<p>The <code>DiscordDebug</code> plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log events to.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>events (Required)</h4>
<h6>Description</h6>
<p>A list of events to dump.</p>
<h6>Default</h6>
<pre><code>[]</code></pre></li><h6>Example</h6>
<pre><code>[
"PLAYER_DIED"
]</code></pre></ul>
</details>
<details>
<summary>DiscordPlaceholder</summary>
<h2>DiscordPlaceholder</h2>
<p>The <code>DiscordPlaceholder</code> plugin allows you to make your bot create placeholder messages that can be used when configuring other plugins.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>command</h4>
<h6>Description</h6>
<p>Command to create Discord placeholder.</p>
<h6>Default</h6>
<pre><code>!placeholder</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The bot will only answer with a placeholder on this channel</p>
<h6>Default</h6>
<pre><code></code></pre></li></ul>
</details>
<details>
<summary>DiscordRcon</summary>
<h2>DiscordRcon</h2>
<p>The <code>DiscordRcon</code> plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>ID of channel to turn into RCON console.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>permissions</h4>
<h6>Description</h6>
<p><ul><li>Dictionary of roles and a list of the permissions they are allowed to use.<li>If dictionary is empty (<code>{}</code>) permissions will be disabled</li><li>A list of available RCON commands can be found here <a>https://squad.gamepedia.com/Server_Administration#Admin_Console_Commands</a>.</ul></p>
<h6>Default</h6>
<pre><code>{}</code></pre></li><h6>Example</h6>
<pre><code>{
"123456789123456789": [
"AdminBroadcast",
"AdminForceTeamChange",
"AdminDemoteCommander"
]
}</code></pre>
<li><h4>prependAdminNameInBroadcast</h4>
<h6>Description</h6>
<p>Prepend admin names when making announcements.</p>
<h6>Default</h6>
<pre><code>false</code></pre></li></ul>
</details>
<details>
<summary>DiscordRoundWinner</summary>
<h2>DiscordRoundWinner</h2>
<p>The <code>DiscordRoundWinner</code> plugin will send the round winner to a Discord channel.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log admin broadcasts to.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>color</h4>
<h6>Description</h6>
<p>The color of the embed.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li></ul>
</details>
<details>
<summary>DiscordServerStatus</summary>
<h2>DiscordServerStatus</h2>
@ -454,96 +650,21 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
</details>
<details>
<summary>AutoKickUnassigned</summary>
<h2>AutoKickUnassigned</h2>
<p>The <code>AutoKickUnassigned</code> plugin will automatically kick players that are not in a squad after a specified ammount of time.</p>
<h3>Options</h3>
<ul><li><h4>warningMessage</h4>
<h6>Description</h6>
<p>Message SquadJS will send to players warning them they will be kicked</p>
<h6>Default</h6>
<pre><code>Join a squad, you are are unassigned and will be kicked</code></pre></li>
<li><h4>kickMessage</h4>
<h6>Description</h6>
<p>Message to send to players when they are kicked</p>
<h6>Default</h6>
<pre><code>Unassigned - automatically removed</code></pre></li>
<li><h4>frequencyOfWarnings</h4>
<h6>Description</h6>
<p>How often in <b>Seconds</b> should we warn the player about being unassigned?</p>
<h6>Default</h6>
<pre><code>30</code></pre></li>
<li><h4>unassignedTimer</h4>
<h6>Description</h6>
<p>How long in <b>Seconds</b> to wait before a unassigned player is kicked</p>
<h6>Default</h6>
<pre><code>360</code></pre></li>
<li><h4>playerThreshold</h4>
<h6>Description</h6>
<p>Player count required for AutoKick to start kicking players, set to -1 to disable</p>
<h6>Default</h6>
<pre><code>93</code></pre></li>
<li><h4>roundStartDelay</h4>
<h6>Description</h6>
<p>Time delay in <b>Seconds</b> from start of the round before AutoKick starts kicking again</p>
<h6>Default</h6>
<pre><code>900</code></pre></li>
<li><h4>ignoreAdmins</h4>
<h6>Description</h6>
<p><ul><li><code>true</code>: Admins will <b>NOT</b> be kicked</li><li><code>false</code>: Admins <b>WILL</b> be kicked</li></ul></p>
<h6>Default</h6>
<pre><code>false</code></pre></li>
<li><h4>ignoreWhitelist</h4>
<h6>Description</h6>
<p><ul><li><code>true</code>: Reserve slot players will <b>NOT</b> be kicked</li><li><code>false</code>: Reserve slot players <b>WILL</b> be kicked</li></ul></p>
<h6>Default</h6>
<pre><code>false</code></pre></li></ul>
</details>
<details>
<summary>DiscordDebug</summary>
<h2>DiscordDebug</h2>
<p>The <code>DiscordDebug</code> plugin can be used to help debug SquadJS by dumping SquadJS events to a Discord channel.</p>
<summary>DiscordSubsystemRestarter</summary>
<h2>DiscordSubsystemRestarter</h2>
<p>The <code>DiscordSubSystemRestarter</code> plugin allows you to manually restart SquadJS subsystems in case an issues arises with them.<ul><li><code>!squadjs restartsubsystem rcon</code></li><li><code>!squadjs restartsubsystem logparser</code></li></ul></p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<li><h4>role (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log events to.</p>
<p>ID of role required to run the sub system restart commands.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>events (Required)</h4>
<h6>Description</h6>
<p>A list of events to dump.</p>
<h6>Default</h6>
<pre><code>[]</code></pre></li><h6>Example</h6>
<pre><code>[
"PLAYER_DIED"
]</code></pre></ul>
</details>
<details>
<summary>IntervalledBroadcasts</summary>
<h2>IntervalledBroadcasts</h2>
<p>The <code>IntervalledBroadcasts</code> plugin allows you to set broadcasts, which will be broadcasted at preset intervals</p>
<h3>Options</h3>
<ul><li><h4>broadcasts</h4>
<h6>Description</h6>
<p>Messages to broadcast.</p>
<h6>Default</h6>
<pre><code>[]</code></pre></li><h6>Example</h6>
<pre><code>[
"This server is powered by SquadJS."
]</code></pre>
<li><h4>interval</h4>
<h6>Description</h6>
<p>Frequency of the broadcasts in milliseconds.</p>
<h6>Default</h6>
<pre><code>300000</code></pre></li></ul>
<pre><code>667741905228136459</code></pre></ul>
</details>
<details>
@ -574,6 +695,49 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
<pre><code>false</code></pre></li></ul>
</details>
<details>
<summary>IntervalledBroadcasts</summary>
<h2>IntervalledBroadcasts</h2>
<p>The <code>IntervalledBroadcasts</code> plugin allows you to set broadcasts, which will be broadcasted at preset intervals</p>
<h3>Options</h3>
<ul><li><h4>broadcasts</h4>
<h6>Description</h6>
<p>Messages to broadcast.</p>
<h6>Default</h6>
<pre><code>[]</code></pre></li><h6>Example</h6>
<pre><code>[
"This server is powered by SquadJS."
]</code></pre>
<li><h4>interval</h4>
<h6>Description</h6>
<p>Frequency of the broadcasts in milliseconds.</p>
<h6>Default</h6>
<pre><code>300000</code></pre></li></ul>
</details>
<details>
<summary>SCBLInfo</summary>
<h2>SCBLInfo</h2>
<p>The <code>SCBLInfo</code> plugin alerts admins when a harmful player is detected joining their server based on data from the <a href="https://squad-community-ban-list.com/">Squad Community Ban List</a>.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to alert admins through.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>threshold</h4>
<h6>Description</h6>
<p>Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the <a href="https://squad-community-ban-list.com/faq">Squad Community Ban List's FAQ</a></p>
<h6>Default</h6>
<pre><code>6</code></pre></li></ul>
</details>
<details>
<summary>SeedingMode</summary>
<h2>SeedingMode</h2>
@ -612,139 +776,28 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
</details>
<details>
<summary>AutoTKWarn</summary>
<h2>AutoTKWarn</h2>
<p>The <code>AutoTkWarn</code> plugin will automatically warn players with a message when they teamkill.</p>
<summary>SocketIOAPI</summary>
<h2>SocketIOAPI</h2>
<p>The <code>SocketIOAPI</code> plugin allows remote access to a SquadJS instance via Socket.IO<br />As a client example you can use this to connect to the socket.io server;<pre><code>
const socket = io.connect('ws://IP:PORT', {
auth: {
token: "MySecretPassword"
}
})
</code></pre>If you need more documentation about socket.io please go ahead and read the following;<br />General Socket.io documentation: <a href="https://socket.io/docs/v3" target="_blank">Socket.io Docs</a><br />Authentication and securing your websocket: <a href="https://socket.io/docs/v3/middlewares/#Sending-credentials" target="_blank">Sending-credentials</a></p>
<h3>Options</h3>
<ul><li><h4>message</h4>
<ul><li><h4>websocketPort (Required)</h4>
<h6>Description</h6>
<p>The message to warn players with.</p>
<h6>Default</h6>
<pre><code>Please apologise for ALL TKs in ALL chat!</code></pre></li></ul>
</details>
<details>
<summary>DBLog</summary>
<h2>DBLog</h2>
<p>The <code>mysql-log</code> 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):
<ul><li> <a href="https://grafana.com/">Grafana</a> is a cool way of viewing server statistics stored in the database.</li>
<li>Install Grafana.</li>
<li>Add your database as a datasource named <code>SquadJS</code>.</li>
<li>Import the <a href="https://github.com/Thomas-Smyth/SquadJS/blob/master/squad-server/templates/SquadJS-Dashboard-v2.json">SquadJS Dashboard</a> to get a preconfigured MySQL only Grafana dashboard.</li>
<li>Install any missing Grafana plugins.</li></ul></p>
<h3>Options</h3>
<ul><li><h4>database (Required)</h4>
<h6>Description</h6>
<p>The Sequelize connector to log server information to.</p>
<h6>Default</h6>
<pre><code>mysql</code></pre></li>
<li><h4>overrideServerID</h4>
<h6>Description</h6>
<p>A overridden server ID.</p>
<h6>Default</h6>
<pre><code>null</code></pre></li></ul>
</details>
<details>
<summary>DiscordRoundWinner</summary>
<h2>DiscordRoundWinner</h2>
<p>The <code>DiscordRoundWinner</code> plugin will send the round winner to a Discord channel.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log admin broadcasts to.</p>
<p>The port for the websocket.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>color</h4>
<pre><code>3000</code></pre>
<li><h4>securityToken (Required)</h4>
<h6>Description</h6>
<p>The color of the embed.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li></ul>
</details>
<details>
<summary>ChatCommands</summary>
<h2>ChatCommands</h2>
<p>The <code>ChatCommands</code> plugin can be configured to make chat commands that broadcast or warn the caller with present messages.</p>
<h3>Options</h3>
<ul><li><h4>commands</h4>
<h6>Description</h6>
<p>An array of objects containing the following properties: <ul><li><code>command</code> - The command that initiates the message.</li><li><code>type</code> - Either <code>warn</code> or <code>broadcast</code>.</li><li><code>response</code> - The message to respond with.</li><li><code>ignoreChats</code> - A list of chats to ignore the commands in. Use this to limit it to admins.</li></ul></p>
<h6>Default</h6>
<pre><code>[
{
"command": "squadjs",
"type": "warn",
"response": "This server is powered by SquadJS.",
"ignoreChats": []
}
]</code></pre></li></ul>
</details>
<details>
<summary>DiscordAdminCamLogs</summary>
<h2>DiscordAdminCamLogs</h2>
<p>The <code>DiscordAdminCamLogs</code> plugin will log in game admin camera usage to a Discord channel.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to log admin camera usage to.</p>
<p>Your secret token/password for connecting.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>color</h4>
<h6>Description</h6>
<p>The color of the embed.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li></ul>
</details>
<details>
<summary>DiscordRcon</summary>
<h2>DiscordRcon</h2>
<p>The <code>DiscordRcon</code> plugin allows a specified Discord channel to be used as a RCON console to run RCON commands.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>ID of channel to turn into RCON console.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>permissions</h4>
<h6>Description</h6>
<p><ul><li>Dictionary of roles and a list of the permissions they are allowed to use.<li>If dictionary is empty (<code>{}</code>) permissions will be disabled</li><li>A list of available RCON commands can be found here <a>https://squad.gamepedia.com/Server_Administration#Admin_Console_Commands</a>.</ul></p>
<h6>Default</h6>
<pre><code>{}</code></pre></li><h6>Example</h6>
<pre><code>{
"123456789123456789": [
"AdminBroadcast",
"AdminForceTeamChange",
"AdminDemoteCommander"
]
}</code></pre>
<li><h4>prependAdminNameInBroadcast</h4>
<h6>Description</h6>
<p>Prepend admin names when making announcements.</p>
<h6>Default</h6>
<pre><code>false</code></pre></li></ul>
<pre><code>MySecretPassword</code></pre></ul>
</details>
<details>
@ -759,29 +812,6 @@ Grafana (NOT YET WORKING WITH V2):
<pre><code>randomize</code></pre></li></ul>
</details>
<details>
<summary>SCBLInfo</summary>
<h2>SCBLInfo</h2>
<p>The <code>SCBLInfo</code> plugin alerts admins when a harmful player is detected joining their server based on data from the <a href="https://squad-community-ban-list.com/">Squad Community Ban List</a>.</p>
<h3>Options</h3>
<ul><li><h4>discordClient (Required)</h4>
<h6>Description</h6>
<p>Discord connector name.</p>
<h6>Default</h6>
<pre><code>discord</code></pre></li>
<li><h4>channelID (Required)</h4>
<h6>Description</h6>
<p>The ID of the channel to alert admins through.</p>
<h6>Default</h6>
<pre><code></code></pre></li><h6>Example</h6>
<pre><code>667741905228136459</code></pre>
<li><h4>threshold</h4>
<h6>Description</h6>
<p>Admins will be alerted when a player has this or more reputation points. For more information on reputation points, see the <a href="https://squad-community-ban-list.com/faq">Squad Community Ban List's FAQ</a></p>
<h6>Default</h6>
<pre><code>6</code></pre></li></ul>
</details>
<br>
## Statement on Accuracy

View File

@ -33,28 +33,40 @@
},
"plugins": [
{
"plugin": "DiscordPlaceholder",
"plugin": "AutoKickUnassigned",
"enabled": true,
"discordClient": "discord",
"command": "!placeholder"
"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",
"enabled": true,
"message": "Please apologise for ALL TKs in ALL chat!"
},
{
"plugin": "DiscordChat",
"plugin": "ChatCommands",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"chatColors": {},
"color": 16761867,
"ignoreChats": [
"ChatSquad"
"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,
@ -62,6 +74,13 @@
"channelID": "",
"color": 16761867
},
{
"plugin": "DiscordAdminCamLogs",
"enabled": false,
"discordClient": "discord",
"channelID": "",
"color": 16761867
},
{
"plugin": "DiscordAdminRequest",
"enabled": true,
@ -75,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",
@ -102,10 +112,40 @@
"events": []
},
{
"plugin": "IntervalledBroadcasts",
"plugin": "DiscordPlaceholder",
"enabled": true,
"discordClient": "discord",
"command": "!placeholder",
"channelID": ""
},
{
"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",
@ -115,6 +155,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,
@ -126,61 +179,15 @@
"liveMessage": "Live!"
},
{
"plugin": "AutoTKWarn",
"enabled": true,
"message": "Please apologise for ALL TKs in ALL chat!"
},
{
"plugin": "DBLog",
"plugin": "SocketIOAPI",
"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
"websocketPort": "",
"securityToken": ""
},
{
"plugin": "TeamRandomizer",
"enabled": true,
"command": "randomize"
},
{
"plugin": "SCBLInfo",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"threshold": 6
}
],
"logger": {

View File

@ -22,7 +22,7 @@ class Layers {
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/_Current%20Version/finished.json'
'https://cdn.jsdelivr.net/gh/Squad-Wiki-Editorial/squad-wiki-pipeline-map-data@dev/completed_output/_Current%20Version/finished.json'
);
for (const layer of response.data.Maps) {

View File

@ -15,6 +15,7 @@
"pg": "^8.5.1",
"pg-hstore": "^2.3.3",
"sequelize": "^6.3.5",
"socket.io": "^3.1.2",
"sqlite3": "^5.0.0",
"tedious": "^9.2.1",
"tinygradient": "^1.1.2"

View File

@ -24,6 +24,11 @@ export default class DiscordPlaceholder extends BasePlugin {
required: false,
description: 'Command to create Discord placeholder.',
default: '!placeholder'
},
channelID: {
required: true,
description: 'The bot will only answer with a placeholder on this channel',
default: ''
}
};
}
@ -31,6 +36,8 @@ export default class DiscordPlaceholder extends BasePlugin {
constructor(server, options, connectors) {
super(server, options, connectors);
this.escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
this.onMessage = this.onMessage.bind(this);
}
@ -44,6 +51,9 @@ export default class DiscordPlaceholder extends BasePlugin {
async onMessage(message) {
if (message.author.bot) return;
if (message.channel.id !== this.options.channelID) return;
const prefixRegex = new RegExp(`^(${this.escapeRegex(this.options.command)})\\s*`);
if (!prefixRegex.test(message.content)) return;
await message.channel.send('Placeholder.');
}
}

View File

@ -111,7 +111,7 @@ export default class SCBLInfo extends DiscordBasePlugin {
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'
'https://cdn.jsdelivr.net/gh/Thomas-Smyth/Squad-Community-Ban-List@master/client/src/assets/img/brand/scbl-logo-square.png'
},
thumbnail: {
url: data.steamUser.avatarFull

View File

@ -0,0 +1,144 @@
import { createServer } from 'http';
import { Server } from 'socket.io';
import BasePlugin from './base-plugin.js';
export default class SocketIOAPI extends BasePlugin {
static get description() {
return (
'The <code>SocketIOAPI</code> plugin allows remote access to a SquadJS instance via Socket.IO' +
'<br />As a client example you can use this to connect to the socket.io server;' +
`<pre><code>
const socket = io.connect('ws://IP:PORT', {
auth: {
token: "MySecretPassword"
}
})
</code></pre>` +
'If you need more documentation about socket.io please go ahead and read the following;' +
'<br />General Socket.io documentation: <a href="https://socket.io/docs/v3" target="_blank">Socket.io Docs</a>' +
'<br />Authentication and securing your websocket: <a href="https://socket.io/docs/v3/middlewares/#Sending-credentials" target="_blank">Sending-credentials</a>'
);
}
static get defaultEnabled() {
return false;
}
static get optionsSpecification() {
return {
websocketPort: {
required: true,
description: 'The port for the websocket.',
default: '',
example: '3000'
},
securityToken: {
required: true,
description: 'Your secret token/password for connecting.',
default: '',
example: 'MySecretPassword'
}
};
}
constructor(server, options, connectors) {
super(server, options, connectors);
this.httpServer = createServer();
this.io = new Server(this.httpServer, {
cors: {
origin: 'http://localhost:3000',
methods: ['GET', 'POST']
}
});
this.io.use((socket, next) => {
if (socket.handshake.auth && socket.handshake.auth.token === this.options.securityToken) {
next();
} else {
next(new Error('Invalid token.'));
}
});
this.io.on('connection', (socket) => {
this.verbose(1, 'New Connection Made.');
this.bindListeners(socket, this.server);
this.bindListeners(socket, this.server.rcon, 'rcon.');
});
}
async mount() {
this.httpServer.listen(this.options.websocketPort);
}
async unmount() {
this.httpServer.close();
}
bindListeners(socket, obj, prefix = '') {
const ignore = [
'options',
'constructor',
'watch',
'unwatch',
'setupRCON',
'setupLogParser',
'getPlayerByCondition',
'pingSquadJSAPI',
'_events',
'_eventsCount',
'_maxListeners',
'plugins',
'rcon',
'logParser',
'updatePlayerListInterval',
'updatePlayerListTimeout',
'updateLayerInformationInterval',
'updateLayerInformationTimeout',
'updateA2SInformationInterval',
'updateA2SInformationTimeout',
'pingSquadJSAPIInterval',
'pingSquadJSAPI',
'pingSquadJSAPITimeout',
'rcon.constructor',
'rcon.processChatPacket',
'rcon._events',
'rcon._eventsCount',
'rcon._maxListeners',
'rcon.password',
'rcon.connect',
'rcon.onData',
'rcon.onClose',
'rcon.onError',
'rcon.client',
'rcon.autoReconnect',
'rcon.autoReconnectTimeout',
'rcon.incomingData',
'rcon.incomingResponse',
'rcon.responseCallbackQueue'
];
for (const key of Object.getOwnPropertyNames(Object.getPrototypeOf(obj))) {
if (ignore.includes(`${prefix}${key}`)) continue;
this.verbose(1, `Setting method listener for ${prefix}${key}...`);
socket.on(`${prefix}${key}`, async (...rawArgs) => {
const args = rawArgs.slice(0, rawArgs.length - 1);
const callback = rawArgs[rawArgs.length - 1];
this.verbose(1, `Call to ${prefix}${key}(${args.join(', ')})`);
const reponse = await obj[key](...args);
callback(reponse);
});
}
for (const key of Object.getOwnPropertyNames(obj)) {
if (ignore.includes(`${prefix}${key}`)) continue;
this.verbose(1, `Setting properties listener for ${prefix}${key}...`);
socket.on(`${prefix}${key}`, (callback) => {
this.verbose(1, `Call to ${prefix}${key}...`);
const reponse = obj[key];
callback(reponse);
});
}
}
}

View File

@ -27,11 +27,11 @@ function versionOutOfDate(current, latest) {
export default async function () {
const { data: masterData } = await axios.get(
`https://raw.githubusercontent.com/Thomas-Smyth/SquadJS/master/package.json`
`https://cdn.jsdelivr.net/gh/Thomas-Smyth/SquadJS@master/package.json`
);
const { data: betaData } = await axios.get(
`https://raw.githubusercontent.com/Thomas-Smyth/SquadJS/beta/package.json`
`https://cdn.jsdelivr.net/gh/Thomas-Smyth/SquadJS@beta/package.json`
);
const branch = SQUADJS_VERSION.includes('beta') ? 'beta' : 'master';