Nonay Docs

Getting Modding

This guide shows how to create your own mod from scratch.

Nonay Bot5 min read
On this page14 sections

1. Create the mod folder

Inside mods/, create a folder for your mod.

Example:

text
mods/
  My First JSON Mod/
    installed.json
    mod.json
    Contents/
      points.json

Required files:

  1. mod.json: mod metadata shown in dashboards/tools
  2. installed.json: guild IDs where this mod is active
  3. Contents/*.json: one or more blueprint files

2. Write mod.json

Use the same shape as other mods:

json
{
  "name": "My First JSON Mod",
  "author": "YourName",
  "version": "1.0.0",
  "size": "2 KB",
  "credits": "Optional",
  "description": "Replies with points when users type !points"
}

3. Write installed.json

Add guild IDs where the mod should run.

json
{
  "guilds": ["123456789012345678", "987654321098765432"]
}

If guilds is empty, the mod is installed nowhere.

4. Blueprint format (Contents/*.json)

Every blueprint file must contain:

json
{
  "nodes": [],
  "connections": []
}

Node structure

json
{
  "id": 1,
  "type": "WhenUser",
  "x": 20,
  "y": 30,
  "data": {
    "action": "SendsMessageContaining",
    "content": "!points"
  }
}
  • id: unique number within that blueprint
  • type: block behavior
  • x, y: editor positions (safe to keep; runtime ignores them)
  • data: type-specific config

Connection structure

json
{
  "from": { "nodeId": 1, "pinId": "exec" },
  "to": { "nodeId": 2, "pinId": "exec" }
}
  • Exec flow uses pins like exec, true, false
  • Data flow uses value pins like value, content, description, id, database

5. Supported trigger nodes

  1. OnStart: runs when bot starts (for installed guilds)
  2. WhenUser: reacts to messages using data.action and optional data.content
  3. OnMessage: same trigger path as WhenUser
  4. OnReaction: reacts to reaction events

WhenUser actions:

  • SendsMessage: exact match with data.content (or always true if empty)
  • SendsMessageContaining: substring match
  • SendsAttachment: true when message has attachments

OnReaction actions:

  • Reacts: any reaction
  • ReactsWith: specific emoji from data.emoji

6. Logic and utility nodes

  1. Branch
  • Uses data.condition
  • Supports ==, !=, and contains
  • Routes execution to true or false
  1. Delay
  • Uses data.duration in milliseconds
  1. SetVariable
  • data.variableName
  • Stores resolved input value in runtime variables
  1. GetVariable
  • data.variableName
  • Reads a variable and outputs value
  1. ConcatenateText
  • Joins text1 + optional separator + text2
  1. FormatText
  • Uses data.template
  • Supports {var1}, {var2}, {var3} and regular runtime placeholders

7. Messaging and member nodes

  1. SendMessage
  • Sends plain text to the current channel
  1. SendEmbed
  • Sends an embed with:
  • data.title
  • data.description
  • data.color (hex without validation strictness; invalid values fallback)
  1. GetUser
  • type: "Command Executor" (default) gets the triggering member
  • type: "Custom ID" uses data.userId
  1. AddRole / RemoveRole
  • Uses role name from data.roleName
  • Requires a valid member input (from GetUser or trigger context)

8. Database nodes

Database files are stored automatically in data/<name>__<modFolder>.json. The mod folder is appended to prevent collisions across mods.

  1. AddDatabase
  • data.name: base database name (for example GuildData)
  • data.fields: comma/newline separated fields
  • data.idType: GuildIDs or PlayerIDs
  1. WriteToDatabase
  • Input pin database should come from AddDatabase (or equivalent object)
  • data.fieldName: one or multiple fields
  • Input pin value or data.value
  • Optional input pin id to override target row ID
  1. ReadFromDatabase
  • Input pin database
  • data.fieldName: one or multiple fields
  • Optional input pin id
  • Single field returns that value
  • Multiple fields return a JSON string and also set each field in runtime variables

9. Runtime placeholders

Strings in node data support placeholders:

  • {content} message content
  • {userId} user ID
  • {userTag} username#discriminator/tag
  • {username} username
  • {channelId} channel ID
  • {guildId} guild ID
  • {emoji} reaction emoji
  • {modId} mod folder name

You can also use values created by variables and database reads:

  • {points}
  • {level}
  • {customVariable}

10. Full example: !points command

json
{
  "nodes": [
    {
      "id": 1,
      "type": "OnStart",
      "x": 30,
      "y": 30,
      "data": {}
    },
    {
      "id": 2,
      "type": "AddDatabase",
      "x": 250,
      "y": 30,
      "data": {
        "name": "GuildPoints",
        "fields": "points",
        "idType": "PlayerIDs"
      }
    },
    {
      "id": 3,
      "type": "WhenUser",
      "x": 30,
      "y": 260,
      "data": {
        "action": "SendsMessageContaining",
        "content": "!points"
      }
    },
    {
      "id": 4,
      "type": "ReadFromDatabase",
      "x": 260,
      "y": 260,
      "data": {
        "fieldName": "points"
      }
    },
    {
      "id": 5,
      "type": "Branch",
      "x": 510,
      "y": 260,
      "data": {
        "condition": "{points}=="
      }
    },
    {
      "id": 6,
      "type": "WriteToDatabase",
      "x": 760,
      "y": 180,
      "data": {
        "fieldName": "points",
        "value": "0"
      }
    },
    {
      "id": 7,
      "type": "SendMessage",
      "x": 760,
      "y": 180,
      "data": {
        "content": "You currently have 0 points."
      }
    },
    {
      "id": 8,
      "type": "SendMessage",
      "x": 760,
      "y": 330,
      "data": {
        "content": "You currently have {points} points."
      }
    }
  ],
  "connections": [
    {
      "from": { "nodeId": 1, "pinId": "exec" },
      "to": { "nodeId": 2, "pinId": "exec" }
    },
    {
      "from": { "nodeId": 3, "pinId": "exec" },
      "to": { "nodeId": 4, "pinId": "exec" }
    },
    {
      "from": { "nodeId": 2, "pinId": "database" },
      "to": { "nodeId": 4, "pinId": "database" }
    },
    {
      "from": { "nodeId": 2, "pinId": "database" },
      "to": { "nodeId": 6, "pinId": "database" }
    },
    {
      "from": { "nodeId": 4, "pinId": "exec" },
      "to": { "nodeId": 5, "pinId": "exec" }
    },
    {
      "from": { "nodeId": 5, "pinId": "true" },
      "to": { "nodeId": 6, "pinId": "exec" }
    },
    {
      "from": { "nodeId": 6, "pinId": "exec" },
      "to": { "nodeId": 7, "pinId": "exec" }
    },
    {
      "from": { "nodeId": 5, "pinId": "false" },
      "to": { "nodeId": 8, "pinId": "exec" }
    }
  ]
}

Tip: the Branch above checks if points is empty and initializes it to 0.

11. Testing checklist

  1. Confirm your mod folder has mod.json, installed.json, and Contents/*.json
  2. Confirm installed.json includes your server ID
  3. Restart the bot after major blueprint changes
  4. Check console for [JSON Mods] Failed to execute ... errors
  5. Verify your trigger text exactly matches your node settings

12. Common mistakes

  1. Reusing the same node ID twice
  2. Typo in pin names (exec/true/false/value)
  3. Forgetting to connect database to read/write nodes
  4. Using a guild ID that does not exist in installed.json
  5. Assuming role add/remove works without proper bot permissions

If your flow does not fire, simplify to a tiny chain first: WhenUser -> SendMessage. Then add one node at a time.

Esc
↑↓ to moveEnter to openEsc to close