BotBase/METHODS.md

17 lines
747 B
Markdown
Raw Normal View History

# BotBase - Methods overview
BotBase has a builtin collection of wrappers around Pyrogram methods that make
it even easier to use them properly.
**DISCLAIMER**: These methods are just wrappers around Pyrogram's ones and behave
2020-06-15 14:15:50 +02:00
the same way.
2020-06-15 14:15:50 +02:00
To use the "safe" methods, just import the `MethodWrapper`` class from `BotBase.methods`
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-15 14:15:50 +02:00
This way, the calls will never trigger exceptions and will log errors to stderr.
If an exception occurs, the exception object is returned, otherwise whatever
the called pyrogram method returns will be returned.