-
-
Save kaeff/1200551 to your computer and use it in GitHub Desktop.
Food script for campfire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'tinder' | |
require 'uri' | |
class Food | |
def initialize(place=nil) | |
@place = place | |
end | |
def prefix | |
'FOOD: ' | |
end | |
def out | |
prefix + "I've got my own here. I'm out." | |
end | |
def now(suggested_time='12:00') | |
prefix + "I'm very hungry. Let's go to #{place} at #{suggested_time}" | |
end | |
def later(suggested_time='12:55') | |
prefix + "I've just ate a late breakfast. Let's go to #{place} at #{suggested_time}" | |
end | |
def place | |
@place || random_place | |
end | |
def random_place | |
%w{Lumina Pasta-e-basta Pierhouse Stadtwerke Aaseemensa Kingdöner}.tap{|choices| return choices[rand(choices.size)]} | |
end | |
end | |
class FireChat | |
CONFIG = { | |
:room => '[zweitag.de] Lounge', | |
:sub_domain => 'zweitag', | |
:user => '', | |
:password => '', | |
:token => 'INSERT_YOUR_TOKEN_HERE_TO_MAKE_IT_WORK' | |
} | |
def room | |
@room ||= campfire.find_room_by_name CONFIG[:room] | |
end | |
def post(msg) | |
puts "Posting messsage \"#{msg}\" to #{room.name}" | |
room.speak msg | |
end | |
def campfire | |
@campfire ||= Tinder::Campfire.new(CONFIG[:sub_domain], :token => CONFIG[:token]) | |
end | |
end | |
def food(place=nil) | |
Food.new(place) | |
end | |
def post(msg) | |
FireChat.new.post msg | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment