npm i node-telegram-bot-api
const TelegramBot = require('node-telegram-bot-api');
// replace the value below with the Telegram token you receive from @BotFather
const token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
// Matches "/echo [whatever]"
bot.onText(/\/echo (.+)/, (msg, match) => {
// 'msg' is the received Message from Telegram
// 'match' is the result of executing the regexp above on the text content
// of the message
const chatId = msg.chat.id;
const resp = match[1]; // the captured "whatever"
// send back the matched "whatever" to the chat
bot.sendMessage(chatId, resp);
});
// Listen for any kind of message. There are different kinds of
// messages.
bot.on('message', (msg) => {
const chatId = msg.chat.id;
// send a message to the chat acknowledging receipt of their message
bot.sendMessage(chatId, 'Received your message');
});
Note: Development is done against the master branch.Code for the latest release resides on the release branch.Experimental features reside on the experimental branch.
We thank all the developers in the Open-Source community who continuouslytake their time and effort in advancing this project.See our list of contributors.
We have a Telegram channel where we post updates onthe Project. Head over and subscribe!
We also have a Telegram group to discuss issues related to this library.
Some things built using this library that might interest you:
The MIT License (MIT)
Copyright © 2019 Yago
安装傻妞 (最新版尚未支持日志芝士,故安装旧版) 一键拉取傻妞文件 1.一键安装傻妞,一键安装命令如下。 记得修改这脚本里的管理qq cd && mkdir sillyGirl && cd && s=/etc/sillyGirl;if [ ! -d ];then mkdir ; fi; echo "set qq masters 你操控机器人的QQ号" > /etc/sillyGirl/set
Telegram Shell Bot 是一个远程执行 Shell 命令的 Telegram 机器人。 Telegram Shell Bot 目前提供的功能有: 鉴权,只有在许可列表里的用户才能对机器人发号指令。 支持命令的黑白名单。注:为避免使用 ; 跳过命令检查,类似的字符也应当加到字符串黑名单中。 Shell 命令的执行,如 ls、cat、ps 等。 长时间执行命令的管理。如执行 wget 操
We have made you a wrapper you can't refuse We have a vibrant community of developers helping each other in our Telegram group. Join us! Stay tuned for library updates and new releases on our Telegram
Telegram Bot API - PHP SDK Telegram Bot PHP SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box. Telegram Bot API is an HTTP-based interface created for developers keen o
telegram-github-search-bot A Github search bot for Telegram. This bot can search users, repos and issues and works well both in normal and inline mode. Installation: 1- Create a bot by talking with Bo
我试图建立一个电报机器人使用python与python-telegram-bot包和它的工作与文本命令现在我试图发送一个语音命令给用户… 生成了mp3文件,那么如何将该语音文件发送给用户呢?
Telegram引入了Bot API 5.1,在更新类中使用了ChatMemberUpdated和和字段。 但是,如果我使用的是ConversationHandler,如何跟踪用户停止机器人的时间呢? 以前,我的机器人在等待/cancel或/stop这样的命令。 现在如何使用ChatMemberUpdated正确地做到这一点?