Update docs
This commit is contained in:
parent
7a8bc74239
commit
e44490c9dc
@ -653,4 +653,5 @@ $loop->start();
|
|||||||
Unlike `GenericLoop`, the callback will **not** be bound to the GenericLoop instance.
|
Unlike `GenericLoop`, the callback will **not** be bound to the GenericLoop instance.
|
||||||
You can still command the loop by using the pause/waitSignal methods from the outside or by capturing the loop instance in a closure like shown above.
|
You can still command the loop by using the pause/waitSignal methods from the outside or by capturing the loop instance in a closure like shown above.
|
||||||
s
|
s
|
||||||
|
|
||||||
<a href="https://docs.madelineproto.xyz/docs/USING_METHODS.html">Next section</a>
|
<a href="https://docs.madelineproto.xyz/docs/USING_METHODS.html">Next section</a>
|
@ -62,4 +62,38 @@ $MadelineProto->logger($message, $level);
|
|||||||
|
|
||||||
By default, `$level` is `\danog\MadelineProto\Logger::NOTICE`.
|
By default, `$level` is `\danog\MadelineProto\Logger::NOTICE`.
|
||||||
|
|
||||||
|
|
||||||
|
## Error reporting
|
||||||
|
|
||||||
|
MadelineProto now can report errors automatically to the bot admin.
|
||||||
|
Simply use the following method:
|
||||||
|
|
||||||
|
```php
|
||||||
|
// $message = (string) $exception, for example
|
||||||
|
$MadelineProto->report($message);
|
||||||
|
```
|
||||||
|
|
||||||
|
This will automatically report the error (and send the logfile!) to the bot admin, set using the `setReportPeers` method:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$MadelineProto->setReportPeers(['danogentili']);
|
||||||
|
```
|
||||||
|
|
||||||
|
**OR** using the `getReportPeers` method of [the event handler](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven).
|
||||||
|
|
||||||
|
```php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get peer(s) where to report errors
|
||||||
|
*
|
||||||
|
* @return int|string|array
|
||||||
|
*/
|
||||||
|
public function getReportPeers()
|
||||||
|
{
|
||||||
|
return [self::ADMIN];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you use the [`startAndLoop`](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven) method to start update handling, all errors surfacing from the loop will be reported automatically.
|
||||||
|
|
||||||
<a href="https://docs.madelineproto.xyz/docs/CALLS.html">Next section</a>
|
<a href="https://docs.madelineproto.xyz/docs/CALLS.html">Next section</a>
|
@ -9,7 +9,7 @@ Update handling can be done in different ways:
|
|||||||
|
|
||||||
* [Self-restart on webhosts](#self-restart-on-webhosts)
|
* [Self-restart on webhosts](#self-restart-on-webhosts)
|
||||||
* [Async Event driven](#async-event-driven)
|
* [Async Event driven](#async-event-driven)
|
||||||
* [Multi-account: Async Combined Event driven update handling](#async-combined-event-driven)
|
* [Multi-account: Async Event driven](#async-event-driven)
|
||||||
* [Async Callback](#async-callback)
|
* [Async Callback](#async-callback)
|
||||||
* [Noop (default)](#noop)
|
* [Noop (default)](#noop)
|
||||||
* [Fetch all updates from the beginning](#fetch-all-updates-from-the-beginning)
|
* [Fetch all updates from the beginning](#fetch-all-updates-from-the-beginning)
|
||||||
|
@ -91,7 +91,7 @@ You can find examples for nearly every MadelineProto function in
|
|||||||
* [Handling updates (new messages)](https://docs.madelineproto.xyz/docs/UPDATES.html)
|
* [Handling updates (new messages)](https://docs.madelineproto.xyz/docs/UPDATES.html)
|
||||||
* [Self-restart on webhosts](https://docs.madelineproto.xyz/docs/UPDATES.html#self-restart-on-webhosts)
|
* [Self-restart on webhosts](https://docs.madelineproto.xyz/docs/UPDATES.html#self-restart-on-webhosts)
|
||||||
* [Async Event driven](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven)
|
* [Async Event driven](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven)
|
||||||
* [Multi-account: Async Combined Event driven update handling](https://docs.madelineproto.xyz/docs/UPDATES.html#async-combined-event-driven)
|
* [Multi-account: Async Event driven](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven)
|
||||||
* [Async Callback](https://docs.madelineproto.xyz/docs/UPDATES.html#async-callback)
|
* [Async Callback](https://docs.madelineproto.xyz/docs/UPDATES.html#async-callback)
|
||||||
* [Noop (default)](https://docs.madelineproto.xyz/docs/UPDATES.html#noop)
|
* [Noop (default)](https://docs.madelineproto.xyz/docs/UPDATES.html#noop)
|
||||||
* [Fetch all updates from the beginning](https://docs.madelineproto.xyz/docs/UPDATES.html#fetch-all-updates-from-the-beginning)
|
* [Fetch all updates from the beginning](https://docs.madelineproto.xyz/docs/UPDATES.html#fetch-all-updates-from-the-beginning)
|
||||||
|
Loading…
Reference in New Issue
Block a user