Skip to content

Commit

Permalink
(Agrega) Autenticación de github para utilizar api (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
leocabeza authored Oct 19, 2018
1 parent 8949552 commit 089bcd6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions config/config.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const config = {
id: process.env.twitterId || '41469246',
hashtagMessage: '#ngVenezuelaTweet'
},
github: {
accessToken: process.env.githubAccessToken || 'GITHUB_ACCESS_TOKEN'
},
githubReleases: [
{
name: 'angular',
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const runMainProcess = () => {
)
);
/**
* On any message check if api.ai has a respond to the message
* On any message check if api.ai has a response to the message
*/
bot
.on('message', msg =>
Expand Down Expand Up @@ -192,7 +192,7 @@ const runMainProcess = () => {
.on('newFeed', feed => blogUtility.checkAndSendBlogEntry(bot, feed));
};

if (process.env.enironment !== 'development' && sentryDsnKey) {
if (process.env.environment !== 'development' && sentryDsnKey) {
raven.config(sentryDsnKey).install();
raven.context(() => {
runMainProcess();
Expand Down
4 changes: 3 additions & 1 deletion src/utils/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const gistCreated = require('./../../config/messages').gistCreated;
const telegramLink = require('./../../config/config').community.telegram.link;
const githubLink = require('./../../config/config').community.github;
const gistRecommendation = require('./../../config/messages').gistRecommendation;
const githubToken = require('./../../config/config').integrations.github.accessToken;

const sendMessage = require('./../utils/message').sendMessage;
const commandUtility = require('./../utils/command');
Expand Down Expand Up @@ -112,6 +113,7 @@ const prepareAndSendGist = (
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Authorization': `token ${githubToken}`
},
body: JSON.stringify(body)
})
Expand All @@ -134,7 +136,7 @@ const prepareAndSendGist = (
*/
const checkGist = (bot, msgContext, redisClient, text = '', checkingForCode = true) => {
commandUtility.verifyCommand(redisClient, GIST_COMMAND, msgContext.from.id)
.then((canExecuteCommand) => {
.then((canExecuteCommand) => {
if (canExecuteCommand) {
if (text === '' && msgContext.text.length >= MAX_LENGTH_GIST_TEXT) {
if (checkingForCode) {
Expand Down

0 comments on commit 089bcd6

Please sign in to comment.