Created
March 8, 2012 09:38
-
-
Save mono0x/1999962 to your computer and use it in GitHub Desktop.
Niconama Alert
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
| # -*- coding: utf-8 -*- | |
| require 'nicoalert' | |
| require 'ruby_gntp' | |
| #require_relative 'webbrowser' | |
| MAIL = '' | |
| PASSWORD = '' | |
| growl = GNTP.new('Nicoalert') | |
| growl.register notifications: [ | |
| { name: 'Live Started', }, | |
| ] | |
| alert = Nicoalert::Client.new(MAIL, PASSWORD) | |
| alert.connect do |live| | |
| next unless alert.communities.include?(live.community.id) | |
| growl.notify({ | |
| name: 'Live Started', | |
| title: "#{live.title}", | |
| text: "#{live.description}\n\n#{live.community.name}", | |
| icon: "#{live.community.thumbnail}", | |
| }) do |context| | |
| case context[:callback_result] | |
| when 'CLICK' | |
| p 'CLICKED', live | |
| #WebBrowser.open live.uri | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment