adff 1.0.0
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/LICENSE +21 -0
- package/README.md +207 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/interpreter/index.d.ts +25 -0
- package/dist/interpreter/index.d.ts.map +1 -0
- package/dist/parser/commandParser.d.ts +10 -0
- package/dist/parser/commandParser.d.ts.map +1 -0
- package/dist/types.d.ts +71 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +57 -0
- package/scripts/install.ps1 +216 -0
- package/scripts/install.sh +225 -0
- package/templates/commands/color.js +7 -0
- package/templates/commands/embed.js +7 -0
- package/templates/commands/ping.js +5 -0
- package/templates/commands/random.js +5 -0
- package/templates/index.js +35 -0
- package/templates/vars.js +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ADFF Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# ADFF - Another Discord/Fluxer Framework
|
|
2
|
+
|
|
3
|
+
A simple, function-based wrapper for creating Fluxer/Discord bots without coding. Just use functions!
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **No coding required** - Use simple functions like `$title[]`, `$description[]`, `$randomText[]`
|
|
8
|
+
- 📦 **Easy setup** - One command installation
|
|
9
|
+
- 🔧 **Bun-powered** - Fast and modern runtime
|
|
10
|
+
- 🎨 **Embed support** - Create beautiful embeds easily
|
|
11
|
+
- 🔄 **Hot reload** - Development mode with auto-reload
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Installation
|
|
16
|
+
|
|
17
|
+
**macOS / Linux:**
|
|
18
|
+
```bash
|
|
19
|
+
curl -fsSL https://raw.githubusercontent.com/aencyorganization/adff/main/scripts/install.sh | bash
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Windows (PowerShell):**
|
|
23
|
+
```powershell
|
|
24
|
+
irm https://raw.githubusercontent.com/aencyorganization/adff/main/scripts/install.ps1 | iex
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Configuration
|
|
28
|
+
|
|
29
|
+
1. Edit `index.js` and add your bot token:
|
|
30
|
+
```javascript
|
|
31
|
+
const TOKEN = 'YOUR_BOT_TOKEN_HERE';
|
|
32
|
+
const PREFIX = '!';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. Run your bot:
|
|
36
|
+
```bash
|
|
37
|
+
bun run index.js
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Creating Commands
|
|
41
|
+
|
|
42
|
+
Commands are stored in the `commands/` folder as `.js` files.
|
|
43
|
+
|
|
44
|
+
### Basic Structure
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
$name[commandname]
|
|
48
|
+
$aliases[alias1;alias2]
|
|
49
|
+
|
|
50
|
+
Your message here!
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Example: Ping Command
|
|
54
|
+
|
|
55
|
+
Create `commands/ping.js`:
|
|
56
|
+
```javascript
|
|
57
|
+
$name[ping]
|
|
58
|
+
$aliases[p;pong]
|
|
59
|
+
|
|
60
|
+
🏓 Pong! The bot is working!
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Example: Embed Command
|
|
64
|
+
|
|
65
|
+
Create `commands/embed.js`:
|
|
66
|
+
```javascript
|
|
67
|
+
$name[embed]
|
|
68
|
+
|
|
69
|
+
$title[My Embed Title]
|
|
70
|
+
$description[This is the embed description!]
|
|
71
|
+
$color[#5865F2]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Example: Random Text
|
|
75
|
+
|
|
76
|
+
Create `commands/random.js`:
|
|
77
|
+
```javascript
|
|
78
|
+
$name[random]
|
|
79
|
+
|
|
80
|
+
$randomText[Option 1;Option 2;Option 3]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Functions Reference
|
|
84
|
+
|
|
85
|
+
### $name[name]
|
|
86
|
+
**Required** - Defines the command name.
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
$name[ping]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### $aliases[alias1;alias2;...]
|
|
93
|
+
**Optional** - Defines command aliases.
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
$aliases[p;pong;pingpong]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### $randomText[text1;text2;...]
|
|
100
|
+
Returns a random text from the arguments.
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
$randomText[Heads;Tails]
|
|
104
|
+
$randomText[Red;Green;Blue;Yellow]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### $title[text]
|
|
108
|
+
Sets the embed title. Creates an embed automatically.
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
$title[Welcome to my server!]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### $description[text]
|
|
115
|
+
Sets the embed description.
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
$description[This is a detailed description of something cool!]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### $color[hex1;hex2;...]
|
|
122
|
+
Sets the embed color. If multiple colors are provided, picks one randomly.
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
$color[#FF0000]
|
|
126
|
+
$color[#FF0000;#00FF00;#0000FF]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Nested Functions
|
|
130
|
+
|
|
131
|
+
Functions can be nested! The inner function executes first.
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
$title[$randomText[Red Title;Blue Title;Green Title]]
|
|
135
|
+
$color[#FF0000;#00FF00;#0000FF]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Comments
|
|
139
|
+
|
|
140
|
+
Use `//` to add comments (ignored by the parser):
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
// This is a comment
|
|
144
|
+
$name[test]
|
|
145
|
+
// Another comment
|
|
146
|
+
This is the actual message!
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Project Structure
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
my-bot/
|
|
153
|
+
├── index.js # Main configuration file
|
|
154
|
+
├── vars.js # Variables (reserved for future)
|
|
155
|
+
├── package.json # Project dependencies
|
|
156
|
+
└── commands/ # Your commands folder
|
|
157
|
+
├── ping.js
|
|
158
|
+
├── embed.js
|
|
159
|
+
└── random.js
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## API Reference
|
|
163
|
+
|
|
164
|
+
### Programmatic Usage
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
import { createADFFClient, registerFunction } from 'adff';
|
|
168
|
+
|
|
169
|
+
// Create custom function
|
|
170
|
+
registerFunction('myFunction', async (args, context, state) => {
|
|
171
|
+
return `Hello, ${context.authorUsername}!`;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Create client
|
|
175
|
+
const bot = createADFFClient({
|
|
176
|
+
token: 'YOUR_TOKEN',
|
|
177
|
+
prefix: '!',
|
|
178
|
+
commandsPath: './commands/',
|
|
179
|
+
debug: true
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Start bot
|
|
183
|
+
bot.start();
|
|
184
|
+
|
|
185
|
+
// Reload commands
|
|
186
|
+
bot.reloadCommands();
|
|
187
|
+
|
|
188
|
+
// Get loaded commands
|
|
189
|
+
const commands = bot.getCommands();
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Custom Functions
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
import { registerFunction } from 'adff';
|
|
196
|
+
|
|
197
|
+
registerFunction('uppercase', async (args, context, state) => {
|
|
198
|
+
return args[0]?.toUpperCase() || '';
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Usage in command:
|
|
202
|
+
// $uppercase[hello world] -> HELLO WORLD
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ADFFConfig, ADFFClient } from './types.js';
|
|
2
|
+
export declare function createADFFClient(config: ADFFConfig): ADFFClient;
|
|
3
|
+
export * from './types.js';
|
|
4
|
+
export { loadCommands, parseCommandFile } from './parser/commandParser.js';
|
|
5
|
+
export { executeCode, processText, registerFunction, getFunction } from './interpreter/index.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAmC,MAAM,YAAY,CAAC;AAMrF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CA4H/D;AAGD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC"}
|