pyOpenTTDAdmin
pyOpenTTDAdmin is a Python library designed to facilitate communication with OpenTTD's Admin port. OpenTTD (Open Transport Tycoon Deluxe) is an open-source simulation game where players manage a transport company.
This library enables developers to interact with an OpenTTD server programmatically, allowing them to perform various administrative tasks and receive real-time updates from the game server.
Features
- Authentication: Authenticate with an OpenTTD server using the provided password.
- Packet Handling: Receive and parse packets from the server, allowing developers to react to different events and messages.
- Sending Commands: Send commands to the OpenTTD server, such as chat messages, remote console commands, and more.
- Subscription to Updates: Subscribe to various types of updates from the server, including chat messages, client information, company data, and more.
- Flexible Usage: The library provides a flexible framework for building custom applications that interact with OpenTTD servers.
Usage
Example code for an echo bot can be found here:
import os
from src.main import Admin
from src.packet import ChatPacket
from src.enums import Actions, ChatDestTypes, AdminUpdateType
PASSWORD = os.getenv('OPENTTD_ADMIN_PASSWORD')
if PASSWORD is None:
raise ValueError('OPENTTD_ADMIN_PASSWORD environment variable is not set')
class App(Admin):
def on_packet(self, packet):
if isinstance(packet, ChatPacket):
print("ChatPacket")
if packet.action == Actions.CHAT:
if packet.desttype == ChatDestTypes.BROADCAST:
self.send_global(packet.message)
with App(password = PASSWORD) as admin:
admin.send_subscribe(AdminUpdateType.CHAT)
admin.run()
Contributing
Contributions to pyOpenTTDAdmin are welcome! If you find any issues or have ideas for improvements, feel free to open an issue or submit a pull request on GitHub.
Metadata
Release files for pyOpenTTDAdmin 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyopenttdadmin-0.1.2.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyOpenTTDAdmin-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.7 kB
Release files / pyopenttdadmin-0.1.2.tar.gz
| Download URL | pyopenttdadmin-0.1.2.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09409d4008d9779854bff80c2ce4bab7ed3b63feeb80f1e775baa4e65eccd665
|
|
BLAKE2b-256 checksum How to use checksums |
177af364e42ff9675912afe2691204f222f6b0eabffc652749ba6e2931c5484d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|
Release files / pyOpenTTDAdmin-0.1.2-py3-none-any.whl
| Download URL | pyOpenTTDAdmin-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c06dc0ee82d18258b55fba100141fa8b314ce6992ab4d6fd060cedabbd52b40e
|
|
BLAKE2b-256 checksum How to use checksums |
3b5376def2fcfbaf25d27e5e183818ce915de1c2abd13109a967feb4a9a77a7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|