Skip to content

Commit a07ab1f

Browse files
author
Slingexe
authored
The bot shouldn't break instantly now if the bot looses access to the internet
1 parent c477e83 commit a07ab1f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

backend/fetchNewMessages.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,15 @@ async function fetchNewMessages(client) {
177177

178178
const pullusers = await loadConfigVar("pullusers");
179179
const mudtoken = await loadConfigVar("mudtoken");
180-
const apiUrl = 'https://www.hackmud.com/mobile/chats.json';
180+
let apiUrl;
181+
try {
182+
apiUrl = 'https://www.hackmud.com/mobile/chats.json';
183+
} catch (error) {
184+
console.log("There was an error trying to connect to the API.");
185+
console.log(error);
186+
return;
187+
}
188+
181189
const payload = {
182190
chat_token: mudtoken,
183191
usernames: pullusers,

0 commit comments

Comments
 (0)