Skip to content

Delph/StarSonataAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StarSonataAPI

A simple Python API for interacting with the Star Sonata game server as a chat client user.

A rather bad usage guide

Import and create an instance of the API

from StarSonataAPI import *
from StarSonataAPI.message_types import *

ss = StarSonataAPI()

Setup an account instance, provide the username and password you wish to log in as;

account = Account('aUsername', 'aPassword')

Setup message handlers for messages you wish to capture, e.g.,;

@ss.on_event(SC_TEXTMESSAGE)
async def text_message(message):
  tm = TextMessage()
  tm.buf_in(message.payload)

  print(f'[{tm.channel_name}] {tm.username}: {tm.message}')

message is the raw message sent by the server, generate the correct message object and buf_in to get usable data.

Connect to server and start handling messages by calling run;

ss.run(account)

run is async, and can be chucked into an asyncio task list.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages