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

discord-14-easy

v1.0.4

Published

use a v14 de uma forma fácil

Downloads

13

Readme

npm install discord-14-easy

BASE INDEX

const { Client, MessageEmbed, MessageButton, MessageActionRow } = require('discord-14-easy');
const client = new Client() //não precisa colocar as intents, ele já vem com todas elas!



client.login('token do seu client aqui')

client.on('ready', () => {
    console.log(`[ MANAGER ] - client ONLINE COMO ${client.user.tag} | ${client.users.cache.size} Users, ${client.guilds.cache.size} Guilds, ${client.channels.cache.size} Channels`)

    const commands = [
        {
            name: 'teste',
            description: 'teste',
            options: [
                {
                    name: 'test',
                    type: 6, //https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationCommandOptionType
                    description: 'teste ok?',
                    required: true
                }
            ]
        }
    ]

    client.setCommands(commands)
})

client.on('interactionCreate', async (interaction) => {
    if(interaction.commandName === 'teste') {
        const button = new MessageButton({ label: 'Aperte Aqui', customId: 'teste', style: 'PRIMARY', emoji: '⭐'}).view()
        const row = new MessageActionRow().addComponents(button)
        const embed = new MessageEmbed().setTitle('Teste').setDescription('descrição').setColor('Red')
        let msg = await interaction.reply({ embeds: [embed], components: [row], fetchReply: true})
        let filter = user => user
        const collector = msg.createMessageComponentCollector({ filter: filter, time: 60000})
        collector.on('collect', (i) => {
            i.reply('teste')
        })
    }
})

Criar botão

const { Button, MessageActionRow } = require('discord-14-easy')
let button = new Button({label: 'label',
        emoji: '⭐',
        style: 'SUCCESS', //styles do djs v13.9.2
        customId: 'teste' //caso o type não for link isso é necessário
    }).view()
const row = new MessageActionRow().addComponents(button)

Setar o status do client

client.setStatus('Sou um client perfeito', 'online') //['online', 'stream', 'watch', 'listen']

Pesquisar um usuário

client.getUser('id')

Pesquisar uma guilda

client.getGuild('id')

Pesquisar um canal

client.getChannel('id')

Desligar o client

client.destroy()

Registrando os SlashCommands

const commands = [
        {
            name: 'teste',
            description: 'teste',
            options: [
                {
                    name: 'test',
                    type: 6,
                    description: 'teste ok?',
                    required: true
                }
            ]
        }
    ]

    client.setCommands(commands)

Usando os comandos

client.on('interactionCreate', async (interaction) => {
    if(interaction.commandName === 'teste') {
        const button = new MessageButton({ label: 'Aperte Aqui', customId: 'teste', style: 'PRIMARY', emoji: '⭐'}).view()
        const row = new MessageActionRow().addComponents(button)
        const embed = new MessageEmbed().setTitle('Teste').setDescription('descrição').setColor('Red')
        let msg = await interaction.reply({ embeds: [embed], components: [row], fetchReply: true})
        let filter = user => user
        const collector = msg.createMessageComponentCollector({ filter: filter, time: 60000})
        collector.on('collect', (i) => {
            i.reply('teste')
        })
    }
})

Enviar mensagens para canais.

client.send('id', {}) // o {} , deve ser usado igual uma msg normal, tipo content: 'teste'

Fazer login no client

client.login('Seu token aqui')

Returns

client.users => retorna os usuários
client.guilds => retorna os servidores
client.channels => retorna os canais
client.user => retorna o usuário do client
client.data => retorna o client inteiro

Servidor de suporte | Servidor de suporte 2