0.0.2 • Published 3 years ago

@definitive-networks/discord-bot v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

About

Discord Bot isn't a bot, but a simple and flexible framework using discord.js, so that you can get your own bot up and running quick.

  • Quick.db integrated for easy access to persistent storage (also used for Slash Commands)
  • Command aliases and permissions
  • interactionButton and interactionSelect events
  • No forced features

Installation

Ensure you have Node.js 14.0.0 or higher installed, then run:

npm install discord.js@dev quick.db @definitive-networks/discord-bot

Example Usage

// ./index.js
const path = require('path');
const DiscordBot = require('@definitive-networks/discord-bot');

const client = new DiscordBot({
  botDir: path.resolve(__dirname),
  defaultPrefix: '?',
  intents: ['GUILDS', 'GUILD_MESSAGES']
});

client.start(/*DISCORD BOT TOKEN*/);
Command Example
// ./commands/ping.js
module.exports = {
  name: 'ping',
  description: 'Ping the bot',
  aliases: ['ms'],
  execute(message, args, client) {
    message.channel.send(`Pong! \`${Date.now() - message.createdTimestamp}ms\``);
  },
  SlashCommand: {
    execute(interaction, args, client) {
      interaction.reply(`Pong! \`${Date.now() - interaction.createdTimestamp}ms\``);
    }
  }
}
Event Example
// ./events/ready.js
module.exports = {
  name: 'ready',
  once: true,
  execute(client) {
    console.log(`Logged in as: ${client.user.tag}`);
  }
}

Documentation

Check out the wiki for more examples and documentation.