<commit_before>require('dotenv').config()

const searxBot = require('./bot')

const Telegraf = require('telegraf')
const bot = new Telegraf(process.env.BOT_TOKEN)

bot.start(ctx => ctx.reply('hello'))

bot.command('searx', ctx => {
    const match = ctx.message.text.match(/\/searx (.+)/)
    searxBot.search(match[1]).then(result => ctx.replyWithMarkdown(result))
})

bot.startPolling()<commit_msg>Prevent match[] out of bounds error.<commit_after>require('dotenv').config()

const searxBot = require('./bot')

const Telegraf = require('telegraf')
const bot = new Telegraf(process.env.BOT_TOKEN)

bot.start(ctx => ctx.reply('hello'))

bot.command('searx', ctx => {
    const match = ctx.message.text.match(/\/searx (.+)/)
    if(match && match.length > 1) {
      searxBot.search(match[1]).then(result => ctx.replyWithMarkdown(result))
    }
})

bot.startPolling()
{'fraction_non_alphanumeric': 0.1907514450867052, 'fraction_numerical': 0.003468208092485549, 'mean_word_length': 4.735099337748345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '3443695', 'n_tokens_mistral': 311, 'n_tokens_neox': 309, 'n_words': 49}