diff options
| author | sD <stoned@derpymail.org> | 2020-02-26 00:51:07 +0100 |
|---|---|---|
| committer | sD <stoned@derpymail.org> | 2020-02-26 00:51:07 +0100 |
| commit | 767b09f6e459d8ec18ee7791e82a8ea02d5dcf7f (patch) | |
| tree | 0b30a8aba5fc90bbfc2dee1a86c773178c904f15 /webAO/client.js | |
| parent | 18f5544d270ed66b1da6ba89191ff68ee3f5ff6e (diff) | |
handle missing inis/no emotes
and don't spam the log over it
Diffstat (limited to 'webAO/client.js')
| -rw-r--r-- | webAO/client.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/webAO/client.js b/webAO/client.js index 4081c17..f49e336 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -636,6 +636,12 @@ class Client extends EventEmitter { }; cini.options = Object.assign(default_options, cini.options); + // sometimes ini files lack important settings + const default_emotions = { + number: 0 + }; + cini.emotions = Object.assign(default_emotions, cini.emotions); + this.chars[charid] = { name: safe_tags(chargs[0]), showname: safe_tags(cini.options.showname), @@ -1104,6 +1110,13 @@ class Client extends EventEmitter { const ini = me.inifile; me.side = ini.options.side; updateActionCommands(me.side); + if(ini.emotions.number === 0) { + emotesList.innerHTML = + `<span + id="emo_0" + alt="unavailable" + class="emote_button">No emotes available</span>`; + }else{ for (let i = 1; i <= ini.emotions.number; i++) { try { const emoteinfo = ini.emotions[i].split("#"); @@ -1139,6 +1152,7 @@ class Client extends EventEmitter { } } pickEmotion(1); + } } } |
