Closed alolis closed 13 years ago
The reason for this is that nicks starting with an underscore are not strictly allowed under the IRC specs. Of course, many IRC servers are more lenient. To solve this problem, specify a custom nick_regex in your stems.yml file:
Example:
nick: MyIRCBot
nick_regex: [a-zA-Z_][a-zA-Z0-9\\-_\\[\\]\\{\\}\\\\|`\\^]+
Thanks. The IRCd is Unreal latest by the way in case you were wondering.
I added the following to my stems.yml
nickregex: "[a-zA-Z][a-zA-Z0-9-_[]{}\|`\^]+<"
And now the bot doesn't respond to any command, not even from normal usernames :(
GitHub treated your regex as formatted so I can't tell what it was originally, but I just used the following regex and it worked fine:
nick_regex: "[a-zA-Z_][a-zA-Z0-9\\-_\\[\\]\\{\\}\\\\|`\\^]+"
Although, maybe delete the angle bracket at the end of your regex.
Thanks, it seems that "<" was added on the regex when i copy pasted and messed it up.
Hello, it seems that i am having a similar problem again but with usernames which look like this:
|USERNAME|
Can you please update the above regex so i can make that work too?
It seems that there is a problem with one letter usernames as well. Basically, whats the regex to accept any username?
You should be able to write out your own regexes, but I'll get you started ...
.+?
should match all usernames, but I haven't tested it.
Ah ok i will work it out no worries, thanks :)
Hello
I just discovered a weird problem. If a username which starts with _ executes a !command then an exception is raised. More specifically:
i have implemented in my controller did_receive_channel_message and one command, test_command, and everytime the user with underscore in front types !test, the sender parameter in leaf.rb, line 614 is nil. The problem i think starts in stem.rb however, line 490, were args[1] is nil as well.
Debug log shows the following:
undefined method
merge' for nil:NilClass testbot/libs/leaf.rb:621:in
command_parse' testbot/libs/leaf.rb:220:inblock in irc_privmsg_event' testbot/libs/leaf.rb:317:in
database' testbot/libs/leaf.rb:218:inirc_privmsg_event' /home/tester/.rvm/gems/ruby-1.9.2-p136/gems/facets-2.8.4/lib/core/facets/kernel/respond.rb:18:in
respond' testbot/libs/stem.rb:490:inblock (2 levels) in broadcast' undefined method
merge' for nil:NilClass testbot/libs/leaf.rb:621:incommand_parse' testbot/libs/leaf.rb:220:in
block in irc_privmsg_event' /home/tester/.rvm/gems/ruby-1.9.2-p136/gems/dm-core-1.0.2/lib/dm-core.rb:299:inblock in repository' /home/tester/.rvm/gems/ruby-1.9.2-p136/gems/dm-core-1.0.2/lib/dm-core/repository.rb:114:in
scope' /home/tester/.rvm/gems/ruby-1.9.2-p136/gems/dm-core-1.0.2/lib/dm-core.rb:299:inrepository' /home/tester/.rvm/gems/ruby-1.9.2-p136/gems/dm-core-1.0.2/lib/dm-core/core_ext/kernel.rb:8:in
repository' testbot/libs/leaf.rb:315:indatabase' testbot/libs/leaf.rb:218:in
irc_privmsg_event' /home/tester/.rvm/gems/ruby-1.9.2-p136/gems/facets-2.8.4/lib/core/facets/kernel/respond.rb:18:inrespond' testbot/libs/stem.rb:490:in
block (2 levels) in broadcast'