What is Nostr?
S!ayer
npub1ehk…mz4s
2024-08-07 19:51:48

S!ayer on Nostr: I have a question for nostr devs: say I want to create a bot, how do I then get it to ...

I have a question for nostr devs: say I want to create a bot, how do I then get it to post to nostr?

ChatGPT is telling me there's a nostrpy and I can import nostr into python?

e.g.

import time
import random
import nostr

# Initialize Nostr
nostr_client = nostr.Client(private_key="your_private_key")

# Example quotes
quotes = [
"Be yourself; everyone else is already taken. - Oscar Wilde",
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. - Albert Einstein",
"So many books, so little time. - Frank Zappa"
]

def post_quote():
quote = random.choice(quotes)
nostr_client.send_message(quote)

# Run the bot
while True:
post_quote()
time.sleep(3600) # Post every hour


but I'm working blind here.
Author Public Key
npub1ehkvx8rdjsrwnf7kkqr8gy42vcwe6vwgqdwrl4juqccp689v8wfqr3mz4s