Skip to content

Instantly share code, notes, and snippets.

@shunirr
Created May 20, 2011 08:30
Show Gist options
  • Save shunirr/982556 to your computer and use it in GitHub Desktop.
Save shunirr/982556 to your computer and use it in GitHub Desktop.
datas = API からデータを拾ってくる()
datas.each do |data|
status_object_id = data.id
unless DB.duplication?(status_object_id)
DB.insert("objects_table", :object_id => status_object_id, :data => data)
DB.insert("relations", :parent_id => "me" :object_id =>status_object_id)
ステータスを表示する
end
comments = data.comments
comments.each do |comment|
comment_object_id = comment.id
unless DB.duplication?(comment_object_id)
DB.insert("objects_table", :object_id => comment_object_id, :data => data)
DB.insert("relations", :parent_id =>status_object_id, :object_id => comment_object_id)
コメントを表示する
end
end
end
これで良いと思った?でも残念、さやかちゃんでした!!
@shunirr
Copy link
Author

shunirr commented May 20, 2011

def process_reply(channel, tid, message)
  object_id = @typablemap[tid]
  data = DB.get_data("object_table", :object_id => object_id)
  parent_id = DB.get_parent_id("relations", :object_id => object_id)
  if parent_id != me
    @client.status(parent_id).comments(:create, :message=>message)
  else
     @client.status(object_id).comments(:create, :message=>message)
  end
end 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment