【文件属性】:
文件名称:node-telegram-bot-api:NodeJS的电报Bot API
文件大小:736KB
文件格式:ZIP
更新时间:2021-01-30 13:34:57
nodejs api bot telegram chatbot
Node.js电报Bot API
与官方交互的Node.js模块。
安装
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 Telegr