Skip to content

Instantly share code, notes, and snippets.

@penguin2716
Created December 8, 2013 04:55
Show Gist options
  • Save penguin2716/7853486 to your computer and use it in GitHub Desktop.
Save penguin2716/7853486 to your computer and use it in GitHub Desktop.
適当なキーバインドのときにフッタをつけてつぶやくためのmikutterプラグイン(設定画面からフッタ文字列を追加してね)
#-*- coding: utf-8 -*-
Plugin.create :post_with_footer do
UserConfig[:post_with_footer_footer] ||= ""
command(:post_with_footer,
name: 'フッタをつけてツイート',
condition: lambda{ |opt| Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text.size > 0 },
visible: true,
role: :postbox) do |opt|
begin
post_text = Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text + UserConfig[:post_with_footer_footer]
Plugin.call(:before_postbox_post, post_text)
Service.primary.post :message => post_text
Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text = ""
rescue Exception => e
Plugin.call(:update, nil, [Message.new(:message => e.to_s, :system => true)])
e.backtrace
end
end
settings "フッタをつけてツイート" do
input("追加するフッタ",:post_with_footer_footer)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment