Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ShootingStarからのつぶやきをふぁぼるmikutterプラグイン
Plugin.create :fav2sts do
on_boot do
if not UserConfig[:fav2sts_ignore]
UserConfig[:fav2sts_ignore] = []
end
end
on_appear do |ms|
ms.each do |m|
if m.message[:source] =~ /ShootingStar/ and
not UserConfig[:fav2sts_ignore].index(m.message.user.to_s)
m.message.favorite(true)
end
end
end
on_mention do |s, ms|
ms.each do |m|
if Time.now - m.message[:created] < 5
if m.message.to_s =~ /ignore me/ and
not UserConfig[:fav2sts_ignore].index(m.message.user.to_s)
tmp = UserConfig[:fav2sts_ignore].dup
tmp.push(m.message.user.to_s)
UserConfig[:fav2sts_ignore] = tmp
createSystemMessage("add user @#{m.message.user.to_s} to ignore list")
elsif m.message.to_s =~ /ignore cancel/ and
UserConfig[:fav2sts_ignore].index(m.message.user.to_s)
tmp = UserConfig[:fav2sts_ignore].dup
tmp.delete(m.message.user.to_s)
UserConfig[:fav2sts_ignore] = tmp
createSystemMessage("remove user @#{m.message.user.to_s} from ignore list")
end
end
end
end
def self.createSystemMessage(message)
Plugin.call(:update, nil, [Message.new(:message => "#{message}", :system => true)])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.