Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Telegram Bots for KyivJS
Search
Andrei Sierkov
February 11, 2017
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Telegram Bots for KyivJS
Andrei Sierkov
February 11, 2017
More Decks by Andrei Sierkov
See All by Andrei Sierkov
Bots: Basics @ Javascript Tonight, 2017.09.22
viattik
0
200
Facebook API for Kottans
viattik
0
140
ECMAScript 2016+
viattik
0
94
Other Decks in Programming
See All in Programming
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
カツオ、ご期待ください
suneo3476
0
190
SREの越境 / SRE Collaboration
y0hgi
2
310
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
Workers Cache を知る
syumai
0
360
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Railsバージョンを4倍にした話
optim
0
360
Event is what happens
moro
2
780
R8 の設定見直しでアプリサイズ削減
andpad
0
220
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
How to Ace a Technical Interview
jacobian
280
24k
From π to Pie charts
rasagy
1
400
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
The Pragmatic Product Professional
lauravandoore
37
7.5k
A better future with KSS
kneath
240
18k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
950
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
780
Transcript
Telegram Bots
WHOAMI Front End Lead @ Rails Reactor github.com/viattik twitter.com/vi_attik
bots, bots, bots
И чо?
Creating Bot
Creating Bot var TelegramBot = require('node-telegram-bot-api'), telegram = new TelegramBot("YOUR_BOT_TOKEN",
{ polling: true }); telegram.on("text", (message) => { telegram.sendMessage(message.chat.id, "Hello world"); });
Creating Bot function getReply(text) { if (text.includes('ничо')) { return 'Вот
и хорошо'; } else if (text.includes('/start')) { return 'Давай, расскажи мне о своих проблемах.'; } else { return 'И чо?'; } } telegram.on("text", (message) => { const text = message.text.toLowerCase(); const reply = getReply(text); telegram.sendMessage(message.chat.id, reply, { parse_mode: "Markdown" }); });
None
Support Bot // Telegram sent message telegram.on("text", (message) => {
const text = message.text; const id = message.chat.id; let chat = chats[id]; if (!chat && text === '/support') { chats[id] = chat = { from: message.from, messages: [] } } else if (chat && text === '/end_support') { chats[id] = chat = undefined; } if(chat) { chat.messages.push({ sender: 0, text }); } syncToBrowser(); });
Support Bot wsServer.on('request', function(request) { let connection = request.accept(null, request.origin);
connections.push(connection); connection.sendUTF(JSON.stringify(chats)); // Browser sent message connection.on('message', function(message) { const { id, text } = JSON.parse(message.utf8Data); const chat = chats[id]; if (!chat) { return; } chat.messages.push({ sender: 1, text }); telegram.sendMessage(id, text); }); });
DEMO https://youtu.be/1xhgMeV4ZCs
Inline Bots
Links https://core.telegram.org/bots https://telegram.me/botfather https://github.com/viattik/support-demo-bot https://medium.com/codeday-by-studentrnd/intro-to-node-js- making-a-telegram-bot-964b8cfe1129