X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgames%2Fazgame.rb;fp=data%2Frbot%2Fplugins%2Fgames%2Fazgame.rb;h=1df3c7b4bc49e8d685cbdced0a0948e41eca3ba0;hb=64f0543749cfa675dcb519313430905810d22c04;hp=2d524305f8214559b19855de04b703149a86d142;hpb=72f8838ffb1b752ebfb52e9c9907fb29d6780638;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/games/azgame.rb b/data/rbot/plugins/games/azgame.rb index 2d524305..1df3c7b4 100644 --- a/data/rbot/plugins/games/azgame.rb +++ b/data/rbot/plugins/games/azgame.rb @@ -127,10 +127,12 @@ class AzGamePlugin < Plugin :listener => /^[a-z]+$/ }, } + + @wordlist_base = "#{@bot.botclass}/azgame/wordlist-" end def initialize_wordlist(lang) - wordlist = "#{@bot.botclass}/azgame/wordlist-#{lang}" + wordlist = @wordlist_base + lang if File.exist?(wordlist) words = File.readlines(wordlist).map {|line| line.strip}.uniq if(words.length >= 4) # something to guess @@ -564,7 +566,15 @@ class AzGamePlugin < Plugin when 'play' return _("az => start a game if none is running, show the current word range otherwise; you can say 'az ' if you want to play in a language different from the current bot default") end - return _("az topics: play, rules, cancel, manage, check") + offset = @wordlist_base.length + langs = @rules.keys + wls = Dir.glob(@wordlist_base + "*").map { |f| f[offset,f.length].intern rescue nil }.compact - langs + return [ + _("az topics: play, rules, cancel, manage, check"), + _("available languages: %{langs}") % { :langs => langs.join(", ") }, + wls.empty? ? nil : _("available wordlists: %{wls}") % { :wls => wls.join(", ") }, + ].compact.join(". ") + end end