summaryrefslogtreecommitdiffstats
path: root/plugins/commands/jan.rb
blob: fd0e9733b24a3ce95d7701d1477c32ecca98d0a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Client.register_command("jan") { |args|
    if not args[0].nil? then
        if args[0].force_encoding("UTF-8") =~ /ał$/ 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 " "
}