repost/plugins/commands/jan.rb

22 lines
713 B
Ruby

Client.register_command("jan") { |args|
if not args[0].nil? then
if args[0].force_encoding("UTF-8") =~ /ł$/ then
predicate = args[0]
object = File.readlines(Config[:commands][:jan][:object]).sample.strip
else
predicate = File.readlines(Config[:commands][:jan][:predicates]).sample.strip
object = args[0]
end
else
object = File.readlines(Config[:commands][:jan][:object]).sample.strip
predicate = File.readlines(Config[:commands][:jan][:predicates]).sample.strip
end
[
Config[:commands][:jan][:subject],
predicate,
Config[:commands][:jan][:attribute],
object
].join " "
}