Node.js 的现代电报瓶框架
< 标题 >
</标题 >
□ 对于 3.x 用户
□ 导言
Bots是专为自动处理消息而设计的 [Telegram] (https://telegram.org) 账户. 用户可以通过在私人或集体聊天中发送命令信息来与bots进行交互. 这些账户是您服务器某处运行代码的接口 。
Telegraf是一个库,它使您可以使用JavaScript或TypeScript开发自己的Telegram bots变得简单.
示例
(原始内容存档于2019-09-29) (英语). ```js const { Telegraf } = require('telegraf') const { message } = require('telegraf/filters')
const bot = new Telegraf(process.env.BOT_TOKEN) bot.start((ctx) => ctx.reply('Welcome')) bot.help((ctx) => ctx.reply('Send me a sticker')) bot.on(message('sticker'), (ctx) => ctx.reply('')) bot.hears('hi', (ctx) => ctx.reply('Hey there')) bot.launch()
// Enable graceful stop process.once('SIGINT', () => bot.stop('SIGINT')) process.once('SIGTERM', () => bot.stop('SIGTERM'))
ZZ1ZZ
新的[`docs repo' (https://github.com/feathers-studio/telegraf-docs/),关于其他的机器人例子。
资源
- [得到stctx.telegram 是一个不同于 bot.telegram 的 Telegram 实例,因此在启动时应用的仪表板永远不会运行
为调试目的改进 TelegramError 中的错误跟踪
在 4.16.3 中,从多部分请求中默默地删除回复参数(使用上传的媒体发送视频/照片) — 存在修复,但从未发布
[FR] 允许更改请求超时
如果未使用默认会话,则会话为未定义
支持 API v8.0
使用 @telegraf/types 的最新版本
删除 `node-fetch` 依赖,改用原生的 `fetch`
ctx.scene.state 的类型定义
类 `SceneContextScene` 的输入格式不正确