Created: 2026/07/02 19:41:27 America/Chicago
By: admin
Views: 0

The support-ticket.lua script gives users a small help command inside a Verlihub hub. A user types a command such as !helpme with a short message, and operators receive a formatted notice with the user nickname and request text.

This script is not a database-backed ticket desk. It is a hub-side notification helper for registration problems, connection questions, abuse reports, rule questions, and other issues that need an operator to look.

What This Script Does

The script watches main chat for a configured support command and handles matching messages before they continue through normal chat.

Example user command:

!helpme I cannot connect to the correct hublist.

Example operator notice:

[SupportTicket] Help request from SomeUser: I cannot connect to the correct hublist.

Common uses include:

  • Letting users contact operators without knowing an operator nickname.
  • Reporting hub connection or hublist issues.
  • Reporting abusive users.
  • Asking for account or registration help.
  • Requesting rule clarification.
  • Creating a simple support workflow inside the hub.

The script sends formatted notices only. It does not create ticket IDs, store history, claim ownership, or replace a web support system.

Requirements

This script requires:

  • Verlihub installed and running.
  • The Verlihub Lua plugin installed.
  • The Lua plugin enabled in Verlihub.
  • Permission to load and unload Lua scripts.
  • A writable script directory for Verlihub Lua files.
  • A Verlihub Lua build that exposes chat message hooks such as VH_OnParsedMsgChat.

Before loading the script, confirm that the Lua plugin is active:

!pluglist

If the Lua plugin is not listed, load or enable it first from the parent Lua setup article.

Use a dedicated script directory:

mkdir -p /PATH/TO/HUB/scripts

Place the script at:

/PATH/TO/HUB/scripts/support-ticket.lua

For production systems, only trusted administrators or the Verlihub service user should write to that directory. Do not use world-writable permissions.

Load And Unload Commands

Load the script:

!luaload /PATH/TO/HUB/scripts/support-ticket.lua

Unload the script:

!luaunload /PATH/TO/HUB/scripts/support-ticket.lua

If you edit the script, unload it and load it again:

!luaunload /PATH/TO/HUB/scripts/support-ticket.lua
!luaload /PATH/TO/HUB/scripts/support-ticket.lua

Use the full absolute path unless your Verlihub Lua plugin configuration supports relative paths.

Script Code

-- Script: support-ticket.lua
-- Purpose: Lets users send simple help requests to hub operators.
-- Scope: Lightweight support notices only.
-- Notes: This is not a database-backed ticket system.

command = "!helpme"
botname = "SupportTicket"
min_message_length = 10
cooldown_seconds = 180
last_request = {}

function Trim(text)
    return string.gsub(text, "^%s*(.-)%s*$", "%1")
end

function StartsWith(text, prefix)
    return string.sub(text, 1, string.len(prefix)) == prefix
end

function GetMessageAfterCommand(text)
    return Trim(string.sub(text, string.len(command) + 1))
end

function CanSendRequest(nick)
    local now = os.time()

    if last_request[nick] == nil then
        last_request[nick] = now
        return true
    end

    if now - last_request[nick] >= cooldown_seconds then
        last_request[nick] = now
        return true
    end

    return false
end

function SendUserMessage(user, message)
    VH:SendToUser("<" .. botname .. "> " .. message, user)
end

function SendOperatorNotice(message)
    -- Depending on your Verlihub Lua API version, this may need to be changed
    -- to the operator or private-message helper function supported by your build.
    VH:SendToClass("<" .. botname .. "> " .. message, 3, 10)
end

function HandleSupportRequest(user, text)
    local nick = user.sNick
    local request = GetMessageAfterCommand(text)

    if string.len(request) < min_message_length then
        SendUserMessage(user, "Usage: " .. command .. " <describe your issue>")
        return 1
    end

    if not CanSendRequest(nick) then
        SendUserMessage(user, "Please wait before sending another help request.")
        return 1
    end

    SendOperatorNotice("Help request from " .. nick .. ": " .. request)
    SendUserMessage(user, "Your help request was sent to the operators. Please wait for a response.")

    return 1
end

function VH_OnParsedMsgChat(user, text)
    if StartsWith(text, command) then
        return HandleSupportRequest(user, text)
    end

    return 0
end

Configuration Options

command

command = "!helpme"

The command users type to request help. Pick one command and publish it in the hub rules or MOTD.

Examples:

command = "!helpme"
command = "!support"
command = "!ticket"
command = "!ophelp"

botname

botname = "SupportTicket"

The name shown in automatic replies and operator notices.

Examples:

botname = "SupportTicket"
botname = "HelpBot"
botname = "OperatorHelp"
botname = "HubSupport"

min_message_length

min_message_length = 10

The minimum number of characters required after the command. This blocks empty requests such as:

