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 0.1.3

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 0.1.3
File Size Uploaded
pyopenttdadmin-0.1.3.tar.gz 8.3 kB Details

Built distribution (wheel)

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

Total release size: 17.7 kB

Release files / pyopenttdadmin-0.1.3.tar.gz

Download URL pyopenttdadmin-0.1.3.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ee33ade8b6798f6f195904e79a6d52cd0891e325afade4a32520b4cc4f6d361b
BLAKE2b-256 checksum
How to use checksums
334845a952a53bff37943f64bead4f04f5d51a5d92b337b6edceefb81d102dea
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.3-py3-none-any.whl

Download URL pyOpenTTDAdmin-0.1.3-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27096d21260aa36a290ae6d24721c6d4d7719748b5c664422a379062dd112ebf
BLAKE2b-256 checksum
How to use checksums
d511d267242eac10f88fa9d1a3d57242c8988a5b9c3f5c2e73952349f91a7884
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

1.0.0

2 release files

This release

0.1.3 This release

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