Last active
December 17, 2015 23:29
-
-
Save syusui-s/5689228 to your computer and use it in GitHub Desktop.
連呼ちゃん。mikutterプラグインです。TLから拾った「らこらこらこ〜w」などの連呼を抽出して、それっぽい連呼を生成して、確率的につぶやきます。
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
| #-*- encoding: utf-8 -*- | |
| Plugin.create(:renko_chan) do | |
| def find_repeat(str) | |
| t=String.new() | |
| for i in 1..(str.size) | |
| if str.index(t+str[i-1],i) then | |
| t+=str[i-1] | |
| end | |
| end | |
| (str.include? t*2) ? t : nil | |
| end | |
| on_update do |service, msgs| | |
| msgs.map!{|m| | |
| t=find_repeat(m.to_s) | |
| (not t.nil? and t.size>1 and not m.from_me?) ? t : nil | |
| } | |
| msgs = [] if msgs.delete(nil).nil? | |
| msgs.each{|m| | |
| Service.primary.post(:message => m*(rand*10).to_i + " #連呼ちゃん") if (rand*100).to_i % 15 == 0 | |
| puts "\e[31;1m #{m} \e[0m""]]" | |
| } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment