Coder Social home page Coder Social logo

gabe's Introduction

Gabe, a Steam Slack Bot

Preview

Gabe is a simple Slack bot for searching the Steam storefront. When a user inputs the '/steam' command along with a game title, Gabe will reply with a brief summary of the game, along with a link to the game's Steam page.

Requirements

This Slack bot is a NodeJS app. It's got a few dependencies, which it fetches through npm. Gabe uses Express to route Slack commands. The Steam store data is fetched through NAME's excellent steam-store utility. Steam technically doesn't have an API for the online store, steam-store is using an undocumented API Steam uses for the Big Picture mode. This API doesn't have a search functionality, so Gabe has to download the entire app list when it first runs. This list is stored in a sqlite3 database, and is updated using the cron package at midnight and noon.

I've also included a Procfile in this repository. You can run Gabe anywhere, but Slack requires apps using /slash commands to be hosted on a server with SSL. Heroku makes an ideal place since they provide SSL out of the box.

Slack Configuration

You'll need to set up two Custom Integrations in Slack. First create a Slash Command with /steam for the command, https://YourServer.com/steam for the URL, POST for the Method, and whatever Name and Icon you'd like. Next, create a an Incoming Webhook. Set the Channel to the channel you'd like the command to work in, and then conigure the name and icon with the same name and icon as you used for the Slash Command.

Steambot.js needs to use the Incoming Webhook URL in the send() function. You'll either need to insert everything after https://hooks.slack.com/services as a variable into the source code (including the / character), or you'll need to set your system's process.env.INCOMING_WEBHOOK_PATH to that same variable.

Build and Run

Gabe's build process is fairly standard. npm install, then node app. If you're going to run Gabe on Heroku, commit the code to a local git repository, then run heroku create and git push heroku master. You'll also have to set Heroku's config vars to have INCOMING_WEBHOOK_PATH set to your Slack's incoming webhook path variable. This can be done through Heroku's web console, or through the command heroku config:set INCOMING_WEBHOOK_PATH=[Everything after "https://hooks.slack.com/services" in Slack's Incoming Webhook URL].

gabe's People

Contributors

imstubtw avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

evilbarney

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.