Skip to content

Instantly share code, notes, and snippets.

@katsyoshi
Forked from tomykaira/aegitter.rb
Created March 10, 2012 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katsyoshi/2010169 to your computer and use it in GitHub Desktop.
Save katsyoshi/2010169 to your computer and use it in GitHub Desktop.
mikutter plugin, 日本語のみ対応。右クリックからあえがせることができます。セクハラ注意
# -*- coding: utf-8 -*-
# mikutter plugin, 日本語のみ対応。右クリックからあえがせることができます。セクハラ注意
# license: MIT
# Author: @tomy_kaira
Plugin::create(:aegu) do
def aegi(str)
split_jp(str).map{ |c|
next c if c.match(/\s+/) || rand(10) < 2
case rand(10)
when 0..2
c + "…"
when 3
c + "……"
when 4
c + "…っ…"
when 5
c + "…っ!…"
when 6
c + "…ぁ…"
when 7
c + "…っぁ…"
when 8
c + "…ぁ!…"
when 9
c + "…ぁあ…"
end
}.join
end
def split_jp(str)
str.scan(/[一-龠]+|[ぁ-ん]+|[ァ-ヴー]+|[a-zA-Z0-9]+|[a-zA-Z0-9]+|[^一-龠ぁ-んa-zA-Z0-9a-zA-Z0-9]+/um)
end
filter_command do|menu|
menu[:aegu] = {
:slug => :aegu,
:name => 'あえがせる',
:condition => lambda{ |m| m.message.repliable? },
:exec => lambda{|m|
Service.primary_service.update(:message => "MT @#{m.message.user.idname}: #{aegi(m.message.to_s)}",
:replyto => m.message)},
:visible => true,
:role => :message }
[menu]
end
end
@katsyoshi
Copy link
Author

最新版のmikutterで動くように変えた

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment