markweirath / big-brother-bot

Big Brother Bot B3 is a complete and total server administration package for online games. B3 is designed primarily to keep your server free from the derelicts of online gaming, but offers more, much more.
http://www.bigbrotherbot.net
44 stars 32 forks source link

Plugin Admin: parseUserCommand issue #54

Closed WickedShell closed 12 years ago

WickedShell commented 13 years ago

Was installing B3 1.7.1, and playing around with it. When I would do a "!clientinfo player" it would error out, apparently you need to provide a second field, but when you don't provide a second field it errors out. I believe this is because when it tries to validate that it returned something the regular expression returned a None object, which you can not take a len of. On a side note, for most plugins this makes very little difference as the next step would have been to fail gracefully, but having to catch an error, stack jump, and deny a plugin the chance to handle an event as it wants is unfortunate...

Stack trace, for those so inclined;

110904 14:40:24 CONSOLE '205:13 say: 2 |WC|spaz: !clientinfo spaz' 110904 14:40:24 VERBOSE 'Client Found: |WC|spaz on slot 2' 110904 14:40:24 VERBOSE 'Queueing event Say !clientinfo spaz' 110904 14:40:24 VERBOSE 'Parsing Event: Say: AdminPlugin' 110904 14:40:24 DEBUG 'AdminPlugin: OnSay handle 5:"!clientinfo spaz"' 110904 14:40:24 DEBUG 'AdminPlugin: Handle command !clientinfo spaz' 110904 14:40:24 VERBOSE "RCON sending (64.74.97.237:27965) 'tell 2 ^0(^2|B3|Bot^0)^7: ^3[pm]^7 ^7There was an error processing your command'" 110904 14:40:24 ERROR "handler AdminPlugin could not handle event Say: TypeError: object of type 'NoneType' has no len() [('/home/wildcats/service95/b3/parser.py', 973, 'handleEvents', 'hfunc.parseEvent(event)'), ('/home/wildcats/service95/b3/plugin.py', 158, 'parseEvent', 'self.onEvent(event)'), ('/home/wildcats/service95/b3/plugin.py', 176, 'onEvent', 'self.handle(event)'), ('/home/wildcats/service95/b3/plugins/admin.py', 223, 'handle', 'self.OnSay(event)'), ('/home/wildcats/service95/b3/plugins/admin.py', 368, 'OnSay', 'results = command.execute(data, event.client)'), ('/home/wildcats/service95/b3/plugins/admin.py', 2002, 'execute', 'self.func(data, client, copy.copy(self))'), ('/home/wildcats/service95/b3/plugins/admin.py', 1150, 'cmd_clientinfo', 'm = self.parseUserCmd(data, True)'), ('/home/wildcats/service95/b3/plugins/admin.py', 427, 'parseUserCmd', 'if req and not len(parms): return None')]"

thomasleveil commented 12 years ago

The fix made it to B3 1.8.0b, @WickedShell can you give it a try and close this issue if you confirm the fix ?