local chatcommand_cmd = yl_ticker.settings.chatcommand_domain .. "_add"
local chatcommand_definition = {
    params = "<message>$<frequency in seconds>$<runtime in seconds>",
    description = "Sends the message each frequency seconds for a maximum number of runtime seconds." ..
        "\nExample: /".. yl_ticker.settings.chatcommand_domain .. "_add Runs every 50 seconds for one hour (= 3600 seconds)$50$3600",
    privs = {[yl_ticker.settings.admin_privs] = true},
    func = function(name, param)
        local success, message = yl_ticker.chatcommand_ticker_add(
                                     name, param)

        if success then
            minetest.log("action", "[yl_ticker] player " .. name ..
                             " added new ticker: " .. param)
            return true, message
        else
            minetest.log("warning",
                         "[yl_ticker] player " .. name ..
                             " added new ticker: " .. param ..
                             " unsuccessfully, message: " .. message)
            return false, message
        end
    end
}

minetest.register_chatcommand(chatcommand_cmd, chatcommand_definition)
yl_ticker.register_help(chatcommand_cmd, chatcommand_definition)
