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
Improvements, adding RTM option in bot options #3
Conversation
var env_file = __dirname + '/.env'; | ||
const fs = require('fs'); | ||
const env = require('node-env-file'); | ||
const env_file = __dirname + '/.env'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted a lot of the vars to consts for security.
bot.js
Outdated
clientId: process.env.clientId, | ||
clientSecret: process.env.clientSecret, | ||
clientSigningSecret: process.env.clientSigningSecret, | ||
// debug: true, | ||
scopes: ['bot'], | ||
studio_token: process.env.studio_token, | ||
studio_command_uri: process.env.studio_command_uri | ||
studio_command_uri: process.env.studio_command_uri, | ||
require_delivery: true, // required for RTM (Real Time Messaging) support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required if we ever use RTM, it makes sure a message is delivered before the bot actions on it and ensures things happen in order.
|
||
// Load in some helpers that make running Botkit on Glitch.com better |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all the Glitch.com stuff we'll never use.
protocol: req.protocol, | ||
glitch_domain: process.env.PROJECT_DOMAIN, | ||
layout: 'layouts/default' | ||
webserver.get('/', (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a clientId
and clientSecret
, just show the install page.
|
||
webserver.get('/', (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't have a clientId
or clientSecret
, just show a very basic message.
bot.js
Outdated
|
||
var bot_options = { | ||
const bot_options = { | ||
clientId: process.env.clientId, | ||
clientSecret: process.env.clientSecret, | ||
clientSigningSecret: process.env.clientSigningSecret, | ||
// debug: true, | ||
scopes: ['bot'], | ||
studio_token: process.env.studio_token, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove studio tokens since we aren't going to use that
Various cleanup and some RTM (Real Time Messaging) requirements. Comments inline!