<commit_before>var express = require('express');
var bodyParser = require('body-parser');
var request = require('request');
var shell = require('shelljs');
var fs = require('fs');
var mineflayer = require('mineflayer');
var app = express();

var API_TOKEN = "<KEY>";
var BASE_URL = "https://api.telegram.org/bot{{token}}".replace("{{token}}", API_TOKEN);

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

String.prototype.replaceAll = function (find, replace) {
    var str = this;
    return str.replace(new RegExp(find.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replace);
};

var Client = function(id){
    this.id = id;
    this.chat_id = -1;
    this.username = null;
    this.password = <PASSWORD>;
    this.ip = null;
    this.port = null;

    this.bot = null;
    this.connect = () => {
        this.bot = mineflayer.createBot({
            host: this.ip,
            port: this.port,
            username: this.username,
            password: <PASSWORD>,
            verbose: true,
        });

        this.bot.on('login', function() {
            sendTextResponse("Connection Success!", this.chat_id);
        });

        this.bot.on('chat', (username, message) => {
            if(username === bot.username)
                return;
            sendTextResponse(username + ': ' + message, this.chat_id);
        });

        this.bot.on('whisper', (username, message) => {
            if(username === bot.username)
                return;
            sendTextResponse(username + ': ' + '<i>' + message.replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('&', '&amp;') + '</i>', this.chat_id);
        });
    }
    this.say = (message) => {
        if(this.bot != null)
            this.bot.chat(message);
    }
    this.whisper = (username, message) => {
        if(this.bot != null)
            this.bot.whisper(username, message);
    }
}

var last_update = 0;

var clients = [];

function loop(){
    getUpdates((data) => {
        for(var i = 0; i<data.length; i++){
            var m = data[i];
            var chat_id = m.message.chat.id;

            if(m.update_id <= last_update)
                continue;

            var client = clients[m.message.from.id];
            if(client == null)
                client = clients[m.message.from.id] = new Client(m.message.from.id);
            client.chat_id = chat_id;

            var text = m.message.text;
            console.log(text);
            if(m.message.entities != null && m.message.entities.length > 0 && m.message.entities[0] == 'bot_command'){
                console.log(text.substr(m.message.entities[0].offset, m.message.entities[0].length));
                switch(text.substr(m.message.entities[0].offset, m.message.entities[0].length)){
                    case '/join':
                        console.log('> /join');
                        if(m.message.entities.length == 2){
                            try
                            {
                                var arr = text.substr(m.message.entities[1].offset, m.message.entities[1].length).split(':');
                                client.ip = arr[0];
                                client.port = arr.length > 1 ? parseInt(arr[1]) : 25565;
                                sendTextResponse('Please login with your Minecraft Account.\n\nWhat is your username?', chat_id);
                            }
                            catch(err){
                                sendTextResponse('Invalid arguments. Please type /help for a list of commands.', chat_id);
                            }
                        }
                        else
                            sendTextResponse('Invalid arguments. Please type /help for a list of commands.', chat_id);
                        break;
                    case '/tell':
                        console.log('> /tell');
                        if(client.bot == null){
                            sendTextResponse('You must join a server before using this command.', chat_id);
                            break;
                        }
                        if(m.message.entities.length > 2)<commit_msg>Hotfix<commit_after>var express = require('express');
var bodyParser = require('body-parser');
var request = require('request');
var shell = require('shelljs');
var fs = require('fs');
var mineflayer = require('mineflayer');
var app = express();

var API_TOKEN = "<KEY>";
var BASE_URL = "https://api.telegram.org/bot{{token}}".replace("{{token}}", API_TOKEN);

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

String.prototype.replaceAll = function (find, replace) {
    var str = this;
    return str.replace(new RegExp(find.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replace);
};

var Client = function(id){
    this.id = id;
    this.chat_id = -1;
    this.username = null;
    this.password = <PASSWORD>;
    this.ip = null;
    this.port = null;

    this.bot = null;
    this.connect = () => {
        this.bot = mineflayer.createBot({
            host: this.ip,
            port: this.port,
            username: this.username,
            password: <PASSWORD>,
            verbose: true,
        });

        this.bot.on('login', function() {
            sendTextResponse("Connection Success!", this.chat_id);
        });

        this.bot.on('chat', (username, message) => {
            if(username === bot.username)
                return;
            sendTextResponse(username + ': ' + message, this.chat_id);
        });

        this.bot.on('whisper', (username, message) => {
            if(username === bot.username)
                return;
            sendTextResponse(username + ': ' + '<i>' + message.replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('&', '&amp;') + '</i>', this.chat_id);
        });
    }
    this.say = (message) => {
        if(this.bot != null)
            this.bot.chat(message);
    }
    this.whisper = (username, message) => {
        if(this.bot != null)
            this.bot.whisper(username, message);
    }
}

var last_update = 0;

var clients = [];

function loop(){
    getUpdates((data) => {
        for(var i = 0; i<data.length; i++){
            var m = data[i];
            var chat_id = m.message.chat.id;

            if(m.update_id <= last_update)
                continue;

            var client = clients[m.message.from.id];
            if(client == null)
                client = clients[m.message.from.id] = new Client(m.message.from.id);
            client.chat_id = chat_id;

            var text = m.message.text;
            console.log(text);
            if(m.message.entities != null && m.message.entities.length > 0 && m.message.entities[0].type == 'bot_command'){
                console.log(text.substr(m.message.entities[0].offset, m.message.entities[0].length));
                switch(text.substr(m.message.entities[0].offset, m.message.entities[0].length)){
                    case '/join':
                        console.log('> /join');
                        if(m.message.entities.length == 2){
                            try
                            {
                                var arr = text.substr(m.message.entities[1].offset, m.message.entities[1].length).split(':');
                                client.ip = arr[0];
                                client.port = arr.length > 1 ? parseInt(arr[1]) : 25565;
                                sendTextResponse('Please login with your Minecraft Account.\n\nWhat is your username?', chat_id);
                            }
                            catch(err){
                                sendTextResponse('Invalid arguments. Please type /help for a list of commands.', chat_id);
                            }
                        }
                        else
                            sendTextResponse('Invalid arguments. Please type /help for a list of commands.', chat_id);
                        break;
                    case '/tell':
                        console.log('> /tell');
                        if(client.bot == null){
                            sendTextResponse('You must join a server before using this command.', chat_id);
                            break;
                        }
                        if(m.message.entities.length > 2)
{'fraction_non_alphanumeric': 0.15084541062801932, 'fraction_numerical': 0.005072463768115942, 'mean_word_length': 1.5590234857849197, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 37, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '689477', 'n_tokens_mistral': 2347, 'n_tokens_neox': 2289, 'n_words': 463}