Skip to content

Commit 1988301

Browse files
authored
Merge pull request #106 from ManualForArchipelago/discord-button
Add a launcher component for the Manual Discord Server
2 parents f5d6d12 + 42d78e1 commit 1988301

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import json
55
from typing import Callable, Optional
6+
import webbrowser
67

78
import requests
89
import Utils
@@ -459,15 +460,21 @@ def add_client_to_launcher() -> None:
459460
with open(icon_paths["manual"], 'wb') as f:
460461
f.write(requests.get(icon_url).content)
461462

463+
discord_component = None
462464
for c in components:
463465
if c.display_name == "Manual Client":
464466
found = True
465467
if getattr(c, "version", 0) < version: # We have a newer version of the Manual Client than the one the last apworld added
466468
c.version = version
467469
c.func = launch_client
468470
c.icon = "manual"
469-
return
471+
elif c.display_name == "Manual Discord Server":
472+
discord_component = c
473+
470474
if not found:
471475
components.append(VersionedComponent("Manual Client", "ManualClient", func=launch_client, version=version, file_identifier=SuffixIdentifier('.apmanual'), icon="manual"))
476+
if not discord_component:
477+
components.append(Component("Manual Discord Server", "ManualDiscord", func=lambda: webbrowser.open("https://discord.gg/hm4rQnTzQ5"), icon="discord", component_type=Type.ADJUSTER))
478+
472479

473480
add_client_to_launcher()

0 commit comments

Comments
 (0)