Skip to content

Commit 9f48aff

Browse files
committed
ZBR v1.5.0
1 parent 9d36488 commit 9f48aff

169 files changed

Lines changed: 784 additions & 645 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
All notable changes to the ZBR project are documented here and in the [changelog](https://zbrlang.vercel.app/docs/changelog) website.
44

5+
## v1.5.0 - Parser Flexibility and Alias Robustness
6+
7+
This release introduces major improvements to the parser's flexibility, simplifies function invocation, and resolves critical bugs in the alias system and positional argument handling.
8+
9+
### Core
10+
- **Optional Brackets** — Zero-argument function calls no longer require curly brackets (e.g., `Zusername` works the same as `Zusername{}`).
11+
- **Literal Text Handling** — Unknown Z-prefixed identifiers (e.g., `ZUnknown`) without brackets are now treated as literal text instead of causing runtime errors.
12+
- **Nested Bracketless Calls** — Bracketless function calls are now correctly recognized and evaluated even when nested within the arguments of other function calls (e.g., `ZsendMessage{ZchannelID;hello}`).
13+
- **Alias Fixes** — Resolved argument merging issues where aliased function calls were losing arguments, and added validation to ensure the aliased function is a valid ZBR function.
14+
15+
### Argument Parsing
16+
- **Empty Argument Preservation**`split_args` now correctly preserves empty arguments between semicolons (e.g., `Zfunc{;arg2}` correctly maps `arg2` to index 1).
17+
- **Positional Argument Robustness** — Refactored 161 functions across the codebase to explicitly handle empty string arguments as "use default" values, preventing positional misalignment bugs.
18+
19+
---
20+
521
## v1.4.4 - Runtime Aliases and Reply Fix
622

723
This release introduces the `Zalias` system for improved code reusability and fixes a bug in message evaluation.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zbr"
3-
version = "1.4.4"
3+
version = "1.5.0"
44
edition = "2021"
55

66
[dependencies]

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
ZBR is a scripting language for Discord bots powered by a high-performance Rust runtime engine.
44
You write commands as plain `.zbr` files using ZBR functions, no boilerplate, no event handlers, no framework knowledge required.
55

6-
Previously a complex setup, **ZBR is now a streamlined CLI tool** distributed via npm. You can now initialize, manage, and run your entire bot engine with a single command.
7-
86
## Quick Start
97

108
Get your bot up and running in seconds:
119

12-
### Option 1: Webapp Editor (Recommended for testing)
10+
### Option 1: Webapp Editor (Recommended)
1311
Head over to the [ZBR Webapp](https://zbr-webapp.vercel.app) for a zero-setup development experience.
1412
1. Build your commands, manage variables, and tweak settings visually.
1513
2. Press **Run** to launch your bot instantly in the cloud for testing.
1614
3. Your bot is now live for testing!
1715

1816
> **Note:** The Webapp "Run" button is strictly for rapid prototyping and interactive testing. For 24/7 production hosting, you must export your project as a ZIP and use the CLI.
1917
20-
### Option 2: CLI (For Technical Users)
18+
### Option 2: CLI
2119
1. **Install the CLI globally:**
2220
```bash
2321
npm i @zbrlang/zbr
@@ -61,7 +59,7 @@ For those who prefer a visual development environment, the [ZBR Webapp](https://
6159
Zvar{xp;ZgetUserVar{xp}}
6260
Zvar{level;ZgetUserVar{level}}
6361
64-
Ztitle{Zusername{}s Rank}
62+
Ztitle{Zusername's Rank}
6563
Zdescription{Level: Zvar{level}
6664
XP: Zvar{xp}}
6765
Zcolor{#5865F2}
@@ -76,7 +74,7 @@ ZaddField{Server Rank;#Zvar{rank};true}
7674
#option user|User to ban|user|required
7775
#option reason|Reason for the ban|string|optional
7876
79-
ZonlyIf{ZisAdmin{}==true;You need administrator permission to use this command}
77+
ZonlyIf{ZisAdmin==true;You need administrator permission to use this command}
8078
Zban{Zoption{user};Zoption{reason}}
8179
Banned Zoption{user}.
8280
```
@@ -86,7 +84,7 @@ Banned Zoption{user}.
8684
#name Confirm Ban Handler
8785
#type interaction
8886
89-
Zephemeral{}
87+
Zephemeral
9088
Zban{ZgetServerVar{pending_ban}}
9189
Done.
9290
```

docs/functions.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,24 @@
9797
},
9898
{
9999
"name": "Zalias",
100-
"description": "Registers an alias that substitutes and evaluates the stored AST node when called. Aliases are local to the command execution.",
101-
"syntax": "Zalias{expression;alias_name}",
100+
"description": "Creates a runtime alias for a ZBR function. The alias can be called using Z+alias_name+{} syntax.",
101+
"syntax": "Zalias{function;alias_name}",
102102
"variadic": false,
103103
"arguments": [
104104
{
105-
"name": "expression",
106-
"type": "string",
107-
"required": true
105+
"name": "function",
106+
"type": "function",
107+
"required": true,
108+
"description": "A valid ZBR function call (e.g. Zusername{})"
108109
},
109110
{
110111
"name": "alias_name",
111112
"type": "string",
112-
"required": true
113+
"required": true,
114+
"description": "The alias name without Z prefix. Call the alias using Z+alias_name+{} (e.g. Zgreet{})"
113115
}
114116
],
115-
"example": "Zalias{ZguildID{};ZGI}"
117+
"example": "Zalias{Zusername;greet} Zgreet{}"
116118
},
117119
{
118120
"name": "ZaddField",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zbrlang/zbr",
3-
"version": "1.4.4",
3+
"version": "1.5.0",
44
"description": "ZBR CLI, A simple and powerful Discord bot scripting engine.",
55
"bin": {
66
"zbr": "./bin/cli.js"

0 commit comments

Comments
 (0)