Skip to content

Commit 7523ed7

Browse files
committed
Display linked Discord account in FS logs
1 parent d909878 commit 7523ed7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/actions/fs22Loop.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChannelType, EmbedBuilder } from "discord.js";
1+
import { ChannelType, EmbedBuilder, userMention } from "discord.js";
22
import type TClient from "../client.js";
33
import {
44
DSSExtension,
@@ -56,7 +56,9 @@ export async function fs22Loop(client: TClient, watchList: TClient["watchList"][
5656
}
5757

5858
function logEmbed(player: PlayerUsed, joinLog: boolean) {
59-
let description = `\`${player.name}\`${getDecorators(player)} ${joinLog ? "joined" : "left"} **${serverAcroUp}** at <t:${now}:t>`;
59+
const playerTimesData = client.playerTimes22.cache.find(x => x._id === player.name);
60+
const playerDiscordMention = playerTimesData ? userMention(playerTimesData._id) : "";
61+
let description = `\`${player.name}\`${getDecorators(player)}${playerDiscordMention} ${joinLog ? "joined" : "left"} **${serverAcroUp}** at <t:${now}:t>`;
6062
const playTimeHrs = Math.floor(player.uptime / 60);
6163
const playTimeMins = (player.uptime % 60).toString().padStart(2, "0");
6264
const embed = new EmbedBuilder()

src/actions/fs25Loop.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ export async function fs25Loop(client: TClient, watchList: TClient["watchList"][
252252

253253
for (const player of leftPlayers) {
254254
const watchListData = watchList.find(x => x._id === player.name);
255+
const playerTimesData = client.playerTimes25.cache.find(x => x._id === player.name);
256+
const playerDiscordMention = playerTimesData ? userMention(playerTimesData._id) : "";
255257
const embed = new EmbedBuilder()
256-
.setDescription(`\`${player.name}\`${getDecorators(player)} left **${serverAcroUp}** at ${timestamp}`)
258+
.setDescription(`\`${player.name}\`${getDecorators(player)}${playerDiscordMention} left **${serverAcroUp}** at ${timestamp}`)
257259
.setColor(client.config.EMBED_COLOR_RED)
258260
.setFooter(player.uptime ? { text: `Playtime: ${formatUptime(player)}` } : null);
259261

@@ -263,6 +265,7 @@ export async function fs25Loop(client: TClient, watchList: TClient["watchList"][
263265
await wlChannel.send({ embeds: [new EmbedBuilder()
264266
.setTitle(`WatchList - ${watchListData.isSevere ? "ban" : "watch over"}`)
265267
.setDescription(`\`${watchListData._id}\` left **${serverAcroUp}** at ${timestamp}`)
268+
.setFooter(player.uptime ? { text: `Playtime: ${formatUptime(player)}` } : null)
266269
.setColor(client.config.EMBED_COLOR_RED)
267270
] });
268271
}
@@ -273,7 +276,9 @@ export async function fs25Loop(client: TClient, watchList: TClient["watchList"][
273276
for (const player of joinedPlayers) {
274277
const watchListData = watchList.find(y => y._id === player.name);
275278
const embed = new EmbedBuilder().setColor(client.config.EMBED_COLOR_GREEN);
276-
let description = `\`${player.name}\`${getDecorators(player)} joined **${serverAcroUp}** at ${timestamp}`;
279+
const playerTimesData = client.playerTimes25.cache.find(x => x._id === player.name);
280+
const playerDiscordMention = playerTimesData ? " " + userMention(playerTimesData._id) : "";
281+
let description = `\`${player.name}\`${getDecorators(player)}${playerDiscordMention} joined **${serverAcroUp}** at ${timestamp}`;
277282

278283
if (player.uptime) embed.setFooter({ text: `Playtime: ${formatUptime(player)}` });
279284

0 commit comments

Comments
 (0)