npm.io
3.0.0 • Published 6 years ago

hershel

Licence
MIT
Version
3.0.0
Deps
8
Size
40 kB
Vulns
0
Weekly
0

Hershel

A framework for modular and blazing fast Discord bots

Hershel on npm Travis CI Coveralls Prettier MIT License


demo

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

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's theoretical logic & documentation layout, a fast and low overhead web framework for Node.js.

License

MIT

Keywords