0.0.13 • Published 2 years ago
@foealke/discordbotframework v0.0.13
Framework docs
npm install @foealke/discordbotframework
// file: bot.js
const BotFamework = require("@foealke/discordbotframework")
const bot = new BotFamework.Bot(
null, // devToken (string)
null, // devServerId (string)
null, // devAppId (string)
null, // prodToken (string)
null, // prodAppId (string)
[], // intents (List<Discord.js Intents>)
)
bot.useCommands(__dirname + "/commands")
bot.useEvents(__dirname + "/events")
bot.login( devMode=true )
// file: commands/ping.command.js
const { SlashCommandBuilder } = require('@discordjs/builders');
const COMMAND_NAME = "ping"
const COMMAND_DESCRIPTION = "ping pong!"
module.exports = {
COMMAND_NAME, COMMAND_DESCRIPTION,
commandInteractionHandler: ( interaction ) => {
interaction.reply({ message: "Pong!" })
},
command: new SlashCommandBuilder()
.setName(COMMAND_NAME)
.setDescription(COMMAND_DESCRIPTION)
}
// file: events/ready.event.js
module.exports = (client) => {
client.on("ready", () => {
console.log("bot started!")
})
}