AsyncOxfordAPI¶
Every method of OxfordAPI is here too; you await them.
AsyncOxfordAPI ¶
AsyncOxfordAPI(server_key=None, *, app_key=None, timeout=10, rate_limit='auto', max_retries=3, base_url=BASE_URL, client=None, global_key=None, server_id=None)
Bases: AsyncSignatures, BaseClient
Async client for the Oxford Response private server API. Every method of
:class:~oxrpy.OxfordAPI is here too; you await them.
Use it with async with, or call await api.aclose() when you're done.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_key
|
Optional[str]
|
Your server's API key (Server Management > External > API Key). |
None
|
app_key
|
Optional[str]
|
Optional app key ( |
None
|
timeout
|
float
|
Seconds to wait for a response (commands always get at least 15). |
10
|
rate_limit
|
Union[str, float, None]
|
|
'auto'
|
max_retries
|
int
|
Retries after a 429, or a network error / 500 on a read. |
3
|
base_url
|
str
|
Override the API base URL (for testing). |
BASE_URL
|
client
|
Any
|
Use your own |
None
|
global_key
|
Optional[str]
|
Removed in 2.0; passing it warns and treats it as |
None
|
server_id
|
Optional[str]
|
No longer used; passing it warns. |
None
|
run_many
async
¶
Run any number of commands, in order, as fast as the game allows (batches of 10,
staying under 15 every 10 seconds). Same as :meth:OxfordAPI.run_many.
sync_staff
async
¶
Make the staff match desired, sending only the changes. Same as
:meth:OxfordAPI.sync_staff.
sync_group
async
¶
Make group contain exactly members, sending only the changes. Same as
:meth:OxfordAPI.sync_group.
iter_bans
async
¶
async for ban in api.iter_bans(): every ban, fetching pages as needed.
wait_for_command
async
¶
Poll :meth:get_command until it's no longer pending (gives up after timeout).
follow ¶
An :class:AsyncLogFollower: async for data, new in api.follow("Events"):
save_to (a file path, or an object with load/save) remembers the position
across restarts. See :mod:oxrpy.state.
run_forever
async
¶
Poll and call the handlers registered with :meth:on until :meth:stop (or the task
is cancelled). Handlers can be plain functions or async def. In discord.py, start it
from setup_hook with asyncio.create_task(api.run_forever()).
Same behaviour and arguments as :meth:OxfordAPI.run_forever, including save_to.
AsyncLogFollower ¶
Bases: _FollowerBase
The async version of :class:~oxrpy.LogFollower::
async for data, new in api.follow("Events", "KillLogs"): ...