Skip to main content

Ethone Namespace

The ethone namespace provides core utilities for your custom scripts.

ethone.on_command()

Create custom commands with automatic argument parsing.

Syntax

ethone.on_command(name, description, usage, callback)

Parameters

ParameterTypeDescription
namestringCommand name without prefix
descriptionstringWhat the command does
usagestringUsage string shown in .custom (e.g., “hello [name]“)
callbackfunctionFunction called when command is used
The callback receives a ctx object with:
  • ctx.command - Command name
  • ctx.args - Array of arguments
  • ctx.message - Message object
  • ctx.guild - Guild object
  • ctx.channel - Channel object
  • ctx.author - Author object
Access IDs through context objects:
  • Use ctx.guild.id for guild ID
  • Use ctx.channel.id for channel ID
  • Use ctx.author.id for author ID

Example

ethone.on_command(
    "hello",          // name
    "Say hello",      // description
    "hello",          // usage
    function(ctx) {   // callback
        var channelId = ctx.channel.id;
        var message = "Hello, " + ctx.author.username + "!";
        discord.send_message(channelId, message);
    }
);

ethone.on_command(
    "say",                // name
    "Repeat message",     // description
    "say <message>",      // usage
    function(ctx) {       // callback
        if (ctx.args.length === 0) {
            discord.send_message(ctx.channel.id, "Usage: .say <message>");
            return;
        }
        var channelId = ctx.channel.id;
        var message = ctx.args.join(" ");
        discord.send_message(channelId, message);
    }
);
See Commands Documentation for more examples.

ethone.log()

Log a message to the console for debugging.

Syntax

ethone.log(message)

Parameters

ParameterTypeDescription
messagestringThe message to log to the console

Returns

void

Example

ethone.log("Script started!");

discord.on_message = function(ctx) {
    ethone.log("Received message from " + ctx.author.username + ": " + ctx.content);
};

ethone.sleep()

Pause execution for a specified number of milliseconds. Only use inside event handlers, never at top level.

Syntax

ethone.sleep(ms)

Parameters

ParameterTypeDescription
msnumberMilliseconds to sleep (e.g., 1000 = 1 second)

Returns

void

Example

discord.on_message = function(ctx) {
    if (ctx.content === ".delay") {
        ethone.sleep(2000); // Wait 2 seconds
        discord.send_message(ctx.channel.id, "Delayed response!");
    }
};

Common Mistakes

ethone.sleep(5000);
ethone.log("This will never run");

discord.on_message = function(ctx) {
    ethone.sleep(5000);
};

ethone.user

Access information about the current user (selfbot user).

Properties

PropertyTypeDescription
idstringYour user ID
usernamestringYour username
discriminatorstringYour discriminator
tagstringFull username with discriminator
avatar_urlstringURL to your avatar image
banner_urlstringURL to your banner image
botbooleanWhether you are a bot account
global_namestringYour display name
accent_colornumberYour accent color as integer
tokenstringYour Discord token

Example

discord.on_message = function(ctx) {
    if (ctx.author.id === ethone.user.id) {
        ethone.log("I sent this message");
        return;
    }
    
    ethone.log(ctx.author.username + " said: " + ctx.content);
};

discord.on_message = function(ctx) {
    if (ctx.author.id === ethone.user.id) return;
    
    var count = ethone.get_value("message_count") || 0;
    count++;
    ethone.set_value("message_count", count);
    
    if (ctx.content === ".stats") {
        discord.send_message(
            ctx.channel.id,
            "Tracked " + count + " messages from other users"
        );
    }
};

discord.on_message = function(ctx) {
    if (ctx.author.id !== ethone.user.id) return;
    
    ethone.sleep(5000);
    discord.delete_message(ctx.channel.id, ctx.message.id);
    ethone.log("Deleted my message after 5 seconds");
};

ethone.log("Running as: " + ethone.user.username + " (" + ethone.user.id + ")");

ethone.stop()

Stop the Ethone client.

Syntax

ethone.stop()

Returns

void

Example

ethone.on_command("shutdown", "Stop the client", "shutdown", function(ctx) {
    if (ctx.author.id !== "YOUR_USER_ID") return;
    discord.send_message(ctx.channel.id, "Shutting down...");
    ethone.stop();
});

ethone.restart()

Restart the Ethone client.

Syntax

ethone.restart()

Returns

void

Example

ethone.on_command("restart", "Restart the client", "restart", function(ctx) {
    if (ctx.author.id !== "YOUR_USER_ID") return;
    discord.send_message(ctx.channel.id, "Restarting...");
    ethone.restart();
});

ethone.reload_scripts()

Reload all scripts without restarting the client.

Syntax

ethone.reload_scripts()

Returns

void

Example

ethone.on_command("reload", "Reload all scripts", "reload", function(ctx) {
    discord.send_message(ctx.channel.id, "Reloading scripts...");
    ethone.reload_scripts();
});

ethone.toggle_console()

Toggle console window visibility (Windows only, no-op on Unix/Linux).

Syntax

ethone.toggle_console()

Returns

void

Example

ethone.on_command("console", "Toggle console", "console", function(ctx) {
    ethone.toggle_console();
    discord.send_message(ctx.channel.id, "Console toggled!");
});

ethone.send_message()

Send a themed message using the active Ethone theme configuration. This function automatically applies your current theme (embed, codeblock, quote, or minimal) and respects your response settings (auto-delete timer, etc.).

Syntax

ethone.send_message(channelId, content, title?)

Parameters

ParameterTypeDescription
channelIdstringThe channel ID to send the message to
contentstringThe message content
titlestring(Optional) Title/command name shown in the theme header (default: “message”)

Returns

Returns a message object with id property on success, null on failure.

Example

ethone.on_command("status", "Show status", "status", function(ctx) {
    var uptime = "5 hours";
    var servers = "10 servers";
    
    var content = "Uptime: " + uptime + "\nServers: " + servers;
    ethone.send_message(ctx.channel.id, content, "status");
});

ethone.on_command("greet", "Send a greeting", "greet <name>", function(ctx) {
    if (ctx.args.length === 0) {
        ethone.send_message(ctx.channel.id, "Please provide a name!", "error");
        return;
    }
    
    var name = ctx.args[0];
    ethone.send_message(ctx.channel.id, "Hello, " + name + "!", "greet");
});

ethone.send_event()

Send a notification event to your Ethone inbox.
This is not a Discord event. Use ethone.send_event() to send notifications to your Ethone inbox.

Syntax

ethone.send_event(title, content, type, link, context)

Parameters

ParameterTypeDescription
titlestringEvent title
contentstringEvent content/description
typestringEvent type: "success", "error", "warning", or "info"
linkstring[] | undefinedOptional array of clickable link URLs (e.g., Discord message links)
contextobject | undefinedOptional context object with text (string) and icon (URL string) properties for visual context

Returns

boolean - true if successful, false otherwise

Example

ethone.send_event("Script Started", "Automation script is running", "success");

ethone.on_command("test", "Test command", "test", function(ctx) {
    try {
        var result = doSomething();
        ethone.send_event("Test Complete", "Test executed successfully", "success");
    } catch (error) {
        ethone.send_event("Test Failed", "Error: " + error, "error");
    }
});

discord.on_message = function(ctx) {
    if (ctx.content.includes("important keyword")) {
        var messageUrl = "https://discord.com/channels/" + ctx.guild.id + "/" + ctx.channel.id + "/" + ctx.message.id;
        ethone.send_event(
            "Keyword Detected",
            "User " + ctx.author.username + " mentioned keyword",
            "info",
            [messageUrl]
        );
    }
};

