0.7.8 • Published 1 year ago

better-discord-collectors v0.7.8

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

better-discord-collectors

Basic Usage

import { Client } from 'discord.js';
import { ButtonCollector } from 'better-discord-collectors';

const client = new Client({ intents: 3276799 });
client.on('messageCreate', async ({ content, channel, author }) => {
    if (content.startsWith('!hello')) {
        let message = await channel.send({
            embeds: [{
                title: 'Embed'
            }],
            components: [{
                type: 1,
                components: [{
                    type: 2,
                    custom_id: 'test',
                    label: 'Button',
                    style: 2
                }]
            }]
        })
        
        let collector = new ButtonCollector(client, {
            customsIDs: 'test',
            usersIDs: author.id,
            rolesIDs: ['123456789012345', '09876543212345'],
            autoUpdate: true, //.deferUpdate
            autoReply: true //.deferReply
        }).setCallback((interaction, self) => {
            interaction?.channel?.send('Collector Work!');
            self.setEnd(); // If you use this collector in a command, to avoid duplication.
        });

        //If you want edit the timeout of the end
        collector.extendTime(60_000); //
    }
});

Other usage

const collector = new ButtonCollector(client, {}).setCallback((interaction, self) => {
    //Code
});

export default collector;
0.7.8

1 year ago

0.7.7

1 year ago

0.7.5

1 year ago

0.7.0

1 year ago

0.6.8

1 year ago

0.6.6

1 year ago

0.6.2

1 year ago

0.6.0

1 year ago

0.5.5

1 year ago