3.0.0 • Published 4 years ago
hershel v3.0.0
Hershel is a small, highly modular Discord bots framework based on the fact that you don't need to embed unnecessary features / code in your bot project. Hershel allows you to write your own message processing logic or to use the packages at your disposal to build an awesome Discord bot.
Install
npm i hershel
Example
// require Hershel's Client
const { Client } = require('hershel')
// instantiate it
const bot = new Client({
logger: true,
})
bot.use(({ message, state }, next) => {
if (message.author.bot) return
state.permission = getPermissionFor(message.author)
next() // call next middleware
})
bot.use(async ({ message, createReply, state }) => {
// use Hershel's reply API
const response = createReply()
await response // response is an embed by default
.setTitle('Echo... Echo... Echo...')
.setAuthor(`${message.author} with perm ${state.permission.level}`)
.setDescription(message.content)
.setFooter('Powered by Hershel')
.send() // returns a promise
await response.setTitle('Update embed title 🙈').update()
})
bot.login(process.env.DISCORD_TOKEN)
Do you want to know more? Head to the Getting Started.
Features
- Modular: Hershel supports plugin and decorator to make it extremely modular and extensible.
- Logging: We all like clean and clear logs. We use Pino, a super fast, json logger.
- Fast: No more useless feature loading you don't use.
Documentation
- Getting Started
- Plugin
- Middleware
- Reply
- Decorator
- Logging
Related
- [hershel/dispatcher](https://github.com/hershel/dispatcher) - Command dispatcher for Hershel
- [hershel/plugin](https://github.com/hershel/plugin) - Plugin helper for Hershel
- [hershel/examples](https://github.com/hershel/examples) - Example of integration with Hershel
Thanks
Thanks to Algorythmis for his corrections of the code. Thanks also to Bit My Code for their support and their 💖.
Hershel uses part of [Fastify](https://github.com/fastify/fastify)'s theoretical logic & documentation layout, a fast and low overhead web framework for Node.js.
License
MIT