<commit_before>'use strict';

const
  request = require('request'),
  webhook = require('./webhook.js'),
  standardUpdates = require('./updates.js'),
  standardMethods = require('./methods.js');

/* Telegram Bot */

class TeleBot {

  constructor(cfg) {

    if (typeof cfg != 'object') cfg = { token: cfg };

    if (!cfg.token || cfg.token.split(':').length != 2) {
      throw Error('[bot.error] invalid bot token');
    }

    this.cfg = cfg;
    this.token = cfg.token;
    this.id = this.token.split(':')[0];
    this.api = `https://api.telegram.org/bot${ this.token }`;
    this.fileLink = `https://api.telegram.org/file/bot${ this.token }/`;

    let poll = cfg.polling;

    // Migration
    if (!poll) {
      if (cfg.pooling) {
        poll = cfg.pooling;
        console.warn('[bot.warning] use "polling" option instead of "pooling"!');
      } else {
        poll = {};
        // Set cfg.polling
        for (let name of ['limit', 'timeout', 'retryTimeout', 'allowed_updates']) {
          poll[name] = cfg[name];
        }
        // cfg.sleep renamed to cfg.polling.interval
        poll.interval = cfg.sleep;
      }
    }

    this.limit = poll.limit > 0 && poll.limit <= 100 ? poll.limit : 100;
    this.interval = poll.interval >= 0 ? poll.interval : 1000;
    this.timeout = poll.timeout >= 0 ? poll.timeout : 0;
    this.retryTimeout = poll.retryTimeout >= 0 ? poll.retryTimeout : 5000;
    this.allowed_updates = typeof poll.allowed_updates == 'string' || Array.isArray(poll.allowed_updates) ? poll.allowed_updates : undefined;

    this.webhook = cfg.webhook;

    this.updateId = 0;
    this.loopFn = null;

    this.flags = {
      poll: false,
      retry: false,
      looping: false
    };

    this.modList = {};
    this.eventList = {};

    this.updateTypes = standardUpdates;
<commit_msg>Change undefined to an empty array<commit_after>'use strict';

const
  request = require('request'),
  webhook = require('./webhook.js'),
  standardUpdates = require('./updates.js'),
  standardMethods = require('./methods.js');

/* Telegram Bot */

class TeleBot {

  constructor(cfg) {

    if (typeof cfg != 'object') cfg = { token: cfg };

    if (!cfg.token || cfg.token.split(':').length != 2) {
      throw Error('[bot.error] invalid bot token');
    }

    this.cfg = cfg;
    this.token = cfg.token;
    this.id = this.token.split(':')[0];
    this.api = `https://api.telegram.org/bot${ this.token }`;
    this.fileLink = `https://api.telegram.org/file/bot${ this.token }/`;

    let poll = cfg.polling;

    // Migration
    if (!poll) {
      if (cfg.pooling) {
        poll = cfg.pooling;
        console.warn('[bot.warning] use "polling" option instead of "pooling"!');
      } else {
        poll = {};
        // Set cfg.polling
        for (let name of ['limit', 'timeout', 'retryTimeout', 'allowed_updates']) {
          poll[name] = cfg[name];
        }
        // cfg.sleep renamed to cfg.polling.interval
        poll.interval = cfg.sleep;
      }
    }

    this.limit = poll.limit > 0 && poll.limit <= 100 ? poll.limit : 100;
    this.interval = poll.interval >= 0 ? poll.interval : 1000;
    this.timeout = poll.timeout >= 0 ? poll.timeout : 0;
    this.retryTimeout = poll.retryTimeout >= 0 ? poll.retryTimeout : 5000;
    this.allowed_updates = typeof poll.allowed_updates == 'string' || Array.isArray(poll.allowed_updates) ? poll.allowed_updates : [];

    this.webhook = cfg.webhook;

    this.updateId = 0;
    this.loopFn = null;

    this.flags = {
      poll: false,
      retry: false,
      looping: false
    };

    this.modList = {};
    this.eventList = {};

    this.updateTypes = standardUpdates;

{'fraction_non_alphanumeric': 0.16356673960612692, 'fraction_numerical': 0.012035010940919038, 'mean_word_length': 2.476235741444867, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 4, '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': '453778', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1176, 'n_words': 258}