Socket
Book a DemoInstallSign in
Socket

discord-structures

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-structures

the basic structures for any discord bot.

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

structures

This npm module is here because i am tired of making them

how to use:

Setup

in your package.json run npm install

Example Command:

let { CommandStructure } = require('discord-structures')

class Ping extends CommandStructure {
    constructor() {
        super();

        this.name    = 'ping' // can be used in super as well
        this.aliases = [' pong ']
    }

    async execute({ message }) or (message) {
        return await message.channel.send('Pong!'); // Discord.js

        return await message.channel.createMessage('Pong!'); // Eris
    }
}

module.exports = Ping;
// or
module.exports = new Ping();

The Structure Client

very simple to set up

all the structure has is a help command. more features will be coming soon

Doc:

NameType
messageObject
clientObject
libString
prefixString
disableHelpBoolean
commandsObject

example:

let { StructureClient } = require('discord-structures');

new StructureClient(message, client, 'eris', '!', false) // true is only if you want to disable the help command

The client is supposed to be like this

let { Client } = require('eris'); // you can also go with discord.js but the lib has to be djs
let { token } = require('./config.json');
let { StructureClient } = require('structures');

let client = new Client(token);

client.once('ready', () => {
    console.log('Ready');
});

let command = require('./test');
client.commands = new Map();

client.commands.set(command.name, command)

client.on('messageCreate', async (message) => {
    new StructureClient(message, client, 'eris', '!', false);

    if (message.content === `!${command.name}` || message.content === `!${command.aliases}`) {
        command.execute({ message });
    }
})

client.connect();

The command object can also be:

if there is no json object, the help menu will show undefined

{
    "name": ["your commands here"]
}

Keywords

discord

FAQs

Package last updated on 26 Feb 2021

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.