Skip to content

Commit

Permalink
Version 0.70.0
Browse files Browse the repository at this point in the history
  • Loading branch information
noplanman committed Dec 21, 2020
1 parent 2841a5d commit 7ecda69
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
23 changes: 17 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Notes
- [:ledger: View file changes][Unreleased]
### Added
- Bot API 5.0 (Big update!).
### Changed
- Upgrade code to PHP 7.3. (#1136, )
- Speed up clean query (@dva-re) (#1139)
- Various code prettifications (@akalongman) (#1140, #1141, #1142, #1143)
### Deprecated
### Removed
### Fixed
### Security
- Minimum PHP 7.3. (#1136, )

## [0.70.0] - 2020-12-21
### Notes
- [:ledger: View file changes][0.70.0][:page_with_curl: DB migration script][0.70.0-sql-migration]
- [:exclamation:][0.70.0-bc-minimum-php-73] PHP 7.3+ required, so make sure your code is up to date with correct types!
### Added
- Bot API 5.0 (Big update!). (#1147)
### Changed
- Upgrade code to PHP 7.3. (#1136, #1158)
- Speed up `/clean` query. (@dva-re) (#1139)
- Various code prettifications. (@akalongman) (#1140, #1141, #1142, #1143)
### Security
- Minimum PHP 7.3, allow PHP 8.0. (#1136, #1158)

## [0.64.0] - 2020-10-04
### Notes
Expand Down Expand Up @@ -341,7 +349,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
- [:ledger: View file changes][0.45.0][:page_with_curl: DB migration script][0.45.0-sql-migration]
### Added
- Documents can be sent by providing its contents via Psr7 stream (as opposed to passing a file path).
- Allow setting a custom Guzzle HTTP Client for requests (#511).
- Allow setting a custom Guzzle HTTP Client for requests (#511, #536).
- First implementations towards Bots API 3.0.
### Changed
- [:exclamation:][0.45.0-bc-chats-params-array] `Request::sendToActiveChats` and `DB::selectChats` now accept parameters as an options array and allow selecting of channels.
Expand Down Expand Up @@ -471,6 +479,8 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Deprecated
- Move `hideKeyboard` to `removeKeyboard`.

[0.70.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.64.0-0.70.0.sql
[0.70.0-bc-minimum-php-73]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#minimum-php-73
[0.63.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.62.0-0.63.0.sql
[0.63.0-bc-static-method-entityescapemarkdown]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#static-method-entityescapemarkdown
[0.62.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.61.1-0.62.0.sql
Expand Down Expand Up @@ -501,6 +511,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
[Tidelift]: https://tidelift.com/subscription/pkg/packagist-longman-telegram-bot?utm_source=packagist-longman-telegram-bot&utm_medium=referral&utm_campaign=changelog

[Unreleased]: https://github.com/php-telegram-bot/core/compare/master...develop
[0.70.0]: https://github.com/php-telegram-bot/core/compare/0.64.0...0.70.0
[0.64.0]: https://github.com/php-telegram-bot/core/compare/0.63.1...0.64.0
[0.63.1]: https://github.com/php-telegram-bot/core/compare/0.63.0...0.63.1
[0.63.0]: https://github.com/php-telegram-bot/core/compare/0.62.0...0.63.0
Expand Down
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Create *composer.json* file
"name": "yourproject/yourproject",
"type": "project",
"require": {
"php": ">=5.5",
"php": ">=7.3",
"longman/telegram-bot": "*"
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ Note: For a more detailed explanation, head over to the [example-bot repository]
In order to set a [Webhook][api-setwebhook] you need a server with HTTPS and composer support.
(For a [self signed certificate](#self-signed-certificate) you need to add some extra code)

Create [*set.php*][set.php] with the following contents:
Create *[set.php]* with the following contents:
```php
<?php
// Load composer
Expand Down Expand Up @@ -235,7 +235,7 @@ try {
Open your *set.php* via the browser to register the webhook with Telegram.
You should see `Webhook was set`.

Now, create [*hook.php*][hook.php] with the following contents:
Now, create *[hook.php]* with the following contents:
```php
<?php
// Load composer
Expand All @@ -259,20 +259,20 @@ try {

### Self Signed Certificate

To upload the certificate, add the certificate path as a parameter in *set.php*:
Upload the certificate and add the path as a parameter in *set.php*:
```php
$result = $telegram->setWebhook($hook_url, ['certificate' => '/path/to/certificate']);
```

### Unset Webhook

Edit [*unset.php*][unset.php] with your bot credentials and execute it.
Edit *[unset.php]* with your bot credentials and execute it.

## getUpdates installation

For best performance, the MySQL database should be enabled for the `getUpdates` method!

Create [*getUpdatesCLI.php*][getUpdatesCLI.php] with the following contents:
Create *[getUpdatesCLI.php]* with the following contents:
```php
#!/usr/bin/env php
<?php
Expand Down Expand Up @@ -325,15 +325,15 @@ $telegram->useGetUpdatesWithoutDatabase();

### Types

All types are implemented according to Telegram API (20 January 2016).
All types are implemented according to Telegram API 5.0 (November 2020).

### Inline Query

Full support for inline query according to Telegram API (20 January 2016).
Full support for inline query according to Telegram API 5.0 (November 2020).

### Methods

All methods are implemented according to Telegram API (20 January 2016).
All methods are implemented according to Telegram API 5.0 (November 2020).

#### Send Message

Expand Down Expand Up @@ -376,7 +376,7 @@ $result = Request::sendPhoto([
```

*sendAudio*, *sendDocument*, *sendAnimation*, *sendSticker*, *sendVideo*, *sendVoice* and *sendVideoNote* all work in the same way, just check the [API documentation](https://core.telegram.org/bots/api#sendphoto) for the exact usage.
See the [*ImageCommand.php*][ImageCommand.php] for a full example.
See the *[ImageCommand.php]* for a full example.

#### Send Chat Action

Expand All @@ -389,11 +389,11 @@ Request::sendChatAction([

#### getUserProfilePhoto

Retrieve the user photo, see [*WhoamiCommand.php*][WhoamiCommand.php] for a full example.
Retrieve the user photo. (see *[WhoamiCommand.php]* for a full example)

#### getFile and downloadFile

Get the file path and download it, see [*WhoamiCommand.php*][WhoamiCommand.php] for a full example.
Get the file path and download it. (see *[WhoamiCommand.php]* for a full example)

#### Send message to all active chats

Expand All @@ -418,6 +418,7 @@ You can also broadcast a message to users, from the private chat with your bot.
#### Filter Update

Update processing can be allowed or denied by defining a custom update filter.

Let's say we only want to allow messages from a user with ID 428, we can do the following before handling the request:

```php
Expand All @@ -438,7 +439,7 @@ The reason for denying an update can be defined with the `$reason` parameter. Th

### MySQL storage (Recommended)

If you want to save messages/users/chats for further usage in commands, create a new database (`utf8mb4_unicode_520_ci`), import *structure.sql* and enable MySQL support after object creation and BEFORE `handle()` method:
If you want to save messages/users/chats for further usage in commands, create a new database (`utf8mb4_unicode_520_ci`), import *[structure.sql]* and enable MySQL support BEFORE `handle()` method:

```php
$mysql_credentials = [
Expand Down Expand Up @@ -466,7 +467,7 @@ It is possible to provide the library with an external MySQL PDO connection.
Here's how to configure it:

```php
$telegram->enableExternalMySql($external_pdo_connection)
$telegram->enableExternalMySql($external_pdo_connection);
//$telegram->enableExternalMySql($external_pdo_connection, $table_prefix)
```
### Channels Support
Expand Down Expand Up @@ -535,7 +536,7 @@ Enabling this feature, the bot admin can perform some super user commands like:
- Post any content to your channels */sendtochannel*
- Inspect a user or a chat with */whois*

Take a look at all default admin commands stored in the [*src/Commands/AdminCommands/*][AdminCommands-folder] folder.
Take a look at all default admin commands stored in the *[src/Commands/AdminCommands/][AdminCommands-folder]* folder.

#### Set Admins

Expand All @@ -551,14 +552,14 @@ $telegram->enableAdmins([
other_telegram_user_id,
]);
```
Telegram user id can be retrieved with the [*/whoami*][WhoamiCommand.php] command.
Telegram user id can be retrieved with the *[/whoami][WhoamiCommand.php]* command.

#### Channel Administration

To enable this feature follow these steps:
- Add your bot as channel administrator, this can be done with any Telegram client.
- Enable admin interface for your user as explained in the admin section above.
- Enter your channel name as a parameter for the [*/sendtochannel*][SendtochannelCommand.php] command:
- Enter your channel name as a parameter for the *[/sendtochannel][SendtochannelCommand.php]* command:
```php
$telegram->setCommandConfig('sendtochannel', [
'your_channel' => [
Expand Down Expand Up @@ -668,7 +669,8 @@ Credit list in [CREDITS](CREDITS)
[WhoamiCommand.php]: https://github.com/php-telegram-bot/example-bot/blob/master/Commands/WhoamiCommand.php "example /whoami command"
[HelpCommand.php]: https://github.com/php-telegram-bot/example-bot/blob/master/Commands/HelpCommand.php "example /help command"
[SendtochannelCommand.php]: https://github.com/php-telegram-bot/core/blob/master/src/Commands/AdminCommands/SendtochannelCommand.php "/sendtochannel admin command"
[DB::selectChats]: https://github.com/php-telegram-bot/core/blob/0.46.0/src/DB.php#L1000 "DB::selectChats() parameters"
[DB::selectChats]: https://github.com/php-telegram-bot/core/blob/0.70.0/src/DB.php#L1148 "DB::selectChats() parameters"
[structure.sql]: https://github.com/php-telegram-bot/core/blob/master/structure.sql "DB structure for importing"
[Wiki]: https://github.com/php-telegram-bot/core/wiki "PHP Telegram Bot Wiki"
[wiki-create-your-own-commands]: https://github.com/php-telegram-bot/core/wiki/Create-your-own-commands "Create your own commands"
[issues]: https://github.com/php-telegram-bot/core/issues "PHP Telegram Bot Issues"
Expand Down
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Telegram
*
* @var string
*/
protected $version = '0.64.0';
protected $version = '0.70.0';

/**
* Telegram API key
Expand Down
File renamed without changes.

0 comments on commit 7ecda69

Please sign in to comment.