botql 1.0.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Database.js +1 -146
- package/Parser.js +1 -762
- package/README.md +157 -12
- package/botql.browser.js +1335 -0
- package/botql.js +3 -785
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,168 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<span style="background: linear-gradient(90deg, #6C5CE7, #00B894); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 900; font-size: 2.2em;">
|
|
3
|
+
BotQL: Bot Query Language
|
|
4
|
+
</span>
|
|
5
|
+
</h1>
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/botql">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/botql.svg" alt="npm version">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
12
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/adilson889/botql/pulls">
|
|
15
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/adilson889/botql">
|
|
18
|
+
<img src="https://img.shields.io/badge/BotQL-rules%20language-blue.svg" alt="BotQL">
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/sponsors/adilson889">
|
|
21
|
+
<img src="https://img.shields.io/badge/Sponsor-%E2%9D%A4-red.svg" alt="Sponsor">
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
7
24
|
|
|
8
|
-
|
|
25
|
+
<p align="justify">
|
|
26
|
+
<strong>BotQL</strong> is a simple, SQL-inspired rules language for creating bots without writing traditional code. All commands are written in <strong>UPPERCASE</strong>, and blocks with more than one action use curly braces <code>{ }</code>.
|
|
27
|
+
</p>
|
|
9
28
|
|
|
10
|
-
|
|
29
|
+
<p align="justify">
|
|
30
|
+
It lives in <code>.sql</code> files, with real database commands — the bot acts and persists data in the same language, without leaving BotQL. The bot runs locally, on the user's own computer or server, not on third-party managed servers.
|
|
31
|
+
</p>
|
|
11
32
|
|
|
12
|
-
|
|
33
|
+
<p align="justify">
|
|
34
|
+
You don't need to know how to code to write BotQL; you just need to know what you want your bot to do.
|
|
35
|
+
</p>
|
|
13
36
|
|
|
14
37
|
---
|
|
15
38
|
|
|
16
|
-
##
|
|
39
|
+
## Getting Started
|
|
17
40
|
|
|
18
|
-
|
|
41
|
+
Want to learn the full syntax, see all commands, and understand how BotQL works? The complete guide walks you through everything from your first bot to advanced features like local knowledge retrieval and AI integration.
|
|
19
42
|
|
|
20
|
-
|
|
43
|
+
**[Read the full documentation →](docs/GETSTARTED.md)**
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
### Node.js
|
|
50
|
+
|
|
51
|
+
For server-side applications, CLI tools, and any Node.js environment:
|
|
21
52
|
|
|
22
53
|
```bash
|
|
23
|
-
npm install botql
|
|
54
|
+
npm install botql
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
const { BotQLInterpreter } = require('botql');
|
|
59
|
+
|
|
60
|
+
const bot = BotQLInterpreter.fromSource(`
|
|
61
|
+
CREATE BOT "MyBot"
|
|
62
|
+
ON MESSAGE {
|
|
63
|
+
WHEN CONTAINS "hello" REPLY "Hi!"
|
|
64
|
+
}
|
|
65
|
+
RUN BOT
|
|
66
|
+
`);
|
|
67
|
+
|
|
68
|
+
bot.start();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Browser (CDN)
|
|
72
|
+
|
|
73
|
+
For websites, web apps, and in-browser editors — no build step required:
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<!-- jsDelivr -->
|
|
77
|
+
<script src="https://cdn.jsdelivr.net/npm/botql/botql.browser.js"></script>
|
|
78
|
+
|
|
79
|
+
<!-- unpkg -->
|
|
80
|
+
<script src="https://unpkg.com/botql/botql.browser.js"></script>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Usage
|
|
86
|
+
|
|
87
|
+
### JavaScript
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
const { BotQLInterpreter } = require('botql');
|
|
91
|
+
|
|
92
|
+
const bot = BotQLInterpreter.fromSource(`
|
|
93
|
+
CREATE BOT "JSBot"
|
|
94
|
+
ON MESSAGE {
|
|
95
|
+
WHEN CONTAINS "hello" REPLY "Hello!"
|
|
96
|
+
}
|
|
97
|
+
RUN BOT
|
|
98
|
+
`);
|
|
99
|
+
|
|
100
|
+
bot.start();
|
|
101
|
+
bot.receiveMessage('+244900000000', 'hello');
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### JSX (React)
|
|
105
|
+
|
|
106
|
+
```jsx
|
|
107
|
+
import { BotQLInterpreter } from 'botql';
|
|
108
|
+
|
|
109
|
+
const bot = BotQLInterpreter.fromSource(`
|
|
110
|
+
CREATE BOT "ReactBot"
|
|
111
|
+
ON MESSAGE {
|
|
112
|
+
WHEN CONTAINS "hello" REPLY "Hello from React!"
|
|
113
|
+
}
|
|
114
|
+
RUN BOT
|
|
115
|
+
`);
|
|
116
|
+
|
|
117
|
+
bot.start();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### TypeScript
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { BotQLInterpreter } from 'botql';
|
|
124
|
+
|
|
125
|
+
const bot = BotQLInterpreter.fromSource(`
|
|
126
|
+
CREATE BOT "TSBot"
|
|
127
|
+
ON MESSAGE {
|
|
128
|
+
WHEN CONTAINS "hello" REPLY "Hello from TypeScript!"
|
|
129
|
+
}
|
|
130
|
+
RUN BOT
|
|
131
|
+
`);
|
|
132
|
+
|
|
133
|
+
bot.start();
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### PHP
|
|
137
|
+
|
|
138
|
+
```php
|
|
139
|
+
<?php
|
|
140
|
+
$code = 'CREATE BOT "PHPBot" ON MESSAGE { WHEN CONTAINS "hello" REPLY "Hello!" } RUN BOT';
|
|
141
|
+
$response = shell_exec('node -e "' . addslashes($code) . '"');
|
|
142
|
+
echo $response;
|
|
143
|
+
?>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Python
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
import subprocess
|
|
150
|
+
|
|
151
|
+
code = 'CREATE BOT "PythonBot" ON MESSAGE { WHEN CONTAINS "hello" REPLY "Hello!" } RUN BOT'
|
|
152
|
+
subprocess.run(['node', '-e', code])
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Support
|
|
158
|
+
|
|
159
|
+
If this project helped you, consider supporting:
|
|
160
|
+
|
|
161
|
+
[](https://github.com/sponsors/adilson889)
|
|
162
|
+
[](https://www.buymeacoffee.com/adilson889)
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### License
|
|
167
|
+
|
|
168
|
+
MIT © Adilson C. Rafael
|