Skip to content

Commit

Permalink
Merge pull request #119 from The-Padi/main
Browse files Browse the repository at this point in the history
Satisfactory 1.0 update + opengsq
  • Loading branch information
BattlefieldDuck authored Jan 27, 2025
2 parents 504c838 + c1de910 commit 7f3c59d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
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

0 comments on commit 7f3c59d

Please sign in to comment.