diff --git a/plugins/commands.py b/plugins/commands.py index 69170a4..933372c 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -136,7 +136,7 @@ def command_unicode(argv, **args): @pluginfunction('dice', 'rolls a dice, optional N times', ptypes_COMMAND, ratelimit_class=RATE_INTERACTIVE) def command_dice(argv, **args): try: - count = 1 if argv else int(argv[0]) + count = 1 if not argv else int(argv[0]) except ValueError as e: return { 'msg': '%s: dice: error when parsing int(%s): %s' % ( diff --git a/urlbot.py b/urlbot.py index dad992e..f7ac5dc 100755 --- a/urlbot.py +++ b/urlbot.py @@ -247,11 +247,15 @@ class UrlBot(IdleBot): data = msg_obj['body'] words = data.split() + # prepend the bot nick so we have the same syntax as in muc + if msg_obj['type'] == 'chat' and words and self.nick not in words[0]: + words = [self.nick] + words + if len(words) < 2: # need at least two words return None - # don't reply if beginning of the text matches bot_nickname - if not data.startswith(config.conf_get('bot_nickname')): + # only reply if beginning of the text matches bot_nickname or it's a private session. + if msg_obj['type'] == 'groupchat' and not data.startswith(config.conf_get('bot_nickname')): return None if 'hangup' in data: @@ -275,7 +279,7 @@ class UrlBot(IdleBot): parser_list=[pl.plugin_name for pl in plugin_storage[ptypes_PARSE]], reply_user=reply_user, msg_obj=msg_obj, - argv=words[2:] + argv=words[2:] if len(words) > 1 else [] ) if ret: