Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Satisfactory 1.0 update + opengsq #119

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion discordgsm/games.csv
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ rune,Rune (2000),gamespy1,port=7777;port_query_offset=1
rust,Rust (2018),source,port=28015

samp,San Andreas Multiplayer (2006),samp,port=7777
satisfactory,Satisfactory (2019),satisfactory,port_query=15777
satisfactory,Satisfactory (2019),satisfactory,port_query=7777
scpsl,SCP: Secret Laboratory (2017),scpsl,
scum,SCUM (2018),scum,port=27015
shatteredhorizon,Shattered Horizon (2009),source,port=27015
Expand Down
3 changes: 3 additions & 0 deletions discordgsm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ def query_server_modal(game: GamedigGame, locale: Locale):
modal.add_item(query_extra['_api_key'])
modal.remove_item(query_param['port'])
query_param['port']._value = '0'
elif game['id'] == 'satisfactory':
query_extra['_token'] = TextInput(label='Application Token', placeholder='Server Application token')
modal.add_item(query_extra['_token'])
elif game['id'] == 'gportal':
query_extra['serverId'] = TextInput(label='GPORTAL server id')
modal.add_item(query_extra['serverId'])
Expand Down
15 changes: 10 additions & 5 deletions discordgsm/protocols/satisfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ class Satisfactory(Protocol):
name = "satisfactory"

async def query(self):
host, port = str(self.kv["host"]), int(str(self.kv["port"]))
satisfactory = opengsq.Satisfactory(host, port, self.timeout)
host, port, app_token = (
str(self.kv["host"]),
int(str(self.kv["port"])),
str(self.kv["_token"]),
)

satisfactory = opengsq.Satisfactory(host, port, app_token, self.timeout)
start = time.time()
status = await satisfactory.get_status()
ping = int((time.time() - start) * 1000)

result: GamedigResult = {
"name": "",
"name": status.server_name,
"map": "",
"password": False,
"numplayers": 0,
"numplayers": status.num_players,
"numbots": 0,
"maxplayers": 0,
"maxplayers": status.server_max_nb_players,
"players": None,
"bots": None,
"connect": f"{host}:{port}",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pymongo==4.7.3
python-dotenv==1.0.1
pywin32==306;platform_system=="Windows"
typing-extensions==4.8.0;python_version<"3.10"
tzdata==2024.1
tzdata==2024.1