#-*- coding: utf-8 -*-
@@elements = ["ビ","ビ","ド","レ","ド","オ","ペ","レ","ショ"]
def bbop()
indice = []
matches = 0
for i in [*0..8] do
indice[i] = [*0..8].sample()
if @@elements[i]==@@elements[indice[i]]
matches += 1
end
end
score = matches / 9.0 * 100
result = ""
result << @@elements[indice[0]]
result << @@elements[indice[1]]
result << "ッ"
result << @@elements[indice[2]]
result << @@elements[indice[3]]
result << "ッ"
result << @@elements[indice[4]]
result << "・"
result << @@elements[indice[5]]
result << @@elements[indice[6]]
result << @@elements[indice[7]]
result << "ー"
result << @@elements[indice[8]]
result << "ン"
result << " (#{sprintf("%.1f",score)}\%)"
return result
end
Plugin.create :bbop do
on_appear do |ms|
ms.each do |m|
if Time.now - m[:created] > 5
next
end
if m.message.to_s =~ /^@#{Service.primary.user.to_s} bbop/
m.favorite
Service.primary.post :message => "@#{m.user.to_s} #{bbop}", :replyto => m.message
end
end
end
end