Socket
Socket
Sign inDemoInstall

discord-14-easy

Package Overview
Dependencies
28
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    discord-14-easy

use a v14 de uma forma fácil


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source
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

Keywords

FAQs

Last updated on 02 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc