Reactions / Command Replies

Discord.Short offers a lot of cool things you can do with reactions

When you make a command, you can get the output / reply by running a function, lets start off by creating a giveaway command:

new ds.Command({
    name: 'giveaway',
    async execute({send}) {
        send('Hello!');
    }
});

we can get the "Hello!" message by running this function:

new ds.Command({
    name: 'giveaway',
    async execute({send}) {
        send('Hello!');
        let hello = await ds.getNextReply(); // here!
    }
});

now we have a message object of the reply, although this is not how we are going to make the command, lets react with a party popper

new ds.Command({
    name: 'giveaway',
    async execute({send}) {
        send('Hello!');
        let hello = await ds.getNextReply();
        hello.react('🎉');
    }
});

When we run the !giveaway command, we will get this:

in discord

This is cool, but we want something to actually happen when we react to the message, so lets run this function

where the function says arguments you can add any of these:

  • user - the person who reacted

  • channel - the channel the message that was reacted to was in

  • message - the message that was reacted to

  • send() - send a message in the channel where the reaction was

so lets make it send a message whenever someone reacts:

now when we run the command and react, it should look like this:

in discord

then, we can make the giveaway work. I have a simple premade example, so ill just show it here:

now if we run, !giveaway example 10 it will create a giveaway for "example" and will end in 10 seconds

after the giveaway, it will look something like this:

in discord

Similarly to ds.reactEvent(); you can see when someone un-reacts, it has the same syntax:

Last updated

Was this helpful?