Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
TohidEq authored Feb 28, 2024
1 parent 085ea0a commit 1a6ce08
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Lightweight Telegram API framework for Node.js

### Installation

```
```shellscript
npm install telenode-js
```

Expand All @@ -44,14 +44,14 @@ so.
<br>
If you do choose to work with these packages, install them manually:

```
```shellscript
npm install express dotenv
```

Or for serverless deployments install express as a dev dependency (to use in your local development environment)
instead:

```
```shellscript
npm install express --save-dev
```

Expand All @@ -70,13 +70,13 @@ You also can provide the secret token parameter if you choose to.

Then you can execute the following command:

```
```shellscript
npx set-webhook
```

* If you want to delete a webhook use the command:

```
```shellscript
npx delete-webhook
```

Expand All @@ -97,7 +97,7 @@ Note that long polling is usually not recommended and webhook is preferred for m

### Usage

```
```js
const Telenode = require('telenode-js');
require('dotenv').config();

Expand Down Expand Up @@ -152,7 +152,7 @@ installed `Telenode`).
<br>
You can run an example from the `telenode-js` directory inside `node_modules` by using the command:

```
```shellscript
npm run dev --file=<example>
```

Expand All @@ -171,15 +171,15 @@ on VMs / containers / on-premise.
You can pass an object as options for `createServer`. Currently, it supports `port` and `unauthorizedCallback` (if you
use secret token) - e.g:

```
```js
bot.createServer({ port: 4000 }) // the default is 3000
```

In the other hand, if you want to deploy on serverless backend you need to use `bot.telenodeHandler` method and pass to
it the request object.
You will probably have something like this:

```
```js
functions.https.onCall((req, res) => {
const secretToken = req.headers['x-telegram-bot-api-secret-token'];
bot.telenodeHandler(req.body, secretToken, unauthorizedHandler);
Expand Down

0 comments on commit 1a6ce08

Please sign in to comment.