Skip to content

Commit

Permalink
User hash upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
onewheelskyward committed Sep 11, 2020
1 parent 6249908 commit 78b25f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions lib/lita/handlers/irc_handlers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -358,19 +358,24 @@ def handle_ansi_aqi(response)
show = response.matches[0][0]
else
Lita.logger.debug response.user.name
if response.user.name == 'lampd1'
show = '38447'
elsif response.user.name == 'aaronpk' or response.user.name == 'zenlinux'
show = '43023'
elsif response.user.name == 'djwong'
show = '61137'
elsif response.user.name == 'philtor'
show = '35221'
else
users = {lampd1: 38447,
aaronpk: 43023,
zenlinux: 43023,
djwong: 61137,
philtor: 35221,
agb: 34409}
users.keys.each do |u|
if u.to_s == response.user.name
show = users[u]
end
end

unless show
Lita.logger.debug "Defaulting to pdx"
show = "9814"
end
end

resp = RestClient.get "https://www.purpleair.com/json?show=#{show}"
aqi = JSON.parse resp
label = aqi['results'][0]['Label']
Expand Down
2 changes: 1 addition & 1 deletion spec/lita/handlers/forecast_io_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def mock_up(filename)
it 'aqis' do
mock_up 'aqi'
send_command 'ansiaqi'
expect(replies.last).to eq("AQI report for Portland, OR: PM2.5 \u00030875.1\u0003 |\u000308_\u000304▅\u000305████\u0003| \u000305322.93\u0003 max: \u000305322.93\u0003 \u000314(7 day average to 10 min average)\u0003")
expect(replies.last).to eq("AQI report for PSU STAR LAB SEL: PM2.5 \u00030875.1\u0003 |\u000308_\u000304▅\u000305████\u0003| \u000305322.93\u0003 max: \u000305322.93\u0003 \u000314(7 day average to 10 min average)\u0003")
end

end

0 comments on commit 78b25f0

Please sign in to comment.