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.create_task(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.4.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

spectrum.py-0.0.4-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file spectrum.py-0.0.4.tar.gz.

File metadata

  • Download URL: spectrum.py-0.0.4.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for spectrum.py-0.0.4.tar.gz
Algorithm Hash digest
SHA256 e457b471d4c6c7c1be24b5c9e5d2509e07bb182c0217abc1d9b37e29a316f207
MD5 a1b57fe83a567a7bebc86d86049df85e
BLAKE2b-256 9aa7b4cd10530c3f9434dd92a13918d71c17a9af8e64cadc9dc944b833f7bad8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spectrum.py-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for spectrum.py-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e4e68b5e63723b0cb28912123e28f40bdb161994d1a370fe58931f4b078c41f5
MD5 370f6ee233f482e3ae99ddc6128939ce
BLAKE2b-256 e93b83349e0b5b0b79f6377f369e34500ae6830e4a2d4f22ad8fd16ceef2d690

See more details on using hashes here.

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