Code Monkey home page Code Monkey logo

discord-ez-bot's Introduction

discord-ez-bot

Super simple Discord bot framework, based on discord.js.

Inspired by Symfony's Webpack Encore, you can easily create your bot using a fluent interface.

Features

  • written in TypeScript - includes .d.ts files
  • very lightweight
  • extremely easy to use
  • not a different API wrapper - it can use all the features of discord.js
  • all builder methods are documented

Example

Install the package:

# if you use npm
npm install discord-ez-bot

# if you use yarn
yarn add discord-ez-bot

Now, bring your bot to life:

// import the builder
const { DiscordBotBuilder } = require('discord-ez-bot');

// create a bot builder
const bot = new DiscordBotBuilder('?') // define the command prefix
  .whenReady(() => console.log('Ready')) // execute a callback when the bot becomes usable
  .cmd('hello', msg => msg.reply('Hi there!')) // easily handle commands
  .cmd('args', (msg, args) => msg.reply(`You gave me: ${args}`)) // command arguments are supported too
  .on('typingStart', (chan, user) => chan.send(`${user.username} is typing!`)) // and raw `on` events as well
  .build(); // magically create an instance of `Discord.Client`!

// at this point, `bot` can use all discord.js functionalities;
// log in with a bot token, just like you usually would!
bot.login('token');

While executing this script, your bot should boot and start responding to commands, and that's just literally in less than 10 lines of code - how cool is that!?

discord-ez-bot's People

Contributors

karmek-k avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.