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

dbdteamjs

v0.0.17

Published

A Discord api wrapper to create your bot!

Downloads

587

Readme

@dbdteam.js

✨ Introducing a compact JavaScript library (NodeJS module) designed to streamline the development of Discord bots using the Discord API. While it's in its initial stages, your feedback is invaluable. Should you encounter any bugs, please do not hesitate to notify us. Join our official Discord server (alternative link here), where you can open a forum in the "support-projects" channel. Our team is committed to providing immediate assistance, ensuring your concerns are promptly addressed (or at least acknowledged). Visit our documentation here (actually depracated).

NPM:

GitHub:

Installation

🚀 To integrate this compact package seamlessly into your project, adhere to the following installation procedures tailored for NPM, Yarn, and PNPM package managers under.

NPM

npm i dbdteamjs 

or (this is better)

npm i github:DBDTeam/dbdteamjs#0.0.6

YARN

yarn add @dbdteamjs

PNPM

pnpm i dbdteamjs

Starting to create the bot

🎒 Firstly, it is suggested that you please have knowledge of how to create Discord Applications in Discord Developers Applications, once you have your application created, follow the following steps (this will be simple, so you should know about Discord Intents too):

  1. Get your app token.
  2. Invite your bot to a server.

Once you have that done, it's time to start creating the robot using the package. See under.

Example using MessageContent Intent

const {
  Client,
  Intents,
  IntentsBitFields,
  PresenceStatus,
  PresenceTypes,
} require("dbdteamjs");
const $Intents = new IntentsBitFields(
  Intents.Guilds,
  Intents.GuildMembers,
  Intents.GuildMessages,
  Intents.MessageContent
);

const client = new Client({
  token:
    "Here your bot token",
  intents: $Intents.intents,
  gateway: {
    mobilePlatform: false,
  },
});

client.on("ready", ({ username }) => {
  console.log(`I have successfully logged on to ${username}`);

  client.presence.update({
    activities: [
        {
          name: `Hello world!`,
          type: PresenceTypes.Competing
        }
      ],
    since: 0,
    status: PresenceStatus.DND,
  });
});

client.on("messageCreate", async(msg) => {
  if(msg.content?.toLowerCase() === "!hi") {
    msg.reply({
      content: `Hi!`
    })
  }
})
});

client.connect() // Will establish the connection between the robot and the WS.

Example using Interactions

import {
  Client,
  IntegrationTypes,
  Intents,
  IntentsBitFields,
  InteractionContexts,
  PresenceStatus,
  PresenceTypes,
} from "dbdteamjs";

const Intents = new IntentsBitFields()

Intents.add("Guilds")
Intents.add("GuildMembers")

const client = new Client({
   token: `Here your bot token`,
   intents: Intents.intents,
   gateway: {
     mobilePlatform: false // Only this if you want the robot to have the online icon on a mobile device.
   }
})

client.on("ready", () => {
   console.log(`I have successfully logged on to ${client.user.username}`)
   client.presence.update({
     activities: [
        {
          name: `Hello world!`,
          type: PresenceTypes.Competing
        }
      ], 
     since: 0,
     status: PresenceStatus.DND // This means Do not Disturb
   })

   client.application.commands.set(
    [
      {
        name: "ping",
        description: "Pong!",
        options: [],
        type: InteractionTypes.Slash
      }, //You can add more application commands adding it in the array.
    ]
   )
})

client.on("interactionCreate", async(interaction) => {
   if(interaction.isSlash){
    if(interaction.name === "ping"){
      interaction.makeReply({ content: `Pong!\nLatency: ${client.ping}` })
    }
   }
})

client.connect() // Will establish the connection between the robot and the WS.