discord.on_message = function(ctx) {
    if (ctx.content.toLowerCase() === ".alert") {
        var messageUrl = "https://discord.com/channels/" + ctx.guild.id + "/" + ctx.channel.id + "/" + ctx.message.id;
        ethone.send_event(
            "Alert Command",
            ctx.author.username + " used alert command",
            "warning",
            [messageUrl],
            {
                text: ctx.guild.name,
                icon: ctx.guild.icon_url
            }
        );
    }
};

ethone.on_command("notify", "Send notification", "notify <message>", function(ctx) {
    if (ctx.args.length === 0) {
        discord.send_message(ctx.channel.id, "Usage: .notify <message>");
        return;
    }
    
    var message = ctx.args.join(" ");
    var messageUrl = "https://discord.com/channels/" + ctx.guild.id + "/" + ctx.channel.id + "/" + ctx.message.id;
    
    ethone.send_event(
        "Custom Notification",
        message,
        "info",
        [messageUrl],
        {
            text: ctx.guild.name + " - #" + ctx.channel.name,
            icon: ctx.author.avatar_url
        }
    );
    
    discord.send_message(ctx.channel.id, "Notification sent to inbox!");
});

Event Types

TypeDescriptionUse Case
successPositive outcomesTask completed, item found, operation succeeded
errorErrors and failuresAPI errors, exceptions, failed operations
warningWarnings and cautionsHigh usage, rate limits, potential issues
infoInformationalGeneral notifications, status updates, reminders

ethone.send_toast()

Send a toast notification to the Ethone dashboard frontend. Toast notifications appear as small popup messages in the dashboard. They’re perfect for quick feedback and status updates that don’t require inbox persistence.

Syntax

ethone.send_toast(message, type, description?)

Parameters

ParameterTypeDescription
messagestringThe main toast message to display
typestringToast type: "success", "error", "warning", or "info"
descriptionstring (optional)Additional description text shown after the message

Returns

boolean - true if successful, false otherwise

Example

ethone.on_command("ban", "Ban a user", "ban <user>", function(ctx) {
    if (ctx.args.length === 0) {
        ethone.send_toast("Please provide a user to ban", "error");
        return;
    }
    
    var user = ctx.args[0];
    discord.ban_member(ctx.guild.id, user);
    ethone.send_toast("User banned successfully", "success");
});

ethone.on_command("backup", "Create backup", "backup", function(ctx) {
    ethone.send_toast("Starting backup...", "info");
    
    try {
        var data = collectData();
        saveBackup(data);
        ethone.send_toast("Backup completed", "success", "All data saved");
    } catch (error) {
        ethone.send_toast("Backup failed", "error", error.toString());
    }
});

discord.on_message = function(ctx) {
    if (ctx.content.includes("@everyone") && ctx.author.id !== ethone.user.id) {
        ethone.send_toast(
            "Everyone mention detected",
            "warning",
            "From " + ctx.author.username + " in " + ctx.guild.name
        );
    }
};

ethone.set_value()

Store a value in cloud storage that persists across script reloads and client restarts.

Syntax

ethone.set_value(key, value)

Parameters

ParameterTypeDescription
keystringStorage key (unique identifier)
valueanyValue to store (any JSON-serializable type)

Returns

boolean - true if successful, false otherwise

Example

ethone.on_command("setkey", "Set API key", "setkey <key>", function(ctx) {
    if (ctx.args.length === 0) {
        discord.send_message(ctx.channel.id, "Usage: .setkey <key>");
        return;
    }
    ethone.set_value("api_key", ctx.args[0]);
    discord.send_message(ctx.channel.id, "API key saved!");
});

ethone.set_value("preferences", {
    theme: "dark",
    notifications: true,
    auto_mod: false
});

ethone.get_value()

Retrieve a value from cloud storage.

Syntax

ethone.get_value(key)

Parameters

ParameterTypeDescription
keystringStorage key to retrieve

Returns

The stored value or null if not found

Example

ethone.on_command("getkey", "Get API key", "getkey", function(ctx) {
    var apiKey = ethone.get_value("api_key");
    if (apiKey) {
        discord.send_message(ctx.channel.id, "API Key: " + apiKey);
    } else {
        discord.send_message(ctx.channel.id, "No API key set");
    }
});

var prefs = ethone.get_value("preferences");
if (!prefs) {
    prefs = {
        theme: "light",
        notifications: false
    };
}

ethone.get_values()

Get all stored values from cloud storage.

Syntax

ethone.get_values()

Returns

object - Object containing all key-value pairs

Example

ethone.on_command("listvalues", "List all stored values", "listvalues", function(ctx) {
    var values = ethone.get_values();
    var keys = Object.keys(values);
    
    if (keys.length === 0) {
        discord.send_message(ctx.channel.id, "No values stored");
        return;
    }
    
    var msg = "Stored values:\n";
    for (var i = 0; i < keys.length; i++) {
        msg += keys[i] + ": " + JSON.stringify(values[keys[i]]) + "\n";
    }
    discord.send_message(ctx.channel.id, msg);
});

HTTP Methods

All ethone.http_* methods include stealth headers and Chrome TLS fingerprinting for bypassing anti-bot detection:
  • Chrome 131 User-Agent
  • Standard Accept, Accept-Language, Accept-Encoding headers
  • Cache-Control headers
  • TLS handshake mimics real Chrome browser
Limits:
  • Response size: 1MB maximum
  • Timeout: 10 seconds
  • Custom headers can override defaults

ethone.http_get()

Make an HTTP GET request to external APIs with anti-detection. Use this for non-Discord APIs and general web requests. For Discord API endpoints, use discord.http_get() instead.

Syntax

ethone.http_get(url, headers?)

Parameters

ParameterTypeDescription
urlstringThe URL to make a GET request to
headersobject (optional)Custom headers to override defaults

Returns

HttpResponse - An object containing:
  • status (number): HTTP status code (e.g., 200, 404, 500). Returns 0 if request failed.
  • statusText (string): HTTP status text (e.g., “200 OK”, “404 Not Found”). Empty string if request failed.
  • headers (object): Response headers as an object
  • body (string): Response body as a string (max 1MB). Empty string if request failed.

Example

ethone.on_command("weather", "Get weather", "weather <city>", function(ctx) {
    if (ctx.args.length === 0) {
        discord.send_message(ctx.channel.id, "Usage: .weather <city>");
        return;
    }
    
    var city = ctx.args.join(" ");
    var response = ethone.http_get("https://api.weather.com/v1/city/" + city);
    
    if (response.status === 200) {
        var data = JSON.parse(response.body);
        discord.send_message(ctx.channel.id, "Weather: " + data.temperature);
    } else {
        discord.send_message(ctx.channel.id, "Failed to get weather data (Status: " + response.status + ")");
    }
});

ethone.http_post()

Make an HTTP POST request to external APIs with anti-detection. Use this for non-Discord APIs and general web requests. For Discord API endpoints, use discord.http_post() instead.

Syntax

ethone.http_post(url, data, headers?)

Parameters

ParameterTypeDescription
urlstringThe URL to make a POST request to
datastringRequest body (JSON string)
headersobject (optional)Custom headers to override defaults

Returns

HttpResponse - An object containing:
  • status (number): HTTP status code (e.g., 200, 404, 500). Returns 0 if request failed.
  • statusText (string): HTTP status text (e.g., “200 OK”, “404 Not Found”). Empty string if request failed.
  • headers (object): Response headers as an object
  • body (string): Response body as a string (max 1MB). Empty string if request failed.

Example

