Destiny 2 is out, and the Slack bot is getting a new look as well! Check out the new version.
This is a Slack bot for Destiny clans. It exposes commands to look up various aspects of the game thanks to the great API Bungie published.
This bot runs on Heroku infrastructure, powered by the Dart build pack which publishes some tools and instructions to deploy a Dart app to Heroku.
Note that in Slack each command needs to be added as a custom integration. It should be possible to package them as an app, although this has not be attempted yet.
/trials [gamertag]
/online [xbl | psn]
/grimoire [gamertag | @username | nothing]
/card
/xur
/twitch
/weekly
/triumphs
/lfg
/wasted
/profile
Several configuration parameters must be passed to your Heroku dyno. This can be done either via the web interface or via the command line:
heroku config:set PARAMETER_NAME=abcde01234ghijk56789
Here are the required parameters:
SLACK_VALIDATION_TOKENS
: the validation tokens
for the Slack custom integrationsBUNGIE_API_KEY
: needed to query the Bungie API; register hereBUNGIE_CLAN_ID
: your clan ID, easily found when navigating to your clan
page on bungie.net, which has the form
https://www.bungie.net/en/Clan/Forum/{clan_id}
DATABASE_URL
: URI of the PostgreSQL database holding Destiny world data -
see next sectionUSE_DELAYED_RESPONSES
: whether to use a delayed response
when a query takes too longTWITCH_STREAMERS
: comma-separated list of Twitch streamers to monitorSLACK_BOT_TOKEN
: auth token for the bot user; note that this token will also be used for slash commandsSLACK_BOT_CHANNEL
: name of the channel where notifications will be posted (note: the bot needs to be manually invited
to the channel first)THE_HUNDRED_AUTH_TOKEN
: the100 group API keyTHE_HUNDRED_GROUP_ID
: your the100 group id, found at https://www.the100.io/groups/{group_id}
The world database is created from the SQLite world database provided in the
manifest and downloaded via
tool/download_world_content
. It is converted to a Postgres database with
tool/create_database
.
A local Postgres instance will be needed for testing, whereas a live instance can be set up on Heroku. The local instance is provisioned via the creation tool, while the live instance is bootstrapped from the local instance with:
heroku pg:reset DATABASE_URL
heroku pg:push <local db name> DATABASE_URL --app <your app's name>
When running a local server, pass the configuration parameters as environment variables:
PARAM1=foo123 PARAM2=bar456 pub run bin/server.dart
Note that you will likely want to set USE_DELAYED_RESPONSES
to false
when
testing locally so that you can receive command results with whichever tool you
use (e.g. http client GUI) to send the requests.