3.8.6 • Published 3 years ago

@steve12341825/discord-create v3.8.6

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

discord-create

discord-create is a package that helps to create a discord.js bot easily

setup

const DiscordCreate = require('@steve12341825/discord-create');
const config = require('./config.json');

const Discord = new DiscordCreate.DiscordBot({
    token: config.token,
    prefix: config.prefix,
    commandfile: 'commands',
    eventfile: 'events'
});

Discord.login();

exmaple command

const DiscordCreate = require('@steve12341825/discord-create');

module.exports = class Test extends DiscordCreate.BaseCommand {
    constructor() {
        super('test', 'test', [])
    }

    async run (client, message, args) {
        message.channel.send('command working');
    }
}

example event

const DiscordCreate = require('@steve12341825/discord-create');

module.exports = class Message extends DiscordCreate.BaseEvent {
    constructor() {
        super('message');
    }

    async run(client, message) {
        if (message.author.bot) return;
        if (!message.guild) return;
        if (message.content.startsWith(client.prefix)) {
          const [name, ...args] = message.content
          .slice(client.prefix.length)
          .trim()
          .split(/\s+/);
          const command = client.commands.get(name);
          if (command) {
            command.run(client, message, args);
         } 
      }
   }
}

example (button and embed)

const DiscordCreate = require('@steve12341825/discord-create');

module.exports = class Test extends DiscordCreate.BaseEvent {
    constructor() {
        super('test', 'test', []);
    }

    async run(client, message, args) {
        const button = new DiscordCreate.MessageButton()
        .setStyle('red')
        .setLabel('Button') 
        .setID('button1');

        const embed = new DiscordCreate.MessageEmbed()
        .setTitle('embed')
        .setDescription('This is an embed')

        message.channel.send(embed, button);
    }
}
3.8.6

3 years ago

3.8.5

3 years ago

3.7.5

3 years ago

3.5.3

3 years ago

3.5.7

3 years ago

3.5.6

3 years ago

3.5.5

3 years ago

3.7.2

3 years ago

3.5.4

3 years ago

3.5.8

3 years ago

2.3.6

3 years ago

2.3.5

3 years ago

2.3.4

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago