mirror of
https://github.com/cloudmaker97/FS25-Discord-Bot.git
synced 2025-12-06 08:28:33 +00:00
Receiving of mods may fail, so return then an empty array as fallback
This commit is contained in:
parent
bdb80dbc4e
commit
c672838f1d
1 changed files with 6 additions and 2 deletions
|
|
@ -119,9 +119,13 @@ export default class ServerStatusFeed {
|
||||||
return dayTime / (60 * 60 * 1000) + 0.0001;
|
return dayTime / (60 * 60 * 1000) + 0.0001;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the server mods from the server stats feed
|
||||||
|
* @returns {IMod[]} The server mods as an array of IMod objects
|
||||||
|
*/
|
||||||
public getServerMods(): IMod[] {
|
public getServerMods(): IMod[] {
|
||||||
let modList = this.getServerStats()?.Server.Mods.Mod;
|
let modList = this.getServerStats()?.Server?.Mods?.Mod;
|
||||||
if(modList === undefined || !Array.isArray(modList)) {
|
if(modList === undefined || !Array.isArray(modList) || modList == null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return modList.map((mod: any) => {
|
return modList.map((mod: any) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue