Skip to content
/ cbb Public

ChatBox Brigadier - A simple chatbox parser for CC:Tweaked + SwitchCraft3.

License

Notifications You must be signed in to change notification settings

migeyel/cbb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

CBB - ChatBox Brigadier

A somewhat simple and somewhat complex SwitchCraft chatbox command parser.

Example Usage

local cbb = require "cbb"

local root = cbb.literal("pgtbox") "pgtbox" {
  cbb.literal("help") "help" {
    help = "Provides this help message",
    execute = function(ctx)
      return cbb.sendHelpTopic(1, ctx)
    end,
  },
  cbb.literal("echo") "echo" {
    cbb.string "arg1" {
      help = "Echoes a string as long as it starts with the letter 'a'",
      execute = function(ctx)
        local argument = ctx.args.arg1
        if argument:sub(1, 1):lower() == "a" then
          ctx.reply({
            text = argument,
            color = cbb.colors.AQUA,
            formats = { cbb.formats.BOLD, cbb.formats.UNDERLINE },
          })
        else
          ctx.replyErr(
            ("String %q doesn't start with 'a'"):format(argument),
            ctx.argTokens.arg1
          )
        end
      end,
    }
  },
}

while true do
    local event = { os.pullEvent("command") }
    pcall(cbb.execute, root, "pgtbox", event)
end

About

ChatBox Brigadier - A simple chatbox parser for CC:Tweaked + SwitchCraft3.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages