add new player tracking logging and add discord link to the footer
This commit is contained in:
parent
ed21d3d780
commit
7f42a27d8f
@ -7,7 +7,8 @@ metadata:
|
|||||||
namespace: public-services
|
namespace: public-services
|
||||||
spec:
|
spec:
|
||||||
encryptedData:
|
encryptedData:
|
||||||
MONGO_URI: AgCUTvItz+Z7ZwWJZuNmdYtNmXPLjxf+48wydwwewJ7AZshoVQSfTNTU+Cu09p6NC9EXCOwsPYQuAqor81puHh/LbYDhdFaGDXWXGg6R6ELPQkU4hDTvIiNyTdeNhn5tFNMdsqwkrsdxjrfMsH+wSHcxJpH1dTmhkEytdhElQmTVJxITtvQlxljR2i9vV87TqYp2ebaBqcj3bGX/pfGLqImOPFJMw8TZ8N1jOxEtLOS9RJJL2YnJP4WH4OQhC+FIb1gQ8N7SI2CMj5Mqt8sdxrGnPBznUGJDEED2Vv7uqRTt/4Kysfv9DN1FpyifiWjGx61tLjS9WfsBoF12JiUFEcpBhBsWHhPjBeyWd6N9LWflDCB47eTLQt/HbarRnjtFpD04jrhv7XXF8YzOtjQDhVqhRDUdybt7LjN4VGw8P4mXf7JinwV4G49orsb561yas5xSTtZgL0t0uI0OTH+AYsiyB8Q9jWlJmdKTCM0gFU19uV+fPKC6UWN9gHXX9p5KK7ZX10I2UnH3knqa/OCGFj96C6RGN4cQlErnhjCrmlyfdcFiET6vgIaYnCbv1IxwpzlooqtWfmXqpmFfshfPWPdGuEqGOBaPmFYNwXaXVKsigv8gKIbWTl+ZhEnAN51wDYVRGT36fh8KM98I1ZcaRJKYJcz8I7+MnmEUDG97boWDe0wi6dY+INnQErsxcJ9W37d3BmEB0o0PS0yKA4lJXXWByS6T8AUpUidHCgufglQIuDXo1nBqVPoSOQg0OAq/kn4zUvfbw2+l0aZKrm0UILd5ZwAuAciJ/x7XtvcGfrYEJUpN/1DC5qL4J8s=
|
MONGO_URI: AgBZ4poRziaXwQLAspWQkgxQIKTYVq2w1fPBSbOBugso2kk5S6UpYo2MXD4F/ERDZM82p41yoNbwA5D8qPk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eoc2itKoBMzA66w3CQPU8nAS5qBln51OASqCsvX6/Ipd0bFZyBrU7j8jPN1gpaWOIwMEhKT2t5nmLyzXN1aaYv8vl9hY6NpFN6T2QOBFsJ849KyoXdN6wfmCV5rPL9blSLSAuS0sy4LOvR5COgsZyCwUycRb8ZLq/gg+r97ySPYliQnuVbMcoce78+YyZGZn3+5T3tRQQ/E7qx7ZEgALKXGwL97LDuTXmuV8BNT0fwnqWqR5n0ZQvjo7FuxQAC4XufBAAdsxb429qflDfpZf5PYOoDUnTdmx2g7enmBb/WDa3Vxz4LTxollRf31HtkH9d02EVP0JQZ7u3fQkeEm3RKffeyNoIy/1K3+PdaVGre8PEuPRTF0RnLYQjyVka4sbJJwX1MvR/6uQX4iKF50dWfohcnt8z44chQKQQhQbzK6tVUIbfhN3XT4b1SWbbMxVXTxxtXjVVnE85yQ7XEo9f1RHbDi3WL2MMnFBnYxwjdHWcZhiHhppIVa+lsGCoO2i+HN4BEfwWP9oecgdLhSZ4OLC9Ps+z9QzF9jDEQuMML5Hpj7zZ
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
@ -13,8 +13,9 @@
|
|||||||
"@elysiajs/swagger": "^1.1.3",
|
"@elysiajs/swagger": "^1.1.3",
|
||||||
"@ssr/common": "workspace:common",
|
"@ssr/common": "workspace:common",
|
||||||
"@tqman/nice-logger": "^1.0.1",
|
"@tqman/nice-logger": "^1.0.1",
|
||||||
"@vercel/og": "^0.6.3",
|
|
||||||
"@typegoose/typegoose": "^12.8.0",
|
"@typegoose/typegoose": "^12.8.0",
|
||||||
|
"@vercel/og": "^0.6.3",
|
||||||
|
"discord-webhook-node": "^1.1.8",
|
||||||
"elysia": "latest",
|
"elysia": "latest",
|
||||||
"elysia-autoroutes": "^0.5.0",
|
"elysia-autoroutes": "^0.5.0",
|
||||||
"elysia-decorators": "^1.0.2",
|
"elysia-decorators": "^1.0.2",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export const Config = {
|
export const Config = {
|
||||||
mongoUri: process.env.MONGO_URI,
|
mongoUri: process.env.MONGO_URI,
|
||||||
apiUrl: process.env.API_URL || "https://ssr.fascinated.cc/api",
|
apiUrl: process.env.API_URL || "https://ssr.fascinated.cc/api",
|
||||||
|
trackedPlayerWebhook: process.env.TRACKED_PLAYERS_WEBHOOK,
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,10 @@ import { scoresaberService } from "@ssr/common/service/impl/scoresaber";
|
|||||||
import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-saber-player-token";
|
import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-saber-player-token";
|
||||||
import { InternalServerError } from "../error/internal-server-error";
|
import { InternalServerError } from "../error/internal-server-error";
|
||||||
import ScoreSaberPlayerScoreToken from "@ssr/common/types/token/scoresaber/score-saber-player-score-token";
|
import ScoreSaberPlayerScoreToken from "@ssr/common/types/token/scoresaber/score-saber-player-score-token";
|
||||||
|
// @ts-ignore
|
||||||
|
import { MessageBuilder, Webhook } from "discord-webhook-node";
|
||||||
|
import { Config } from "../common/config";
|
||||||
|
import { formatPp } from "@ssr/common/utils/number-utils";
|
||||||
|
|
||||||
export class PlayerService {
|
export class PlayerService {
|
||||||
/**
|
/**
|
||||||
@ -34,6 +38,20 @@ export class PlayerService {
|
|||||||
player = (await PlayerModel.create({ _id: id })) as PlayerDocument;
|
player = (await PlayerModel.create({ _id: id })) as PlayerDocument;
|
||||||
player.trackedSince = new Date();
|
player.trackedSince = new Date();
|
||||||
await this.seedPlayerHistory(player, playerToken);
|
await this.seedPlayerHistory(player, playerToken);
|
||||||
|
|
||||||
|
const hook = new Webhook({
|
||||||
|
url: Config.trackedPlayerWebhook,
|
||||||
|
});
|
||||||
|
hook.setUsername("Player Tracker");
|
||||||
|
const embed = new MessageBuilder();
|
||||||
|
embed.setTitle("New Player Tracked");
|
||||||
|
embed.addField("Username", playerToken.name, true);
|
||||||
|
embed.addField("ID", playerToken.id, true);
|
||||||
|
embed.addField("PP", formatPp(playerToken.pp) + "pp", true);
|
||||||
|
embed.setDescription(`https://ssr.fascinated.cc/player/${playerToken.id}`);
|
||||||
|
embed.setThumbnail(playerToken.profilePicture);
|
||||||
|
embed.setColor("#00ff00");
|
||||||
|
await hook.send(embed);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message = `Failed to create player document for "${id}"`;
|
const message = `Failed to create player document for "${id}"`;
|
||||||
console.log(message, err);
|
console.log(message, err);
|
||||||
|
@ -22,6 +22,11 @@ const items: NavbarItem[] = [
|
|||||||
link: "https://x.com/ssr_reloaded",
|
link: "https://x.com/ssr_reloaded",
|
||||||
openInNewTab: true,
|
openInNewTab: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Discord",
|
||||||
|
link: "https://discord.gg/kmNfWGA4A8",
|
||||||
|
openInNewTab: true,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function Footer() {
|
export default function Footer() {
|
||||||
|
Reference in New Issue
Block a user