Closed fox365 closed 7 years ago
Thanks for using the bot! I'm sure we can figure it out. Can you send me the error message you are getting? As a first step, you should be able to send requests directly to the server's address. Once this works adding it to Slack should not be too hard.
Thank you for creating it! Once it is up and going it is going to add a lot to slack. Forgive me I am new to using Slack API's and I do not know how to send a request directly to the server's address. The app's url is https://secret-bastion-94596.herokuapp.com/
Looking forward to learning a lot from this, thank you for your help.
Edit: Forgot to mention, in the logs I do not see any other error codes that could help.
It looks like the server is properly started, as for example https://secret-bastion-94596.herokuapp.com/commands/online returns the response I'd expect (it will do that on GET requests - everything that comes from Slack is usually a POST).
Does it work locally? You can run the server on your machine with dart bin/server.dart
. You will need to set all the required environment variables. For local testing you can pass bogus values for the verification tokens. Then use a script or a graphical HTTP request program (I recommend the Postman Chrome extension) to query your server.
Once this is working, create a custom integration in Slack for a slash command, give it the proper URL (e.g. ttps://secret-bastion-94596.herokuapp.com/commands/online), add the verification token to the SLACK_VALIDATION_TOKENS environment variable in the Heroku settings for you app, and it should work™️.
Note that recently I started migrating the commands to a Slack app (so that Message Buttons work) but as of right now you should still be able to use a custom slash command.
I will also try to get it running locally.
These crashes happen because some environment variables are missing on the Heroku instance. On your app's configuration page, go to Settings > Reveal Config Vars
and add the proper values for the variables above. The list of expected variables is on the project's README page.
First 2 was set for POST in the slash command. Last one was GET. I used the token for the slash command as the AUTH token
The token you get from Slack needs to be put in SLACK_VALIDATION_TOKENS
.
Hey so I'm working with fox365 on this. From the ReadMe I see we need a SLACK_VALIDATION_TOKEN, which I see we get from the slash command. But I don't see it mentioned anywhere about the SLACK_CLIENT_SECRET, CLIENT_ID, or the SLACK_VERIFICATION_TOKEN. I used the Slack Build an App feature to get a Client ID and Secret but I don't know if this was correct.
Also, if it helps at all this is the Heroku log after running the /online command that added as a Slash command.
2016-11-07T16:35:31.484687+00:00 heroku[router]: at=info method=GET path="/commands/online?token=YCQt0P9dpGshQlWCRQVncTA6&team_id=T1KB1S8DQ&team_domain=dc187&channel_id=D2NNZ3NKT&channel_name=directmessage&user_id=U2NNNB64W&user_name=cbennees&command=%2Fonline&text=cbennees&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%2FT1KB1S8DQ%2F101349556194%2Fko0EMpn5yAFK6AlcoeZ6uKjm" host=secret-bastion-94596.herokuapp.com request_id=4b40a50d-c69b-4dd5-a871-f42e9a0d721d fwd="54.174.114.150" dyno=web.1 connect=0ms service=15ms status=404 bytes=321 2016-11-07T16:35:31.483469+00:00 app[web.1]: INFO: 2016-11-07 16:35:31.483346: DestinySlackBot: 2016-11-07 16:35:31.475035 0:00:00.008182 GET [404] /commands/online?token=YCQt0P9dpGshQlWCRQVncTA6&team_id=T1KB1S8DQ&team_domain=dc187&channel_id=D2NNZ3NKT&channel_name=directmessage&user_id=U2NNNB64W&user_name=cbennees&command=%2Fonline&text=cbennees&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%2FT1KB1S8DQ%2F101349556194%2Fko0EMpn5yAFK6AlcoeZ6uKjm
Quick update. I also added the Grimoire command and that works. So the issue right now is getting the /online command to work.
Okay I have grimoire, wasted and weekly for sure working. I think online works too but no clan members to check
2 issues I'm stuck on.
For the /trials command I keep getting Could not find Trials data for "
And for twitch when I pushed to heroku it said it needed a TWITCH_CLIENT_ID param which wasn't shown in the README. Is this different than the twitch username because twitch command just hangs.
The Trials command isn't working at the moment because of an issue with guardian.gg (see https://twitter.com/fathert0m/status/794752314384842752).
I'll look at the Twitch issue tonight.
Glad the other commands are working!
Awesome, thanks for the heads up. Also /LFG hangs as well. Dont know if that's another issue or it could be an issue with out 100.io token as well
And don't worry about Twitch it's good. I had to get a different API key and add that to the TWITCH_CLIENT_ID....maybe you can add that PARAM to the README
How did you get your the100.io token? I emailed mike@the100.io
to get one.
fox365 emailed him to get one a while ago, but it's been a while and might not work anymore. I'll shoot him an email to get another one
I've also verified that /online is working. Waiting on the 100 key now.
Also couple questions. Is this supposed to be tired into a bot at all? right now I'm just running the /commands with it actual bot. Also for twitch is it supposed to notify when someone comes online or just when I run the /twitch command?
Also, I noticed you added a /profile command. I added it as a Slash command but just get "Contacting Destiny servers..." or "The Cryptarchs are on it..."
*Edit: I noticed it does work with XBL gamertags but not with PSN? Also look at the Heroku log it appears to find the characters for PSN and show if they have completes the raid but then throws an error. See attachment:
Re: Twitch
There are two parts to it: the slash command, and a notification bot which periodically checks whether a stream came online and posts a note to a channel you can configure. You need to pass a proper bot token for the latter to work. I expect this all to become easier to set up once I make it so that you have to bundle everything into an app. Note that this bots also posts a notification when a the100.io gets created or is about to start.
Re: Profile
It looks like a bug where the request handler does not properly deal with characters which haven't completed a raid. Actually it looks like the request to Bungie is failing. I opened https://github.com/pylaligand/destiny-slack-bot/issues/175. Please don't complete a raid on that character until it's solved :)
Bug fixed, the profile now works.
Awesome, thanks! I'll go ahead and update when I get home tonight!
Anything specific I have to do to get the bot working. I created a normal bot, added the token to the param and the channel but it still doesn't show online. Is it supposed to be a Hubot or anything?
You will need to manually invite the bot to the channel otherwise it won't be able to post there (see https://github.com/slackapi/node-slack-sdk/issues/26).
Yeah I have the bot added to a channel and everything. When I look at it's status it shows offline? It should appear to be online yes?
Mine appears offline as well, and yet it works.
There's one subtlety though. If you use the Heroku free plan, they will put your service to sleep if it's not active for 30 minutes. Any request directed to it will wake it up, but that usually results in a timeout of your first slash command - or at least Slack considers it timed out, but then you still get the result of the command a few seconds later. In the case of notifications though, they won't work as the background service periodically checking the100.io and twitch.tv is not running. In my clan this is often not an issue as when folks are playing they usually issue slash commands which automatically wakes the service up, thereby enabling notifications.
Okay awesome, i'll just have to wait for one of the twitch streamer we have to come online to see if works. Still waiting on the100 token to get that up and working.
And yeah I ran into that issue before with heroku, I'll see some scripts I can load that will constantly ping the app at a specific interval to keep it awake but nothing was worked so far.
Other than the /profile command, another other commands no in the README that I can add?
*Edit, Tested bot for twitch, got someone to jump on and still didn't work. I must of set something up wrong.
Were you able to make everything work?
Sorry haven't had a chance to update, been crazy busy. I planned on going back through it around Christmas break.
With that said though, Trials command and everything else just started working properly. Biggest annoyance right now is the vm going idle and having to wake it up.
Well, there's one easy way to fix that problem but it involves 💵 .
I'll close this issue, feel free to open new, specific ones should you run into other problems!
We have the heroku application pushed. It gave errors for Slack Client ID, Client Secret and Verification token. We took some liberties in filling these values from the Slack API page but it seems some are supposed to be given by the server.
The bot does not come online or respond to mentions.