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

reseau-discord

v1.1.1

Published

Node.js package to interact with the Réseau Discord Artivain API. Official one or selfhosted.

Downloads

20

Readme

reseau-discord-node

wakatime CodeFactor npm npm npm npm (prod) dependency version Discord

Node.js module for interacting with the Réseau Discord Artivain API.

How to use

Create a new connection to an API

By default, it uses the official database from Artivain but it can be changed to any database compatible with the Réseau Discord API.

// Import the library
import ReseauDiscordAPI, { ReseauDiscordAPICredentials } from "reseau-discord";

// Create a new connection
const rd = new ReseauDiscordAPI();

// Optional: use a third-party database compatible with the API
rd.setBaseUrl("https://anotherdatabase.tld");

// You can also directly set the base URL when initializing the ReseauDiscordAPI
const alternativeDatabase = new ReseauDiscordAPI("https://anotherdatabase.tld");

// Optional: set authentication credentials to use endpoints that requires permissions
const USERNAME = "username";
const TOKEN = "supersecrettoken";
rd.setCredentials(new ReseauDiscordAPICredentials(USERNAME, TOKEN));

// Check if an ID is suspect
rd.check("382869186042658818")
	.then(response => {
		console.log("Is suspect?", response.suspect.status);
	})
	// Handle errors
	.catch(error => {
		// ...
	});

// Check if an ID is blacklisted
rd.check("382869186042658818")
	.then(response => {
		console.log("Is blacklisted?", response.blacklist.status);
	})
	// Handle errors
	.catch(error => {
		// ...
	});

// Check if an ID is listed on at least one list
rd.check("382869186042658818")
	.then(response => {
		console.log("Is listed?", response.suspect.status || response.blacklist.status);
	})
	// Handle errors
	.catch(error => {
		// ...
	});

// Know who added the ID to the list
rd.check("382869186042658818")
	.then(response => {
		if (!response.suspect.status) return console.log("Not suspect");

		// Log the username and timestamp
		console.log("Added as suspect by", response.suspect.addedBy, "on", response.suspect.since);
	})
	// Handle errors
	.catch(error => {
		// ...
	});

// Add an ID to a list
// Don't forget to set the credentials first!
rd.add("suspect", "382869186042658818")
	.then(added => {
		// added will be false if it was already on the list
		console.log("Added?", added);
	})
	.catch(error => {
		// ...
	});

// Remove an ID from the list
// Don't forget to set the credentials first!
rd.remove("suspect", "382869186042658818")
	.then(removed => {
		// removed will be false if it wasn't on the list
		console.log("Removed?", removed);
	})
	// Handle errors
	.catch(error => {
		// ...
	});