Skip to content

Commit 9d33f1c

Browse files
committed
update docs
1 parent 9696d6e commit 9d33f1c

File tree

7 files changed

+54
-29
lines changed

7 files changed

+54
-29
lines changed

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ An elegant, Object-Oriented, reliable PHP Telegram Bot Interface
66
## Features
77

88
- All the Methods and Types implemented in Bot Api as of September 2020.
9+
- Typed Properties for each Object (with description too)
910
- Exactly like Bot Api (so you don't really need documentation)
1011
- [JSON Payload](https://docs.novagram.ga/construct.html#json-payload) implementation, for a faster Bot.
1112
- Auto JSON-Encode in parameters that require it (when passing an array)
@@ -15,24 +16,41 @@ An elegant, Object-Oriented, reliable PHP Telegram Bot Interface
1516
- Telegram IP check, in order to protect from Fake Update attacks (with Cloudflare too!)
1617
- Optional Telegram Exceptions, for handling Telegram API Errors as you like.
1718
- Global Parse Mode, so you won't need to specify it in each method
19+
- Global disable_web_page_preview, so you won't need to specify it in each method
20+
- Global disable_notification, so you won't need to specify it in each method
1821
- Ability to [retrieve DC](https://docs.novagram.ga/docs.html#getUsernameDC) of Users that has an Username
1922
- Usable with Composer, but also in Hosting Panels that doesn't provide it, with PHPEasyGit
2023

2124
## Being implemented
2225

2326
- Database
2427
- Conversations
28+
- Message Entities -> HTML
2529

2630
## Upcoming Features
31+
32+
- non-dinamic object methods
2733
- Database
2834
- Conversations
2935
- TTL in Conversations
30-
- disable_web_page_preview in settings
31-
- disable_notification in settings
32-
- Long Polling
36+
- Long Polling (async)
37+
- Message Entities to Markdown
38+
39+
### Installation via [Composer](https://getcomposer.org)
40+
If Composer is installed globally:
41+
```
42+
composer require skrtdev/novagram
43+
```
44+
45+
If Composer is installed in the current directory:
46+
```
47+
php composer.phar require skrtdev/novagram
48+
```
3349

34-
### Installation via Composer
35-
`composer require skrtdev/novagram`
50+
After Installation, include NovaGram with:
51+
```php
52+
require __DIR__ . '/vendor/autoload.php';
53+
```
3654

3755
### Example
3856
An example code of a simple bot that just forwards back what you send.

docs/construct.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ $token is the Bot's token generated by @BotFather
1111
$settings is an array which contains some NovaGram configurations.
1212
> None of these fields is required
1313
14-
| key | value | default | description |
15-
|------------------|---------|---------|----------------------------------------------------------------------------------------------------|
16-
| json_payload | boolean | true | Whether or not print json payload |
17-
| log_updates | integer | false | Chat id where raw json updates will be sent (set to false to disable) |
18-
| debug | integer | false | Chat id where debug logs will be sent if an api error occurs (set to false to disable) |
19-
| disable_ip_check | boolean | false | Whether or not disable telegram ip check (could be useful in case of reverse proxy, such as ngrok) |
20-
| disable_webhook | boolean | false | Whether or not disable update receiving |
21-
| parse_mode | string | no | Parse mode that will be passed to all the methods that require it if not provided |
22-
| exceptions | bool | true | Whether or not throw \skrtdev\Telegram\Exception(s) when API Errors occurs |
23-
| database | array | no | [Database](database.md) connection info |
14+
| key | value | default | description |
15+
|--------------------------|---------|---------|----------------------------------------------------------------------------------------------------|
16+
| json_payload | boolean | true | Whether or not print json payload |
17+
| log_updates | integer | false | Chat id where raw json updates will be sent (set to false to disable) |
18+
| debug | integer | false | Chat id where debug logs will be sent if an api error occurs (set to false to disable) |
19+
| disable_ip_check | boolean | false | Whether or not disable telegram ip check (could be useful in case of reverse proxy, such as ngrok) |
20+
| disable_webhook | boolean | false | Whether or not disable update receiving |
21+
| parse_mode | string | no | Default `parse_mode` for methods that require it |
22+
| disable_web_page_preview | string | no | Default `disable_web_page_preview` for methods that require it |
23+
| disable_notification | string | no | Default `disable_notification` for methods that require it |
24+
| exceptions | bool | true | Whether or not throw \skrtdev\Telegram\Exception(s) when API Errors occurs |
25+
| database | array | no | [Database](database.md) connection info |
2426

2527
### JSON Payload
2628

2729
JSON Payload is a different way to make API Calls.
2830
In Webhooks, you can print a JSON-Encoded request directly in the webhook page, that will be processed by Telegram afterwards, without effectively making an API Call.
29-
> Only One API Call can use JSON Payload in the same execution contest
31+
> Only One API Call can use JSON Payload simultaneously
3032
3133
#### Pro:
3234
* Since no HTTP Request is involved, using Payload speeds up the bot.

docs/index.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ An elegant, Object-Oriented, reliable PHP Telegram Bot Interface
33

44
## Features
55

6-
- All the Methods and Types implemented in Bot Api as of August 2020.
6+
- All the Methods and Types implemented in Bot Api as of September 2020.
7+
- Typed Properties for each Object (with description too)
78
- Exactly like Bot Api (so you don't really need documentation)
89
- [JSON Payload](https://docs.novagram.ga/construct.html#json-payload) implementation, for a faster Bot.
910
- Auto JSON-Encode in parameters that require it (when passing an array)
10-
- [Object Methods](https://docs.novagram.ga/objects.html) for a smarter code (and a nice syntax)
11-
- [JSON based](https://github.com/skrtdev/NovaGram/blob/master/src/json.json), so all methods and types are dinamically created.
11+
- [Object Methods](https://docs.novagram.ga/objects.html#objects-methods) for a smarter code (and a nice syntax)
12+
- [JSON based](https://github.com/skrtdev/NovaGram/blob/master/src/novagram/json.json), so all methods and types are dinamically created.
1213
- Native Debug, so you will be able to fix bugs immediately.
1314
- Telegram IP check, in order to protect from Fake Update attacks (with Cloudflare too!)
1415
- Optional Telegram Exceptions, for handling Telegram API Errors as you like.
1516
- Global Parse Mode, so you won't need to specify it in each method
17+
- Global disable_web_page_preview, so you won't need to specify it in each method
18+
- Global disable_notification, so you won't need to specify it in each method
1619
- Ability to [retrieve DC](https://docs.novagram.ga/docs.html#getUsernameDC) of Users that has an Username
1720
- Usable with Composer, but also in Hosting Panels that doesn't provide it, with PHPEasyGit
1821

docs/requests.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ $Bot->sendMessage([
1515
"chat_id" => 01234567,
1616
"text" => "message_text"
1717
]);
18+
// same as
19+
$Bot->sendMessage(01234567, "message_text");
1820
```
1921

2022
This will send a Message in the specified chat with the specified text.
@@ -24,16 +26,12 @@ This will send a Message in the specified chat with the specified text.
2426
If JSON Payload is enabled in Bot's settings, you can make a Payload request.
2527
When making an API Call, pass `true` in `$payload` (or leave default), and it will be made as payload.
2628

27-
**NOTE: Only one API Call can be made as JSON Payload in the same execution contest.
28-
If there are more than one Payload API Call, only the first one will be made as Payload, while others will be made normally**
29+
**NOTE: Attempt to use payload multiple times will result in a `Trying to use JSON Payload more than one time` Notice**
2930

30-
> Payload API Calls will be executed after the script exits
31+
> Payload API Calls will be executed when script execution finishes
3132
3233
```php
33-
$Bot->sendMessage([
34-
"chat_id" => 01234567,
35-
"text" => "This is a JSON Payload"
36-
], true);
34+
$Bot->sendMessage(01234567, "This is a JSON Payload", true);
3735
```
3836

3937
Argument `$payload` is `true`, so this will be made as Payload (if a Payload wasn't made yet).

docs/start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $message = $update->message;
2020
$chat = $message->chat;
2121
$user = $message->from;
2222

23-
$update->message->forward([], true); // forward() with no parameters will forward the Message back to the sender
23+
$message->forward([], true); // forward() with no parameters will forward the Message back to the sender
2424
```
2525

2626
Using `"json_payload" => true` and `true` in forward method, the api call will be print as payload, making the bot faster. Only one Api Call can use json payload

examples/EchoBot.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
require "../PHPEasyGit/autoload.php";
77
*/
88

9-
$Bot = new NovaGram\Bot("YOUR_TOKEN", [
9+
use skrtdev\NovaGram\Bot;
10+
11+
$Bot = new Bot("YOUR_TOKEN", [
1012
"debug" => YOURCHATID, // chat id where debug will be sent when api errors occurs
1113
"json_payload" => true, // allow use of json payload (without this, all the api calls will be made normally, even if they should be made as json payload)
1214
]);

examples/EncoderBot.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
require "../PHPEasyGit/autoload.php";
77
*/
88

9-
$Bot = new NovaGram\Bot("YOUR_TOKEN", [
9+
use skrtdev\NovaGram\Bot;
10+
11+
$Bot = new Bot("YOUR_TOKEN", [
1012
"debug" => YOURCHATID, // chat id where debug will be sent when api errors occurs
1113
"json_payload" => true, // allow use of json payload (without this, all the api calls will be made normally, even if they should be made as json payload)
1214
"parse_mode" => "HTML" // will set parse_mode automatically in methods that require it if not providedå

0 commit comments

Comments
 (0)