<commit_before>'use strict'
const http = require('http')
const express = require('express')
const bodyParser = require('body-parser')
const Bot = require('./Bot')

let bot = new Bot({
  token: process.env.PAGE_TOKEN,
  verify: process.env.VERIFY_TOKEN,
  app_secret: process.env.APP_SECRET
})

bot.setGreetingText('Welcome to EBudgie\'s assistant', (err, data) => {
  console.log(`Setting GreetingText result ${JSON.stringify(data)}`);
});

bot.setGetStartedButton([{
  payload: 'New user connected'
}], (err, data) => {
  console.log(`Setting GetStartedButton result ${JSON.stringify(data)}`);
});

// bot.setPersistentMenu(payload, callback)

bot.on('error', (err) => {
  console.log(err.message)
})

bot.on('message', (payload, reply) => {
  let text = payload.message.text

  bot.getProfile(payload.sender.id, (err, profile) => {
    if (err) throw err

    reply({ text }, (err) => {
      if (err) throw err

      console.log(`Echoed back to ${profile.first_name} ${profile.last_name}: ${text}`)
    })
  })
})

let app = express()
app.set('port', process.env.PORT || 8080);

app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
  extended: true
}))

app.get('/', (req, res) => {
  return bot._verify(req, res)
})
<commit_msg>Add persistant menu and a sample postback response<commit_after>'use strict'
const http = require('http')
const express = require('express')
const bodyParser = require('body-parser')
const Bot = require('./Bot')

let bot = new Bot({
  token: process.env.PAGE_TOKEN,
  verify: process.env.VERIFY_TOKEN,
  app_secret: process.env.APP_SECRET
})

bot.setGreetingText('Welcome to EBudgie\'s assistant', (err, data) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(`Setting GreetingText result ${JSON.stringify(data)}`);
});
bot.setPersistentMenu([
  {
    "title": "Account",
    "type": "nested",
    "call_to_actions": [
      {
        "title": "Expenses",
        "type": "postback",
        "payload": "SHOW_EXPENSES"
      },
      {
        "title": "Incomes",
        "type": "postback",
        "payload": "SHOW_INCOMES"
      },
      {
        "title": "Threshold",
        "type": "postback",
        "payload": "SHOW_THRESHOLD"
      }
    ]
  },
  {
    "type": "web_url",
    "title": "Visit Website",
    "url": "https://leon92xx.wixsite.com/ebudgie-website/",
    "webview_height_ratio": "full"
  }
], (err, data) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(`Setting setPersistentMenu result ${JSON.stringify(data)}`);
});

bot.setGetStartedButton([{
  payload: 'New user connected'
}], (err, data) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(`Setting GetStartedButton result ${JSON.stringify(data)}`);
});

// bot.setPersistentMenu(payload, callback)

bot.on('error', (err) => {
  console.log(err.message)
})

bot.on('message', (payload, reply) => {
  let text = payload.message.text

  bot.getProfile(payload.sender.id, (err, profile) => {
    if (err) throw err

    reply({ text }, (err) => {
      if (err) throw err

      console.log(`Echoed back to ${profile.first_name} ${profile.last_name}: ${text}`)
    })
  })
})

bot.on('postback', (payload, reply) => {
  let text = payload.message.text

  bot.getProfile(payload.sender.id, (err, profile) => {
    if (err) throw err

    reply({
      "attachment": {
        "type": "template",
        "payload": {
          "template_type": "button",
          "text": "What do you want to do next?",
          "buttons": [
            {
              "type": "account_link",
              "url": "https://leon92xx.wixsite.com/ebudgie-website/"
            }
          ]
        }
      }
    }, (err) => {
      if (err) throw err

      console.log(`Echoed back to ${profile.first_name} ${profile.last_name}: ${text}`)
    })
  })
})

let app = express()
app.set('port', process.env.PORT || 8080);

app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
  extended: true
}))

app.get('/', (req, res) => {
  return bot._verify(req, res)
})

{'fraction_non_alphanumeric': 0.18577468291469784, 'fraction_numerical': 0.0029843322556577967, 'mean_word_length': 3.108273748723187, 'pattern_counts': {'":': 24, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 2, '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': '840295', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1392, 'n_words': 286}