0.1.6 • Published 7 months ago

dscxtra v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Discord Extra

This module simplifies the coding of discord bots

Installation

Install Discord Extra with npm :

  npm install dscxtra

yarn :

  yarn install dscxtra

pnpm :

  pnpm install dscxtra

Usage/Examples

/index.js

const { Client } = require('discord.js')
const { Handler } = require('dscxtra')
const path = require('path')

const token = 'discord_token'

const client = new Client({
    intents: ['Guilds']
})

client.login(token)

new Handler({
    client: client,
    slashCommandsPath: path.join(__dirname, 'commands'),
    slashCommandsMode: 'normal',
    eventsPath: path.join(__dirname, 'events'),
    eventsMode: 'foldernames'
})

/commands/test.js

const { SlashCommandBuilder } = require('discord.js');
const { SlashCommand } = require('dscxtra');

exports.command = new SlashCommand({
    data: new SlashCommandBuilder().setName('test').setDescription('test'),
    run(command) {
        command.reply('test')
    }
})

/events/messageCreate/test.js

const { Event } = require('dscxtra');

exports.event = new Event({
    once: true,
    run(message) {
        if (message.author.bot) return;
        message.reply('test')
    },
})

API Reference

  new Handler()
ParameterTypeDescription
clientClient (discord.js)Required. Your discord client
slashCommandsPathpathCommands path
slashCommandsModestringCommands mode (normal (default) or subfolders)
eventsPathpathEvents path
eventsModestringEvents mode (normal (default) or subfolders or foldernames)
  new SlashCommand()
ParameterTypeDescription
dataSlashCommandBuilder (discord.js)Required. Slash command data
run(command)functionRequired. Slash command executor
  new Event()
ParameterTypeDescription
namestring or Events (discord.js)Required if mode isn't "foldernames". Event name
oncebooleanIf client.once (default: false)
run(command)functionRequired. Event executor

License

MIT

Author

0.1.6

7 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago