X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fdictclient.rb;h=903b3f1ea50299a27b1b6e15d97cf69265fcc3fc;hb=7a128ab6457c9b79ed31a5562be98e1718bfaf80;hp=910583ffd209670c5ede25a61a752ab6eaabc913;hpb=4d25b749c765dd6c2d88f3be961d3249de2c7000;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/dictclient.rb b/data/rbot/plugins/dictclient.rb index 910583ff..903b3f1e 100644 --- a/data/rbot/plugins/dictclient.rb +++ b/data/rbot/plugins/dictclient.rb @@ -52,25 +52,25 @@ class ::Definition end class DictClientPlugin < Plugin - BotConfig.register BotConfigStringValue.new('dictclient.server', + Config.register Config::StringValue.new('dictclient.server', :default => 'dict.org', :desc => _('Hostname or hostname:port of the DICT server used to lookup words')) - BotConfig.register BotConfigIntegerValue.new('dictclient.max_defs_before_collapse', + Config.register Config::IntegerValue.new('dictclient.max_defs_before_collapse', :default => 4, :desc => _('When multiple databases reply a number of definitions that above this limit, only the database names will be listed. Otherwise, the full definitions from each database are replied')) - BotConfig.register BotConfigIntegerValue.new('dictclient.max_length_per_def', + Config.register Config::IntegerValue.new('dictclient.max_length_per_def', :default => 200, :desc => _('Each definition is truncated to this length')) - BotConfig.register BotConfigStringValue.new('dictclient.headword_format', + Config.register Config::StringValue.new('dictclient.headword_format', :default => "#{Bold}#{Bold}", :desc => _('Format of headwords; will be replaced with the actual word')) - BotConfig.register BotConfigStringValue.new('dictclient.database_format', + Config.register Config::StringValue.new('dictclient.database_format', :default => "#{Underline}#{Underline}", :desc => _('Format of database names; will be replaced with the database name')) - BotConfig.register BotConfigStringValue.new('dictclient.definition_format', + Config.register Config::StringValue.new('dictclient.definition_format', :default => ': -', :desc => _('Format of definitions. will be replaced with the formatted headword, will be replaced with the truncated definition, and with the formatted database name')) - BotConfig.register BotConfigStringValue.new('dictclient.match_format', + Config.register Config::StringValue.new('dictclient.match_format', :default => '––', :desc => _('Format of match results. will be replaced with the formatted headwords, with the formatted database name')) @@ -181,7 +181,16 @@ class DictClientPlugin < Plugin end def help(plugin, topic='') - _("define [from ] => Show definition of a phrase; match [using ] [from ] => Show matching phrases; dictclient databases => List databases; dictclient strategies => List strategies") + case topic + when 'define' + _('define [from ] => Show definition of a phrase') + when 'match' + _('match [using ] [from ] => Show phrases matching the given pattern') + when 'server information' + _('dictclient databases => List databases; dictclient strategies => List strategies') + else + _('look up phrases on the configured DICT server. topics: define, match, server information') + end end end @@ -189,12 +198,14 @@ plugin = DictClientPlugin.new plugin.map 'define *phrase [from :database]', :action => 'cmd_define', - :defaults => {:database => DICT::ALL_DATABASES} + :defaults => {:database => DICT::ALL_DATABASES}, + :threaded => true plugin.map 'match *phrase [using :strategy] [from :database]', :action => 'cmd_match', :defaults => {:database => DICT::ALL_DATABASES, - :strategy => DICT::DEFAULT_MATCH_STRATEGY } + :strategy => DICT::DEFAULT_MATCH_STRATEGY }, + :threaded => true -plugin.map 'dictclient databases', :action => 'cmd_databases' -plugin.map 'dictclient strategies', :action => 'cmd_strategies' +plugin.map 'dictclient databases', :action => 'cmd_databases', :thread => true +plugin.map 'dictclient strategies', :action => 'cmd_strategies', :thread => true