AutoPost API Reference#
- class AutoPost(client)[source]#
Bases:
object
You can use this to post stats automatically.
- Parameters:
client (
BoticordClient
) – An instance of BoticordClient.
- property is_running: bool#
Is autopost running?
- on_success(callback: Any | None = None)[source]#
Registers success callback.
Warning
Callback functions must be a coroutine. If they aren’t, then you might get unexpected errors. In order to turn a function into a coroutine they must be
async def
functions.This method can be used as a decorator (if you want).
- on_error(callback: Any | None = None)[source]#
Registers error callback.
Warning
Callback functions must be a coroutine. If they aren’t, then you might get unexpected errors. In order to turn a function into a coroutine they must be
async def
functions.The callback function requires to take Exception argument. This method can be used as a decorator (if you want).
- init_stats(callback: Any | None = None)[source]#
Registers a function that will return stats. Registered Function Must return dictionary.
Warning
None of the values must be equal to 0. Specify None instead of 0.
Warning
Callback functions must be a coroutine. If they aren’t, then you might get unexpected errors. In order to turn a function into a coroutine they must be
async def
functions.This method can be used as a decorator (if you want).
- property interval: float#
The interval between posting stats.
- set_interval(seconds: int) AutoPost [source]#
Sets the interval between posting stats.
- Parameters:
seconds (
int
) – The interval.- Raises:
ValueError – Boticord recommends not to set interval lower than 900 seconds!