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.

Download files

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

Source Distribution

spectrum_py-0.1.0.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spectrum_py-0.1.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file spectrum_py-0.1.0.tar.gz.

File metadata

  • Download URL: spectrum_py-0.1.0.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for spectrum_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2401e40f8097c43d1fa98fae85d1177830dded2bb3a091ca199549ef014805d1
MD5 9399e315bcb6d85ee4b0c38ff7bb901c
BLAKE2b-256 86221f4de4f2ea20098580dab31c3b962274827e9e624606213ab9a2f1d98b6e

See more details on using hashes here.

File details

Details for the file spectrum_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: spectrum_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for spectrum_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9898b1f7927c38b9980af67d6a21e9c68703a58e4527322450ae880ef97329b7
MD5 94246eaad66568850b7a2601a34cbad0
BLAKE2b-256 ea0014579bd1d5db7c9c2a2d6a4111fad855d8cadde00d2f8636d799f8a7d97a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page