2.1.1 • Published 1 year ago

simple-djs-framework v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Moved to @made-simple/discord.js

Simple Discord.JS Framework


Makes it extremely easy to create and get a bot up and running with Discord.JS. This framework is designed to get a bot up and running as quickly as possible with minimal effort.

Installation

npm install simple-djs-framework

Example Usage

const { Client, SlashCommandBuilder } = require("simple-djs-framework")
const client = new Client([ "Guilds" ])

client.addCommand("ping", {
    description: "Pings the bot.",
    execute: (client, interaction) => {
        interaction.reply("Pong!")
    }
})

client.addEvent("ready", () => console.log("Ready!"))

client.registerCommands() // registers the commands globally
client.start("token")

Examples

Adding a command

client.addCommand("ping", {
    description: "Pings the bot.",
    execute: (client, interaction) => {
        interaction.reply("Pong!")
    }
})

// commands also support adding more fields

client.addCommand("userjoined", {
    description: "Tells you when a user joined.",
    allowedInDMs: false,
    args: [{
        name: "user",
        type: "user",
        description: "The user to check.",
        required: true
    }],
    execute: (client, interaction) => {
        const user = interaction.options.getUser("user")
        interaction.reply(`${user.username} joined on ${user.createdAt}`)
    }
})

Registering a command

client.registerCommands() // registers the commands globally
client.registerCommands("guildID") // registers the commands in a guild

Adding an event

client.addEvent("ready", (client) => console.log("Ready!"))

Using folders instead of a single file

client.addCommandsFolder("./commands")
client.addEventsFolder("./events")
client.addModalsFolder("./modals")

Creating a command file

// commands/ping.js

const { SlashCommandBuilder } = require("simple-djs-framework")

export const builder = new SlashCommandBuilder()
    .setName("ping")
    .setDescription("Pings the bot.")

export const execute = (client, interaction) => {
    interaction.reply("Pong!")
}

Creating an event file

// events/ready.js

export const execute = (client) => console.log("Ready!")

Using dotenv

require("dotenv").config()
client.start() // token will be read from .env as DISCORD_TOKEN or TOKEN

License

MIT

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Repository

Contributors

@alexasterisk

2.1.1

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago