npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@elara-services/threads

v1.0.2

Published

- This package will let you know when someone posts on threads.net. - Allows you to track multiple users at once. - Has an automatic defaultAnnouncements for Discord webhooks.

Downloads

4

Readme

Threads.net Announcements/Posts

  • This package will let you know when someone posts on threads.net.
  • Allows you to track multiple users at once.
  • Has an automatic defaultAnnouncements for Discord webhooks.

Getting Started


const { Client } = require(`@elara-services/threads`);
const client = new Client({
    defaultAnnouncements: true,
    debug: true, // Only if you want debug logged.
    interval: 3 * 60000, // Check all of the users every 3 minutes. (WARNING, I wouldn't go under 2 minutes.)
    // The default interval is: every 3 minutes.
});

Add a user

client.addUser({
    name: "the_name_for_the_user", // Their name all lowercase username. 
    id: "the_id_for_the_user", // Their user ID, use `client.fetchUser` or `client.bulkFetchUserIds` to get multiple user IDs.
    webhooks: [ // Only required if you want the package to automatically announce new thread posts
        "https://discord.com/api/webhooks/.../...",
    ],
    full_name: "Their Display Username", // Optional 
    color: 0, // The color for the embed(s)
    ignoreText: [ // What is the text you want to ignore, if it's in the thread post.
        "#boop"
    ],
    useLinkButton: true, // If the package should use a link button for the user's thread post url. (ONLY WORKS FOR WEBHOOKS CREATED BY DISCORD BOTS/APPLICATIONS)
});

Add multiple users.

client.addUsers([
    {
        name: "the_name_for_the_user", // Their name all lowercase username. 
        id: "the_id_for_the_user", // Their user ID, use `client.fetchUser` or `client.bulkFetchUserIds` to get multiple user IDs.
        webhooks: [ // Only required if you want the package to automatically announce new thread posts
            "https://discord.com/api/webhooks/.../...",
        ],
        full_name: "Their Display Username", // Optional 
        color: 0, // The color for the embed(s)
        ignoreText: [ // What is the text you want to ignore, if it's in the thread post.
            "#boop"
        ],
        useLinkButton: true, // If the package should use a link button for the user's thread post url. (ONLY WORKS FOR WEBHOOKS CREATED BY DISCORD BOTS/APPLICATIONS)
    },
    {
        ...etc,
    }
]);

Start listening for new posts.

client.onPost(async (user, post, raw) => {
    // Whatever code you want to run after a new post is found for the user.
});

Run the process for everything

client.run();

Formatted User

{
    username: string, // The user's username.
    id: string | number, // The user's ID 
    avatar: string, // The image url for the user.
    verified: boolean, // If the account is verified with Meta.
    following: number, // The amount of users the user is following.
    followers: number, // The amount of users the user has following. 
}

Formatted Post

{
    replies: number, // The total replies of the post. 
    likes: number, // The post likes count. 
    created: {
        iso: string, // The ISOTimestamp for when the post was created.
        unix: number, // The unix timestamp for when the post was created.
    },
    content: string | null, // The content of the post (string or null)
    id: string, // The post ID 
    code: string, // The post code to view the post.
    images: string[], // The image urls found in the post (an array of strings)
    videos: string[], // The video urls found in the post (an array of strings) 
    url: string, // The threads.net post URL.
    user: object | null, // For the formatted user object
    posts: {
        quoted: object | null, // Formatted post of the quoted thread post. (object or null)
        reposted: object | null, // Formatted post of the reposted thread post. (object or null)
        repliedTo: string | null, // The user that got replied to. (string or null)
    }
};