Skip to content

Commit 8b87de2

Browse files
authored
Merge pull request #124 from oof2win2/features
Allow hidden servers
2 parents 9f22630 + 46948b3 commit 8b87de2

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

src/commands/Factorio/onlineplayers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ const OnlinePlayers: Command<Message> = {
2323

2424
const serversWithScenario = rcon.rconConnections
2525
.filter((connection) => connection.hasScenario)
26+
.filter((connection) => connection.server.hidden === false)
2627
.map((connection) => connection.server.discordname);
2728
const serversWithoutScenario = rcon.rconConnections
2829
.filter((connection) => !connection.hasScenario)
30+
.filter((connection) => connection.server.hidden === false)
2931
.map((connection) => connection.server.discordname);
3032

3133
const scenarioOutputProm = serversWithScenario.map((discordname) =>

src/helpers/serverHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ class serverHandler {
529529
}
530530
async discordHandler(data) {
531531
if (data.server.dev) return; // ignore dev server
532+
if (data.server.hidden) return; // return if server is hidden
532533
const message = data.line.replace(
533534
"${serverName}",
534535
`<#${data.server.discordid}>`
@@ -546,7 +547,6 @@ class serverHandler {
546547
modchannel.isText() &&
547548
modchannel.send({
548549
embed: new MessageEmbed(embed),
549-
content: `<@&${config.moderatorroleid}>`,
550550
});
551551
}
552552
async startHandler(data: OutputData) {

src/servers.example.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const servers: FactorioServer[] = [
1919
discord: false, // requires the full scenario, not just the mod
2020
},
2121
dev: false, // whether or not the server is developmental
22+
hidden: false, // whether the server is hidden from ?po etc
2223
},
2324
];
2425

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface FactorioServer {
1212
discord: boolean;
1313
};
1414
dev: boolean;
15+
hidden: boolean
1516
}
1617

1718
export type BotConfigEmojis = Record<string, string>;

0 commit comments

Comments
 (0)