Takaro module library

Takaro Modules

Takaro is a game server management platform for running, automating, and moderating multiplayer communities. These modules install into Takaro to add server automation, Discord workflows, economy systems, and moderation tools.

lottery

Players can buy tickets for a lottery, and the winner is chosen at random.
builtinTakaro >=0.0.1

Components Overview

1
config
3
commands
0
hooks
1
Cron Jobs
0
functions
2
permissions

Configuration

Configure this module using the schemas below. The JSON schema defines the data structure, while the UI schema customizes how the configuration form is displayed.

Configuration Schema

Configuration Properties (1)

profitMarginnumber

The profit margin the server takes from the lottery.

Default: 0.1
Constraints: min: 0, max: 1

UI Schema

No UI schema defined. Configuration form will use default rendering.

About Configuration Schemas

The Configuration Schema defines the structure and validation rules for module settings. The UI Schema customizes how the configuration form is displayed in the Takaro interface, including field ordering, labels, and input types.

Commands (3)

These commands can be executed by players in-game. Each command has a trigger word, optional arguments, and executes JavaScript code on the server.

buyTicket

/buyTicketTrigger Command

Description

Buy a lottery ticket.

Arguments (1)

amount
numberPosition 0
Help: The amount of tickets to buy.
Default: None

Function Implementation

buyTicket Function

JAVASCRIPT

Usage Example

Player types: /buyTicket <amount>

viewTickets

/viewTicketsTrigger Command

Description

View your lottery tickets.

Function Implementation

viewTickets Function

JAVASCRIPT

Usage Example

Player types: /viewTickets

nextDraw

/nextDrawTrigger Command

Description

View when the next draw is.

Function Implementation

nextDraw Function

JAVASCRIPT

Usage Example

Player types: /nextDraw

About Module Commands

Commands allow players to interact with your module through chat. Each command has a trigger word that players type (prefixed with /), optional arguments for parameters, and a JavaScript function that executes when the command is used. Arguments are automatically validated and passed to the function.

Scheduled Jobs (1)

These jobs run automatically on a schedule defined by cron expressions. Each job executes JavaScript code at specific times or intervals.

drawLottery

0 0 * * *Schedule

Schedule Details

Cron Expression
0 0 * * *
Human-Readable Schedule

Daily at midnight

Function Implementation

drawLottery Function

JAVASCRIPT

Cron Expression Format

minute hour day-of-month month day-of-week

Each field can contain numbers, ranges (1-5), lists (1,3,5), or wildcards (*). Use */n for intervals (e.g., */5 for every 5 units).

About Scheduled Jobs

Cron jobs allow your module to execute code automatically on a schedule. Each job has a cron expression that defines when it runs, and a JavaScript function that executes at those times. Jobs run server-side and can perform maintenance tasks, send notifications, or update game state automatically.

Permissions (2)

These permissions control who can access different features of this module. Administrators can assign these permissions to roles, allowing fine-grained access control.

General Permissions

2 permissions

Buy Lottery Tickets

LOTTERY_BUYPermission Key
Description

Allows the player to buy lottery tickets.

Permission Details
Full Key:LOTTERY_BUY
Can Have Count:No
Category:General

View Lottery Tickets

LOTTERY_VIEW_TICKETSPermission Key
Description

Allows the player to view his lottery tickets.

Permission Details
Full Key:LOTTERY_VIEW_TICKETS
Can Have Count:No
Category:General

About Module Permissions

Permissions control access to module features and functionality. Each permission has a unique key for identification, a friendly name for display, and a description explaining what it allows. Some permissions are countable, meaning they can have numeric values or limits assigned. Administrators assign these permissions to user roles to control who can use different module features.