ethone.on_command("webhook", "Send webhook", "webhook <message>", function(ctx) {
    if (ctx.args.length === 0) {
        discord.send_message(ctx.channel.id, "Usage: .webhook <message>");
        return;
    }
    
    var payload = JSON.stringify({ 
        message: ctx.args.join(" "),
        user: ctx.author.username
    });
    
    var response = ethone.http_post(
        "https://hooks.example.com/webhook",
        payload,
        { "Authorization": "Bearer token123" }
    );
    
    if (response.status === 200 || response.status === 201) {
        discord.send_message(ctx.channel.id, "Webhook sent!");
    } else {
        discord.send_message(ctx.channel.id, "Failed to send webhook (Status: " + response.status + ")");
    }
});

ethone.http_put()

Make an HTTP PUT request to external APIs with anti-detection. Use this for non-Discord APIs and general web requests. For Discord API endpoints, use discord.http_put() instead.

Syntax

ethone.http_put(url, data, headers?)

Parameters

ParameterTypeDescription
urlstringThe URL to make a PUT request to
datastringRequest body (JSON string)
headersobject (optional)Custom headers to override defaults

Returns

HttpResponse - An object containing:
  • status (number): HTTP status code (e.g., 200, 404, 500). Returns 0 if request failed.
  • statusText (string): HTTP status text (e.g., “200 OK”, “404 Not Found”). Empty string if request failed.
  • headers (object): Response headers as an object
  • body (string): Response body as a string (max 1MB). Empty string if request failed.

Example

var data = JSON.stringify({ name: "Updated Name", value: 42 });
var response = ethone.http_put("https://api.example.com/resource/123", data);
if (response.status === 200) {
    ethone.log("Resource updated successfully");
}

if (response) {
    ethone.log("PUT successful: " + response);
}

ethone.http_patch()

Make an HTTP PATCH request to external APIs with anti-detection. Use this for non-Discord APIs and general web requests. For Discord API endpoints, use discord.http_patch() instead.

Syntax

ethone.http_patch(url, data, headers?)

Parameters

ParameterTypeDescription
urlstringThe URL to make a PATCH request to
datastringRequest body (JSON string)
headersobject (optional)Custom headers to override defaults

Returns

HttpResponse - An object containing:
  • status (number): HTTP status code (e.g., 200, 404, 500). Returns 0 if request failed.
  • statusText (string): HTTP status text (e.g., “200 OK”, “404 Not Found”). Empty string if request failed.
  • headers (object): Response headers as an object
  • body (string): Response body as a string (max 1MB). Empty string if request failed.

Example

var data = JSON.stringify({ status: "active" });
var response = ethone.http_patch("https://api.example.com/resource/123", data);

if (response.status === 200) {
    var result = JSON.parse(response.body);
    ethone.log("Status updated: " + result.status);
}

ethone.http_delete()

Make an HTTP DELETE request to external APIs with anti-detection. Use this for non-Discord APIs and general web requests. For Discord API endpoints, use discord.http_delete() instead.

Syntax

ethone.http_delete(url, headers?)

Parameters

ParameterTypeDescription
urlstringThe URL to make a DELETE request to
headersobject (optional)Custom headers to override defaults

Returns

HttpResponse - An object containing:
  • status (number): HTTP status code (e.g., 200, 404, 500). Returns 0 if request failed.
  • statusText (string): HTTP status text (e.g., “200 OK”, “404 Not Found”). Empty string if request failed.
  • headers (object): Response headers as an object
  • body (string): Response body as a string (max 1MB). Empty string if request failed.

Example

ethone.on_command("delete", "Delete resource", "delete <id>", function(ctx) {
    if (ctx.args.length === 0) {
        discord.send_message(ctx.channel.id, "Usage: .delete <id>");
        return;
    }
    
    var response = ethone.http_delete(
        "https://api.example.com/resource/" + ctx.args[0],
        { "Authorization": "Bearer token123" }
    );
    
    if (response.status === 204 || response.status === 200) {
        discord.send_message(ctx.channel.id, "Resource deleted!");
    } else {
        discord.send_message(ctx.channel.id, "Failed to delete resource");
    }
});