<commit_before>module.exports = function(robot) {

	'use strict';
	var slackMsgs = require('./slackMsgs.js');				

	/* set Github Account */
	var GitHubApi = require("github");
	//var Trello = require(https://api.trello.com/1/client.js?key=<KEY>);

	var github = new GitHubApi({
	    /* optional */
	    // debug: true,
	    // protocol: "https",
	    // host: "api.github.com", // should be api.github.com for GitHub
	    // //thPrefix: "/api/v3", // for some GHEs; none for GitHub
	    // headers: {
	    //     "user-agent": "My-Cool-GitHub-App" // GitHub is happy with a unique user agent
	    // },
	    // Promise: require('bluebird'),
	    // followRedirects: false, // default: true; there's currently an issue with non-get redirects, so allow ability to disable follow-redirects
	    // timeout: 5000
	});


    /* oauth autentication using github personal token */
	github.authenticate({
	    "type": "oauth",
	    "token": process.env.HUBOT_GITHUB_TOKEN
	})

    /* basic autentication using github's username & password */
	// github.authenticate({
	//     type: "basic",
	//     username: '',
	//     password: ''
	// });




	robot.on('github-webhook-event', function(data){
		// console.log(data);
		var room, adapter, payload;
		room = "random";

		adapter = robot.adapterName;

		payload = data.payload;
		switch(data.eventType){
			case 'push': 
				let repo_name 	= payload.repository.full_name;
				let branch 		= payload.repository.default_branch;
				let repo_url	= payload.repository.url + 	'/tree/' + branch;
				let user_name	= payload.commits[0].name;
				let user_login	= payload.commits[0].username;
				let commit_id 	= payload.commits[0].id.substr(0,7);
				let commit_msg	= payload.commits[0].message;
				let commit_url  = payload.commits[0].url;

				robot.messageRoom(room, "push event");	

				if (adapter == 'slack'){
					let msg = slackMsgs.githubEvent();
					msg.attachments[0].pretext = `<${repo_url}|[${repo_name}:${branch}]> 1 new commit by ${user_name}:`;
					msg.attachments[0].title = '';
					msg.attachments[0].text = `<${commit_url}|`+'`'+`${commit_id}>`+'`'+`${commit_msg} - <www.github.com/${user_login}|${user_name}>`;<commit_msg>update gh<commit_after>module.exports = function(robot) {

	'use strict';
	var slackMsgs = require('./slackMsgs.js');				

	/* set Github Account */
	var GitHubApi = require("github");
	//var Trello = require(https://api.trello.com/1/client.js?key=<KEY>);

	var github = new GitHubApi({
	    /* optional */
	    // debug: true,
	    // protocol: "https",
	    // host: "api.github.com", // should be api.github.com for GitHub
	    // //thPrefix: "/api/v3", // for some GHEs; none for GitHub
	    // headers: {
	    //     "user-agent": "My-Cool-GitHub-App" // GitHub is happy with a unique user agent
	    // },
	    // Promise: require('bluebird'),
	    // followRedirects: false, // default: true; there's currently an issue with non-get redirects, so allow ability to disable follow-redirects
	    // timeout: 5000
	});


    /* oauth autentication using github personal token */
	github.authenticate({
	    "type": "oauth",
	    "token": process.env.HUBOT_GITHUB_TOKEN
	})

    /* basic autentication using github's username & password */
	// github.authenticate({
	//     type: "basic",
	//     username: '',
	//     password: ''
	// });




	robot.on('github-webhook-event', function(data){
		// console.log(data);
		var room, adapter, payload;
		room = "random";

		adapter = robot.adapterName;

		payload = data.payload;
		switch(data.eventType){
			case 'push': 
				let repo_name 	= payload.repository.full_name;
				let branch 		= payload.repository.default_branch;
				let repo_url	= payload.repository.url + 	'/tree/' + branch;
				let user_name	= payload.commits[0].name;
				let user_login	= payload.commits[0].username;
				let commit_id 	= payload.commits[0].id.substr(0,7);
				let commit_msg	= payload.commits[0].message;
				let commit_url  = payload.commits[0].url;

				robot.messageRoom(room, "push event");	

				if (adapter == 'slack'){
					let msg = slackMsgs.githubEvent();
					msg.attachments[0].pretext = `<${repo_url}|[${repo_name}:${branch}]> 1 new commit by ${user_name}:`;
					msg.attachments[0].title = '';
					msg.attachments[0].text = `<${commit_url}|`+'`'+`${commit_id}`>+'`'+`${commit_msg} - <www.github.com/${user_login}|${user_name}>`;
{'fraction_non_alphanumeric': 0.17377349839523154, 'fraction_numerical': 0.007794589637780834, 'mean_word_length': 3.039814814814815, 'pattern_counts': {'":': 6, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '328699', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1455, 'n_words': 312}