<commit_before>var mc = require('minecraft-protocol');
var tmi = require('tmi.js');
var minecraft = require('./config/minecraft');
var twitch = require('./config/twitch');

/**
 * Minecraft
 */
minecraft.on('chat', function(packet) {
    var jsonMsg = JSON.parse(packet.message);
    if (jsonMsg.translate == 'chat.type.announcement' || jsonMsg.translate == 'chat.type.text') {
        var username = jsonMsg.with[0].text;
        var msg = jsonMsg.with[1];
        if (username === minecraft.username) 
            return;
        twitch.action(twitch.opts.channels[0], '[' + username + '] ' + msg);
    }
});
minecraft.on('login', function(first, second) {
    console.log('Connected... ' + JSON.stringify(first, null, 4));
});
/*
minecraft.on('packet', function(packet) {
    console.log(packet);
});
*/

/**
 * Twitch
 */
twitch.on("connected", function(address, port) {
    twitch.action(twitch.opts.channels[0], "Hello! I'm a bot! Type 'help' to interact with minecraft.");
});
twitch.on('chat', function(channel, user, message, self) {
    if (message == 'rain') {
        minecraft.write('chat', { message: '/weather rain 30' });
    } else if (message == 'clear') {
        minecraft.write('chat', { message: '/weather clear' });
    } else if (message == 'slime') {
        minecraft.write('chat', { message: '/execute @a ~2 ~3 ~2 /summon minecraft:slime ~2 ~3 ~2 {Size:0,CustomName:"' + user.username + ' Slime",CustomNameVisible:1,Glowing:1}' });
        minecraft.write('chat', { message: user.username + " has summoned slimes!" });
    } else if (message == 'blind') {
        minecraft.write('chat', { message: '/effect @a blindness');
        minecraft.write('chat', { message: 'The god ' + user.username + ' has cursed you for your many sins!' });
    } else if (message == 'help') {
        twitch.action(twitch.opts.channels[0], "'rain' - make weather rainy.");
        twitch.action(twitch.opts.channels[0], "'clear' - make weather clear.");
        twitch.action(twitch.opts.channels[0], "'slime' - summon attack slimes.");
        twitch.action(twitch.opts.channels[0], "'blind' - strike players blind.");
    } else {
        minecraft.write('chat', { message: '[' + user.username + '] ' + message });
    }<commit_msg>Updating.<commit_after>var mc = require('minecraft-protocol');
var tmi = require('tmi.js');
var minecraft = require('./config/minecraft');
var twitch = require('./config/twitch');

/**
 * Minecraft
 */
minecraft.on('chat', function(packet) {
    var jsonMsg = JSON.parse(packet.message);
    if (jsonMsg.translate == 'chat.type.announcement' || jsonMsg.translate == 'chat.type.text') {
        var username = jsonMsg.with[0].text;
        var msg = jsonMsg.with[1];
        if (username === minecraft.username) 
            return;
        twitch.action(twitch.opts.channels[0], '[' + username + '] ' + msg);
    }
});
minecraft.on('login', function(first, second) {
    console.log('Connected... ' + JSON.stringify(first, null, 4));
});
minecraft.on('end', function(packet) {
    console.log("Disconnected from minecraft.");
});

/**
 * Twitch
 */
twitch.on("connected", function(address, port) {
    twitch.action(twitch.opts.channels[0], "Hello! I'm a bot! Type 'help' to interact with minecraft.");
});
twitch.on('chat', function(channel, user, message, self) {
    if (message == 'rain') {
        minecraft.write('chat', { message: '/weather rain 30' });
    } else if (message == 'clear') {
        minecraft.write('chat', { message: '/weather clear' });
    } else if (message == 'slime') {
        minecraft.write('chat', { message: '/execute @a ~2 ~3 ~2 /summon minecraft:slime ~2 ~3 ~2 {Size:0,CustomName:"' + user.username + ' Slime",CustomNameVisible:1,Glowing:1}' });
        minecraft.write('chat', { message: user.username + " has summoned slimes!" });
    } else if (message == 'blind') {
        minecraft.write('chat', { message: '/effect @a blindness' });
        minecraft.write('chat', { message: 'The god ' + user.username + ' has cursed you for your many sins!' });
    } else if (message == 'nausea') {
        minecraft.write('chat', { message: '/effect @a Nausea' });
    } else if (message == 'particle hugeexplosion') {
        minecraft.write('chat', { message: '/execute @a ~ ~ ~ /particle hugeexplosion ~ ~ ~ 0 0 0 0' });
    } else if (message == 'help') {
        twitch.action(twitch.opts.channels[0], "'rain' - make weather rainy.");
        twitch.action(twitch.opts.channels[0], "'clear' - make weather clear.");
        twitch.action(twitch.opts.channels[0], "'slime' - summon attack slimes.");
        twitch.action(twitch.opts.channels[0], "'blind' - strike players blind.");
        twitch.action(twitch.opts.channels[0], "'nausea' - make players sick.");
    } else {
        minecraft.write('chat', { message: '[' + user.username + '] ' + message });
    }
{'fraction_non_alphanumeric': 0.19475423378769105, 'fraction_numerical': 0.00929368029739777, 'mean_word_length': 3.3318425760286225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3325081', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1518, 'n_words': 345}