2020-06-05 21:22:17 +02:00
|
|
|
# BotBase - Methods overview
|
|
|
|
|
2020-07-03 18:40:44 +02:00
|
|
|
BotBase has a builtin wrapper around Pyrogram objects that make
|
2020-06-05 21:22:17 +02:00
|
|
|
it even easier to use them properly.
|
|
|
|
|
2020-07-03 18:40:28 +02:00
|
|
|
**DISCLAIMER**: The ``MethodWrapper`` class is just a wrapper around Pyrogram.
|
2020-06-05 21:22:17 +02:00
|
|
|
|
|
|
|
|
2020-07-03 18:40:28 +02:00
|
|
|
To use the "safe" methods, just import the `MethodWrapper` class from `BotBase.methods`
|
2020-06-15 14:15:50 +02:00
|
|
|
and pass it a `pyrogram.Client` **instance** (not the class) or a `pyrogram.CallbackQuery`
|
|
|
|
or even a `pyrogram.InlineQuery` object. Then you can just call `wrapper.method` rather than `client.method`.
|
2020-06-05 21:22:17 +02:00
|
|
|
|
2020-07-03 18:41:48 +02:00
|
|
|
This way, the calls will never trigger `RPCError`s and will log errors to stderr.
|
2020-06-15 14:15:50 +02:00
|
|
|
If an exception occurs, the exception object is returned, otherwise whatever
|
|
|
|
the called pyrogram method returns will be returned.
|