Ecstar is the easiest framework for Discord.js.
- commands
- events
- slash command
- Only partially available
Install Ecstar
npm install ecstar
yarn add ecstar
*You can also use plain JavaScript, but TypeScript is recommended.
// src/index.ts
import { Client } from 'ecstar';
new Client({ prefix: '!' }).login(/* token */);
// src/commands/ping.ts
import { command } from 'ecstar';
export default command(() => ({
name: 'ping', // Name of the command
run({ message, send }) {
/* We will implement as usual. */
message.channel.send('pong!');
/* There is a more convenient way. */
send('pong!');
},
}));
// src/events/ready.ts
import { event } from 'ecstar';
export default event(() => ({
name: 'ready', // event name
run({ client }) {
client.log.ready(client.user?.tag);
},
}));
Run it, and it's done!