diff options
Diffstat (limited to 'data/rbot/plugins/games')
-rw-r--r-- | data/rbot/plugins/games/azgame.rb | 2 | ||||
-rw-r--r-- | data/rbot/plugins/games/quiz.rb | 11 | ||||
-rw-r--r-- | data/rbot/plugins/games/shiritori.rb | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/data/rbot/plugins/games/azgame.rb b/data/rbot/plugins/games/azgame.rb index cb95228d..6e2526e2 100644 --- a/data/rbot/plugins/games/azgame.rb +++ b/data/rbot/plugins/games/azgame.rb @@ -150,7 +150,7 @@ class AzGamePlugin < Plugin }, } - @autoadd_base = "#{@bot.botclass}/azgame/autoadd-" + @autoadd_base = datafile "autoadd-" end def initialize_wordlist(params) diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index 7577e7ce..9159a4c4 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -186,8 +186,9 @@ class QuizPlugin < Plugin def fetch_data( m ) # Read the winning messages file @win_messages = Array.new - if File.exists? "#{@bot.botclass}/quiz/win_messages" - IO.foreach("#{@bot.botclass}/quiz/win_messages") { |line| @win_messages << line.chomp } + winfile = datafile 'win_messages' + if File.exists? winfile + IO.foreach(winfile) { |line| @win_messages << line.chomp } else warning( "win_messages file not found!" ) # Fill the array with a least one message or code accessing it would fail @@ -212,13 +213,13 @@ class QuizPlugin < Plugin m.reply "Failed to download questions from #{p}, ignoring sources" end else - path = "#{@bot.botclass}/quiz/#{p}" + path = datafile p debug "Fetching from #{path}" # Local data begin - datafile = File.new( path, File::RDONLY ) - data << "\n\n" << datafile.read + file = File.new( path, File::RDONLY ) + data << "\n\n" << file.read rescue m.reply "Failed to read from local database file #{p}, skipping." end diff --git a/data/rbot/plugins/games/shiritori.rb b/data/rbot/plugins/games/shiritori.rb index 84ee9620..0b77871e 100644 --- a/data/rbot/plugins/games/shiritori.rb +++ b/data/rbot/plugins/games/shiritori.rb @@ -390,7 +390,7 @@ class ShiritoriPlugin < Plugin if ruleset.has_key?(:wordlist_file) begin ruleset[:words] = - File.new("#{@bot.botclass}/shiritori/#{ruleset[:wordlist_file]}").grep( + File.new(datafile ruleset[:wordlist_file]).grep( ruleset[:listen]) {|l| ruleset[:normalize].call l.chomp} rescue raise "unable to load word list" |