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() as admin:
    admin.login("pyOpenTTDAdmin", PASSWORD)
    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.1

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.1
File Size Uploaded
pyopenttdadmin-1.0.1.tar.gz 11.3 kB Details

Built distribution (wheel)

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

Total release size: 25.3 kB

Release files / pyopenttdadmin-1.0.1.tar.gz

Download URL pyopenttdadmin-1.0.1.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d28bfb30ba14d88e70cf26086b058d845a5b377fed9aab36109f5602868e664a
BLAKE2b-256 checksum
How to use checksums
a84051808fa727aece8685fc57a1220ba443bfdbe0e241ed3c5898443183aa03
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.1-py3-none-any.whl

Download URL pyOpenTTDAdmin-1.0.1-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8d2919efdb86942dc1ca2ef5dbff0ca9a7405345eebef11162ae8838e1aa853
BLAKE2b-256 checksum
How to use checksums
c51fa99634119a1d45a0f0925a786bc2c511e608df04c72a4c122fbc5152eeb2
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

This release

1.0.1 This release

2 release files

1.0.0

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