@tgify/tgify 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
<p>Modern Telegram Bot API framework for Node.js</p>
|
|
7
7
|
|
|
8
|
+
<i>This is a fork of the Telegraf library and its continuation as I envision it. I will do my best to maintain full compatibility so that anyone who lacks certain functionality can migrate to this solution quickly and without friction.</i>
|
|
9
|
+
|
|
8
10
|
<a href="https://core.telegram.org/bots/api">
|
|
9
11
|
<img src="https://img.shields.io/badge/Bot%20API-v7.1-f36caf.svg?style=flat-square" alt="Bot API Version" />
|
|
10
12
|
</a>
|
|
11
|
-
<a href="https://packagephobia.com/result?p
|
|
12
|
-
<img src="https://flat.badgen.net/packagephobia/install/tgify" alt="install size" />
|
|
13
|
+
<a href="https://packagephobia.com/result?p=@tgify/tgify,node-telegram-bot-api">
|
|
14
|
+
<img src="https://flat.badgen.net/packagephobia/install/@tgify/tgify" alt="install size" />
|
|
13
15
|
</a>
|
|
14
16
|
<a href="https://github.com/IATNAOD/tgify">
|
|
15
17
|
<img src="https://img.shields.io/github/languages/top/IATNAOD/tgify?style=flat-square&logo=github" alt="GitHub top language" />
|
|
@@ -30,7 +32,7 @@ Tgify is a library that makes it simple for you to develop your own Telegram bot
|
|
|
30
32
|
|
|
31
33
|
- Full [Telegram Bot API 7.1](https://core.telegram.org/bots/api) support
|
|
32
34
|
- [Excellent TypeScript typings](https://github.com/IATNAOD/tgify/releases/tag/v4.0.0)
|
|
33
|
-
- [Lightweight](https://packagephobia.com/result?p
|
|
35
|
+
- [Lightweight](https://packagephobia.com/result?p=@tgify/tgify,node-telegram-bot-api)
|
|
34
36
|
- [AWS **λ**](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html)
|
|
35
37
|
/ [Firebase](https://firebase.google.com/products/functions/)
|
|
36
38
|
/ [Glitch](https://glitch.com/edit/#!/dashing-light)
|
|
@@ -42,8 +44,8 @@ Tgify is a library that makes it simple for you to develop your own Telegram bot
|
|
|
42
44
|
### Example
|
|
43
45
|
|
|
44
46
|
```js
|
|
45
|
-
const { Telegraf } = require('
|
|
46
|
-
const { message } = require('
|
|
47
|
+
const { Telegraf } = require('@tgify/tgify')
|
|
48
|
+
const { message } = require('@tgify/tgify/filters')
|
|
47
49
|
|
|
48
50
|
const bot = new Telegraf(process.env.BOT_TOKEN)
|
|
49
51
|
bot.start((ctx) => ctx.reply('Welcome'))
|
|
@@ -58,7 +60,7 @@ process.once('SIGTERM', () => bot.stop('SIGTERM'))
|
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
```js
|
|
61
|
-
const { Telegraf } = require('
|
|
63
|
+
const { Telegraf } = require('@tgify/tgify')
|
|
62
64
|
|
|
63
65
|
const bot = new Telegraf(process.env.BOT_TOKEN)
|
|
64
66
|
bot.command('oldschool', (ctx) => ctx.reply('Hello'))
|
|
@@ -76,7 +78,7 @@ For additional bot examples see the new [`docs repo`](https://github.com/feather
|
|
|
76
78
|
|
|
77
79
|
- [Getting started](#getting-started)
|
|
78
80
|
- [GitHub Discussions](https://github.com/IATNAOD/tgify/discussions)
|
|
79
|
-
- [Dependent repositories](https://libraries.io/npm/tgify/dependent_repositories)
|
|
81
|
+
- [Dependent repositories](https://libraries.io/npm/@tgify/tgify/dependent_repositories)
|
|
80
82
|
|
|
81
83
|
## Getting started
|
|
82
84
|
|
|
@@ -91,19 +93,19 @@ BotFather will give you a _token_, something like `123456789:AbCdefGhIJKlmNoPQRs
|
|
|
91
93
|
### Installation
|
|
92
94
|
|
|
93
95
|
```shellscript
|
|
94
|
-
$ npm install tgify
|
|
96
|
+
$ npm install @tgify/tgify
|
|
95
97
|
```
|
|
96
98
|
|
|
97
99
|
or
|
|
98
100
|
|
|
99
101
|
```shellscript
|
|
100
|
-
$ yarn add tgify
|
|
102
|
+
$ yarn add @tgify/tgify
|
|
101
103
|
```
|
|
102
104
|
|
|
103
105
|
or
|
|
104
106
|
|
|
105
107
|
```shellscript
|
|
106
|
-
$ pnpm add tgify
|
|
108
|
+
$ pnpm add @tgify/tgify
|
|
107
109
|
```
|
|
108
110
|
|
|
109
111
|
### `Telegraf` class
|
|
@@ -124,8 +126,8 @@ This is probably the class you'll be using the most.
|
|
|
124
126
|
#### Shorthand methods
|
|
125
127
|
|
|
126
128
|
```js
|
|
127
|
-
import { Telegraf } from '
|
|
128
|
-
import { message } from '
|
|
129
|
+
import { Telegraf } from '@tgify/tgify'
|
|
130
|
+
import { message } from '@tgify/tgify/filters'
|
|
129
131
|
|
|
130
132
|
const bot = new Telegraf(process.env.BOT_TOKEN)
|
|
131
133
|
|
|
@@ -174,8 +176,8 @@ process.once('SIGTERM', () => bot.stop('SIGTERM'))
|
|
|
174
176
|
### Webhooks
|
|
175
177
|
|
|
176
178
|
```TS
|
|
177
|
-
import { Telegraf } from "
|
|
178
|
-
import { message } from '
|
|
179
|
+
import { Telegraf } from "@tgify/tgify";
|
|
180
|
+
import { message } from '@tgify/tgify/filters';
|
|
179
181
|
|
|
180
182
|
const bot = new Telegraf(token);
|
|
181
183
|
|
|
@@ -285,8 +287,8 @@ As in Koa and some other middleware-based libraries,
|
|
|
285
287
|
`await next()` will call next middleware and wait for it to finish:
|
|
286
288
|
|
|
287
289
|
```TS
|
|
288
|
-
import { Telegraf } from '
|
|
289
|
-
import { message } from '
|
|
290
|
+
import { Telegraf } from '@tgify/tgify';
|
|
291
|
+
import { message } from '@tgify/tgify/filters';
|
|
290
292
|
|
|
291
293
|
const bot = new Telegraf(process.env.BOT_TOKEN);
|
|
292
294
|
|
|
@@ -335,7 +337,7 @@ Consequently, you can change the type of `ctx` to fit your needs in order for yo
|
|
|
335
337
|
This is done through Generics:
|
|
336
338
|
|
|
337
339
|
```ts
|
|
338
|
-
import { Context, Telegraf } from '
|
|
340
|
+
import { Context, Telegraf } from '@tgify/tgify'
|
|
339
341
|
|
|
340
342
|
// Define your own context type
|
|
341
343
|
interface MyContext extends Context {
|