Git Product home page Git Product logo

bluesky-social-image-poster's Introduction

Bluesky Social Image Posting Module

Overview

This module provides a streamlined solution for posting images to Bluesky Social. It abstracts the complexities involved in interacting with the Bluesky Social API, offering a simple interface for image uploads and post creation.

Features

  • Multiple Image Support: Allows posting multiple images in a single post.
  • Flexible Text Posting: Enables posts with or without accompanying text.
  • File Type Validation: Supports JPG, JPEG, and PNG formats, ensuring robust handling of image files.
  • Error Handling: Robust error handling for file existence, file types, and API interactions.
  • Modular Design: Easily integrable into larger projects or standalone applications.

Limitations

  • File Type Support: Currently, the Bluesky Social API supports only JPG, JPEG, and PNG file formats. This limitation is reflected in the module's validation process.
  • API Dependencies: The module's functionality is dependent on the stability and availability of the Bluesky Social API.

Installation

Ensure that Node.js is installed on your system, then clone this repository and install the dependencies:

git clone https://github.com/rmcc3/bluesky-social-image-poster.git
cd bluesky-social-image-poster
npm install

Usage

The module's functionality is encapsulated in postWithImages.js. Here's a guide to using it in your project:

Setting up the BskyAgent

Set up and log in to the BskyAgent in your main file (e.g., main.js):

// main.js
require('dotenv').config();
const { BskyAgent } = require('@atproto/api');
const sendPostWithImages = require('./postWithImages');

async function main() {
    const agent = new BskyAgent({ service: 'https://bsky.social' });
    await agent.login({
        identifier: process.env.IDENTIFIER,
        password: process.env.PASSWORD,
    });

    // Additional code...
}

main();

Creating a Post with Images

Use the sendPostWithImages function to post images:

// Example usage
try {
    const imagePaths = ['./path/to/image1.jpg', './path/to/image2.jpeg'];
    const text = 'Optional post text';
    await sendPostWithImages(agent, imagePaths, text);
    console.log('Post created!');
} catch (error) {
    console.error('Error:', error.message);
}

Contributing

Contributions are welcome. Please adhere to the project's coding standards and include tests for new features or bug fixes.

License

This project is provided under a custom license. Usage, copying, modification, merging, publication, distribution, sublicensing, and/or selling of the software are permitted provided that the following conditions are met:

  1. Appropriate credit must be given to the original author, Ray McCann, for any use of the software, in any form or medium.
  2. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  3. Altered source versions must be plainly marked as such and must not be misrepresented as being the original software.

See the LICENSE file for more details.

bluesky-social-image-poster's People

Contributors

jesse-holden avatar rmcc3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.