Wiederhergestellt

This commit is contained in:
Simon Szustkowski 2013-04-22 13:39:22 +02:00
parent 6e876e28de
commit 471c70cec1
1 changed files with 8 additions and 4 deletions

12
bot.rb
View File

@ -33,16 +33,20 @@ $current_status = res.body.to_s.strip
# If status differs from last time checked, put the announcement # If status differs from last time checked, put the announcement
if (last_status != $current_status) if (last_status != $current_status)
if ($current_status == "offline") if ($current_status == "offline")
tweet = "Der Raum ist jetzt geschlossen." tweet = "Der Raum ist jetzt GESCHLOSSEN. #ctdo"
status = "offline" status = "offline"
elsif ($current_status == "online") elsif ($current_status == "online")
tweet = "Der Raum ist jetzt offen." tweet = "Der Raum ist jetzt OFFEN. #ctdo."
status = "online" status = "online"
else else
tweet = "Raumstatus unbekannt." tweet = "Raumstatus UNBEKANNT."
status = "unknown" status = "unknown"
end end
client.update(tweet)
$config['worker']['last_status'] = status $config['worker']['last_status'] = status
File.open(CONFIG_FILE, 'w') { |f| YAML.dump($config, f) } File.open(CONFIG_FILE, 'w') { |f| YAML.dump($config, f) }
begin
client.update(tweet, {:lat => "51.527611", :lon => "7.464944", :display_coordinates => "true"})
rescue
# Nothing to do here
end
end end