Skip to main content

spectrum.py

spectrum.py is a discord.py style proof-of-concept library for making chatbots for Star Citizen's Spectrum chat client. It also offers HTTP clients for interacting with both Spectrum's REST API and the Community Hub's GraphQL API.

Installation

# Latest Release
python -m pip install spectrum.py
# Latest in Github
python -m pip install git+https://github.com/henry232323/spectrum.py

Examples

With Gateway

import asyncio
from spectrum import Client, Message

class MyClient(Client):
    async def on_message(self, message: Message):
        print(message)

    async def on_ready(self):
        print("We're ready!")


async def run():
    myclient = MyClient(
        rsi_token=...,
        device_id=...,
    )

    asyncio.ensure_future(myclient.run())
    await asyncio.Event().wait()


asyncio.run(run())

HTTP Only

import asyncio
from spectrum import HTTPClient

async def run():
    client = HTTPClient(
        rsi_token=...,
        device_id=...,
    )

    await client.identify()
    member = await client.fetch_member_by_handle("Khuzdul")
    print(member)

    await client.close()

asyncio.run(run())

Community Hub

import asyncio
from spectrum import CommunityHubClient

async def run():
    client = CommunityHubClient()
    print(await client.fetch_user_profile("Khuzdul"))

asyncio.run(run())

Authentication

The bot can be run in a read only state without any authentication. If you want to be able to send messages or read private messages (and eventually do other things), you'll need to provide credentials for an RSI account. These can be found in the cookies sent with any request to RSI when logged in.

Release files for spectrum.py 0.1.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 spectrum.py 0.1.0
File Size Uploaded
spectrum_py-0.1.0.tar.gz 34.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spectrum.py 0.1.0
File Interpreter ABI Platform
spectrum_py-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.5 kB

Release files / spectrum_py-0.1.0.tar.gz

Download URL spectrum_py-0.1.0.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2401e40f8097c43d1fa98fae85d1177830dded2bb3a091ca199549ef014805d1
BLAKE2b-256 checksum
How to use checksums
86221f4de4f2ea20098580dab31c3b962274827e9e624606213ab9a2f1d98b6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / spectrum_py-0.1.0-py3-none-any.whl

Download URL spectrum_py-0.1.0-py3-none-any.whl
Size 45.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9898b1f7927c38b9980af67d6a21e9c68703a58e4527322450ae880ef97329b7
BLAKE2b-256 checksum
How to use checksums
ea0014579bd1d5db7c9c2a2d6a4111fad855d8cadde00d2f8636d799f8a7d97a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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