Skip to main content

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 pyopenttdadmin import Admin, Actions, ChatDestTypes, AdminUpdateType, openttdpacket

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, openttdpacket.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 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyOpenTTDAdmin 1.0.0
File Size Uploaded
pyopenttdadmin-1.0.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyOpenTTDAdmin 1.0.0
File Interpreter ABI Platform
pyOpenTTDAdmin-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / pyopenttdadmin-1.0.0.tar.gz

Download URL pyopenttdadmin-1.0.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8d4b9b11a1d24d8da595e14ce9efddf1c3cb3483d81e12fc64046de379d16053
BLAKE2b-256 checksum
How to use checksums
4b0f3c4e01df3ccde0e4a52f625c4a3cff1066cc28923872a67e098c53dbf3f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release files / pyOpenTTDAdmin-1.0.0-py3-none-any.whl

Download URL pyOpenTTDAdmin-1.0.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61e58cd6baa14003465163bd48fd60eef7f349e9c4b67c18319c8f5f931ee1e8
BLAKE2b-256 checksum
How to use checksums
25436cc50511eb29ada6729328b8795d9e34061203555d595299ba1d450c4cfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

1.1.0

73 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

This release

1.0.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page