JavaScript telegram bot that sends images based on user search
// Request module
const request = require('request');

// Telebot module
const Telebot = require('telebot');

// Bot
const bot = new Telebot("YOUR TELEGRAM API TOKEN");

// DOMParser
const jsdom = require('jsdom');
const { JSDOM } = jsdom;


First of all is the comment noise. It's pretty clear what the code is already doing. You don't need to put comments on code that's already obvious. If you really need comments, save it for "weird" cases or things that is normally done one way yet you did it in another.

// /start command
bot.on('/start', (msg) =&gt; msg.reply.text('Hello! For informations about usage, creator, etc., please use the command /help!'));

// /help command
bot.on('/help', (msg) =&gt; msg.reply.text('Usage:\n /imageof &lt;your_word&gt; sends you an random image.\nExample:\n/imageof dog - You\'ll get an random image of a dog.\n\nAbout:\nVersion: 2.0\nCreator: @CodeFox\nGitHub: https://github.com/CodeF0x/image-search-telegram-bot\nAll images are taken from https://unsplash.com.'));


This is fine for now. But should your app grow, consider putting the messages in a dedicated object. This allows you to easily look up and modification of messaging without diving into code.

    var html = new JSDOM(response.body); // Parse the response 
    var images = html.window.document.getElementsByClassName('_2zEKz'); // Get all images - in this case by class name, otherwise we would get profile pictures too
    var sources = []; // Array to pick random url from


I find it strange that you use const on the stuff above, but var down here.

    var images = html.window.document.getElementsByClassName('_2zEKz'); // Get all images - in this case by class name, otherwise we would get profile pictures too
    var sources = []; // Array to pick random url from
    for (var i = 0; i &lt; images.length; i++) { // Loop through all images and push only valid url to the array
        if (images[i].src.includes('https')) {
            sources.push(images[i].src);
        }
    }


Given the existence of array methods that let you transform one array to another, I find this pattern of "create array and push items from another array into it" an anti-pattern. Use array.map and array.filter instead. Also, you might want to check if https is actually the start of src.

const sources = Array.prototype.slice.call(images) // Convert NodeList to regular array.
  .filter(img =&gt; img.src.indexOf('https') === 0)   // Only https images
  .map(img =&gt; img.src)                             // Extract src