Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created March 10, 2011 03:14
Show Gist options
  • Save goofmint/863518 to your computer and use it in GitHub Desktop.
Save goofmint/863518 to your computer and use it in GitHub Desktop.
# Bugと言うと、バグリストを返すSkype bot
require 'rubygems'
require 'basecamp'
require 'Skype'
require 'active_support'
project_id = null
Basecamp.establish_connection!('subdomain.basecamphq.com', 'your id', 'your password', true)
Skype.init 'some application name'
Skype.start_messageloop
Skype::ChatMessage.set_notify do |chatmessage, property, value|
if (value == 'RECEIVED' || value == "SENT") && property == :status && chatmessage.get_body == "# Bug"
Basecamp.get_token
ary = Basecamp::TodoList.all(project_id)
total = ary[0].completed_count + ary[0].uncompleted_count
chatmessage.get_chat.send_message "Bug list -> #{ary[0].completed_count}件完了。#{ary[0].uncompleted_count}未終了。全#{total}件、達成率 #{(ary[0].completed_count.to_f/total.to_f*100.to_f).round(1)}%"
end
end
Skype.attach_wait
sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment