Closed BarelyMiSSeD closed 9 years ago
Um, well. If that's all there is to the command, then it does nothing even if it's called. Create a gist or something with the whole plugin so I can take a look at the whole thing.
EDIT: Oh, and to answer your question: No, there's no limit and any command name should do (with the exception of whitespace, which the bot probably won't like).
I put the file here: https://gist.github.com/BarelyMiSSeD/c21e9706b057aa376ad3 It is supposed to read a text file for names and not allow them to be kicked if someone callvotes to kick them. That part works. The part that doesn't work is the !protect command. I get no response at all from the bot when saying that. I put some self.msg commands just so I could see where the code may be breaking, but I don't even get the "Start" one.
I can't test it myself at the moment, but is the problem that cmd_protect
simply doesn't execute at all? Not even the call to msg()
in line 25? I can't see anything obvious that would cause that to happen without throwing any errors. Is it throwing absolutely no errors when you try to execute it from someone with permission level 4 or higher? How about when the plugin is loaded?
If you don't run the debug build, it's not very verbose, but if you load the raw
plugin and do !exec minqlbot.IS_DEBUG = True
it'll start telling you when commands are executed (look for lines prefixed with "[EXECUTE]") among other things. You could try checking if that is the case with your command, although I don't think there should be any cases where you'd see that message without line 25 being executed. You could also try \bot py protect
in the console to see if that makes any difference.
I was trying to test it using the bot itself and I got no response at all, I assume the bot has full permissions since its level is 999. The line 25 msg() didn't work so I thought maybe the command wasn't being recognized for some reason. I will try the debug stuff you talked about tomorrow. I assume the messages from the raw plugin will show up in the console? I will let you know what I find.
I was having a similar problem adding another command in a plugin that was working, but I never could get that command to respond either. I am not sure what has been happening. I will let you know if I find anything out. Thanks for the help. Hopefully one of up can find something.
I assume the messages from the raw plugin will show up in the console?
No, it won't show up in the console. It's debug output that has to be viewed using DebugView or something equivalent.
If you have no luck with the debugging, I'll do some testing on my end.
The debugview helped. The problem I had was the definition line for protect. It said: def cmd_protect(self, player, msg):
I had to change it to: def cmd_protect(self, player, msg, channel):
There were a couple of other errors that I was easily able to fix after getting that to work.
Thanks again for your help.
Is there a limit to the amount of commands that can be added, or a naming convention that can't be used? I tried adding a command in essentials.py like so: self.add_command("protect", self.cmd_protect, 4, usage="")
def cmd_protect(self, player, msg): if len(msg) < 2: return minqlbot.RET_USAGE
but if doesn't work when I say !protect in quake live. Any ideas?