Overview
Rune is the scripting language behind Functious tags. It is small on purpose, built for Fluxer, and fully sandboxed.
What is Rune?
A tag is a small program a server can invoke any time. It can be a reusable message, a minigame, a lookup. Rune is what you write inside it. The language uses braces for blocks and JS-style parentheses, so if you have written any scripting language before, it will feel immediately familiar.
- Braces for blocks. Functions, loops, and conditionals group with
{ }. - A full standard library. Math, randomness, strings, lists, dicts, regex, and embeds are all built in.
- Sandboxed by default. A runaway loop can never take the bot down with it.
Hello world
Rune strings interpolate [name] directly, and a few globals are always in scope. Greeting a member is one line.
Your first tag
Tags are stored on the bot. Create one with f!tags add, giving it a name, a type, and the code that runs when someone uses it.
f!tags add welcome text say("hello, world")Now anyone can run it by name:
f!tags welcomeAnything typed after the tag name is passed to the code as args. args.0 is the first word, args.1 is the second, and so on. The Context chapter has the full details.
So f!tags greet rubik gives the tag an args.0 of "rubik", and [args.0] in the code is replaced with it. A single tag turns into a command.
f!tags add greet text say("hi [args.0]!")
f!tags greet rubikWhere tags live
Sandboxed by default
Rune runs in a sandbox with hard limits, so even a tag gone wrong is a single clean error instead of a problem.
Limits
When a tag fails, Functious replies with a short embed naming the category of the error (parse vs. runtime). When it can, it also adds a code block with a caret pointing at the offending line.
What's in this guide
This guide walks through the language from the ground up. The chapters are short and each one builds on the last.
- 01OverviewWhat Rune is and how to run your first tag.
- 02BasicsComments, variables, values, strings, and operators.
- 03Control FlowConditionals, loops, and functions.
- 04BuiltinsThe full standard library reference.
- 05Context$user, $channel, $message, $guild, and args.
- 06EmbedsRich messages built with embed().
- 07ExamplesReal working tags to learn from.