1.0.542 • Published 3 years ago

discord-with-slash v1.0.542

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

This handler provides an easy to use for the brand new discord slash commands

Donate Paypal & feedback : demonshosting.business@gmail.com

Path Note 1.0.5

Type in the terminal

npm i discord-with-slash@latest

Custumize You Messages with the new send request

Now :

  • You can send ephemeral messages (Hidden messages)
  • You can define a custum type of the interaction response
  • You can custumize your response by adding a components (buttons and that stuff)

An Example

if(!options.member.hasPermission('BAN_MEMBERS')) return options.send('You have not permission to ban member', {
    ephemeral:true, components:[{
        type:1,
        components:[{
            type:2,
            label:'Invite the bot',
            url: 'https://discord.gg/...',
            style:5
        }]
    }]
    });

    options.guild.members.fetch(options.args.target).ban().then((banned_user) {
        options.send(`${banned_user.tag} has been banned successfully ✈`);
    })

Initialization

To initialise the handler just type in your script

const discord = require('discord.js');
const client = new discord.Client();
const path = require("path");
// Import the slash commands handler
const slashCommands = require('discord-with-slash');

const slashCommandHandler = new slashCommands(client, path.join(__dirname,"commands directory"), "testing guild id (Optionnal)");

client.login('your token');

Done, So now lets create our first command

First we need to create a file in the commands directory that we specified

- Slash Commands
    - ping.js

Now we open the file and type the following script to create our command

    module.exports = {
        name: "ping",
        description : "My first slash command",
        execute(options) {
            options.send('Pong 🏓')
        }
    }

You see here i declared a send function that is not availaible in the normal slash commands methods its embeded with the options and take as parameters ({content: 'The reply', interaction: options.interaction})

You can also easily create embeds

Lets Take a look

  • Create a second file : name it embed.js

The directory will look something like this

  • Slash Commands
    • ping.js
    • embed.js

Open the file and simply use the embeded send function and its done !

    const { MessageEmbed } = require('discord.js');
    module.exports = {
        name: "embed",
        description : "Sends An Embed",
        execute(options) {
            options.send(new MessageEmbed().setAuthor("Hey Im Using Slash Commands").setColor("RANDOM"));
        }
    }

We are done

We created our first slash commands within a minute, its impressive

Thank you for choosing us !

Have Fun 😉

1.0.541

3 years ago

1.0.485

3 years ago

1.0.482

3 years ago

1.0.481

3 years ago

1.0.542

3 years ago

1.0.5

3 years ago

1.0.51

3 years ago

1.0.54

3 years ago

1.0.53

3 years ago

1.0.52

3 years ago

1.0.48

3 years ago

1.0.47

3 years ago

1.0.46

3 years ago

1.0.4

3 years ago

1.0.45

3 years ago

1.0.31

3 years ago

1.0.3

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago