Last active
August 29, 2015 14:16
-
-
Save suna-pan/5ecbd18ae4d444ff87f6 to your computer and use it in GitHub Desktop.
mikutterオタク構文警告プラグイン
This file contains 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 '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