X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frbot%2Fcore%2Fjournal.rb;h=c4f5f0f453a01fa7cf97c32bcbbef641aed71643;hb=a2eeb15faadf94c879d749e211d160cb86b659c6;hp=f8a886202a2167e1fa39baaf1eff695e6b848411;hpb=85bfb8405528b2da203291b5671f9077d5b62742;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/core/journal.rb b/lib/rbot/core/journal.rb index f8a88620..c4f5f0f4 100644 --- a/lib/rbot/core/journal.rb +++ b/lib/rbot/core/journal.rb @@ -7,6 +7,17 @@ require 'rbot/journal' +module ::Irc +class Bot + # this should return the journal if the managing plugin has been loaded. + def journal + if @plugins['journal'] + @plugins['journal'].broker + end + end +end +end + class JournalModule < CoreBotModule attr_reader :broker @@ -28,7 +39,13 @@ class JournalModule < CoreBotModule name = @bot.config['journal.storage'] uri = @bot.config['journal.storage.uri'] if name - storage = Storage.create(name, uri) + begin + storage = Storage.create(name, uri) + rescue + error 'journal storage initialization error!' + error $! + error $@.join("\n") + end end debug 'journal broker starting up...' @broker = JournalBroker.new(storage: storage)