Skip to content

Instantly share code, notes, and snippets.

@tumugin
Created July 2, 2014 12:06
Show Gist options
  • Save tumugin/cf04f72b32269a9b2946 to your computer and use it in GitHub Desktop.
Save tumugin/cf04f72b32269a9b2946 to your computer and use it in GitHub Desktop.
mikutterで改名するためのプラグイン
# -*- 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
@tumugin
Copy link
Author

tumugin commented Jul 2, 2014

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