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

dsc-functions

v1.4.0

Published

Manage the dsc.best events easily and set up them fast

Downloads

2

Readme

Dsc.best Functions npm

Manage the dsc.best events easily

Package migrated to TypeScript

Support

If you need help with the package or have any question you can join our support server

Table of Contents

Node.js v16 is required

Webhooks

Send a message (or embed) when someone votes for your bot

Prerequisites

Before you configure the package you need to do 3 things:

  1. Have your bot listed in dsc.best
  2. Install and setup the express and discord.js packages
  3. Add the endpoint url in your bot's panel (https://dsc.best/dashboard/bot/YOUR-BOT-ID-HERE) of dsc.best

Picture Example

Setup

npm install dsc-functions --save
const { DscClient } = require('dsc-functions') // import the package
const dscClient = new DscClient({  DiscordClient:  discordClient,  DscAPIToken:  'API-TOKEN-HERE'  })

In your main file

const Discord = require('discord.js');
const Client = new Discord.Client({
	intents: [Discord.Intents.FLAGS.GUILDS, 
	Discord.Intents.FLAGS.GUILD_MESSAGES] //Only add intents if you work in v13
})

const express = require('express')
const app = express()

app.use(express.json())
app.use(express.urlencoded({ extended: false }))

client.on('ready', () => {
	console.log('Online!')
})

app.post('/endpointname', (req, res) => {
	const info = dscClient.webhooks(req)
	
	const webhookEmbed = new Discord.MessageEmbed()
	.setDescription(`${info.eventData.user.username} has voted, and now i have ${info.eventData.votes} votes`)
	
	info.sendWebhook(webhookEmbed, {
		channelId: '856544223801245736', // Here goes the id the channel where you want to send the embed
		reaction: '💟', // Reaction not required (reaction must be a reaction unicode), support animated, normal and custom emojis
		discordJSVersion: 'v13' //We support v12 too (if you are a v13 user this line is optional)
	})
})

app.listen(3000, console.log('Server listening on port 3000'))
Client.login('YOUR-BOT-TOKEN-HERE')

Data you can request of Webhooks

  • Verification
  • Event type
  • Username
  • Discriminator
  • User ID
  • User Avatar
  • Total Votes of your bot

Post Server Count

Post the server count of your bot

Prerequisites

  1. Have your bot listed in dsc.best

In your main file

/* The server count will not be updated till the interval time ends */

const Discord = require('discord.js')
const Client = new Discord.Client({
	intents: [Discord.Intents.FLASG.GUILDS,
	Discord.Intents.FLAGS.GUILD_MESSAGES]
})

Client.on('ready', async () => {
	await dscClient.postServerCount(1200000, true) // put it in the ready event
	/* 1200000 its the Interval of time in ms you want to post the server count, if you don't input nothing by default will be every hour in ms */
	/* True its to log in the console when the server count was posted, if you dont input anything will be false by default */
})

Client.login('YOUR-BOT-TOKEN-HERE')

Bot Information and Votes

Get information and vote's information about dsc.best listed bots

In your main file

const Discord = require('discord.js')
const Client = new Discord.Client({
	intents: [Discord.Intents.FLASG.GUILDS,
	Discord.Intents.FLAGS.GUILD_MESSAGES]
})

client.on('ready', async() => { // The methods getBotInfo and getVotes must be in a client event such as ready, messageCreate (message for v12), etc.
	/* Information */
	const botInfo = await dscClient.getBotInfo('BOT-ID-HERE') // if you have your bot listed and want to get the info you don't need to input the id 
	
	console.log(`${botInfo.name}\n${botInfo.owners}`) // Scroll down to see what information you can get
	
	/* Votes */
	const votesInfo = await dscClient.getBotVotes('BOT-ID-HERE') // if you have your bot listed and want to get the votes you don't need to input the id
	console.log(`Votes: ${votesInfo.votes}\nVoters: ${votesInfo.users}`)
})

Client.login('YOUR-BOT-TOKEN-HERE')

Information you can request about bots

  • Avatar
  • Owners
  • Badges
  • If its certified
  • If its approved
  • Servers count
  • Shards count
  • Name
  • Short Description
  • Entire Description
  • Prefix

Creators

Coder: Jelosus1 Project Setup: ASHUdev05

License

MIT License

Copyright (c) 2021 Jelosus1

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.