diff --git a/main.py b/main.py index 4a17436..06bab60 100644 --- a/main.py +++ b/main.py @@ -73,8 +73,9 @@ async def post(): sender_client.post(msg) -# write a DM and receive DMs -asyncio.run(dm()) - -# make a post and subscribe to posts -# asyncio.run(post()) +if input("Enter 1 for DM, 2 for Posts (Default: 1)") or 1 == 1: + # write a DM and receive DMs + asyncio.run(dm()) +else: + # make a post and subscribe to posts + asyncio.run(post()) diff --git a/nostr/client/client.py b/nostr/client/client.py index 16cf96a..8cceb42 100644 --- a/nostr/client/client.py +++ b/nostr/client/client.py @@ -35,13 +35,15 @@ class NostrClient: if len(relays): self.relays = relays - if connect: - for relay in self.relays: - self.relay_manager.add_relay(relay) - self.relay_manager.open_connections( - {"cert_reqs": ssl.CERT_NONE} - ) # NOTE: This disables ssl certificate verification + self.connect() + + def connect(self): + for relay in self.relays: + self.relay_manager.add_relay(relay) + self.relay_manager.open_connections( + {"cert_reqs": ssl.CERT_NONE} + ) # NOTE: This disables ssl certificate verification def close(self): self.relay_manager.close_connections()