Skip to content

Instantly share code, notes, and snippets.

@suna-pan
Last active August 29, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suna-pan/5ecbd18ae4d444ff87f6 to your computer and use it in GitHub Desktop.
Save suna-pan/5ecbd18ae4d444ff87f6 to your computer and use it in GitHub Desktop.
mikutterオタク構文警告プラグイン
#-*- coding: utf-8 -*-
require 'gtk2'
module Gtk
class PostBox
class PostToPrimaryService
def post(*args, &proc)
if args[0][:message] =~ /.+(,|,|、).+(感じ|ところ)だ?(。|.|\.)?/
d = Dialog.new
label = Label.new("ちょっとまって!\
\nオタク「ことば」かもしれませんがそれでもつかいますか?\
\n(使うと、後でおうちの人も使ったことがわかります)")
label.show
d.vbox.pack_start(label, true, true, 30)
d.add_buttons(["使わない", 1], ["使う", 0])
d.run do |res|
d.destroy
if res == 0
Service.primary.post(*args, &proc)
elsif res == 1
else
:fail
end
end
else
Service.primary.post(*args, &proc)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment