Skip to content

Commit

Permalink
🩹 add "No data" response to droprecent
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Oct 8, 2021
1 parent c66d692 commit 2572cdf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drop-game/static/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,13 @@ export default class Game extends Phaser.Scene {

onDropRecent() {
const scores = JSON.parse(localStorage.getItem('recent') || '{}');
const keys = Object.keys(scores);
const output = [];

for (let key of Object.keys(scores))
if (keys.length === 0)
return twitch.say(qs.channel, 'VoteNay No data.');

for (let key of keys)
output.push(`${key} ${scores[key][0]}`)

twitch.say(qs.channel, `CurseLit Recent scores: ${output.join(', ')}`);
Expand All @@ -245,7 +249,7 @@ export default class Game extends Phaser.Scene {
const top = JSON.parse(localStorage.getItem('top') || 'null');

if (top === null)
return twitch.say(qs.channel, 'No data.');
return twitch.say(qs.channel, 'VoteNay No data.');

twitch.say(
qs.channel, `Poooound Highest score in the last 24 hours: ${top[0]} ${top[1]}`);
Expand Down

0 comments on commit 2572cdf

Please sign in to comment.