Skip to content

Instantly share code, notes, and snippets.

@syusui-s
Last active December 17, 2015 23:29
Show Gist options
  • Select an option

  • Save syusui-s/5689228 to your computer and use it in GitHub Desktop.

Select an option

Save syusui-s/5689228 to your computer and use it in GitHub Desktop.
連呼ちゃん。mikutterプラグインです。TLから拾った「らこらこらこ〜w」などの連呼を抽出して、それっぽい連呼を生成して、確率的につぶやきます。
#-*- 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