add untested attestation feature
This commit is contained in:
parent
9683c4f41c
commit
026f84fef5
1 changed files with 30 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
import { gatewayServer } from "./commonservers.js";
|
||||
import { discordToken, logContextMap, watchedGuildIds } from "./config.js";
|
||||
import DiscordClient from "./DiscordClient.js";
|
||||
import WatchedGuild from "./WatchedGuild.js";
|
||||
|
@ -50,4 +51,33 @@ bot.once("READY", () => {
|
|||
watchedGuild.discordConnect(bot);
|
||||
guildMap.set(id, watchedGuild);
|
||||
});
|
||||
|
||||
bot.on("MESSAGE_CREATE", (message) => {
|
||||
if (message.content === "!:bridge-attest") {
|
||||
let clientsString = "";
|
||||
gatewayServer.wss.clients.forEach((client) => {
|
||||
if (client.state && client.state.authenticated && client.state.user && client.state.user.username) {
|
||||
clientsString += `**${client.state.user.username}** |`;
|
||||
}
|
||||
});
|
||||
|
||||
bot.api(["POST", `/channels/${message.channel_id}/messages`], {
|
||||
embeds: [
|
||||
{
|
||||
title: "Bridge Attestation",
|
||||
fields: [
|
||||
{
|
||||
name: "Connected Clients Count",
|
||||
value: gatewayServer.wss.clients.size
|
||||
},
|
||||
{
|
||||
name: "Connected Clients",
|
||||
value: clientsString === "" ? "[no connected clients]" : clientsString
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue