botql 1.0.2 → 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/README.md CHANGED
@@ -1,23 +1,168 @@
1
- # BotQL — Bot Query Language
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
- [![npm version](https://img.shields.io/npm/v/botql.svg)](https://www.npmjs.com/package/botql)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/adilson889/botql/pulls)
6
- [![BotQL](https://img.shields.io/badge/BotQL-rules%20language-blue.svg)](https://github.com/adilson889/botql)
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
- **BotQL** é uma linguagem de regras simples, inspirada em SQL, para criar bots sem precisar de escrever código tradicional. Todos os comandos são escritos em **MAIÚSCULAS**, e blocos com mais de uma ação usam chaves `{ }`.
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
- Vive no mesmo ficheiro `.sql`, com comandos reais de banco de dados — o bot age e persiste dados na mesma linguagem, sem sair do BotQL. O bot corre localmente, no computador ou servidor do próprio utilizador, e não em servidores geridos por terceiros.
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
- Não precisas de saber programar para escrever BotQL; precisas apenas de saber o que queres que o teu bot faça.
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
- ## Documentação Completa
39
+ ## Getting Started
17
40
 
18
- Ver **[docs/GETSTARTED.md](docs/GETSTARTED.md)** para o guia completo.
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
- ## Instalação
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
+ [![GitHub Sponsors](https://img.shields.io/badge/GitHub%20Sponsors-Donate-pink.svg)](https://github.com/sponsors/adilson889)
162
+ [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-Donate-yellow.svg)](https://www.buymeacoffee.com/adilson889)
163
+
164
+ ---
165
+
166
+ ### License
167
+
168
+ MIT © Adilson C. Rafael