<commit_before>var e = module.exports = {};
var bu = require('./util.js');
var moment = require('moment-timezone');
var bu = require('./util.js');

var bot;
e.init = (Tbot) => {
    bot = Tbot;
};

e.processTag = (msg, contents, command) => {
    var words = command.replace(/ +/g, ' ').split(' ');

    if (contents.split(' ')[0].indexOf('help') > -1) {
        contents = '\u200B' + contents;
    }
    contents = contents.replace(/\{channelid}/gi, msg.channel.id)
        .replace(/\{channelname}/gi, msg.channel.name)
        .replace(/\{channelpos}/gi, msg.channel.position)
        .replace(/\{guildid}/gi, msg.channel.guild.id)
        .replace(/\{guildname}/gi, msg.channel.guild.name)
        .replace(/\{guildmembers}/gi, msg.channel.guild.memberCount)
        .replace(/\{guildownerid}/gi, msg.channel.guild.ownerID)
        .replace(/\{guildownername}/gi, bot.users.get(msg.channel.guild.ownerID).username)
        .replace(/\{guildownernick}/gi, msg.channel.guild.members.get(msg.channel.guild.ownerID).nick ? msg.channel.guild.members.get(msg.channel.guild.ownerID).nick : bot.users.get(msg.channel.guild.ownerID).username)
        .replace(/\{guildicon}/gi, `https://cdn.discordapp.com/icons/${msg.channel.guild.id}/${msg.channel.guild.icon}.jpg`)
        .replace(/\{guilddefaultchannelid}/gi, msg.channel.guild.defaultChannel.id)
        .replace(/\{guilddefaultchannelname}/gi, msg.channel.guild.defaultChannel.name)
        .replace(/\{nsfw}/gi, '')
        .replace(/\{rb}/gi, '&rb;')
        .replace(/\{lb}/gi, '&lb;');

    var fallback = '';
    while (contents.indexOf('{') > -1 && contents.indexOf('}') > -1 &&
        contents.indexOf('{') < contents.indexOf('}')) {
        var tagEnds = contents.indexOf('}')
            , tagBegins = tagEnds == -1 ? -1 : contents.lastIndexOf('{', tagEnds)
            , tagBrackets = contents.substring(tagBegins, tagEnds + 1)
            , tag = contents.substring(tagBegins + 1, tagEnds)
            , args = tag.split(';')
            , replaceString = ''
            , i
            , obtainedUser
            , formatCode
            , createdDate;
        switch (args[0].toLowerCase()) {
            case 'randuser':
                replaceString = msg.channel.guild.members.map(m => m)[bu.getRandomInt(0, msg.channel.guild.members.map(m => m).length - 1)].user.id;
                break;
            case '//':
                break;
            case 'fallback':
                if (args[1])
                    fallback = args[1];
                break;
            case 'randint':
                //console.log(args.length);
                if (args.length == 2) {
                    replaceString = bu.bu.getRandomInt(0, parseInt(args[1]));
                } else if (args.length > 2) {
                    replaceString = bu.bu.getRandomInt(parseInt(args[1]), parseInt(args[2]));
                } else {
                    replaceString = tagProcessError(fallback, '`Not enough arguments`');
                }<commit_msg>fixed tag randint bug<commit_after>var e = module.exports = {};
var bu = require('./util.js');
var moment = require('moment-timezone');
var bu = require('./util.js');

var bot;
e.init = (Tbot) => {
    bot = Tbot;
};

e.processTag = (msg, contents, command) => {
    var words = command.replace(/ +/g, ' ').split(' ');

    if (contents.split(' ')[0].indexOf('help') > -1) {
        contents = '\u200B' + contents;
    }
    contents = contents.replace(/\{channelid}/gi, msg.channel.id)
        .replace(/\{channelname}/gi, msg.channel.name)
        .replace(/\{channelpos}/gi, msg.channel.position)
        .replace(/\{guildid}/gi, msg.channel.guild.id)
        .replace(/\{guildname}/gi, msg.channel.guild.name)
        .replace(/\{guildmembers}/gi, msg.channel.guild.memberCount)
        .replace(/\{guildownerid}/gi, msg.channel.guild.ownerID)
        .replace(/\{guildownername}/gi, bot.users.get(msg.channel.guild.ownerID).username)
        .replace(/\{guildownernick}/gi, msg.channel.guild.members.get(msg.channel.guild.ownerID).nick ? msg.channel.guild.members.get(msg.channel.guild.ownerID).nick : bot.users.get(msg.channel.guild.ownerID).username)
        .replace(/\{guildicon}/gi, `https://cdn.discordapp.com/icons/${msg.channel.guild.id}/${msg.channel.guild.icon}.jpg`)
        .replace(/\{guilddefaultchannelid}/gi, msg.channel.guild.defaultChannel.id)
        .replace(/\{guilddefaultchannelname}/gi, msg.channel.guild.defaultChannel.name)
        .replace(/\{nsfw}/gi, '')
        .replace(/\{rb}/gi, '&rb;')
        .replace(/\{lb}/gi, '&lb;');

    var fallback = '';
    while (contents.indexOf('{') > -1 && contents.indexOf('}') > -1 &&
        contents.indexOf('{') < contents.indexOf('}')) {
        var tagEnds = contents.indexOf('}')
            , tagBegins = tagEnds == -1 ? -1 : contents.lastIndexOf('{', tagEnds)
            , tagBrackets = contents.substring(tagBegins, tagEnds + 1)
            , tag = contents.substring(tagBegins + 1, tagEnds)
            , args = tag.split(';')
            , replaceString = ''
            , i
            , obtainedUser
            , formatCode
            , createdDate;
        switch (args[0].toLowerCase()) {
            case 'randuser':
                replaceString = msg.channel.guild.members.map(m => m)[bu.getRandomInt(0, msg.channel.guild.members.map(m => m).length - 1)].user.id;
                break;
            case '//':
                break;
            case 'fallback':
                if (args[1])
                    fallback = args[1];
                break;
            case 'randint':
                //console.log(args.length);
                if (args.length == 2) {
                    replaceString = bu.getRandomInt(0, parseInt(args[1]));
                } else if (args.length > 2) {
                    replaceString = bu.getRandomInt(parseInt(args[1]), parseInt(args[2]));
                } else {
                    replaceString = tagProcessError(fallback, '`Not enough arguments`');
                }
{'fraction_non_alphanumeric': 0.17960679773408864, 'fraction_numerical': 0.007330889703432189, 'mean_word_length': 2.091143151390319, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '149182', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1901, 'n_words': 285}