Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.