Skip to main content

spectrum.py is a [discord.py](https://github.com/Rapptz/discord.py) style proof-of-concept library for making chatbots for Star Citizen's [Spectrum](https://robertsspaceindustries.com/spectrum/community/SC) chat client.

Project description

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.

Project details


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.0.10.tar.gz (27.2 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.0.10-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spectrum_py-0.0.10.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for spectrum_py-0.0.10.tar.gz
Algorithm Hash digest
SHA256 c501127b51bd613e3a660763611bcc5402dc3187e595871701d46eed4a5a1321
MD5 6af1d1166dd56e4863d7df3c063399e5
BLAKE2b-256 86dd5267272a0beccfcad876378069e9acbd2ed6ce92b0f6cf2dac5c8f35f6c5

See more details on using hashes here.

File details

Details for the file spectrum.py-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: spectrum.py-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for spectrum.py-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 d758ab6cbc2ad55294a7bb3b7694766f55067f4882edc1dd29870b5816a4a30d
MD5 53cc89f7fbf8319f604740f0fbd4afe6
BLAKE2b-256 2892de655c51f03ee3a00a0cac6ad96b665a7c935441e9a5ff4605fd4304f7d4

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 Pingdom Monitoring Sentry Error logging StatusPage Status page