<commit_before>console.log("PLUGIN: URLS loaded");

var utils = require('../../lib/utils');
var color = require('irc-colors');

function init(client, config) {

    var levelup = require('levelup');
    var db = levelup(__dirname + '/data', {
        keyEncoding: 'binary'
    });
    var Puid = require('puid');
    var puid = new Puid(true);

    client.addListener('message', function (nick, to, message, raw) {

        var cmdline = utils.filterCommands(message);
        var maxLimit = 42;
        var limit;

        var urls = [];
        var re = /http[s]?\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/g;

        if (utils.isBotMessage(nick, config)) {

            return;
        }

        if (utils.isBotMessage(to, config)) {
            to = nick;
        }

        while (match = re.exec(message)) {
            urls.push(match[0]);
        }

        urls.forEach(function (url) {
            db.put('urls\x00' + puid.generate(), url, function (err) {

                if (err) {
                    console.log("ERROR: URLS: adding new url");
                }
            });
        });

        if (utils.isCmd('!urls', cmdline)) {
<commit_msg>if priv msg to bot, set maxlimit to 4242 records<commit_after>console.log("PLUGIN: URLS loaded");

var utils = require('../../lib/utils');
var color = require('irc-colors');

function init(client, config) {

    var levelup = require('levelup');
    var db = levelup(__dirname + '/data', {
        keyEncoding: 'binary'
    });
    var Puid = require('puid');
    var puid = new Puid(true);

    client.addListener('message', function (nick, to, message, raw) {

        var cmdline = utils.filterCommands(message);
        var maxLimit = 42;
        var limit;

        var urls = [];
        var re = /http[s]?\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/g;

        if (utils.isBotMessage(nick, config)) {

            return;
        }

        if (utils.isBotMessage(to, config)) {

            maxLimit = 4242;
            to = nick;
        }

        while (match = re.exec(message)) {
            urls.push(match[0]);
        }

        urls.forEach(function (url) {
            db.put('urls\x00' + puid.generate(), url, function (err) {

                if (err) {
                    console.log("ERROR: URLS: adding new url");
                }
            });
        });

        if (utils.isCmd('!urls', cmdline)) {

{'fraction_non_alphanumeric': 0.17298874531054606, 'fraction_numerical': 0.010837849103793247, 'mean_word_length': 1.7649769585253456, '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': '315170', 'n_tokens_mistral': 802, 'n_tokens_neox': 762, 'n_words': 165}