好的,所以我学习 ruby 并想为 kik https://dev.kik.com创建一个机器人,我只是不明白出了什么问题。
这是代码
require 'HTTParty'
require 'base64'
require 'json'
bot_name = #bot_name
api_key = #api_key
message = Message.new(self)
HTTParty.post('https://api.kik.com/v1/config',
headers: {
'Content-Type' => 'application/json',
'Authorization' => "#{bot_name}:#{api_key}",
},
body: {
"manuallySendReadReceipts" => false,
"receiveReadReceipts" => true,
"receiveDeliveryReceipts" => true,
"receiveIsTyping" => true,
message: [
{
body: message,
to: user_name,
type: 'text',
chatId: chat_id
}
],
debug_output: $stdout
}
)
这是错误:
kikBot.rb:7:in `<main>': uninitialized constant Message (NameError)
大部分代码是通过引用这个gem创建的
有没有办法在本地测试它并让它打印出一些“连接成功”之类的东西。