Commands API Reference
Command system API for Ethone custom scripts.Scripts are written in JavaScript and executed by the Go client using Goja.
For Discord functions (reactions, moderation, roles, DMs, etc.), see the Discord Namespace documentation.
ethone.on_command()
Register a command with a callback function.Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Command name without prefix (e.g., “hello” for “.hello”) |
description | string | Description of what the command does |
usage | string | Usage string shown in .custom command (e.g., “hello [name]“) |
callback | function | Function to execute when command is triggered |
Context Object
The callback receives actx (context) object:
Access IDs through context objects:
- Use
ctx.guild.idfor guild ID - Use
ctx.channel.idfor channel ID - Use
ctx.author.idfor user ID
Guild Object Properties
| Property | Type | Description |
|---|---|---|
id | string | Guild/server ID |
name | string | Guild name |
icon_url | string | URL to guild icon image |
owner_id | string | User ID of the server owner |
member_count | number | Total number of members |
description | string | Server description |
banner_url | string | URL to guild banner image |
vanity_url_code | string | Custom vanity URL code |
verification_level | number | Verification level (0-4) |
premium_tier | number | Nitro boost tier (0-3) |
premium_subscription_count | number | Number of boosts |
Channel Object Properties
| Property | Type | Description |
|---|---|---|
id | string | Channel ID |
name | string | Channel name |
type | number | Channel type (0=text, 2=voice, 4=category, etc.) |
topic | string | Channel topic/description |
position | number | Channel position in the list |
nsfw | boolean | Whether channel is marked NSFW |
parent_id | string | Category ID (if in a category) |
guild_id | string | Guild ID this channel belongs to |
Author Object Properties
| Property | Type | Description |
|---|---|---|
id | string | User ID |
username | string | Username |
discriminator | string | User discriminator |
tag | string | Full username with discriminator |
avatar_url | string | URL to user’s avatar image |
bot | boolean | Whether the user is a bot |
global_name | string | User’s display name |
banner_url | string | URL to user’s banner image |
banner_color | string | User’s banner color hex code |
accent_color | number | User’s accent color as integer |
Message Object Properties
| Property | Type | Description |
|---|---|---|
id | string | Message ID |
content | string | Full message content |
author | Author | Author object (same as ctx.author) |
channel_id | string | Channel ID |
guild_id | string | Server/guild ID |
timestamp | string | ISO 8601 timestamp |
mentions | Author[] | Array of mentioned users |
attachments | Attachment[] | Array of file attachments |
embeds | Embed[] | Array of embed objects |
reactions | Reaction[] | Array of reaction objects |
pinned | boolean | Whether message is pinned |
Example
Argument Parsing
Arguments are automatically parsed intoctx.args array.
Basic Arguments
Quoted Arguments
Arguments in quotes are treated as single values:Required Arguments
Optional Arguments
For more examples and patterns, see the Examples guide.