Skip to main content

A python wrapper for the Rust Plus API

Project description

Rust+.py

A lot of code and ideas have come from the JavaScript version of a wrapper, so I will credit it now: RustPlus.js I have used their Protocol Buffer file for this, as well as instructions on how to use the command line tool to get the information you need.

Installation:

Install the package with:

pip install rustplus

It should also install all the dependencies, but if not you will have to install them yourself

Usage:

from  rustplus  import  RustSocket

rust_socket = RustSocket("IPADDRESS", "PORT", 64BITSTEAMID, PLAYERTOKEN)
#See below for more information on the above ^^

#Connects to the server's websocket
await rust_socket.connect()

"""
For information on the following see below
"""
#Get mapMarkers:
markers = await rust_socket.getMarkers()

#Get Server Info:
info = await rust_socket.getInfo()

#Get Current time:
time = await rust_socket.getTime()

#Getting Team info
team_info = await rust_socket.getTeamInfo()

#Getting Team Chat:
team_chat = await rust_socket.getTeamChat()

#Sending a Team Chat message:
status = await rust_socket.sendTeamMessage("Yo! I sent this with Rust+.py")

#Get Camera Image:
camera_image = await rust_socket.getCameraFrame("CAMID",FRAMENO)

#Get Map Image:
rust_map = await rust_socket.getMap(addIcons = True, addEvents = True, addVendingMachines= True, overrideImages = {})

#Getting Map Data
rust_map_data = await rust_socket.getRawMapData()

#Get Entity Information
entity_info = await rust_socket.getEntityInfo(ENTITYID)

#Turning On/Off a Smart Switch
await rust_socket.turnOffSmartSwitch(ENTITYID)
await rust_socket.turnOnSmartSwitch(ENTITYID)

#Promoting a TeamMate to team leader
await rust_socket.promoteToTeamLeader(SteamID)

#Getting the contents of a TC:
tc_contents = await rust_socket.getTCStorageContents(ENTITYID, MERGESTACKS : bool)

#Getting Current Map Events
events = await rust_socket.getCurrentEvents()

await rust_socket.closeConnection()

For information on all of the above methods, see the Wiki

Support:

If you need help, or you think that there is an issue feel free to open an issue. If you think you have made some improvements, open a PR!

I have tried to explain this a well as possible, but if you should need further clarification, join me on my discord server: here

GitHub ⭐'s are always welcome :)

Have Fun!

Project details


Release history Release notifications | RSS feed

This version

4.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustplus-4.0.tar.gz (684.4 kB view hashes)

Uploaded Source

Built Distribution

rustplus-4.0-py3-none-any.whl (691.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page