bugfixes, can omit username in PMs now
This commit is contained in:
@@ -136,7 +136,7 @@ def command_unicode(argv, **args):
|
|||||||
@pluginfunction('dice', 'rolls a dice, optional N times', ptypes_COMMAND, ratelimit_class=RATE_INTERACTIVE)
|
@pluginfunction('dice', 'rolls a dice, optional N times', ptypes_COMMAND, ratelimit_class=RATE_INTERACTIVE)
|
||||||
def command_dice(argv, **args):
|
def command_dice(argv, **args):
|
||||||
try:
|
try:
|
||||||
count = 1 if argv else int(argv[0])
|
count = 1 if not argv else int(argv[0])
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return {
|
return {
|
||||||
'msg': '%s: dice: error when parsing int(%s): %s' % (
|
'msg': '%s: dice: error when parsing int(%s): %s' % (
|
||||||
|
|||||||
10
urlbot.py
10
urlbot.py
@@ -247,11 +247,15 @@ class UrlBot(IdleBot):
|
|||||||
data = msg_obj['body']
|
data = msg_obj['body']
|
||||||
words = data.split()
|
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
|
if len(words) < 2: # need at least two words
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# don't reply if beginning of the text matches bot_nickname
|
# only reply if beginning of the text matches bot_nickname or it's a private session.
|
||||||
if not data.startswith(config.conf_get('bot_nickname')):
|
if msg_obj['type'] == 'groupchat' and not data.startswith(config.conf_get('bot_nickname')):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if 'hangup' in data:
|
if 'hangup' in data:
|
||||||
@@ -275,7 +279,7 @@ class UrlBot(IdleBot):
|
|||||||
parser_list=[pl.plugin_name for pl in plugin_storage[ptypes_PARSE]],
|
parser_list=[pl.plugin_name for pl in plugin_storage[ptypes_PARSE]],
|
||||||
reply_user=reply_user,
|
reply_user=reply_user,
|
||||||
msg_obj=msg_obj,
|
msg_obj=msg_obj,
|
||||||
argv=words[2:]
|
argv=words[2:] if len(words) > 1 else []
|
||||||
)
|
)
|
||||||
|
|
||||||
if ret:
|
if ret:
|
||||||
|
|||||||
Reference in New Issue
Block a user