{"id":31044,"date":"2019-10-31T21:39:05","date_gmt":"2019-10-31T18:39:05","guid":{"rendered":"https:\/\/prohoster.info\/blog\/rukovodstvo-kak-sdelat-prostogo-bota-dlya-telegram-na-js-dlya-novichka-v-programmirovanii\/"},"modified":"2019-10-31T21:39:05","modified_gmt":"2019-10-31T18:39:05","slug":"rukovodstvo-kak-sdelat-prostogo-bota-dlya-telegram-na-js-dlya-novichka-v-programmirovanii","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rukovodstvo-kak-sdelat-prostogo-bota-dlya-telegram-na-js-dlya-novichka-v-programmirovanii","title":{"rendered":"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Kam fillova t\u00eb zhytjes n\u00eb bot\u00ebn e TI vet\u00ebm tri jav\u00eb m\u00eb par\u00eb. Seriousisht, tri jav\u00eb m\u00eb par\u00eb nuk e dija as sintaks\u00ebn HTML, nd\u00ebrsa njohuria ime p\u00ebr gjuh\u00ebt e programimit mbaronte me programin shkollor t\u00eb Pascal-it t\u00eb para 10 vjet\u00ebve. Megjithat\u00eb, vendosa t\u00eb shkoj n\u00eb nj\u00eb kamp IT, ku do t\u00eb ishte mir\u00eb p\u00ebr f\u00ebmij\u00ebt t\u00eb krijonin nj\u00eb bot. Vendosa se nuk mund t\u00eb ishte kaq e v\u00ebshtir\u00eb.<\/p>\n<p>Nga kjo filloi nj\u00eb rrug\u00eb e gjat\u00eb, n\u00eb kuad\u00ebr t\u00eb s\u00eb cil\u00ebs un\u00eb:<\/p>\n<ul>\n<li>n\u00eb nd\u00ebrgjegje serverin e re n\u00eb cloud me Ubuntu,<\/li>\n<li>u regjistrova n\u00eb GitHub,<\/li>\n<li>m\u00ebsova sintaks\u00ebn baz\u00eb t\u00eb JavaScript,<\/li>\n<li>lexova nj\u00eb mori artikujsh n\u00eb anglisht dhe rusisht,<\/li>\n<li>n\u00eb fund e krijova botin,<\/li>\n<li>shkrova k\u00ebt\u00eb artikull, n\u00eb fund.<\/li>\n<\/ul>\n<p>\nProdukti p\u00ebrfundimtar dukej k\u00ebshtu:<\/p>\n<p><img decoding=\"async\" alt=\"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim\" src=\"\/wp-content\/uploads\/2019\/04\/fc072aaa72b23c95faeaa09be8a652db.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nT\u00eb them t\u00eb drejt\u00ebn, ky artikull \u00ebsht\u00eb p\u00ebr fillestar\u00ebt \u2014 p\u00ebr t\u00eb kuptuar thjesht si t\u00eb b\u00ebj gj\u00ebra elementare nga pika m\u00eb e ul\u00ebt.<\/p>\n<p>Dhe gjithashtu \u2014 p\u00ebr programuesit e avancuar \u2014 thjesht p\u00ebr t'i b\u00ebr\u00eb ata t\u00eb qeshin pak. <\/p>\n<p><b>1. Si t\u00eb shkruaj kod n\u00eb JS?<\/b><\/p>\n<p>Dija se ishte mir\u00eb t\u00eb filloja s\u00eb paku t\u00eb kuptoja sintaks\u00ebn e gjuh\u00ebs. Zgjedhja ra n\u00eb JavaScript, thjesht sepse hapi tjet\u00ebr p\u00ebr mua ishte t\u00eb krijoja nj\u00eb aplikacion n\u00eb ReactNative. Fillova me <noindex><a rel=\"nofollow\" href=\"https:\/\/www.codecademy.com\/learn\/introduction-to-javascript\">t\u00eb kursit<\/a><\/noindex> n\u00eb Codecademy dhe mbeta shum\u00eb i emocionuar. 7 dit\u00ebt e para falas. Projekte reale. E rekomandoj. Kalimi i saj zgjati rreth 25 or\u00eb. N\u00eb t\u00eb v\u00ebrtet\u00eb, jo gjith\u00e7ka prej saj ishte e p\u00ebrdorshme. K\u00ebshtu duket struktura e kursit dhe detajet e bllokut t\u00eb par\u00eb.<\/p>\n<p><img decoding=\"async\" alt=\"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim\" src=\"\/wp-content\/uploads\/2019\/04\/e63be1e6c7f32cc3c929e0145996d569.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<b>2. Si t\u00eb regjistroj botin?<\/b><\/p>\n<p>N\u00eb fillim, m\u00eb ndihmoi shum\u00eb ky <noindex><a rel=\"nofollow\" href=\"https:\/\/archakov.im\/post\/telegram-bot-on-nodejs.html\">k\u00ebtij artikulli<\/a><\/noindex> nga blogu i nj\u00eb individi t\u00eb quajtur Archakov. Ai e shpjegon fillimin. Por gj\u00ebja m\u00eb e r\u00ebnd\u00ebsishme q\u00eb ka \u00ebsht\u00eb \u2014 nj\u00eb udh\u00ebzues p\u00ebr regjistrimin e botit. Nuk do ta shkruaj m\u00eb mir\u00eb, dhe pasi kjo \u00ebsht\u00eb pjesa m\u00eb e leht\u00eb, do ta shpjegoj thjesht. Duhet t\u00eb krijoni nj\u00eb bot dhe t\u00eb merrni API-n\u00eb e tij. Kjo b\u00ebhet p\u00ebrmes nj\u00eb boti tjet\u00ebr \u2014 @BotFather. Gjeni at\u00eb n\u00eb telegram, shkruajini, ndiqni nj\u00eb rrug\u00eb t\u00eb thjesht\u00eb dhe merrni (ruani!) \u00e7el\u00ebsin API (ky \u00ebsht\u00eb nj\u00eb grup numrash dhe shkronjash). M\u00eb nevojitej m\u00eb von\u00eb.<\/p>\n<p><img decoding=\"async\" alt=\"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim\" src=\"\/wp-content\/uploads\/2019\/04\/b8181f6ad1c67dd47dd337f8171bf941.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<b>3. Si duket kodi i botit?<\/b><\/p>\n<p>Pas nj\u00eb studimi t\u00eb gjat\u00eb t\u00eb artikujve, e kuptova se duhet t\u00eb p\u00ebrdor ndonj\u00eb bibliotek\u00eb (kod t\u00eb jasht\u00ebm n\u00eb format modul), p\u00ebr t\u00eb mos u munduar me studimin e API-t t\u00eb Telegramit dhe krijimin nga e para t\u00eb pjes\u00ebve t\u00eb m\u00ebdha t\u00eb kodit. Gjeta korniz\u00ebn <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/telegraf\/telegraf\">telegraf<\/a><\/noindex>, q\u00eb duhej ta lidhnim ndonj\u00ebher\u00eb me di\u00e7ka p\u00ebrmes npm ose yarn. K\u00ebshtu e kuptoja at\u00ebher\u00eb se \u00e7far\u00eb p\u00ebrfshin vendosja e boti. Qeshni k\u00ebtu. Nuk do t\u00eb dyshoj. M\u00eb se shumti n\u00eb krijimin e m\u00ebtejsh\u00ebm t\u00eb boti m\u00eb ndihmuan shembujt e renditur posht\u00eb faqes:<\/p>\n<p><img decoding=\"async\" alt=\"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim\" src=\"\/wp-content\/uploads\/2019\/04\/711b252c5118b47a14c52862dd869058.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<b>3. Si t\u00eb krijoni serverin tuaj t\u00eb clouds p\u00ebr 100 rubla<\/b><\/p>\n<p>Pas nj\u00eb k\u00ebrkimi t\u00eb gjat\u00eb, kuptova se ekipi 'npm' nga figura m\u00eb sip\u00ebr i p\u00ebrket komand\u00ebs n\u00eb terminal. Terminali ekziston kudo, por p\u00ebr ta ekzekutuar, duhet t\u00eb instaloni NodePackageManager. Problemi ishte se un\u00eb programoja n\u00eb PixelBook me ChromeOS. Do ta anashkaloj k\u00ebtu nj\u00eb bllok t\u00eb madh mbi si e njoh Linux-in \u2014 p\u00ebr shumic\u00ebn, kjo \u00ebsht\u00eb e panevojshme dhe e kot\u00eb. N\u00ebse keni Windows ose MacBook, tashm\u00eb e keni konsol\u00ebn. <\/p>\n<p>N\u00ebse e themi me fjal\u00eb t\u00eb shkurt\u00ebr, instalova Linux p\u00ebrmes Crostini. <\/p>\n<p>Megjithat\u00eb, gjat\u00eb procesit kuptova se p\u00ebr t\u00eb punuar n\u00eb m\u00ebnyr\u00eb t\u00eb vazhdueshme me botin (dhe jo vet\u00ebm kur kompjuteri im \u00ebsht\u00eb i ndezur) m\u00eb nevojitet nj\u00eb server clouds. Zgjodha <noindex><a rel=\"nofollow\" href=\"http:\/\/vscale.io\">vscale.io<\/a><\/noindex> Shtova 100 rubla, blova serverin m\u00eb t\u00eb lir\u00eb Ubuntu (shiko imazhin). <\/p>\n<p><img decoding=\"async\" alt=\"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim\" src=\"\/wp-content\/uploads\/2019\/04\/74cdc3858900bbd0d95715f5371ef52a.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<b>4. Si t\u00eb p\u00ebrgatitni serverin p\u00ebr t\u00eb startuar botin<\/b><\/p>\n<p>Pas k\u00ebsaj kuptova q\u00eb duhet t\u00eb b\u00ebj nj\u00eb ndonj\u00eb folder n\u00eb server, ku do t\u00eb vendosja skedarin me tekstin e kodit. P\u00ebr k\u00ebt\u00eb, n\u00eb konsol\u00eb (p\u00ebr ta hapur direkt n\u00eb faqe p\u00ebrmes butonit \u201cHap konsol\u00ebn\u201d) shkrova <\/p>\n<pre><code class=\"plaintext\">mkdir bot<\/code><\/pre>\n<p>\nbot \u2014 \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0435\u0439 \u043f\u0430\u043f\u043a\u0438. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b npm \u0438 Node.js, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043c\u043d\u0435 \u043f\u043e\u0442\u043e\u043c \u043a\u043e\u0434 \u0438\u0437 \u0444\u0430\u0439\u043b\u0438\u043a\u043e\u0432 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c *.js<\/p>\n<pre><code class=\"plaintext\">sudo apt update\nsudo apt install nodejs\nsudo apt install npm<\/code><\/pre>\n<p>\nM\u00eb vjen mir\u00eb q\u00eb n\u00eb k\u00ebt\u00eb pik\u00eb t\u00eb konfiguroni lidhjen me serverin p\u00ebrmes konsol\u00ebs suaj. Ja <noindex><a rel=\"nofollow\" href=\"https:\/\/community.vscale.io\/hc\/ru\/community\/posts\/207745269-%D0%9A%D0%B0%D0%BA-%D1%81%D0%B3%D0%B5%D0%BD%D0%B5%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C-SSH-%D0%BA%D0%BB%D1%8E%D1%87-%D0%B4%D0%BB%D1%8F-%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B0-%D0%BD%D0%B0-%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80\">instruksion<\/a><\/noindex> Kjo do t\u00eb lejoj\u00eb t\u00eb punoni me serverin drejtp\u00ebrdrejt p\u00ebrmes konsol\u00ebs s\u00eb kompjuterit tuaj.<\/p>\n<p><b>5. Si t\u00eb shkruani kodin e boti t\u00eb par\u00eb.<\/b><\/p>\n<p>Dhe tani \u00ebsht\u00eb nj\u00eb hap i thjesht\u00eb p\u00ebr mua. \u00c7do program \u00ebsht\u00eb thjesht rreshta teksti. Mund t'i shkruani kudo, t'i ruani me zgjedhjen e duhur dhe mbaron. Je i shk\u00eblqyer. Un\u00eb p\u00ebrdora <noindex><a rel=\"nofollow\" href=\"https:\/\/atom.io\/\">Atom<\/a><\/noindex>, por t\u00eb v\u00ebrtet\u00eb, mund ta shkruani thjesht n\u00eb bllokun standard. E r\u00ebnd\u00ebsishme \u00ebsht\u00eb t\u00eb ruani pastaj skedarin me zgjedhjen e duhur. Ky \u00ebsht\u00eb si t\u00eb shkruani tekst n\u00eb Word dhe ta ruani. <\/p>\n<p>B\u00ebra nj\u00eb skedar t\u00eb ri, ku ngelja kodo nga shembulli n\u00eb faqen telegraf dhe e ruajta n\u00eb skedarin index.js (nuk \u00ebsht\u00eb aspak e detyrueshme ta quani skedarin k\u00ebshtu, por k\u00ebshtu \u00ebsht\u00eb e zakonshme). E r\u00ebnd\u00ebsishme \u2014 n\u00eb vend t\u00eb BOT_TOKEN, vendosni \u00e7el\u00ebsin tuaj API nga pika e dyt\u00eb.<\/p>\n<pre><code class=\"plaintext\">const Telegraf = require('telegraf')\n\nconst bot = new Telegraf(process.env.BOT_TOKEN)\nbot.start((ctx) =&gt; ctx.reply('Mir\u00ebsevini!'))\nbot.help((ctx) =&gt; ctx.reply('M\u00eb d\u00ebrgoni nj\u00eb ngjit\u00ebse'))\nbot.on('sticker', (ctx) =&gt; ctx.reply(''))\nbot.hears('hi', (ctx) =&gt; ctx.reply('Hej aty'))\nbot.launch()<\/code><\/pre>\n<p>\n<b>6. Si t\u00eb ngarkoni kodin n\u00eb server p\u00ebrmes github<\/b><\/p>\n<p>Tani duhet t\u00eb ngarkoja ndonj\u00eb m\u00ebnyr\u00eb k\u00ebt\u00eb kod n\u00eb server dhe ta filloja at\u00eb. P\u00ebr mua, kjo ishte nj\u00eb sfid\u00eb. Si rezultat, pas shum\u00eb mundimesh, kuptova se ishte m\u00eb e leht\u00eb t\u00eb krijoja nj\u00eb sked\u00eb n\u00eb github, e cila lejonte t\u00eb p\u00ebrdit\u00ebsoja kodin me an\u00eb t\u00eb komand\u00ebs n\u00eb konsol. <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/\">github<\/a><\/noindex> Dhe krijova <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/b0tank\/bot\">projekti i ri<\/a><\/noindex>, ku ngarkova sked\u00ebn. Pas k\u00ebsaj, m\u00eb duhej t\u00eb kuptoja sesi t\u00eb konfigurija ngarkimin e skedave nga llogaria ime (e hapur!) n\u00eb server n\u00eb dosjen bot (n\u00ebse ndonj\u00ebher\u00eb dilni prej saj - thjesht shkruani cd bot).<\/p>\n<p><b>7. Si t\u00eb ngarkoni skedat n\u00eb server p\u00ebrmes github-it \u00e7.2<\/b><\/p>\n<p>M\u00eb nevojitej t\u00eb instaloja n\u00eb server programin q\u00eb do t\u00eb ngarkonte skedat nga git. E instalova git n\u00eb server, duke shkruar n\u00eb konsol\u00eb <\/p>\n<pre><code class=\"plaintext\">apt-get install git<\/code><\/pre>\n<p>\nPas k\u00ebsaj, m\u00eb duhej t\u00eb konfigurija ngarkimin e skedave. P\u00ebr k\u00ebt\u00eb, shkrova n\u00eb komand\u00ebn e linj\u00ebs <\/p>\n<pre><code class=\"plaintext\">git clone git:\/\/github.com\/b0tank\/bot.git bot\n<\/code><\/pre>\n<p>\n\u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u0441\u0435 \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440. \u041e\u0448\u0438\u0431\u043a\u043e\u0439 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0431\u044b\u043b\u043e, \u0447\u0442\u043e \u044f, \u043f\u043e \u0441\u0443\u0442\u0438, \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u0442\u043e\u0440\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043f\u0430\u043f\u043a\u0438 bot. \u0410\u0434\u0440\u0435\u0441 \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u043a\u0430\u043a *\/bot\/bot\/index.js<\/p>\n<p>Vendosa t\u00eb injoroja k\u00ebt\u00eb problem.<\/p>\n<p>Dhe p\u00ebr t\u00eb ngarkuar bibliotek\u00ebn telegraf, e cila e k\u00ebrkojm\u00eb n\u00eb rreshtin e par\u00eb t\u00eb kodit, shkruani n\u00eb konsol\u00eb komand\u00ebn.<\/p>\n<pre><code class=\"plaintext\">npm install telegraf<\/code><\/pre>\n<p>\n<b>8. Si t\u00eb nisim boten<\/b><\/p>\n<p>P\u00ebr k\u00ebt\u00eb, duke qen\u00eb n\u00eb dosjen me sked\u00ebn (p\u00ebr t\u00eb kaluar nga nj\u00eb dosje n\u00eb tjet\u00ebr p\u00ebrmes konsol\u00ebs - kryeni komand\u00ebn e formatit <code>cd bot<\/code> P\u00ebr t\u00eb siguruar q\u00eb jeni aty ku duhet, mund t\u00eb shkruani komand\u00ebn q\u00eb do t\u00eb tregoj\u00eb n\u00eb konsol\u00eb t\u00eb gjitha skedat dhe dosjet q\u00eb ndodhen aty<code> ls -a<\/code><\/p>\n<p>P\u00ebr t\u00eb nisur, shkrova n\u00eb konsol\u00eb <\/p>\n<pre><code class=\"plaintext\">node index.js\n<\/code><\/pre>\n<p>\nN\u00ebse nuk ka ndonj\u00eb gabim - gjith\u00e7ka \u00ebsht\u00eb n\u00eb rregull, bota funksionon. K\u00ebrkoni p\u00ebr t\u00eb n\u00eb telegram. N\u00ebse ka nj\u00eb gabim - p\u00ebrdorni njohurit\u00eb tuaja nga pika 1.<\/p>\n<p><b>9. Si t\u00eb nisim botin n\u00eb m\u00ebnyr\u00eb t\u00eb heshtur<\/b><\/p>\n<p>Mjaft shpejt do t\u00eb kuptoni se bota funksionon vet\u00ebm kur ju jeni vet\u00eb n\u00eb konsol\u00eb. P\u00ebr t\u00eb zgjidhur k\u00ebt\u00eb problem, p\u00ebrdora komand\u00ebn <\/p>\n<pre><code class=\"plaintext\">screen<\/code><\/pre>\n<p>\nPas k\u00ebsaj, do t\u00eb shfaqet nj\u00eb ekran me nj\u00eb far\u00eb teksti. Kjo do t\u00eb thot\u00eb se gjith\u00e7ka \u00ebsht\u00eb n\u00eb rregull. Jeni n\u00eb serverin virtual n\u00eb serverin cloud. P\u00ebr t\u00eb kuptuar m\u00eb mir\u00eb se si funksionon gjith\u00e7ka - <noindex><a rel=\"nofollow\" href=\"https:\/\/bablofil.ru\/kak-zapustit-bota-na-servere\/\">ja artikulli<\/a><\/noindex>. Thjesht hyni n\u00eb dosjen tuaj dhe shkruani komand\u00ebn p\u00ebr nisjen e bot\u00ebs<\/p>\n<pre><code class=\"plaintext\">node index.js<\/code><\/pre>\n<p>\n<b>10. Si funksionon bota dhe si ta zgjerojm\u00eb funksionalitetin e saj<\/b><\/p>\n<p>\u00c7far\u00eb b\u00ebn bota jon\u00eb nga shembulli? Ajo mund <\/p>\n<pre><code class=\"plaintext\">bot.start((ctx) =&gt; ctx.reply('Welcome!'))<\/code><\/pre>\n<p>\nt\u00eb thot\u00eb \"Welcome!\" n\u00eb momentin e nisjes (provoni t\u00eb ndryshoni tekstin)<\/p>\n<pre><code class=\"plaintext\">bot.help((ctx) =&gt; ctx.reply('Send me a sticker'))<\/code><\/pre>\n<p>\nsi p\u00ebrgjigje ndaj komand\u00ebs standarde \/help t\u00eb d\u00ebrgoj\u00eb mesazhin \"Send me a sticker\"<\/p>\n<pre><code class=\"plaintext\">bot.on('sticker', (ctx) =&gt; ctx.reply(''))<\/code><\/pre>\n<p>\nsi p\u00ebrgjigje ndaj nj\u00eb sticker t\u00eb d\u00ebrgoj\u00eb miratimin<\/p>\n<pre><code class=\"plaintext\">bot.hears('hi', (ctx) =&gt; ctx.reply('Hey there'))<\/code><\/pre>\n<p>\nt\u00eb p\u00ebrgjigjemi 'Hey there', n\u00ebse ai shkruan 'hi'<br \/>\nbot.launch()<\/p>\n<p><img decoding=\"async\" alt=\"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim\" src=\"\/wp-content\/uploads\/2019\/04\/d2a52f8feb46ff67ee39622c56e8ce8e.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nN\u00ebse e shikoni kodin n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/b0tank\/bot\/blob\/master\/index.js\">github<\/a><\/noindex>, do t\u00eb kuptoni shpejt se nuk jam larg k\u00ebtij funksionaliteti. Ajo q\u00eb p\u00ebrdoret aktivisht \u00ebsht\u00eb funksioni <code>ctx.replyWithPhoto<\/code> Ai lejon d\u00ebrgimin e nj\u00eb fotoje ose gif-i t\u00eb caktuar si p\u00ebrgjigje ndaj nj\u00eb teksti t\u00eb caktuar. <\/p>\n<p>Nj\u00eb pjes\u00eb e r\u00ebnd\u00ebsishme e kodit ishte e shkruar nga f\u00ebmij\u00eb t\u00eb mosh\u00ebs 11-13 vje\u00e7are, t\u00eb cil\u00ebve u dhash\u00eb qasje n\u00eb robot. Ata soll\u00ebn p\u00ebrdorimet e tyre. Mendoj se \u00ebsht\u00eb e leht\u00eb t\u00eb p\u00ebrcaktohet se cila pjes\u00eb \u00ebsht\u00eb b\u00ebr\u00eb prej tyre.<\/p>\n<p>P\u00ebr shembull, n\u00eb mesazhin \"jake\" vjen nj\u00eb gif me nj\u00eb personazh t\u00eb njohur nga kartoni Adventure Time. <\/p>\n<p><img decoding=\"async\" alt=\"Udh\u00ebzimi: si t\u00eb b\u00ebni nj\u00eb bot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim\" src=\"\/wp-content\/uploads\/2019\/04\/56bdcb4dde80c032c225726b88417fb4.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nP\u00ebr t\u00eb vazhduar zhvillimin e robotit, p\u00ebr ta lidhur tastier\u00ebn, duhet t\u00eb shikoni shembujt, p\u00ebr shembull, <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/telegraf\/telegraf\/tree\/develop\/docs\/examples\">k\u00ebtu<\/a><\/noindex><\/p>\n<p><b>11. Si t\u00eb p\u00ebrdit\u00ebsoni kodin dhe t\u00eb ri-nisni robotin<\/b><\/p>\n<p>Mos harroni se duhet t\u00eb p\u00ebrdit\u00ebsoni kodin jo vet\u00ebm n\u00eb github, por edhe n\u00eb server. Ta b\u00ebni k\u00ebt\u00eb \u00ebsht\u00eb e thjesht\u00eb \u2014 ndaloni robotin (shtypni ctrl+c),<\/p>\n<p> \u2014 shkruani n\u00eb konsol\u00eb, duke qen\u00eb n\u00eb folderin p\u00ebrkat\u00ebs, <code>git pull<\/code><br \/>\n \u2014 p\u00ebrs\u00ebri nisni robotin me komand\u00ebn <code>node index.js<\/code><\/p>\n<p><b>END<\/b><\/p>\n<p>Shum\u00eb gj\u00ebra, t\u00eb p\u00ebrshkruara n\u00eb k\u00ebt\u00eb dokument, do t\u00eb jen\u00eb super t\u00eb dukshme p\u00ebr programuesit e avancuar. Megjithat\u00eb, kur un\u00eb p\u00ebrpiqesha t\u00eb kaloj\u00eb nj\u00eb hendek p\u00ebr n\u00eb bot\u00ebn e robot\u00ebve, m\u00eb mungonte shum\u00eb nj\u00eb guid\u00eb e till\u00eb. Nj\u00eb guid\u00eb, n\u00eb t\u00eb cil\u00ebn nuk kalohen gj\u00ebrat e dukshme dhe t\u00eb thjeshta p\u00ebr \u00e7do specialist IT. <\/p>\n<p>N\u00eb t\u00eb ardhmen planifikoj t\u00eb shkruaj nj\u00eb postim rreth se si t\u00eb krijoni aplikacionin tuaj t\u00eb par\u00eb n\u00eb ReactNative n\u00eb at\u00eb stil, regjistrohuni!<br \/>\n<br \/>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/447006\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u042f \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043c\u0438\u0440 IT \u043b\u0438\u0448\u044c \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434. \u0421\u0435\u0440\u044c\u0435\u0437\u043d\u043e, \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434 \u044f \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 HTML, \u0430 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0448\u043a\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u043f\u043e Pascal 10-\u043b\u0435\u0442\u043d\u0435\u0439 \u0434\u0430\u0432\u043d\u043e\u0441\u0442\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u044f \u0440\u0435\u0448\u0438\u043b\u0441\u044f \u043f\u043e\u0435\u0445\u0430\u0442\u044c \u0432 IT-\u043b\u0430\u0433\u0435\u0440\u044c, \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u0442\u0430. \u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0440\u044f\u0434 \u043b\u0438 \u0442\u0430\u043a \u0441\u043b\u043e\u0436\u043d\u043e. \u0421 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":23020,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-31044","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u042f \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043c\u0438\u0440 IT \u043b\u0438\u0448\u044c \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434. \u0421\u0435\u0440\u044c\u0435\u0437\u043d\u043e, \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434 \u044f \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 HTML, \u0430 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0448\u043a\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u043f\u043e Pascal 10-\u043b\u0435\u0442\u043d\u0435\u0439 \u0434\u0430\u0432\u043d\u043e\u0441\u0442\u0438.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rukovodstvo-kak-sdelat-prostogo-bota-dlya-telegram-na-js-dlya-novichka-v-programmirovanii\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e: \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043d\u0430 JS \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u042f \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043c\u0438\u0440 IT \u043b\u0438\u0448\u044c \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434. \u0421\u0435\u0440\u044c\u0435\u0437\u043d\u043e, \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434 \u044f \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 HTML, \u0430 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0448\u043a\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u043f\u043e Pascal 10-\u043b\u0435\u0442\u043d\u0435\u0439 \u0434\u0430\u0432\u043d\u043e\u0441\u0442\u0438.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rukovodstvo-kak-sdelat-prostogo-bota-dlya-telegram-na-js-dlya-novichka-v-programmirovanii\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:39:05+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:39:05+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Manuali: si t\u00eb krijoni nj\u00eb robot t\u00eb thjesht\u00eb p\u00ebr Telegram n\u00eb JS p\u00ebr fillestar\u00ebt n\u00eb programim | ProHoster","description":"Kam filluar t\u00eb zhyt\u00ebm n\u00eb bot\u00ebn e IT-s\u00eb vet\u00ebm tre jav\u00eb m\u00eb par\u00eb. Seriousisht, tre jav\u00eb m\u00eb par\u00eb nuk e kuptoja as sintaks\u00ebn e HTML-s\u00eb, nd\u00ebrsa njohja me gjuh\u00ebt programuese p\u00ebrfundonte me programin shkollor n\u00eb Pascal 10 vite m\u00eb par\u00eb.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rukovodstvo-kak-sdelat-prostogo-bota-dlya-telegram-na-js-dlya-novichka-v-programmirovanii","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e: \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043d\u0430 JS \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 | ProHoster","og:description":"\u042f \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043c\u0438\u0440 IT \u043b\u0438\u0448\u044c \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434. \u0421\u0435\u0440\u044c\u0435\u0437\u043d\u043e, \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u043d\u0430\u0437\u0430\u0434 \u044f \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 HTML, \u0430 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0448\u043a\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u043f\u043e Pascal 10-\u043b\u0435\u0442\u043d\u0435\u0439 \u0434\u0430\u0432\u043d\u043e\u0441\u0442\u0438.","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/rukovodstvo-kak-sdelat-prostogo-bota-dlya-telegram-na-js-dlya-novichka-v-programmirovanii","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:39:05+00:00","article:modified_time":"2019-10-31T18:39:05+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"31044","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 04:16:23","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 13:23:43","updated":"2026-01-21 04:16:23","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/31044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=31044"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/31044\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/23020"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=31044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=31044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=31044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}