<commit_before>var token = process.env.token;
var bot = require('express')();
var bodyParser = require('body-parser');
var request = require('request');

var url = `https://api.telegram.org/bot${token}/`;

request({
	url: url + 'setWebhook',
	method: 'POST',
	json: true,
	body: {
		url: process.env.url + token
	}
}, function (error, response, body) {
	console.log(body.description);
});

function sendMessage (chat_id, text) {
	request({
		url: url + 'sendMessage',
		method: 'POST',
		json: true,
		body: {
			chat_id: chat_id,
			text: text
		}
	});
}

bot.use(bodyParser.json());

var lastUpdate_id, isNoting;

bot.post('/' + token, function (req, res) {
	if (lastUpdate_id != req.body.update_id) {
		lastUpdate_id = req.body.update_id;
		if (req.body.message) {
			var message = req.body.message;
			if (message.from.username === 'neolwc') {
				if (isNoting) {
					isNoting = false;
					sendMessage(message.chat.id, message.text);
				}
				else if (message.entities) {
					if (message.text.indexOf('/note') >= 0) {
						isNoting = true;
						sendMessage(message.chat.id, 'Please reply with you note.');
					}
				}
				else sendMessage(message.chat.id, 'Hey beloved ' + message.from.first_name);
			}
			else {
				sendMessage(message.chat.id, 'Hey ' + message.from.first_name);
			}
		}
	}
	res.send();<commit_msg>POST notes to api<commit_after>var token = process.env.token;
var bot = require('express')();
var bodyParser = require('body-parser');
var request = require('request');

var url = `https://api.telegram.org/bot${token}/`;

request({
	url: url + 'setWebhook',
	method: 'POST',
	json: true,
	body: {
		url: process.env.url + token
	}
}, function (error, response, body) {
	console.log(body.description);
});

function sendMessage (chat_id, text) {
	request({
		url: url + 'sendMessage',
		method: 'POST',
		json: true,
		body: {
			chat_id: chat_id,
			text: text
		}
	});
}

bot.use(bodyParser.json());

var lastUpdate_id, isNoting;

bot.post('/' + token, function (req, res) {
	if (lastUpdate_id != req.body.update_id) {
		lastUpdate_id = req.body.update_id;
		if (req.body.message) {
			var message = req.body.message;
			if (message.from.username === 'neolwc') {
				if (isNoting) {
					isNoting = false;
					request({
						url: process.env.noteAPI,
						method: 'POST',
						json: true,
						body: {
							title: message.text,
							content: ''
						}
					}, function (error, response, body) {
						sendMessage(message.chat.id, body.message);
					});
				}
				else if (message.entities) {
					if (message.text.indexOf('/note') >= 0) {
						isNoting = true;
						sendMessage(message.chat.id, 'Please reply with you note.');
					}
				}
				else sendMessage(message.chat.id, 'Hey beloved ' + message.from.first_name);
			}
			else {
				sendMessage(message.chat.id, 'Hey ' + message.from.first_name);
			}
		}
	}
	res.send();
{'fraction_non_alphanumeric': 0.16893068617206547, 'fraction_numerical': 0.0006966213862765587, 'mean_word_length': 3.138328530259366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2379705', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1027, 'n_words': 219}