Giter VIP home page Giter VIP logo

discord-rod's Introduction

Rod of Discord

Rod 2.0 is released! You can check out https://rodbot.io/ for reference and guides.

Join the discord: https://discord.gg/MvdRurG

For Developers

I'm going to sort of assume you know how to program and have used Rod before for the next bit, and just do a high-level overview. Rod2 uses an express.js type of structure to handle messages and is backed by a Mongo database, which we access with the Mongoose driver.

Discord message received
   |
   |
   V
Create RodRequest and RodResponse objects
   |
   |
   V
Determine if bot should process message
via escape char etc.
   |
   |
   V
Run pre-processing middleware
   |
   |
   V
Run the handler
   |
   |
   V
Run post-processing middleware
   |
   |
   V
Send message response

Middleware and handlers are auto-detected by just dropping the files in the corresponding folders. You'll see a message on start-up about what's been detected.

RodRequest and RodResponse

RodRequest holds all the information about the incoming message. The actual message object, the author, the server it was sent on, etc. The RodResponse object hold everything about the message we're going to send in response (if any).

Handlers

Handlers in Rod2 are groups of commands with similar functionality, but if you so chose, each command could have their own handler. You'll also see a few of the handlers are subclasses of MultiCommandHandler, which just abstracts away some of the nitty gritty about processing the commands.

Middleware

Middleware is processing that happens to a message before the command (if there is one) is processed. This is where logic like "is this author supposed to be talking as an alias" sort of things are processed. Negative priority middleware is simply processed after the handler goes. For instance the "call" middleware runs after the handler because it wants to detect rolls after they've been processed.

Questions

If you have any questions, hop in the Discord and ask.

discord-rod's People

Contributors

dependabot[bot] avatar ultimatebrent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

discord-rod's Issues

useonce is overridden by channel aliases

Typing this /useonce Timmy picturelink.com/picture.png Hello there! in a channel where you already have an automatic alias set will result in the aliased char saying "Hello there!"

from LeoIvanov#5546

Ternary operations in rolls

Basically if/then statements, but need reference to results.

$1 would be the left hand side of the comparator, while $2 would be the right.

ex: /roll d6 > 5 ? $1 + d6 : $1 is a convoluted way to right a one dimensional explosion on 6 of a d6

Dependent on #4

Cannot use commands on WidgetBot

I'm using WidgetBot on a website and one of the requests is to make possible to use RoD Bot commands, but when I try the command is read as a simple message.

First I make contact with Widgetbot's creator and he replied with:

  • users cannot use slash commands from WidgetBot; it is not possible for us to add bot slash commands to the widget due to a Discord limitation

  • for old message-based bot commands, the bot can see messages sent through WidgetBot, but it may be choosing to ignore it. You'll need to talk to the developers of rod-bot for more information.

So, now I'm here :)
Is it possible to fix it?

Comparisons in rolls

Add support for comparisons in rolls.

As in /roll 3 > 2 = 1

Can be used to track successes: /roll [3] d6 > 3 will tell you how many 4, 5, and 6s you rolled in those 3 dice.

Slash Command in Rodbot on discord

Setting the Command function from the default value of . to a new value of / causes errors when attempting to post as an alias.
When posting the alias will not allow spaces or capitalization.
If the command is set to \ the issue is not present.
UW LARP: Tempest Grove
Server ID: 310766703338586123
Channel ID: 525750676240990228
Members: 153
Since
2017-05-07
Escape Char

Ignore Char
none

[Crash] User aborted sending error

- hook.send error: HTTPError [AbortError]: The user aborted a request.
    at RequestHandler.execute (/var/hg/discord-rod-live/node_modules/discord.js/src/rest/RequestHandler.js:93:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at runNextTicks (internal/process/task_queues.js:66:3)
    at listOnTimeout (internal/timers.js:518:9)
    at processTimers (internal/timers.js:492:7) {
  name: 'AbortError',
  code: 500,
  method: 'post',
  path: '/webhooks/869487192949555211/nVmhbSn-hE4A-XkCO9C2DDgE4VaOBvO6s-uzcOAqZykJ99N2ca8BcliWH0qkF8bvx-NM?wait=true'
}

Ellipsis bug

Npc speech with ellipsis dies for some reason

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.