oxrpy.sync¶
Keep staff ranks and groups in step with somewhere else (Discord roles, a database…).
Oxford's advice is to compare what the server has with what you want and send only the
differences. These functions work out those differences as commands. The clients'
plan_staff_sync/sync_staff and plan_group_sync/sync_group fetch the current
lists for you and run the commands within the game's limits.
Users are identified by user ID only: a username can match nobody, or someone else after a name change.
CommandWindow ¶
Tracks commands sent in the last 10 seconds, to stay under the game's 15.
plan_staff_changes ¶
The rank/unrank commands that turn the current staff list into desired.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
staff
|
Mapping[str, Any]
|
The |
required |
desired
|
Mapping[UserKey, Optional[str]]
|
User ID -> rank name or Id ( |
required |
remove_others
|
bool
|
Also unrank staff who aren't in |
False
|
The owner is never touched. Ranks are matched by name or Id, ignoring case.
plan_group_changes ¶
The group add/group remove commands that make group contain members.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups
|
Iterable[Mapping[str, Any]]
|
The |
required |
group
|
str
|
The group's name or Id (ignoring case). |
required |
members
|
Iterable[UserKey]
|
User IDs who should be in it. |
required |
remove_others
|
bool
|
Take out anyone not in |
True
|