Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

IRC Robot says everything twice #71

Closed
dcarley opened this Issue · 24 comments
@dcarley

Hubot seems so keen to talk to IRC that it repeats everything twice.

09:44 <@dan> hubot: ping
09:44 < hubot> PONG
09:44 < hubot> PONG

From dan to #test: hubot: ping
undefined: PONG
27 Oct 09:44:47 - SEND: PRIVMSG #test :PONG
undefined: PONG
27 Oct 09:44:47 - SEND: PRIVMSG #test :PONG
@atmos

Closing in favor of #72

@atmos atmos closed this
@dcarley

This is still happening in 5c76e7c. Separate from #72, which is now fixed.

@atmos atmos reopened this
@atmos atmos closed this in 2ec62c3
@atmos

@dcarley can you try 0.1.4?

@marceldegraaf

Weird, I get the exact same behavior on the shell and in Campfire. The answer for each command I throw at Hubot (ping, math, image, mustache) is outputted twice. How can I help resolve this?

@dcarley

That raises an error. But, if I'm reading it correctly, still wants to reply twice.

From dan to #test: hubot: ping
#test <dan> hubot: ping
#test PONG
error while calling listener: TypeError: Cannot call method 'say' of undefined
#test PONG
error while calling listener: TypeError: Cannot call method 'say' of undefined

In case it's relevant I'm launching Hubot with:

PATH=$PATH:node_modules/coffee-script/bin \
HUBOT_IRC_SERVER="irc" \
HUBOT_IRC_ROOMS="#test" \
HUBOT_IRC_NICK="hubot" \
./bin/hubot -a irc
@dcarley

Oh, this is my fault!

I think there was a time when I had trouble loading the distributed scripts and for reasons that I can no longer qualify I symlinked src/hubot/scripts to src/scripts. This must have caused all of the scripts to be loaded twice.

After removing the symlink it behaves as normal. 2ec62c3 can probably be reverted.

@marceldegraaf

Aha! @dcarley, thanks for your hint. Apparently I had two separate scripts directories. Don't know why, but after removing the second one it all works normally again.

@cadwallion

This is causing error while calling listener: TypeError: Cannot call method 'say' of undefined because you're losing scope of the @bot within the do () -> on line 7 and 17 of irc.coffee. It should be => so it maintains scope of the @bot attrib on lines 10 and 13.

@glucero glucero referenced this issue from a commit in absperf/hubot
@atmos atmos fixup irc double posting issues, fixes #71 9cfbfc6
@findchris

Any clues for debugging the "hubot repeats everything twice" problem? I don't believe I've symlinked any scripts directory. Any help is appreciated.

@jeffmcfadden

@findchris I solved it for us by realizing I had scripts in both the scripts dir and in the hubots-scripts.json file.

@findchris

@jeffmcfadden Is that not correct behavior? github/hubot-scripts has the following in the README:
Just put them in scripts, add the new scripts to the hubot-scripts.json file.

@jeffmcfadden

@findchris that's how I read it the first time too, but it seems there's an "or" missing in there.

If the script is in hubot-scripts catalog you can add it to the hubot-scripts file, otherwise you must drop it into scripts.

@findchris

@jeffmcfadden That did it. Thank you for the help! :thumbsup:

@technicalpickles

I updated the hubot-scripts README to be less ambiguous, thanks @findchris and @jeffmcfadden!

@timfallkrux

This actually continues to happen when using the flowdock adapter. I suspect that it may actually happen when you create a new hubot inside the same directory as the git clone. Thus you could get a copy of your scripts from the original clone and another when creating the bot. As further evidence, a script that is only included in hubot-scripts.json only fires once.

@timfallkrux timfallkrux referenced this issue in flowdock/hubot-flowdock
Closed

Hubot Crash After One Response #30

@tombell

It must be a bug in the flowdock adapter as this isn't an issue with the core adapters (shell and campfire).

@timfallkrux

Actually, it happens when you store your hubot and hubot git clone in the same dir. It reads both the /scripts folder and the src/scripts folder. Moving it fixed the issue.

@picsoung

it also happened to me because my .coffee files were compiling to .js files

@gmelika

this seems to happen when hubot loses/restablishes connection

@lukaszraczylo

+1 on lost & re-established connection issue.

@michaelansel
Collaborator

The double load on reconnect is likely caused by the 'connected' event getting emitted again. The robot listens for 'connected' and loads all scripts at that point (assuming it will only get fired once). This would be adapter dependent (adapter decides when to emit 'connected'). Can you confirm which adapter you are using when this happens?

@gmelika

I use the hipchat adapter

@michaelansel
Collaborator

Filed #919 to track the reconnecting issue

@brianjdoherty

This was happening to me, and I realized I was running the hubot process twice on my server. :-)

@bardoloi bardoloi referenced this issue in HeadspringLabs/hsbot
Closed

Duplicate Messages/Responses #43

11 of 11 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.