<commit_before>import TelegramBot from 'node-telegram-bot-api';
import Message from './message';
import config from '../config';
import Validator from './validator';
import handlers from '../handlers';

const validator = new Validator();

export default class Messenger {
  constructor() {
    if (process.env.NODE_ENV === 'production') {
      this.bot = new TelegramBot(config.telegram.token, { webHook: { port: config.telegram.port, host: config.telegram.host } });
      this.bot.setWebHook(`${config.telegram.externalUrl}:433/bot${config.telegram.token}`);
    } else {
      this.bot = new TelegramBot(config.telegram.token, { polling: true });
    }

    this.handleText = this.handleText.bind(this);
  }

  listen() {
    this.bot.on('text', this.handleText);

    return Promise.resolve();
  }

  handleText(msg) {
    const message = new Message(Message.mapMessage(msg));
    const text = message.text;<commit_msg>Disable webhooks<commit_after>import TelegramBot from 'node-telegram-bot-api';
import Message from './message';
import config from '../config';
import Validator from './validator';
import handlers from '../handlers';

const validator = new Validator();

export default class Messenger {
  constructor() {
    // if (process.env.NODE_ENV === 'production') {
    //   this.bot = new TelegramBot(config.telegram.token, { webHook: { port: config.telegram.port, host: config.telegram.host } });
    //   this.bot.setWebHook(`${config.telegram.externalUrl}:433/bot${config.telegram.token}`);
    // } else {
    //   this.bot = new TelegramBot(config.telegram.token, { polling: true });
    // }

    this.bot = new TelegramBot(config.telegram.token, { polling: true });

    this.handleText = this.handleText.bind(this);
  }

  listen() {
    this.bot.on('text', this.handleText);

    return Promise.resolve();
  }

  handleText(msg) {
    const message = new Message(Message.mapMessage(msg));
    const text = message.text;
{'fraction_non_alphanumeric': 0.1558641975308642, 'fraction_numerical': 0.0030864197530864196, 'mean_word_length': 3.65311004784689, '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': '6052253', 'n_tokens_mistral': 607, 'n_tokens_neox': 590, 'n_words': 129}