repost/plugins/commands/jan.rb

22 lines
713 B
Ruby
Raw Permalink Normal View History

2014-04-28 11:07:24 +00:00
Client.register_command("jan") { |args|
2014-04-28 11:05:32 +00:00
if not args[0].nil? then
2014-04-28 13:00:14 +00:00
if args[0].force_encoding("UTF-8") =~ /ł$/ then
2014-04-28 11:05:32 +00:00
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
2014-04-28 07:00:14 +00:00
[
2014-04-28 07:07:56 +00:00
Config[:commands][:jan][:subject],
2014-04-28 11:05:32 +00:00
predicate,
2014-04-28 07:07:56 +00:00
Config[:commands][:jan][:attribute],
2014-04-28 11:05:32 +00:00
object
2014-04-28 07:00:14 +00:00
].join " "
}