Skip to content

Commit

Permalink
Merge pull request #245 from IgnisAlienus/master
Browse files Browse the repository at this point in the history
Replace SCBL integrations with CBL integrations
  • Loading branch information
Thomas-Smyth authored Jun 28, 2022
2 parents 053e100 + 39fad4b commit 82850f6
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 101 deletions.
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,29 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
<pre><code>Please apologise for ALL TKs in ALL chat!</code></pre></li></ul>
</details>

<details>
<summary>CBLInfo</summary>
<h2>CBLInfo</h2>
<p>The <code>CBLInfo</code> plugin alerts admins when a harmful player is detected joining their server based on data from the <a href="https://communitybanlist.com/">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://communitybanlist.com/faq">Community Ban List's FAQ</a></p>
<h6>Default</h6>
<pre><code>6</code></pre></li></ul>
</details>

<details>
<summary>ChatCommands</summary>
<h2>ChatCommands</h2>
Expand Down Expand Up @@ -592,9 +615,9 @@ Grafana:
<p>The color of the embeds.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li>
<li><h4>disableSCBL</h4>
<li><h4>disableCBL</h4>
<h6>Description</h6>
<p>Disable Squad Community Ban List information.</p>
<p>Disable Community Ban List information.</p>
<h6>Default</h6>
<pre><code>false</code></pre></li></ul>
</details>
Expand Down Expand Up @@ -783,9 +806,9 @@ Grafana:
<p>The color of the embeds.</p>
<h6>Default</h6>
<pre><code>16761867</code></pre></li>
<li><h4>disableSCBL</h4>
<li><h4>disableCBL</h4>
<h6>Description</h6>
<p>Disable Squad Community Ban List information.</p>
<p>Disable Community Ban List information.</p>
<h6>Default</h6>
<pre><code>false</code></pre></li></ul>
</details>
Expand Down Expand Up @@ -827,29 +850,6 @@ Grafana:
<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>
Expand Down
18 changes: 9 additions & 9 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
"enabled": true,
"message": "Please apologise for ALL TKs in ALL chat!"
},
{
"plugin": "CBLInfo",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"threshold": 6
},
{
"plugin": "ChatCommands",
"enabled": true,
Expand Down Expand Up @@ -134,7 +141,7 @@
"discordClient": "discord",
"channelID": "",
"color": 16761867,
"disableSCBL": false
"disableCBL": false
},
{
"plugin": "DiscordPlaceholder",
Expand Down Expand Up @@ -188,7 +195,7 @@
"discordClient": "discord",
"channelID": "",
"color": 16761867,
"disableSCBL": false
"disableCBL": false
},
{
"plugin": "FogOfWar",
Expand All @@ -202,13 +209,6 @@
"broadcasts": [],
"interval": 300000
},
{
"plugin": "SCBLInfo",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"threshold": 6
},
{
"plugin": "SeedingMode",
"enabled": true,
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/deployable-damaged.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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],
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/player-damaged.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: Player:(.+) ActualDamage=([0-9.]+) from (.+) caused by ([A-z_0-9]+)_C/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: Player:(.+) ActualDamage=([0-9.]+) from (.+) caused by ([A-z_0-9]+)_C/,
onMatch: (args, logParser) => {
const data = {
raw: args[0],
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/player-died.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Die\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) caused by ([A-z_0-9]+)_C/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Die\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) caused by ([A-z_0-9]+)_C/,
onMatch: (args, logParser) => {
const data = {
...logParser.eventStore[args[3]],
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/player-disconnected.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogEasyAntiCheatServer: \[[0-9:]+] \[[A-z]+] \[EAC Server] \[Info] \[UnregisterClient] Client: ([A-z0-9]+) PlayerGUID: ([0-9]{17})/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogEasyAntiCheatServer: \[[0-9:]+] \[[A-z]+] \[EAC Server] \[Info] \[UnregisterClient] Client: ([A-z0-9]+) PlayerGUID: ([0-9]{17})/,
onMatch: (args, logParser) => {
const data = {
raw: args[0],
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/player-possess.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnPossess\(\): PC=(.+) Pawn=([A-z0-9_]+)_C/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnPossess\(\): PC=(.+) Pawn=([A-z0-9_]+)_C/,
onMatch: (args, logParser) => {
const data = {
raw: args[0],
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/player-un-possess.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnUnPossess\(\): PC=(.+)/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQPlayerController::)?OnUnPossess\(\): PC=(.+)/,
onMatch: (args, logParser) => {
const data = {
raw: args[0],
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/player-wounded.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Wound\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) caused by ([A-z_0-9]+)_C/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Wound\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) caused by ([A-z_0-9]+)_C/,
onMatch: (args, logParser) => {
const data = {
...logParser.eventStore[args[3]],
Expand Down
3 changes: 2 additions & 1 deletion squad-server/log-parser/round-winner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQGameMode::)?DetermineMatchWinner\(\): (.+) won on (.+)/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQGameMode::)?DetermineMatchWinner\(\): (.+) won on (.+)/,
onMatch: (args, logParser) => {
const data = {
raw: args[0],
Expand Down
7 changes: 4 additions & 3 deletions squad-server/log-parser/squad-created.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: (.+) \(Steam ID: ([0-9]{17})\) has created Squad (\d+) \(Squad Name: (.+)\) on (.+)/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: (.+) \(Steam ID: ([0-9]{17})\) has created Squad (\d+) \(Squad Name: (.+)\) on (.+)/,
onMatch: async (args, logParser) => {
const data = {
raw: args[0],
Expand All @@ -11,7 +12,7 @@ export default {
squadName: args[6],
teamName: args[7]
};

logParser.emit('SQUAD_CREATED', data);
}
};
};
4 changes: 2 additions & 2 deletions squad-server/log-parser/steamid-connected.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogEasyAntiCheatServer: \[[0-9:]+] \[[A-z]+] \[EAC Server] \[Info] \[RegisterClient] Client: ([A-z0-9]+) PlayerGUID: ([0-9]{17}) PlayerIP: [0-9]{17} OwnerGUID: [0-9]{17} PlayerName: (.+)/,
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogEasyAntiCheatServer: \[[0-9:]+] \[[A-z]+] \[EAC Server] \[Info] \[RegisterClient] Client: ([A-z0-9]+) PlayerGUID: ([0-9]{17}) PlayerIP: [0-9]{17} OwnerGUID: [0-9]{17} PlayerName: (.+)/,
onMatch: async (args, logParser) => {
logParser.eventStore['steamid-connected'] = args[4];
}
};

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import DiscordBasePlugin from './discord-base-plugin.js';

const { request, gql } = GraphQLRequest;

export default class SCBLInfo extends DiscordBasePlugin {
export default class CBLInfo extends DiscordBasePlugin {
static get description() {
return (
'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>.'
'The <code>CBLInfo</code> plugin alerts admins when a harmful player is detected joining their server based ' +
'on data from the <a href="https://communitybanlist.com/">Community Ban List</a>.'
);
}

Expand All @@ -30,7 +30,7 @@ export default class SCBLInfo extends DiscordBasePlugin {
description:
'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>',
'<a href="https://communitybanlist.com/faq">Community Ban List\'s FAQ</a>',
default: 6
}
};
Expand All @@ -53,7 +53,7 @@ export default class SCBLInfo extends DiscordBasePlugin {
async onPlayerConnected(info) {
try {
const data = await request(
'https://squad-community-ban-list.com/graphql',
'https://communitybanlist.com/graphql',
gql`
query Search($id: String!) {
steamUser(id: $id) {
Expand Down Expand Up @@ -91,7 +91,7 @@ export default class SCBLInfo extends DiscordBasePlugin {
if (!data.steamUser) {
this.verbose(
2,
`Player ${info.player.name} (Steam ID: ${info.player.steamID}) is not listed in the Squad Community Ban List.`
`Player ${info.player.name} (Steam ID: ${info.player.steamID}) is not listed in the Community Ban List.`
);
return;
}
Expand All @@ -108,15 +108,14 @@ export default class SCBLInfo extends DiscordBasePlugin {
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://cdn.jsdelivr.net/gh/Team-Silver-Sphere/Squad-Community-Ban-List@master/client/src/assets/img/brand/scbl-logo-square.png'
name: 'Community Ban List',
url: 'https://communitybanlist.com/',
icon_url: 'https://communitybanlist.com/static/media/cbl-logo.caf6584e.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.`,
description: `[${info.player.name}](https://communitybanlist.com/search/${info.player.steamID}) has ${data.steamUser.reputationPoints} reputation points on the Community Ban List and is therefore a potentially harmful player.`,
fields: [
{
name: 'Reputation Points',
Expand Down Expand Up @@ -149,14 +148,14 @@ export default class SCBLInfo extends DiscordBasePlugin {
color: '#ffc40b',
timestamp: info.time.toISOString(),
footer: {
text: 'Powered by SquadJS and the Squad Community Ban List'
text: 'Powered by SquadJS and the Community Ban List'
}
}
});
} catch (err) {
this.verbose(
1,
`Failed to fetch Squad Community Ban List data for player ${info.name} (Steam ID: ${info.steamID}): `,
`Failed to fetch Community Ban List data for player ${info.name} (Steam ID: ${info.steamID}): `,
err
);
}
Expand Down
10 changes: 5 additions & 5 deletions squad-server/plugins/discord-killfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export default class DiscordKillFeed extends DiscordBasePlugin {
description: 'The color of the embeds.',
default: 16761867
},
disableSCBL: {
disableCBL: {
required: false,
description: 'Disable Squad Community Ban List information.',
description: 'Disable Community Ban List information.',
default: false
}
};
Expand Down Expand Up @@ -80,10 +80,10 @@ export default class DiscordKillFeed extends DiscordBasePlugin {
}
];

if (!this.options.disableSCBL)
if (!this.options.disableCBL)
fields.push({
name: 'Squad Community Ban List',
value: `[Attacker's Bans](https://squad-community-ban-list.com/search/${info.attacker.steamID})`
name: 'Community Ban List',
value: `[Attacker's Bans](https://communitybanlist.com/search/${info.attacker.steamID})`
});

await this.sendDiscordMessage({
Expand Down
56 changes: 27 additions & 29 deletions squad-server/plugins/discord-squad-created.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class DiscordSquadCreated extends DiscordBasePlugin {
description: 'The color of the embed.',
default: 16761867
},
useEmbed:{
useEmbed: {
required: false,
description: `Send message as Embed`,
default: true
Expand All @@ -46,36 +46,34 @@ export default class DiscordSquadCreated extends DiscordBasePlugin {
}

async onSquadCreated(info) {

if(this.options.useEmbed){

await this.sendDiscordMessage({
embed: {
title: `Squad Created`,
color: this.options.color,
fields: [
{
name: 'Player',
value: info.player.name,
inline: true
},
{
name: 'Team',
value: info.teamName,
inline: true
},
{
name: 'Squad Number & Squad Name',
value: `${info.player.squadID} : ${info.squadName}`
}
],
timestamp: info.time.toISOString()
if (this.options.useEmbed) {
await this.sendDiscordMessage({
embed: {
title: `Squad Created`,
color: this.options.color,
fields: [
{
name: 'Player',
value: info.player.name,
inline: true
},
{
name: 'Team',
value: info.teamName,
inline: true
},
{
name: 'Squad Number & Squad Name',
value: `${info.player.squadID} : ${info.squadName}`
}
});

],
timestamp: info.time.toISOString()
}
});
} else {

await this.sendDiscordMessage(` \`\`\`Player: ${info.player.name}\n created Squad ${info.player.squadID} : ${info.squadName}\n on ${info.teamName}\`\`\` `)
await this.sendDiscordMessage(
` \`\`\`Player: ${info.player.name}\n created Squad ${info.player.squadID} : ${info.squadName}\n on ${info.teamName}\`\`\` `
);
}
}
}
Loading

0 comments on commit 82850f6

Please sign in to comment.