Skip to content

Instantly share code, notes, and snippets.

@mono0x
Created March 8, 2012 09:38
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mono0x/1999962 to your computer and use it in GitHub Desktop.
Niconama Alert
# -*- 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