我正在使用Turntabler,这是一个用于与 turntable.fm 交互的 Ruby gem。我创建了这个简单的“Hello World”程序:
require 'turntabler'
require_relative 'config.rb'
config = KevbotConfiguration.load_config # Reads a YAML file
Turntabler.run(config[:email], config[:password], :room => config[:room], :reconnect => true, :reconnect_wait => 30) do
on :user_spoke do |message|
# Respond to "/hello" command
if (message.content =~ /^\/hello$/)
room.say("Hey! How are you @#{message.sender.name}?")
end
end
end
当我运行这个程序时,它失败并显示以下消息:
$ ruby src/main.rb
D, [2013-11-09T15:57:17.602019 #10407] DEBUG -- : Connection failed: Connection is not open
D, [2013-11-09T15:57:47.634282 #10407] DEBUG -- : Attempting to reconnect
D, [2013-11-09T15:57:47.719336 #10407] DEBUG -- : Connection failed: Connection is not open
D, [2013-11-09T15:58:17.744107 #10407] DEBUG -- : Attempting to reconnect
D, [2013-11-09T15:58:17.828378 #10407] DEBUG -- : Connection failed: Connection is not open
D, [2013-11-09T15:58:47.854309 #10407] DEBUG -- : Attempting to reconnect
# etc.
我能做些什么来解决这个问题?
编辑:这是以下内容config.rb
:
module KevbotConfiguration
require 'yaml'
def self.load_config
return YAML.load_file('config.yaml')
end
end