<commit_before>'use strict'
const slapp  = require('../slackSetup.js').slapp
const getRadius = require('../radius.js').getRadius
const tinyurl = require('tinyurl');
const request = require('request')

//db imports
const firebase    = require('../firebaseSetup.js'),
      db = firebase.db,
      snaps = firebase.snaps,
      tags = firebase.tags,
      users = firebase.users

  

let notify  = function() {
  let randomNum = 0;
  slapp.command('/jaywalkNotify', (msg, text) => {
    let state = { requested: Date.now() }


    msg
      .say({
        text: '',
        attachments: [{
          text: 'What notifications do you want on this channel?',
          fallback: 'Set timed events.',
          callback_id: 'doit_confirm_callback',
          actions: [{
              name: 'answer',
              text: 'Coffee Spots',
              type: 'button',
              value: 'breakfast'
            },
            {
              name: 'answer',
              text: 'Lunch',
              type: 'button',
              value: 'lunch'
            },
            {
              name: 'answer',
              text: 'Dinner',
              type: 'button',
              value:  'dinner'
            },
            {
              name: 'answer',
              text: 'Happy Hour',
              type: 'button',
              value: 'hh'
            },
            {
              name: 'answer',
              text: 'Weekend fun',
              type: 'button',
              value:  'party'
            }            
          ]
        }]
      })
        .route('scheduler', state, 60) //expires after 60 sec       
  })
  .route('scheduler', (msg, state) => {
    let answer = msg.body.actions[0].value
    // user may not have typed text as their next action, ask again and re-route
    // if (!randSnap || !randTag) {
    //   return msg
    //     .say("Whoops, you just have to pick a button...")
    //     .say('Click a button!')
    //     .route('getid1', state)
    // }
    if(answer == 'breakfast'){
      let callback =function(err,res){
      console.log(err,res)
      msg.say(JSON.stringify(res))
     
      }

      request.post({
        "schedule": "0 * * * * *",
        "url":'https://beepboophq.com/api/v1/chronos/tasks',
        "payload": {
          "greeting": "hello",
          "list": [{
              "one": 1
          }],
          "object": {
              "two": 2
          }
        },
        "headers":{
          "Authorization": `Bearer ${process.env.BEEPBOOP_TOKEN}`
        }       
        // ,"expires": "2017-06-01T23:00:00Z"
      },callback);
  
      // radius = getRadius(39.758451,-105.007625) //test: snap #1055
    }else if(answer == 'lunch'){
      msg.say({
        text: `this will set auto suggestions day-day @ 11:30am`
      })
      // radius = getRadius(40.018689, -105.279993) //test: snap #1055
    }else if(answer == 'dinner'){
      msg.say({
        text: `this will set auto suggestions day-day @ 5:30pm`
      })
       // return open("itms-apps://itunes.apple.com/us/app/jaywalk-walk-get-deals/id1171719157?mt=8")
    }else if(answer == 'hh'){
      msg.say({
        text: `this will set auto suggestions day-day @ 4:30pm`
      })
       // return open("itms-apps://itunes.apple.com/us/app/jaywalk-walk-get-deals/id1171719157?mt=8")
    }else if(answer == 'party'){
      msg.say({
        text: `this will set auto suggestions day-day @ 8:00pm`
      })
       // return open("itms-apps://itunes.apple.com/us/app/jaywalk-walk-get-deals/id1171719157?mt=8")
    }else{ //handle error
      return msg
        .say("Whoops, you just have to pick a button...")
        .say('Click a button!')<commit_msg>postman to the rescue<commit_after>'use strict'
const slapp  = require('../slackSetup.js').slapp
const getRadius = require('../radius.js').getRadius
const tinyurl = require('tinyurl');
const request = require('request')

//db imports
const firebase    = require('../firebaseSetup.js'),
      db = firebase.db,
      snaps = firebase.snaps,
      tags = firebase.tags,
      users = firebase.users

  

let notify  = function() {
  let randomNum = 0;
  slapp.command('/jaywalkNotify', (msg, text) => {
    let state = { requested: Date.now() }


    msg
      .say({
        text: '',
        attachments: [{
          text: 'What notifications do you want on this channel?',
          fallback: 'Set timed events.',
          callback_id: 'doit_confirm_callback',
          actions: [{
              name: 'answer',
              text: 'Coffee Spots',
              type: 'button',
              value: 'breakfast'
            },
            {
              name: 'answer',
              text: 'Lunch',
              type: 'button',
              value: 'lunch'
            },
            {
              name: 'answer',
              text: 'Dinner',
              type: 'button',
              value:  'dinner'
            },
            {
              name: 'answer',
              text: 'Happy Hour',
              type: 'button',
              value: 'hh'
            },
            {
              name: 'answer',
              text: 'Weekend fun',
              type: 'button',
              value:  'party'
            }            
          ]
        }]
      })
        .route('scheduler', state, 60) //expires after 60 sec       
  })
  .route('scheduler', (msg, state) => {
    let answer = msg.body.actions[0].value
    // user may not have typed text as their next action, ask again and re-route
    // if (!randSnap || !randTag) {
    //   return msg
    //     .say("Whoops, you just have to pick a button...")
    //     .say('Click a button!')
    //     .route('getid1', state)
    // }
    if(answer == 'breakfast'){
    
      

      var options = {
          method: 'POST',
          url: 'https://beepboophq.com/api/v1/chronos/tasks',
          headers: { 
            'cache-control': 'no-cache',
            'authorization': 'Bearer <KEY>' 
          }, body: {
              "method": "POST",
              "schedule": "0 * * * * *",
              "url":"https://beepboophq.com/proxy/352f35865bf544c69066ea5ad8596b32/slack/event",
              "payload":{
                "greeting": "hello",
                "list": [{"one": 1}],
                "object": {"two": 2}
              }
            }
          };

      request(options, function (error, response, body) {
        if (error) throw new Error(error);

        console.log(body);
        msg.say(JSON.stringify(body))
      });

  
      // radius = getRadius(39.758451,-105.007625) //test: snap #1055
    }else if(answer == 'lunch'){
      msg.say({
        text: `this will set auto suggestions day-day @ 11:30am`
      })
      // radius = getRadius(40.018689, -105.279993) //test: snap #1055
    }else if(answer == 'dinner'){
      msg.say({
        text: `this will set auto suggestions day-day @ 5:30pm`
      })
       // return open("itms-apps://itunes.apple.com/us/app/jaywalk-walk-get-deals/id1171719157?mt=8")
    }else if(answer == 'hh'){
      msg.say({
        text: `this will set auto suggestions day-day @ 4:30pm`
      })
       // return open("itms-apps://itunes.apple.com/us/app/jaywalk-walk-get-deals/id1171719157?mt=8")
    }else if(answer == 'party'){
      msg.say({
        text: `this will set auto suggestions day-day @ 8:00pm`
      })
       // return open("itms-apps://itunes.apple.com/us/app/jaywalk-walk-get-deals/id1171719157?mt=8")
    }else{ //handle error
      return msg
        .say("Whoops, you just have to pick a button...")
        .say('Click a button!')
{'fraction_non_alphanumeric': 0.15461873926258754, 'fraction_numerical': 0.031055900621118012, 'mean_word_length': 1.5576208178438662, 'pattern_counts': {'":': 20, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2947450', 'n_tokens_mistral': 2507, 'n_tokens_neox': 2330, 'n_words': 528}