Skip to content

Commit

Permalink
Merge pull request #11 from Thomas-Smyth/beta
Browse files Browse the repository at this point in the history
SquadJS v1.0.7 Release
  • Loading branch information
Thomas-Smyth authored May 21, 2020
2 parents 3c9de1d + 92681ac commit cc9e568
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SquadJS",
"version": "1.0.6",
"version": "1.0.7",
"repository": "https://github.com/Thomas-Smyth/SquadJS.git",
"author": "Thomas Smyth <https://github.com/Thomas-Smyth>",
"license": "MIT",
Expand Down
23 changes: 23 additions & 0 deletions plugins/auto-tk-warn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div align="center">

<img src="../../assets/squadjs-logo.png" alt="Logo" width="500"/>

#### SquadJS - Auto Teamkill Warning
</div>

## About
Automatically sends a warning to players who teamkill to remind them to apologise in all chat.

## Installation
```js
// Place the following line at the top of your index.js file.
import { autoTKWarn } from 'plugins';

// Place the following lines after all of the above.
await discordAdminCamLogs(
server,
{ // options - the options included below display the defaults and can be removed for simplicity.
message: 'Please apologise for ALL TKs in ALL chat!' // warning to send
}
);
```
15 changes: 15 additions & 0 deletions plugins/auto-tk-warn/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LOG_PARSER_TEAMKILL } from 'squad-server/events/log-parser';

export default async function(server, options= {}) {
if (!server)
throw new Error(
'DiscordAdminCamLogs must be provided with a reference to the server.'
);

server.on(LOG_PARSER_TEAMKILL, info => {
// ignore suicides
if(info.attacker.steamID === info.victim.steamID) return;
server.rcon.execute(`AdminWarn "${info.attacker.steamID}" ${options.message || 'Please apologise for ALL TKs in ALL chat!'}`);
});

}
2 changes: 1 addition & 1 deletion plugins/discord-admin-cam-logs/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { COPYRIGHT_MESSAGE } from 'core/config';
import { LOG_PARSER_PLAYER_POSSESS, LOG_PARSER_PLAYER_UNPOSSESS } from 'squad-server/events/log-parser';

export default async function plugin(
export default async function(
server,
discordClient,
channelID,
Expand Down
2 changes: 1 addition & 1 deletion plugins/discord-chat/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { COPYRIGHT_MESSAGE } from 'core/config';
import { RCON_CHAT_MESSAGE } from 'squad-server/events/rcon';

export default async function plugin(
export default async function(
server,
discordClient,
channelID,
Expand Down
2 changes: 1 addition & 1 deletion plugins/discord-debug/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default async function plugin(
export default async function(
server,
discordClient,
channelID,
Expand Down
2 changes: 1 addition & 1 deletion plugins/discord-server-status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function makeEmbed(server, options) {
};
}

export default async function plugin(server, discordClient, options = {}) {
export default async function(server, discordClient, options = {}) {
if (!server)
throw new Error(
'DiscordDebug must be provided with a reference to the server.'
Expand Down
66 changes: 35 additions & 31 deletions plugins/discord-teamkill/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { COPYRIGHT_MESSAGE } from 'core/config';
import { LOG_PARSER_TEAMKILL } from 'squad-server/events/log-parser';

export default async function plugin(
export default async function(
server,
discordClient,
channelID,
Expand All @@ -22,6 +22,7 @@ export default async function plugin(

options = {
color: 16761867,
disableSCBL: false,
...options
};

Expand All @@ -30,40 +31,43 @@ export default async function plugin(
server.on(LOG_PARSER_TEAMKILL, info => {
if (!info.attacker) return;

const fields = [
{
name: "Attacker's Name",
value: info.attacker.name,
inline: true
},
{
name: "Attacker's SteamID",
value: `[${info.attacker.steamID}](https://steamcommunity.com/profiles/${info.attacker.steamID})`,
inline: true
},
{
name: 'Weapon',
value: info.weapon
},
{
name: "Victim's Name",
value: info.victim.name,
inline: true
},
{
name: "Victim's SteamID",
value: `[${info.victim.steamID}](https://steamcommunity.com/profiles/${info.victim.steamID})`,
inline: true
}
];

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

channel.send({
embed: {
title: `${info.attacker.steamID === info.victim.steamID ? 'Suicide' : 'Teamkill'}: ${info.attacker.name}`,
color: options.color,
fields: [
{
name: "Attacker's Name",
value: info.attacker.name,
inline: true
},
{
name: "Attacker's SteamID",
value: `[${info.attacker.steamID}](https://steamcommunity.com/profiles/${info.attacker.steamID})`,
inline: true
},
{
name: 'Weapon',
value: info.weapon
},
{
name: "Victim's Name",
value: info.victim.name,
inline: true
},
{
name: "Victim's SteamID",
value: `[${info.victim.steamID}](https://steamcommunity.com/profiles/${info.victim.steamID})`,
inline: true
},
{
name: 'Squad Community Ban List',
value: `[Attacker's Bans](https://squad-community-ban-list.com/search/${info.attacker.steamID})\n[Victims's Bans](https://squad-community-ban-list.com/search/${info.victim.steamID})`
}
],
fields: fields,
timestamp: info.time.toISOString(),
footer: {
text: COPYRIGHT_MESSAGE
Expand Down
2 changes: 2 additions & 0 deletions plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import autoTKWarn from './auto-tk-warn/index.js';
import discordAdminCamLogs from './discord-admin-cam-logs/index.js';
import discordChat from './discord-chat/index.js';
import discordDebug from './discord-debug/index.js';
Expand All @@ -11,6 +12,7 @@ import seedingMessage from './seeding-message/index.js';
import teamRandomizer from './team-randomizer/index.js';

export {
autoTKWarn,
discordAdminCamLogs,
discordChat,
discordDebug,
Expand Down
2 changes: 1 addition & 1 deletion plugins/influxdb-log/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import { SERVER_PLAYERS_UPDATED } from 'squad-server/events/server';

export default function influxdbLog(server, influxDB, options = {}) {
export default function(server, influxDB, options = {}) {
if (!server)
throw new Error(
'InfluxDBLog must be provided with a reference to the server.'
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-log/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'squad-server/events/log-parser';
import { SERVER_PLAYERS_UPDATED } from 'squad-server/events/server';

export default function mysqlLog(server, mysqlPool, options = {}) {
export default function(server, mysqlPool, options = {}) {
if (!server)
throw new Error(
'MySQLLog must be provided with a reference to the server.'
Expand Down

0 comments on commit cc9e568

Please sign in to comment.