Skip to content

Commit

Permalink
Added FTP source type to admin lists. (#379)
Browse files Browse the repository at this point in the history
* Added FTP support to admin lists.

* Removed debug messages. Added info to readme template.

* Ran yarn build-all

* Ran yarn lint

---------

Co-authored-by: Marek <[email protected]>
  • Loading branch information
mbartisan and werewolfboy13 authored Aug 20, 2024
1 parent d595661 commit 9976545
Show file tree
Hide file tree
Showing 9 changed files with 489 additions and 426 deletions.
604 changes: 304 additions & 300 deletions README.md

Large diffs are not rendered by default.

200 changes: 100 additions & 100 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
},
"plugins": [
{
"plugin": "TeamRandomizer",
"enabled": true,
"command": "randomize"
"plugin": "DiscordAdminCamLogs",
"enabled": false,
"discordClient": "discord",
"channelID": "",
"color": 16761867
},
{
"plugin": "DiscordAdminBroadcast",
Expand All @@ -58,11 +60,12 @@
"color": 16761867
},
{
"plugin": "DiscordFOBHABExplosionDamage",
"enabled": true,
"plugin": "DiscordRcon",
"enabled": false,
"discordClient": "discord",
"channelID": "",
"color": 16761867
"permissions": {},
"prependAdminNameInBroadcast": false
},
{
"plugin": "DiscordRoundWinner",
Expand All @@ -72,37 +75,77 @@
"color": 16761867
},
{
"plugin": "DiscordChat",
"enabled": true,
"plugin": "DiscordKillFeed",
"enabled": false,
"discordClient": "discord",
"channelID": "",
"chatColors": {},
"color": 16761867,
"ignoreChats": [
"ChatSquad"
]
"disableCBL": false
},
{
"plugin": "DiscordRoundEnded",
"plugin": "DiscordPlaceholder",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"color": 16761867
"command": "!placeholder",
"channelID": ""
},
{
"plugin": "DiscordAdminCamLogs",
"plugin": "DBLog",
"enabled": false,
"database": "mysql",
"overrideServerID": null
},
{
"plugin": "CBLInfo",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"threshold": 6
},
{
"plugin": "DiscordRoundEnded",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"color": 16761867
},
{
"plugin": "DiscordRcon",
"enabled": false,
"plugin": "ChatCommands",
"enabled": true,
"commands": [
{
"command": "squadjs",
"type": "warn",
"response": "This server is powered by SquadJS.",
"ignoreChats": []
}
]
},
{
"plugin": "DiscordServerStatus",
"enabled": true,
"discordClient": "discord",
"messageStore": "sqlite",
"command": "!status",
"disableSubscriptions": false,
"updateInterval": 60000,
"setBotStatus": true
},
{
"plugin": "TeamRandomizer",
"enabled": true,
"command": "randomize"
},
{
"plugin": "DiscordChat",
"enabled": true,
"discordClient": "discord",
"channelID": "",
"permissions": {},
"prependAdminNameInBroadcast": false
"chatColors": {},
"color": 16761867,
"ignoreChats": [
"ChatSquad"
]
},
{
"plugin": "SeedingMode",
Expand All @@ -116,18 +159,6 @@
"waitOnNewGames": true,
"waitTimeOnNewGame": 30
},
{
"plugin": "AutoKickUnassigned",
"enabled": true,
"warningMessage": "Join a squad, you 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,
Expand All @@ -136,43 +167,54 @@
"events": []
},
{
"plugin": "CBLInfo",
"enabled": true,
"plugin": "DiscordSubsystemRestarter",
"enabled": false,
"discordClient": "discord",
"role": ""
},
{
"plugin": "DiscordSquadCreated",
"enabled": false,
"discordClient": "discord",
"channelID": "",
"threshold": 6
"color": 16761867,
"useEmbed": true
},
{
"plugin": "SocketIOAPI",
"plugin": "FogOfWar",
"enabled": false,
"websocketPort": "",
"securityToken": ""
"mode": 1,
"delay": 10000
},
{
"plugin": "DBLog",
"plugin": "IntervalledBroadcasts",
"enabled": false,
"database": "mysql",
"overrideServerID": null
"broadcasts": [],
"interval": 300000
},
{
"plugin": "DiscordSquadCreated",
"plugin": "SocketIOAPI",
"enabled": false,
"discordClient": "discord",
"channelID": "",
"color": 16761867,
"useEmbed": true
"websocketPort": "",
"securityToken": ""
},
{
"plugin": "ChatCommands",
"plugin": "AutoTKWarn",
"enabled": true,
"commands": [
{
"command": "squadjs",
"type": "warn",
"response": "This server is powered by SquadJS.",
"ignoreChats": []
}
]
"attackerMessage": "Please apologise for ALL TKs in ALL chat!",
"victimMessage": null
},
{
"plugin": "AutoKickUnassigned",
"enabled": true,
"warningMessage": "Join a squad, you are unassigned and will be kicked",
"kickMessage": "Unassigned - automatically removed",
"frequencyOfWarnings": 30,
"unassignedTimer": 360,
"playerThreshold": 93,
"roundStartDelay": 900,
"ignoreAdmins": false,
"ignoreWhitelist": false
},
{
"plugin": "DiscordTeamkill",
Expand All @@ -182,22 +224,6 @@
"color": 16761867,
"disableCBL": false
},
{
"plugin": "IntervalledBroadcasts",
"enabled": false,
"broadcasts": [],
"interval": 300000
},
{
"plugin": "DiscordServerStatus",
"enabled": true,
"discordClient": "discord",
"messageStore": "sqlite",
"command": "!status",
"disableSubscriptions": false,
"updateInterval": 60000,
"setBotStatus": true
},
{
"plugin": "DiscordAdminRequest",
"enabled": true,
Expand All @@ -214,37 +240,11 @@
"showInGameAdmins": true
},
{
"plugin": "DiscordKillFeed",
"enabled": false,
"discordClient": "discord",
"channelID": "",
"color": 16761867,
"disableCBL": false
},
{
"plugin": "AutoTKWarn",
"enabled": true,
"attackerMessage": "Please apologise for ALL TKs in ALL chat!",
"victimMessage": null
},
{
"plugin": "DiscordPlaceholder",
"plugin": "DiscordFOBHABExplosionDamage",
"enabled": true,
"discordClient": "discord",
"command": "!placeholder",
"channelID": ""
},
{
"plugin": "FogOfWar",
"enabled": false,
"mode": 1,
"delay": 10000
},
{
"plugin": "DiscordSubsystemRestarter",
"enabled": false,
"discordClient": "discord",
"role": ""
"channelID": "",
"color": 16761867
}
],
"logger": {
Expand Down
16 changes: 10 additions & 6 deletions squad-server/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

import {Client, Events, GatewayIntentBits} from 'discord.js';
import { Client, Events, GatewayIntentBits } from 'discord.js';
import sequelize from 'sequelize';
import AwnAPI from './utils/awn-api.js';

Expand Down Expand Up @@ -103,16 +103,20 @@ export default class SquadServerFactory {
Logger.verbose('SquadServerFactory', 1, `Starting ${type} connector ${connectorName}...`);

if (type === 'discord') {
const connector = new Client({intents:[
const connector = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
]});
connector.once(Events.ClientReady, readyClient => {console.log(`Ready! Logged in as ${readyClient.user.tag}`);});
GatewayIntentBits.GuildMembers
]
});
connector.once(Events.ClientReady, (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
await connector.login(connectorConfig);
// setup compatability with older plugins for message create event.
connector.on('messageCreate', message=>{
connector.on('messageCreate', (message) => {
connector.emit('message', message);
});
return connector;
Expand Down
1 change: 1 addition & 0 deletions squad-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "module",
"dependencies": {
"axios": "^0.21.1",
"basic-ftp": "^4.6.6",
"core": "1.0.0",
"didyoumean": "^1.2.1",
"discord.js": "^14.14.1",
Expand Down
4 changes: 2 additions & 2 deletions squad-server/plugins/discord-base-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export default class DiscordBasePlugin extends BasePlugin {
if (typeof message === 'object' && 'embed' in message) {
message.embed.footer = message.embed.footer || { text: COPYRIGHT_MESSAGE };
if (typeof message.embed.color === 'string')
message.embed.color = parseInt(message.embed.color,16);
message = {...message, embeds:[message.embed]};
message.embed.color = parseInt(message.embed.color, 16);
message = { ...message, embeds: [message.embed] };
}

await this.channel.send(message);
Expand Down
Loading

0 comments on commit 9976545

Please sign in to comment.