上传者: 42123237
|
上传时间: 2023-05-12 19:21:56
|
文件大小: 736KB
|
文件类型: ZIP
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