Skip to content

Commit

Permalink
Updated handles as botsin.space is read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhcjones authored Dec 18, 2024
1 parent de67bba commit 06d4243
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import random
from atproto import Client, client_utils

mastodon_instance_url = 'https://botsin.space'
mastodon_instance_url = 'https://mastodon.cloud'
debugTesting = 0

# Retrieve secrets from GitHub
Expand All @@ -14,7 +14,7 @@

def postBluesky(toot):
client = Client()
client.login('wotd.bsky.social', at_password)
client.login('wotd.bluesky.bot', at_password)

text = client_utils.TextBuilder().text(toot)
post = client.send_post(text)
Expand All @@ -32,7 +32,8 @@ def postBluesky(toot):
definition = definitions[index]

# Format the toot
toot = f"πŸ“š The word of the day is {word}!\n––––––––––\nDefinition/s:\n{definition}\n\n#wordoftheday #wotd #english #bot"
formatted_text = f"πŸ“š The word of the day is {word}!\n––––––––––\nDefinition/s:\n{definition}"
toot = f"{formatted_text}\n\n#wordoftheday #wotd #english #bot"
if (debugTesting == 0):
# Mastodon API endpoint for posting a status
toot_url = f"{mastodon_instance_url}/api/v1/statuses"
Expand All @@ -45,7 +46,7 @@ def postBluesky(toot):
# Make the API request to post the toot
headers = {'Authorization': f'Bearer {access_token}'}
response = requests.post(toot_url, params=params, headers=headers)
postBluesky(toot)
postBluesky(formatted_text)

if response.status_code == 200:
print("Toot posted successfully!")
Expand Down

0 comments on commit 06d4243

Please sign in to comment.