项目作者: DiscordBoats

项目描述 :
Node.js webhook vote listener
高级语言: TypeScript
项目地址: git://github.com/DiscordBoats/webhooks-node.git
创建时间: 2019-03-15T16:50:25Z
项目社区:https://github.com/DiscordBoats/webhooks-node

开源协议:MIT License

下载


DEPRECATED

The website this module is for has shutdown.

Laffey

:office: | Webhook handler for discord.boats

Example

  1. const { Server } = require('laffey');
  2. const handler = new Server(7700, '/webhook', {
  3. token: 'youshallnotpass'
  4. });
  5. handler
  6. .on('vote', (voter, bot) => console.log(`${voter.username} has voted ${bot.name}`))
  7. .on('listen', () => console.log(`Listening on port ${handler.port}`))
  8. .listen(); // It listens and emits the listen event /\

Express Example

  1. const { express: laffey } = require('laffey');
  2. const express = require('express');
  3. const app = express();
  4. app.use(express.json());
  5. app.use(laffey({
  6. callback: (error, bot, voter) => {
  7. if (error) return console.error(error);
  8. // vote logic is here
  9. },
  10. token: 'any random token you wanna set',
  11. path: '/votes'
  12. }));
  13. app.listen(3000, () => console.log('localhost:3000'));

License

laffey is released under the MIT License. Read here for more information.