0.0.2 • Published 1 year ago
vam.js v0.0.2
VamJS
!WARNING
This project is still actively in development. Expect ongoing updates and improvements. Use with caution.
Current support
- Events handling
- Slash commands
- Context menu commands
- Button handlers
- Guards (middlewares)
- Autocomplete handlers
- Message Commands
- External plugins
About
vam.js emerges as a finely-tuned discord.js framework, meticulously engineered to prioritize ease of use and efficiency.
- Lightweight and easy syntax
- Plugins support (developing)
- Fully typed parameters
- Written in TypeScript
Installation
discord.js library is required for vam.js to work.
npm install vam.js discord.js
yarn add vam.js discord.js
pnpm add vam.js discord.js
bun add vam.js discord.js
Basic example usage
// path: src/index.js
import { VamClient } from 'vam.js'
import { GatewayIntentBits } from 'discord.js'
const client = new VamClient({ intents: [GatewayIntentBits.Guilds] })
client.login() // uses by default process.env.DISCORD_TOKEN
// path: src/events/ready.js
import { Event, context } from 'vam.js'
const event = new Event({ name: 'ready', once: true })
event.handle(async (client) => {
console.log(`logged in as ${client.user.tag}`)
// this will change in future
await context.client.registerCommands()
})
export default event
// path: src/events/interaction-create.js
import { Event, handleInteraction } from 'vam.js'
const event = new Event({ name: 'interactionCreate' })
event.handle(async (interaction) => {
await handleInteraction(interaction)
})
export default event
// path: src/commands/ping.js
import { SlashCommand } from 'vam.js'
const slash = new SlashCommand({ name: 'ping', description: 'ping pong' })
slash.handle((interaction) => {
interaction.reply({ content: 'pong' })
})
export default slash
// if you want to export more than one in a single file:
// export { slash, ... }