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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ExecutionContext, InterpreterState, ADFFFunction } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Register a function
|
|
4
|
+
*/
|
|
5
|
+
export declare function registerFunction(name: string, fn: ADFFFunction): void;
|
|
6
|
+
/**
|
|
7
|
+
* Get a registered function
|
|
8
|
+
*/
|
|
9
|
+
export declare function getFunction(name: string): ADFFFunction | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Process text and execute all functions
|
|
12
|
+
*/
|
|
13
|
+
export declare function processText(text: string, context: ExecutionContext, state: InterpreterState): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new interpreter state
|
|
16
|
+
*/
|
|
17
|
+
export declare function createState(): InterpreterState;
|
|
18
|
+
/**
|
|
19
|
+
* Execute a command's code
|
|
20
|
+
*/
|
|
21
|
+
export declare function executeCode(code: string, context: ExecutionContext): Promise<{
|
|
22
|
+
content: string;
|
|
23
|
+
embed: InterpreterState['embed'] | null;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interpreter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAkB,YAAY,EAAE,MAAM,aAAa,CAAC;AAK/F;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,GAAG,IAAI,CAErE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAElE;AAiLD;;GAEG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,gBAAgB,CAQ9C;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC,CAcvE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ParsedCommand } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a single command file
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseCommandFile(filePath: string): Promise<ParsedCommand | null>;
|
|
6
|
+
/**
|
|
7
|
+
* Load all commands from a directory
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadCommands(commandsPath: string): Promise<Map<string, ParsedCommand>>;
|
|
10
|
+
//# sourceMappingURL=commandParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandParser.d.ts","sourceRoot":"","sources":["../../src/parser/commandParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA6D5C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA2BtF;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CA8B5F"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface ADFFConfig {
|
|
2
|
+
/** Bot token for Fluxer */
|
|
3
|
+
token: string;
|
|
4
|
+
/** Command prefix for text commands */
|
|
5
|
+
prefix: string;
|
|
6
|
+
/** Path to commands directory (default: ./commands/) */
|
|
7
|
+
commandsPath?: string;
|
|
8
|
+
/** Application ID (optional, will be fetched automatically) */
|
|
9
|
+
applicationId?: string;
|
|
10
|
+
/** Enable debug logging */
|
|
11
|
+
debug?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ParsedCommand {
|
|
14
|
+
/** Command name */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Command aliases */
|
|
17
|
+
aliases: string[];
|
|
18
|
+
/** Raw code content after header */
|
|
19
|
+
code: string;
|
|
20
|
+
/** Source file path */
|
|
21
|
+
filePath: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ExecutionContext {
|
|
24
|
+
/** Message content (without prefix and command) */
|
|
25
|
+
args: string[];
|
|
26
|
+
/** Full message content */
|
|
27
|
+
messageContent: string;
|
|
28
|
+
/** Channel ID */
|
|
29
|
+
channelId: string;
|
|
30
|
+
/** Guild ID (if in a server) */
|
|
31
|
+
guildId?: string;
|
|
32
|
+
/** Author ID */
|
|
33
|
+
authorId: string;
|
|
34
|
+
/** Author username */
|
|
35
|
+
authorUsername: string;
|
|
36
|
+
/** Raw message object */
|
|
37
|
+
raw: any;
|
|
38
|
+
}
|
|
39
|
+
export interface EmbedData {
|
|
40
|
+
title?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
color?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface FunctionResult {
|
|
45
|
+
/** Text content to send */
|
|
46
|
+
content?: string;
|
|
47
|
+
/** Embed data if any */
|
|
48
|
+
embed?: EmbedData;
|
|
49
|
+
/** Whether this result should be combined with others */
|
|
50
|
+
combine?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export type ADFFFunction = (args: string[], context: ExecutionContext, state: InterpreterState) => Promise<FunctionResult | string | void>;
|
|
53
|
+
export interface InterpreterState {
|
|
54
|
+
/** Current embed being built */
|
|
55
|
+
embed: EmbedData;
|
|
56
|
+
/** Accumulated content */
|
|
57
|
+
content: string;
|
|
58
|
+
/** Whether an embed has been started */
|
|
59
|
+
hasEmbed: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface ADFFClient {
|
|
62
|
+
/** Start the bot */
|
|
63
|
+
start: () => Promise<void>;
|
|
64
|
+
/** Stop the bot */
|
|
65
|
+
stop: () => void;
|
|
66
|
+
/** Reload commands from disk */
|
|
67
|
+
reloadCommands: () => Promise<void>;
|
|
68
|
+
/** Get loaded commands */
|
|
69
|
+
getCommands: () => Map<string, ParsedCommand>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,2BAA2B;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,yBAAyB;IACzB,GAAG,EAAE,GAAG,CAAC;CACV;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,gBAAgB,KACpB,OAAO,CAAC,cAAc,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,KAAK,EAAE,SAAS,CAAC;IACjB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,mBAAmB;IACnB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,gCAAgC;IAChC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,0BAA0B;IAC1B,WAAW,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC/C"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "adff",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A simple function-based wrapper for Fluxer - Create Discord/Fluxer bots without coding, just functions!",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"templates",
|
|
18
|
+
"scripts"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target node --minify",
|
|
22
|
+
"dev": "bun run --watch src/index.ts",
|
|
23
|
+
"prepublishOnly": "bun run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"fluxer",
|
|
27
|
+
"discord",
|
|
28
|
+
"bot",
|
|
29
|
+
"wrapper",
|
|
30
|
+
"no-code",
|
|
31
|
+
"low-code",
|
|
32
|
+
"functions",
|
|
33
|
+
"adff"
|
|
34
|
+
],
|
|
35
|
+
"author": "",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/aencyorganization/adff"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/aencyorganization/adff/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/aencyorganization/adff#readme",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@discordjs/core": "^2.0.0",
|
|
47
|
+
"@discordjs/rest": "^2.0.0",
|
|
48
|
+
"@discordjs/ws": "^1.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"bun-types": "latest",
|
|
52
|
+
"typescript": "^5.0.0"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# ============================================
|
|
2
|
+
# ADFF Installation Script for Windows
|
|
3
|
+
# PowerShell Version
|
|
4
|
+
# ============================================
|
|
5
|
+
|
|
6
|
+
# Colors
|
|
7
|
+
function Write-ColorOutput($ForegroundColor) {
|
|
8
|
+
$fc = $host.UI.RawUI.ForegroundColor
|
|
9
|
+
$host.UI.RawUI.ForegroundColor = $ForegroundColor
|
|
10
|
+
if ($args) {
|
|
11
|
+
Write-Output $args
|
|
12
|
+
}
|
|
13
|
+
$host.UI.RawUI.ForegroundColor = $fc
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function Write-Step($message) {
|
|
17
|
+
Write-ColorOutput Cyan "`nā¶ $message"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function Write-Success($message) {
|
|
21
|
+
Write-ColorOutput Green "ā $message"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function Write-Error($message) {
|
|
25
|
+
Write-ColorOutput Red "ā $message"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Write-Warning($message) {
|
|
29
|
+
Write-ColorOutput Yellow "! $message"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Main installation
|
|
33
|
+
function Main {
|
|
34
|
+
Write-ColorOutput Blue "`nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
35
|
+
Write-ColorOutput Blue "ā ADFF - Fluxer Bot Framework ā"
|
|
36
|
+
Write-ColorOutput Blue "ā Installation Script ā"
|
|
37
|
+
Write-ColorOutput Blue "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`n"
|
|
38
|
+
|
|
39
|
+
# Check for Bun
|
|
40
|
+
Write-Step "Checking for Bun..."
|
|
41
|
+
if (Get-Command bun -ErrorAction SilentlyContinue) {
|
|
42
|
+
$bunVersion = bun --version
|
|
43
|
+
Write-Success "Bun found (version $bunVersion)"
|
|
44
|
+
} else {
|
|
45
|
+
Write-Error "Bun is not installed!"
|
|
46
|
+
Write-ColorOutput Yellow "`nPlease install Bun first:"
|
|
47
|
+
Write-ColorOutput Yellow " powershell -c `"irm bun.sh/install.ps1 | iex`""
|
|
48
|
+
Write-ColorOutput Yellow "`nOr visit: https://bun.sh`n"
|
|
49
|
+
exit 1
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Create project structure
|
|
53
|
+
Write-Step "Creating project structure..."
|
|
54
|
+
|
|
55
|
+
# Create directories
|
|
56
|
+
New-Item -ItemType Directory -Force -Path "commands" | Out-Null
|
|
57
|
+
|
|
58
|
+
Write-Success "Directories created"
|
|
59
|
+
|
|
60
|
+
# Create index.js if it doesn't exist
|
|
61
|
+
Write-Step "Creating configuration files..."
|
|
62
|
+
|
|
63
|
+
if (-not (Test-Path "index.js")) {
|
|
64
|
+
$indexContent = @'
|
|
65
|
+
// ============================================
|
|
66
|
+
// ADFF Configuration File
|
|
67
|
+
// ============================================
|
|
68
|
+
// Modify the values below to configure your bot
|
|
69
|
+
|
|
70
|
+
import { createADFFClient } from 'adff';
|
|
71
|
+
|
|
72
|
+
// Your bot token from Fluxer (required)
|
|
73
|
+
const TOKEN = 'YOUR_BOT_TOKEN_HERE';
|
|
74
|
+
|
|
75
|
+
// Command prefix (e.g., "!" for !ping)
|
|
76
|
+
const PREFIX = '!';
|
|
77
|
+
|
|
78
|
+
// Path to commands folder (default: ./commands/)
|
|
79
|
+
const COMMANDS_PATH = './commands/';
|
|
80
|
+
|
|
81
|
+
// ============================================
|
|
82
|
+
// Don't modify below this line
|
|
83
|
+
// ============================================
|
|
84
|
+
|
|
85
|
+
const bot = createADFFClient({
|
|
86
|
+
token: TOKEN,
|
|
87
|
+
prefix: PREFIX,
|
|
88
|
+
commandsPath: COMMANDS_PATH,
|
|
89
|
+
debug: true
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
bot.start().catch(console.error);
|
|
93
|
+
|
|
94
|
+
// Handle graceful shutdown
|
|
95
|
+
process.on('SIGINT', () => {
|
|
96
|
+
console.log('\n[ADFF] Shutting down...');
|
|
97
|
+
bot.stop();
|
|
98
|
+
process.exit(0);
|
|
99
|
+
});
|
|
100
|
+
'@
|
|
101
|
+
Set-Content -Path "index.js" -Value $indexContent -NoNewline
|
|
102
|
+
Write-Success "Created index.js"
|
|
103
|
+
} else {
|
|
104
|
+
Write-Warning "index.js already exists, skipping"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# Create vars.js if it doesn't exist
|
|
108
|
+
if (-not (Test-Path "vars.js")) {
|
|
109
|
+
$varsContent = @'
|
|
110
|
+
// ============================================
|
|
111
|
+
// ADFF Variables File
|
|
112
|
+
// ============================================
|
|
113
|
+
// This file is reserved for future versions
|
|
114
|
+
// Do not modify this file
|
|
115
|
+
|
|
116
|
+
export const vars = {
|
|
117
|
+
// Reserved for future use
|
|
118
|
+
};
|
|
119
|
+
'@
|
|
120
|
+
Set-Content -Path "vars.js" -Value $varsContent -NoNewline
|
|
121
|
+
Write-Success "Created vars.js"
|
|
122
|
+
} else {
|
|
123
|
+
Write-Warning "vars.js already exists, skipping"
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# Create example commands
|
|
127
|
+
Write-Step "Creating example commands..."
|
|
128
|
+
|
|
129
|
+
if (-not (Test-Path "commands/ping.js")) {
|
|
130
|
+
$pingContent = @'
|
|
131
|
+
// Example command: ping
|
|
132
|
+
$name[ping]
|
|
133
|
+
$aliases[p;pong]
|
|
134
|
+
|
|
135
|
+
š Pong! The bot is working!
|
|
136
|
+
'@
|
|
137
|
+
Set-Content -Path "commands/ping.js" -Value $pingContent -NoNewline
|
|
138
|
+
Write-Success "Created commands/ping.js"
|
|
139
|
+
} else {
|
|
140
|
+
Write-Warning "commands/ping.js already exists, skipping"
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (-not (Test-Path "commands/embed.js")) {
|
|
144
|
+
$embedContent = @'
|
|
145
|
+
// Example command: embed
|
|
146
|
+
$name[embed]
|
|
147
|
+
$aliases[e]
|
|
148
|
+
|
|
149
|
+
$title[Example Embed]
|
|
150
|
+
$description[This is an example embed created with ADFF functions!]
|
|
151
|
+
$color[#5865F2]
|
|
152
|
+
'@
|
|
153
|
+
Set-Content -Path "commands/embed.js" -Value $embedContent -NoNewline
|
|
154
|
+
Write-Success "Created commands/embed.js"
|
|
155
|
+
} else {
|
|
156
|
+
Write-Warning "commands/embed.js already exists, skipping"
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (-not (Test-Path "commands/random.js")) {
|
|
160
|
+
$randomContent = @'
|
|
161
|
+
// Example command: random
|
|
162
|
+
$name[random]
|
|
163
|
+
$aliases[rand;roll]
|
|
164
|
+
|
|
165
|
+
$randomText[You rolled a 1!;You rolled a 2!;You rolled a 3!;You rolled a 4!;You rolled a 5!;You rolled a 6!]
|
|
166
|
+
'@
|
|
167
|
+
Set-Content -Path "commands/random.js" -Value $randomContent -NoNewline
|
|
168
|
+
Write-Success "Created commands/random.js"
|
|
169
|
+
} else {
|
|
170
|
+
Write-Warning "commands/random.js already exists, skipping"
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# Create package.json if it doesn't exist
|
|
174
|
+
Write-Step "Creating package.json..."
|
|
175
|
+
|
|
176
|
+
if (-not (Test-Path "package.json")) {
|
|
177
|
+
$packageContent = @'
|
|
178
|
+
{
|
|
179
|
+
"name": "my-adff-bot",
|
|
180
|
+
"version": "1.0.0",
|
|
181
|
+
"type": "module",
|
|
182
|
+
"scripts": {
|
|
183
|
+
"start": "bun run index.js",
|
|
184
|
+
"dev": "bun run --watch index.js"
|
|
185
|
+
},
|
|
186
|
+
"dependencies": {
|
|
187
|
+
"adff": "latest"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
'@
|
|
191
|
+
Set-Content -Path "package.json" -Value $packageContent -NoNewline
|
|
192
|
+
Write-Success "Created package.json"
|
|
193
|
+
} else {
|
|
194
|
+
Write-Warning "package.json already exists, skipping"
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
# Install dependencies
|
|
198
|
+
Write-Step "Installing dependencies..."
|
|
199
|
+
bun install
|
|
200
|
+
Write-Success "Dependencies installed"
|
|
201
|
+
|
|
202
|
+
# Final message
|
|
203
|
+
Write-ColorOutput Green "`nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
204
|
+
Write-ColorOutput Green "ā Installation Complete! ā"
|
|
205
|
+
Write-ColorOutput Green "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`n"
|
|
206
|
+
|
|
207
|
+
Write-ColorOutput Yellow "Next steps:"
|
|
208
|
+
Write-ColorOutput Yellow " 1. Edit index.js and add your bot token"
|
|
209
|
+
Write-ColorOutput Yellow " 2. Create commands in the commands/ folder"
|
|
210
|
+
Write-ColorOutput Yellow " 3. Run your bot with: bun run index.js`n"
|
|
211
|
+
|
|
212
|
+
Write-ColorOutput Cyan "Documentation: https://github.com/aencyorganization/adff"
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
# Run main
|
|
216
|
+
Main
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ============================================
|
|
4
|
+
# ADFF Installation Script
|
|
5
|
+
# Works on macOS, Linux, and Windows (Git Bash/WSL)
|
|
6
|
+
# ============================================
|
|
7
|
+
|
|
8
|
+
set -e
|
|
9
|
+
|
|
10
|
+
# Colors for output
|
|
11
|
+
RED='\033[0;31m'
|
|
12
|
+
GREEN='\033[0;32m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
BLUE='\033[0;34m'
|
|
15
|
+
NC='\033[0m' # No Color
|
|
16
|
+
|
|
17
|
+
# Print colored message
|
|
18
|
+
print_msg() {
|
|
19
|
+
echo -e "${2}${1}${NC}"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# Print step
|
|
23
|
+
print_step() {
|
|
24
|
+
print_msg "\nā¶ $1" "$BLUE"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Print success
|
|
28
|
+
print_success() {
|
|
29
|
+
print_msg "ā $1" "$GREEN"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Print error
|
|
33
|
+
print_error() {
|
|
34
|
+
print_msg "ā $1" "$RED"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Print warning
|
|
38
|
+
print_warning() {
|
|
39
|
+
print_msg "! $1" "$YELLOW"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Check if command exists
|
|
43
|
+
command_exists() {
|
|
44
|
+
command -v "$1" >/dev/null 2>&1
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Main installation
|
|
48
|
+
main() {
|
|
49
|
+
print_msg "\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā" "$BLUE"
|
|
50
|
+
print_msg "ā ADFF - Fluxer Bot Framework ā" "$BLUE"
|
|
51
|
+
print_msg "ā Installation Script ā" "$BLUE"
|
|
52
|
+
print_msg "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n" "$BLUE"
|
|
53
|
+
|
|
54
|
+
# Check for Bun
|
|
55
|
+
print_step "Checking for Bun..."
|
|
56
|
+
if command_exists bun; then
|
|
57
|
+
BUN_VERSION=$(bun --version)
|
|
58
|
+
print_success "Bun found (version $BUN_VERSION)"
|
|
59
|
+
else
|
|
60
|
+
print_error "Bun is not installed!"
|
|
61
|
+
print_msg "\nPlease install Bun first:" "$YELLOW"
|
|
62
|
+
print_msg " curl -fsSL https://bun.sh/install | bash" "$YELLOW"
|
|
63
|
+
print_msg "\nOr visit: https://bun.sh\n" "$YELLOW"
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# Create project structure
|
|
68
|
+
print_step "Creating project structure..."
|
|
69
|
+
|
|
70
|
+
# Create directories
|
|
71
|
+
mkdir -p commands
|
|
72
|
+
|
|
73
|
+
print_success "Directories created"
|
|
74
|
+
|
|
75
|
+
# Create index.js if it doesn't exist
|
|
76
|
+
print_step "Creating configuration files..."
|
|
77
|
+
|
|
78
|
+
if [ ! -f "index.js" ]; then
|
|
79
|
+
cat > index.js << 'INDEXEOF'
|
|
80
|
+
// ============================================
|
|
81
|
+
// ADFF Configuration File
|
|
82
|
+
// ============================================
|
|
83
|
+
// Modify the values below to configure your bot
|
|
84
|
+
|
|
85
|
+
import { createADFFClient } from 'adff';
|
|
86
|
+
|
|
87
|
+
// Your bot token from Fluxer (required)
|
|
88
|
+
const TOKEN = 'YOUR_BOT_TOKEN_HERE';
|
|
89
|
+
|
|
90
|
+
// Command prefix (e.g., "!" for !ping)
|
|
91
|
+
const PREFIX = '!';
|
|
92
|
+
|
|
93
|
+
// Path to commands folder (default: ./commands/)
|
|
94
|
+
const COMMANDS_PATH = './commands/';
|
|
95
|
+
|
|
96
|
+
// ============================================
|
|
97
|
+
// Don't modify below this line
|
|
98
|
+
// ============================================
|
|
99
|
+
|
|
100
|
+
const bot = createADFFClient({
|
|
101
|
+
token: TOKEN,
|
|
102
|
+
prefix: PREFIX,
|
|
103
|
+
commandsPath: COMMANDS_PATH,
|
|
104
|
+
debug: true
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
bot.start().catch(console.error);
|
|
108
|
+
|
|
109
|
+
// Handle graceful shutdown
|
|
110
|
+
process.on('SIGINT', () => {
|
|
111
|
+
console.log('\n[ADFF] Shutting down...');
|
|
112
|
+
bot.stop();
|
|
113
|
+
process.exit(0);
|
|
114
|
+
});
|
|
115
|
+
INDEXEOF
|
|
116
|
+
print_success "Created index.js"
|
|
117
|
+
else
|
|
118
|
+
print_warning "index.js already exists, skipping"
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# Create vars.js if it doesn't exist
|
|
122
|
+
if [ ! -f "vars.js" ]; then
|
|
123
|
+
cat > vars.js << 'VARSEOF'
|
|
124
|
+
// ============================================
|
|
125
|
+
// ADFF Variables File
|
|
126
|
+
// ============================================
|
|
127
|
+
// This file is reserved for future versions
|
|
128
|
+
// Do not modify this file
|
|
129
|
+
|
|
130
|
+
export const vars = {
|
|
131
|
+
// Reserved for future use
|
|
132
|
+
};
|
|
133
|
+
VARSEOF
|
|
134
|
+
print_success "Created vars.js"
|
|
135
|
+
else
|
|
136
|
+
print_warning "vars.js already exists, skipping"
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# Create example commands
|
|
140
|
+
print_step "Creating example commands..."
|
|
141
|
+
|
|
142
|
+
if [ ! -f "commands/ping.js" ]; then
|
|
143
|
+
cat > commands/ping.js << 'PINGEOF'
|
|
144
|
+
// Example command: ping
|
|
145
|
+
$name[ping]
|
|
146
|
+
$aliases[p;pong]
|
|
147
|
+
|
|
148
|
+
š Pong! The bot is working!
|
|
149
|
+
PINGEOF
|
|
150
|
+
print_success "Created commands/ping.js"
|
|
151
|
+
else
|
|
152
|
+
print_warning "commands/ping.js already exists, skipping"
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
if [ ! -f "commands/embed.js" ]; then
|
|
156
|
+
cat > commands/embed.js << 'EMBEDEOF'
|
|
157
|
+
// Example command: embed
|
|
158
|
+
$name[embed]
|
|
159
|
+
$aliases[e]
|
|
160
|
+
|
|
161
|
+
$title[Example Embed]
|
|
162
|
+
$description[This is an example embed created with ADFF functions!]
|
|
163
|
+
$color[#5865F2]
|
|
164
|
+
EMBEDEOF
|
|
165
|
+
print_success "Created commands/embed.js"
|
|
166
|
+
else
|
|
167
|
+
print_warning "commands/embed.js already exists, skipping"
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
if [ ! -f "commands/random.js" ]; then
|
|
171
|
+
cat > commands/random.js << 'RANDOMEOF'
|
|
172
|
+
// Example command: random
|
|
173
|
+
$name[random]
|
|
174
|
+
$aliases[rand;roll]
|
|
175
|
+
|
|
176
|
+
$randomText[You rolled a 1!;You rolled a 2!;You rolled a 3!;You rolled a 4!;You rolled a 5!;You rolled a 6!]
|
|
177
|
+
RANDOMEOF
|
|
178
|
+
print_success "Created commands/random.js"
|
|
179
|
+
else
|
|
180
|
+
print_warning "commands/random.js already exists, skipping"
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
# Create package.json if it doesn't exist
|
|
184
|
+
print_step "Creating package.json..."
|
|
185
|
+
|
|
186
|
+
if [ ! -f "package.json" ]; then
|
|
187
|
+
cat > package.json << 'PACKAGEEOF'
|
|
188
|
+
{
|
|
189
|
+
"name": "my-adff-bot",
|
|
190
|
+
"version": "1.0.0",
|
|
191
|
+
"type": "module",
|
|
192
|
+
"scripts": {
|
|
193
|
+
"start": "bun run index.js",
|
|
194
|
+
"dev": "bun run --watch index.js"
|
|
195
|
+
},
|
|
196
|
+
"dependencies": {
|
|
197
|
+
"adff": "latest"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
PACKAGEEOF
|
|
201
|
+
print_success "Created package.json"
|
|
202
|
+
else
|
|
203
|
+
print_warning "package.json already exists, skipping"
|
|
204
|
+
fi
|
|
205
|
+
|
|
206
|
+
# Install dependencies
|
|
207
|
+
print_step "Installing dependencies..."
|
|
208
|
+
bun install
|
|
209
|
+
print_success "Dependencies installed"
|
|
210
|
+
|
|
211
|
+
# Final message
|
|
212
|
+
print_msg "\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā" "$GREEN"
|
|
213
|
+
print_msg "ā Installation Complete! ā" "$GREEN"
|
|
214
|
+
print_msg "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n" "$GREEN"
|
|
215
|
+
|
|
216
|
+
print_msg "Next steps:" "$YELLOW"
|
|
217
|
+
print_msg " 1. Edit index.js and add your bot token" "$YELLOW"
|
|
218
|
+
print_msg " 2. Create commands in the commands/ folder" "$YELLOW"
|
|
219
|
+
print_msg " 3. Run your bot with: bun run index.js\n" "$YELLOW"
|
|
220
|
+
|
|
221
|
+
print_msg "Documentation: https://github.com/aencyorganization/adff" "$BLUE"
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
# Run main
|
|
225
|
+
main "$@"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// ADFF Configuration File
|
|
3
|
+
// ============================================
|
|
4
|
+
// Modify the values below to configure your bot
|
|
5
|
+
|
|
6
|
+
import { createADFFClient } from 'adff';
|
|
7
|
+
|
|
8
|
+
// Your bot token from Fluxer (required)
|
|
9
|
+
const TOKEN = 'YOUR_BOT_TOKEN_HERE';
|
|
10
|
+
|
|
11
|
+
// Command prefix (e.g., "!" for !ping)
|
|
12
|
+
const PREFIX = '!';
|
|
13
|
+
|
|
14
|
+
// Path to commands folder (default: ./commands/)
|
|
15
|
+
const COMMANDS_PATH = './commands/';
|
|
16
|
+
|
|
17
|
+
// ============================================
|
|
18
|
+
// Don't modify below this line
|
|
19
|
+
// ============================================
|
|
20
|
+
|
|
21
|
+
const bot = createADFFClient({
|
|
22
|
+
token: TOKEN,
|
|
23
|
+
prefix: PREFIX,
|
|
24
|
+
commandsPath: COMMANDS_PATH,
|
|
25
|
+
debug: true
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
bot.start().catch(console.error);
|
|
29
|
+
|
|
30
|
+
// Handle graceful shutdown
|
|
31
|
+
process.on('SIGINT', () => {
|
|
32
|
+
console.log('\n[ADFF] Shutting down...');
|
|
33
|
+
bot.stop();
|
|
34
|
+
process.exit(0);
|
|
35
|
+
});
|