!helpme

It also blocks weak messages such as:

!helpme hi

Recommended values:

ValueMeaning
5Permissive. Useful while testing.
10Good default for normal help requests.
20Better when users send vague requests.

cooldown_seconds

cooldown_seconds = 180

How long a user must wait before sending another support request.

Recommended values:

ValueMeaning
601 minute.
1803 minutes.
3005 minutes.

Use a longer cooldown on busy hubs or when users keep repeating the same request.

last_request

last_request = {}

Internal table used to track user cooldowns. Do not edit this unless you are changing the script logic.

Example Configurations

Basic Help Request

command = "!helpme"
botname = "SupportTicket"
min_message_length = 10
cooldown_seconds = 180

User example:

!helpme I need help with registration.

Operator Help Command

command = "!ophelp"
botname = "OperatorHelp"
min_message_length = 10
cooldown_seconds = 180

User example:

!ophelp Someone is flooding main chat.

Ticket Style Command

command = "!ticket"
botname = "HubSupport"
min_message_length = 20
cooldown_seconds = 300

User example:

!ticket I cannot connect after changing my client settings.

For most hubs, start with:

command = "!helpme"
botname = "SupportTicket"
min_message_length = 10
cooldown_seconds = 180

This gives users an easy command while reducing blank or repeated requests.

For busy hubs, use:

cooldown_seconds = 300

For a small private hub, use:

cooldown_seconds = 60

Testing The Script

After loading the script, test as a normal user:

!helpme I need help testing this command.

Confirm that:

  • The user receives a confirmation message.
  • Operators receive the help request.
  • Empty requests are rejected.
  • Short requests are rejected when they are below min_message_length.
  • Cooldown prevents repeated spam.
  • The script unloads cleanly.

Also test invalid usage:

!helpme

Expected result:

Usage: !helpme <describe your issue>

Troubleshooting

The Script Does Not Load

Check that the Lua plugin is active:

!pluglist

Check the file path:

!luaload /PATH/TO/HUB/scripts/support-ticket.lua

Use the absolute path if relative paths do not work.

The Command Does Not Respond

Check:

  • The script is loaded.
  • The command matches exactly.
  • The Lua plugin supports VH_OnParsedMsgChat.
  • The user is typing the command in main chat.

Try a short test command:

command = "!testhelp"

Then reload the script and test again.

Operators Do Not Receive Notices

The example uses:

VH:SendToClass("<" .. botname .. "> " .. message, 3, 10)

Your Verlihub Lua plugin version may use a different function for operator messages or class-based messages. Check the Lua API examples for your Verlihub version and replace SendOperatorNotice() with the function supported by your build.

The function to adjust is:

function SendOperatorNotice(message)
    VH:SendToClass("<" .. botname .. "> " .. message, 3, 10)
end

Users Can Spam Requests

Increase the cooldown:

cooldown_seconds = 300

Increase the minimum message length:

min_message_length = 20

Help Requests Are Too Vague

Update the usage message:

SendUserMessage(user, "Usage: " .. command .. " <describe the issue, nickname involved, and what happened>")

This asks users to include the issue, nickname, and event instead of a one-word request.

Safety Notes

This script should stay lightweight. Do not add:

  • External HTTP requests.
  • Blocking network calls.
  • Database writes on every message.
  • File writes for every request unless log rotation exists.
  • Long loops.
  • Sleep calls.
  • Per-message heavy processing.

If you need a database-backed ticket system, use this script only as the hub-side entry point to a separate support process.

Privacy Notes

Help requests can contain complaints, nicknames, connection problems, moderation reports, or account questions.

Recommended practices:

  • Send requests only to operators.
  • Do not broadcast support requests to all users.
  • Do not log private details unless the hub rules explain why.
  • Rotate or delete logs if file logging is added later.
  • Tell users not to include passwords or private credentials.

Suggested user warning:

Do not include passwords or private credentials in help requests.

Maintenance Notes

Keep a backup before changing the script:

cp /PATH/TO/HUB/scripts/support-ticket.lua /PATH/TO/HUB/scripts/support-ticket.lua.bak

If using Git:

cd /PATH/TO/HUB/scripts
git add support-ticket.lua
git commit -m "Update support-ticket.lua settings"

When changing only the command, bot name, cooldown, or minimum message length, no logic changes are required.

Suggested Future Improvements

Possible later versions could add:

  • Ticket ID numbers.
  • File-based logging with rotation.
  • An operator claim command.
  • User confirmation with a ticket number.
  • Separate commands for abuse reports.
  • Private operator-only notices.
  • Rate limits by IP address or account.
  • Integration with an external support system.

Keep the first version small. Add a feature only when it solves a real hub management problem.

Parent Page