import dotenv from 'dotenv'; import { ActivityType, Client, GatewayIntentBits } from 'discord.js' import { queryGameServerInfo } from 'steam-server-query'; import axios from 'axios'; dotenv.config() const client = new Client({ intents: [GatewayIntentBits.Guilds] }); client.on('ready', () => { console.log(`Logged in as ${client.user?.tag}!`); updateServerData(); setInterval(updateServerData, 10000) }); async function updateServerData() { try { const { data } = await axios.get(`${process.env.ECO_API_BASE || "https://eco.kamgames.xyz"}/info`); client.user?.setActivity({ name: `${data.OnlinePlayers}/${data.TotalPlayers}`, type: ActivityType.Playing }) } catch (e) { client.user?.setActivity({ name: `Сервер офлайн`, type: ActivityType.Playing }) } } client.login(process.env.DISCORD_TOKEN);