0.0.34 • Published 8 months ago
telegram_client v0.0.34
Telegram Client node js
Quick Start
Bot
var { Telegram } = require("../src/index"); var lib = new Telegram("token_bot"); var tg = lib.api; function setWebhook() { var url = "url_deployc"; var option = { "url": url }; var data = tg.request("setWebhook", option); console.log(data); } function doGet(e) { return ContentService.createTextOutput("hello"); } function doPost(e) { if (e.postData.type == "application/json") { var update = JSON.parse(e.postData.contents); if (update) { if (update.message) { var msg = update.message; if (text) { if (msg.text == "/start") { var option = { "chat_id": msg.chat.id, "text": "Hay this start message" }; return tg.request("sendMessage", option); } else { var option = { "chat_id": msg.chat.id, "text": "echo " + text }; return tg.request("sendMessage", option); } } else { var option = { "chat_id": msg.chat.id, "text": "Hello you" }; return tg.request("sendMessage", option); } } } } }
Userbot
var { Telegram } = require("../src/index"); var lib = new Telegram("paste_your_tokenhere", { "type": "user", "api": "api_userbot" }); var tg = lib.api; function getToken(){ var data = lib.loginUser("phone_number_int", "url_api"); console.log(JSON.stringify(data, null, 2)); } function login(){ var option = { "code": "code_telegram" }; var data = tg.request("authcode", option); console.log(JSON.stringify(data, null, 2)); } function setWebhook() { var url = "urlDeploy"; var option = { "url": url }; var data = tg.request("setWebhook", option); console.log(data); } function doGet(e) { return ContentService.createTextOutput("hello"); } function doPost(e) { if (e.postData.type == "application/json") { var update = JSON.parse(e.postData.contents); if (update) { if (update.message) { var msg = update.message; if (text) { if (msg.text == "/start") { var option = { "chat_id": msg.chat.id, "text": "Hay this start message" }; return tg.request("sendMessage", option); } else { var option = { "chat_id": msg.chat.id, "text": "echo " + text }; return tg.request("sendMessage", option); } } else { var option = { "chat_id": msg.chat.id, "text": "Hello you" }; return tg.request ("sendMessage", option); } } } } }
0.0.30
9 months ago
0.0.31
8 months ago
0.0.32
8 months ago
0.0.33
8 months ago
0.0.34
8 months ago
0.0.29
1 year ago
0.0.28
2 years ago
0.0.20
2 years ago
0.0.21
2 years ago
0.0.22
2 years ago
0.0.23
2 years ago
0.0.24
2 years ago
0.0.25
2 years ago
0.0.16
2 years ago
0.0.17
2 years ago
0.0.18
2 years ago
0.0.19
2 years ago
0.0.26
2 years ago
0.0.27
2 years ago
0.0.14
2 years ago
0.0.15
2 years ago
0.0.10
2 years ago
0.0.11
2 years ago
0.0.12
2 years ago
0.0.13
2 years ago
0.0.3
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago
0.0.0
2 years ago