Created
July 2, 2014 12:06
-
-
Save tumugin/cf04f72b32269a9b2946 to your computer and use it in GitHub Desktop.
mikutterで改名するためのプラグイン
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
# -*- coding: utf-8 -*- | |
#設定 | |
Plugin.create :kaimei do | |
on_mention do |s,ms| | |
ms.each do |m| | |
if Time.now - m.message[:created] < 5 then | |
if m.message.to_s =~ /[((][@@]#{Service.primary.user}[))]\Z/ then | |
if m.from_me? or (UserConfig[:kaimei_enable] and (UserConfig[:kaimei_require_approve] or ::Gtk::Dialog.confirm("この改名リクエストを受理しますか?\n\n#{m.message.to_s}"))) then | |
rename = m.message.to_s.gsub(/[((][@@]#{Service.primary.user}[))]\Z/,"") | |
(Service.primary.twitter/'account/update_profile').json(:name => "#{rename}") | |
Service.primary.post(:message => ".@#{m.user.idname}さんによって#{rename}に改名されました", :replyto => m.message) | |
end | |
end | |
end | |
end | |
end | |
settings("改名プラグイン") do | |
boolean("改名には承認を必要としない",:kaimei_require_approve) | |
boolean("改名機能をONにする",:kaimei_enable) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考: https://gist.github.com/rinx/7100657