This repository has no description
1# Bluesky Avatar Updater
2
3## Overview
4
5This repository contains a Python script intended to update your Bluesky avatar automatically based on the current hour. The script utilises environment variables for configuration and reads a JSON file of blob CIDs to determine the appropriate avatar for each hour. Please note that the implementation is not yet fully operational, as several issues remain to be resolved. This script was inspired by [@dame.is](https://bsky.app/profile/dame.is)'s blog post ['How I made an automated dynamic avatar for my Bluesky profile'](https://dame.is/blog/how-i-made-an-automated-dynamic-avatar-for-my-bluesky-profile).
6
7## Prerequisites
8
9Before running the script, ensure you have the following:
10
11- Python 3.6 or later installed.
12
13- The required Python packages:
14 - `python-dotenv`
15 - `atproto`
16 - Standard libraries such as `os`, `json`, `logging`, and `datetime`
17- A valid Bluesky account with the necessary API credentials.
18
19## Installation
20
211. **Clone the repository:**
22
23 ```bash
24 git clone https://github.com/ewanc26/bluesky-avatar-updater.git
25 cd bluesky-avatar-updater
26 ```
27
282. **Create a virtual environment and install dependencies:**
29
30 ```bash
31 python3 -m venv .venv
32 source .venv/bin/activate # On Windows use: .venv\Scripts\activate
33 pip install -r requirements.txt
34 ```
35
363. **Configure environment variables:**
37 - Place your `.env` file in the `../assets` directory relative to the script.
38 - The `.env` file should contain the following entries:
39
40 ```env
41 ENDPOINT=your_endpoint
42 HANDLE=your_handle
43 PASSWORD=your_password
44 ```
45
464. **Prepare the JSON file:**
47 - Ensure that a `cids.json` file is located in the `../assets` directory. This file should map each hour (in two-digit format) to a corresponding blob CID.
48
49## Usage
50
51To run the script, execute:
52
53```bash
54python -u ./src/main.py
55```
56
57The script will:
58
59- Load the environment configuration from `./assets/.env`.
60- Read the blob CIDs from `./assets/cids.json`.
61- Determine the current hour and select the appropriate blob CID.
62- Attempt to authenticate and update the avatar using the AT Protocol.
63
64Execution logs will be recorded in `avatar_update.log` for your review.
65
66## Known Issues
67
68At present, the script isn’t fully working. We’ve noticed an error when updating the profile—specifically, the `put_record()` method is missing a required parameter. There have also been occasional authentication hiccoughs, which might be due to configuration issues or [API](https://atproto.blue) quirks.
69
70If you’re keen to help sort these out or have ideas for improvements, please open a Pull Request. Your contributions are very welcome!
71
72---
73
74## Licence
75
76This project is released under the MIT Licence. See the [LICENSE](./LICENSE) file for full details.