Actions
Filters let the event in. Conditions confirmed it's the one you wanted. Actions are where you finally tell Nighty what to do about it.
Actions run in order, top to bottom
Your actions are a list, and Nighty works through it one at a time, from top to bottom. Each action finishes completely before the next one starts.
So the order you put them in is the order they happen in. If you send a message and then react to it, the message exists by the time the reaction happens. Flip them around and it doesn't.
Three things that follow from this:
If one action fails, the rest still run. Say your second action tries to delete a message that's already gone. It fails, the reason goes into your feature's log, and Nighty moves straight on to the third action. One broken step doesn't throw away the whole list.
Slow actions hold up the queue. Anything that takes time - waiting, fetching, running a slash command - blocks the actions below it until it's done. Usually that's exactly what you want, and it's what makes the Wait action useful.
Using the result of an action
Some actions hand you something back that later actions can use - an Action Ref:
This unlocks a lot. Once Send Message hands you the message it sent, later actions can react to it, edit it, pin it, or delete it - all in the same run.
Example - a self-deleting notice:
Example - post an invite:
Remember the ordering rule: you can only use a result after the action that produced it. Put them in the right order.
Last updated