Skip to content

Instantly share code, notes, and snippets.

@siyo
Created March 12, 2012 15:49
Show Gist options
  • Save siyo/2022891 to your computer and use it in GitHub Desktop.
Save siyo/2022891 to your computer and use it in GitHub Desktop.
顔文字を殺すやつ
# -*- coding: utf-8 -*-
#
# find kaomoji and replace it with dead
Earthquake.init do
output_filter do |item|
next if item.nil? || item["text"].nil?
regexp = /[^\(\342\272\200-\351\276\245ぁ-ヶ…‥!!??]*[\(]+[^\(\)\342\272\200-\351\276\245]+[\);]+[^\(\342\272\200-\351\276\245ぁ-ヶ]*/
dest = ["","爆","即","溺","殴"].shuffle[0] + "死"
item["text"].gsub!(regexp,"(%s)" % [dest])
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment