Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hubot not reporting 0 value (Using Slack adapter) #2

Closed
ileathan opened this issue Oct 14, 2014 · 5 comments
Closed

Hubot not reporting 0 value (Using Slack adapter) #2

ileathan opened this issue Oct 14, 2014 · 5 comments

Comments

@ileathan
Copy link

me: math 1+1
hubot: 2
me: math 1+1-2
-no reply-
me: math 1+1-2+4
hubot: 4
me: math 1+1-2+4-4
-no reply-
me: math 5_5
hubot: 25
me: math 5_5-25
-no reply-

@canadianveggie
Copy link
Member

Weird. I can't reproduce this with the shell adapter or the hipchat adapter, and I don't see anything the in the slack adapter that would cause it to drop "0" messages.

Can you try adding some logging to the slack adapter to see if it is making it to the POST step and what the args are?

@ileathan
Copy link
Author

It is arriving to the POST step.

May I offer some potential help? ->

Last time your script broke on the slack adapter because slack was expecting a STRING. possibly when you convert your NUMBERS to STRINGS the 0 turns into NULL.

Because I get a Slack 500 error (hubot is sending null) every time hubot should return the value 0.

@canadianveggie
Copy link
Member

That was my first thought too, but it's sending the string "0" for the other adapters, so I'm not sure why Slack would be different. If you could log the stringified JSON object (the args variable) that is posted to Slack, that will hopefully pinpoint the problem.

@ileathan
Copy link
Author

"{"username":"x","channel":"C02L5KU0M","text":"0 ","link_names":0}"

It seems the bug stems from slack itself. Bots are not allowed to send just the STRING "0". So the bellow little hack will solve my problem. and the general problem that slackbots cant send "0". Sorry for reporting this error to you it is independent of your code. Maybe you could check if the slack adapter is being used and append " " to 0's like i did... but anyway thanks for your time.

https://github.com/ileathan/hubot-slack/compare/tinyspeck:master...patch-1?quick_pull=1

@canadianveggie
Copy link
Member

No problem. Glad you found a workaround. Maybe the slack adapter will incorporate it into their code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants