<commit_before>const cheerio = require('cheerio'),
    fs = require('fs'),
    util = require('util'),
    moment = require('moment'),
    schedule = require('node-schedule'),
    TelegramBot = require('node-telegram-bot-api'),
    request = require("request");

let username,
    messageIDs = [],
    results = [],
    pubDate = moment();

const config = JSON.parse(fs.readFileSync('data.json', 'utf8')),
    bot = new TelegramBot(config.key, {
        polling: {
            timeout: 60,
            interval: 0
        }
    });

bot.getMe().then(me => {
    username = me.username;
}).then(() => {
    bot.onText(new RegExp('^/(\\w+)(?:@' + username + ')?', 'i'), (msg, regex) => {
        if (msg.chat.type === 'private') {
            console.log('%s(%s) => %s: %s', msg.from.username, msg.from.id, username, msg.text);
        }
        else console.log('%s(%s) => %s(%s): %s', msg.from.username, msg.from.id, msg.chat.title, msg.chat.id, msg.text);

        switch (regex[1]) {
            case 'search':
                search(msg);
                break;
            case 'subscribe':
                if (config.channel.indexOf(msg.chat.id) < 0) {
                    config.channel.push(msg.chat.id);
                    fs.writeFile('data.json', JSON.stringify(config));
                    console.log(msg.chat.id + ' Add to subscription list.');
                    bot.sendMessage(msg.chat.id, '已加入訂閱清單！');
                }
                else bot.sendMessage(msg.chat.id, '已經在訂閱清單中了！');
                break;
            case 'unsubscribe':
                if (config.channel.indexOf(msg.chat.id) > -1) {
                    config.channel.splice(config.channel.indexOf(msg.chat.id), 1);
                    fs.writeFile('data.json', JSON.stringify(config));
                    console.log(msg.chat.id + ' remove from subscription list.');
                    bot.sendMessage(msg.chat.id, '已從訂閱清單中刪除');
                }
                else bot.sendMessage(msg.chat.id, '尚未訂閱');
                break;
        }<commit_msg>fix group command match<commit_after>const cheerio = require('cheerio'),
    fs = require('fs'),
    util = require('util'),
    moment = require('moment'),
    schedule = require('node-schedule'),
    TelegramBot = require('node-telegram-bot-api'),
    request = require("request");

let username,
    messageIDs = [],
    results = [],
    pubDate = moment();

const config = JSON.parse(fs.readFileSync('data.json', 'utf8')),
    bot = new TelegramBot(config.key, {
        polling: {
            timeout: 60,
            interval: 0
        }
    });

bot.getMe().then(me => {
    username = me.username;
}).then(() => {
    bot.onText(new RegExp('^/(\\w+)(?:@' + username + ')? ', 'i'), (msg, regex) => {
        if (msg.chat.type === 'private') {
            console.log('%s(%s) => %s: %s', msg.from.username, msg.from.id, username, msg.text);
        }
        else console.log('%s(%s) => %s(%s): %s', msg.from.username, msg.from.id, msg.chat.title, msg.chat.id, msg.text);

        switch (regex[1]) {
            case 'search':
                search(msg);
                break;
            case 'subscribe':
                if (config.channel.indexOf(msg.chat.id) < 0) {
                    config.channel.push(msg.chat.id);
                    fs.writeFile('data.json', JSON.stringify(config));
                    console.log(msg.chat.id + ' Add to subscription list.');
                    bot.sendMessage(msg.chat.id, '已加入訂閱清單！');
                }
                else bot.sendMessage(msg.chat.id, '已經在訂閱清單中了！');
                break;
            case 'unsubscribe':
                if (config.channel.indexOf(msg.chat.id) > -1) {
                    config.channel.splice(config.channel.indexOf(msg.chat.id), 1);
                    fs.writeFile('data.json', JSON.stringify(config));
                    console.log(msg.chat.id + ' remove from subscription list.');
                    bot.sendMessage(msg.chat.id, '已從訂閱清單中刪除');
                }
                else bot.sendMessage(msg.chat.id, '尚未訂閱');
                break;
        }
{'fraction_non_alphanumeric': 0.17223713100756283, 'fraction_numerical': 0.003903391070992925, 'mean_word_length': 1.7834351663272234, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '1575004', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1286, 'n_words': 217}