Skip to content

Webhooks ​

All Twinded scripts support Discord webhook logging out of the box, with an option for custom webhook handlers.

Discord Webhooks ​

Setup ​

  1. Copy config/_default.lock/settings.lua → config/custom/settings.lua
  2. Set your webhook URL:
lua
Config.Webhook = {
    type = 'discord',
    url = 'https://discord.com/api/webhooks/...',
}

That's it — the script will send formatted Discord embeds automatically.

What gets logged ​

Each script logs different events. Check the script's documentation page for details on what actions trigger webhooks.

Custom Webhooks ​

If you use a logging system other than Discord (e.g., a custom panel, database, or external API), you can override the webhook handler.

Setup ​

  1. Copy config/_default.lock/webhook.lua → config/custom/webhook.lua
  2. Change the webhook type:
lua
-- config/custom/settings.lua
Config.Webhook = {
    type = 'custom',
    url = '',  -- not used with custom type
}
  1. Implement your handler in config/custom/webhook.lua:
lua
function SendScriptWebhook(data)
    -- data contains the full Discord-formatted payload:
    -- data.username    - Bot name
    -- data.avatar_url  - Bot avatar
    -- data.embeds      - Array of embed objects
    --   .title         - Embed title
    --   .description   - Embed body
    --   .color         - Color code
    --   .fields        - Array of {name, value, inline}
    --   .footer        - {text}
    --   .timestamp     - ISO 8601

    -- Example: forward to your custom API
    PerformHttpRequest('https://your-api.com/logs', function() end,
        'POST', json.encode(data),
        { ['Content-Type'] = 'application/json' })
end

WARNING

The data payload structure matches Discord's webhook format. Each script documents its specific fields in the webhook.lua comments.

Premium RedM Scripts — Multi-Framework