add timeout for axios response

This commit is contained in:
The Foxon 2023-04-26 20:19:36 +12:00
parent b5bdc33f28
commit d1c9687d17

View File

@ -14,7 +14,9 @@ client.on('ready', () => {
async function updateServerData() { async function updateServerData() {
try { try {
const { data } = await axios.get<any>(`${process.env.ECO_API_BASE || "https://eco.kamgames.xyz"}/info`); const { data } = await axios.get<any>(`${process.env.ECO_API_BASE || "https://eco.kamgames.xyz"}/info`, {
timeout: 6000,
});
client.user?.setActivity({ client.user?.setActivity({
name: `${data.OnlinePlayers}/${data.TotalPlayers}`, name: `${data.OnlinePlayers}/${data.TotalPlayers}`,
type: ActivityType.Playing type: ActivityType.Playing