Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/migeyel/cbb
ChatBox Brigadier - A simple chatbox parser for CC:Tweaked + SwitchCraft3.
https://github.com/migeyel/cbb
Last synced: about 2 months ago
JSON representation
ChatBox Brigadier - A simple chatbox parser for CC:Tweaked + SwitchCraft3.
- Host: GitHub
- URL: https://github.com/migeyel/cbb
- Owner: migeyel
- License: mit
- Created: 2023-05-30T15:26:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-10T19:43:50.000Z (11 months ago)
- Last Synced: 2024-08-04T02:07:42.544Z (5 months ago)
- Language: Lua
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-switchcraft - cbb - Simple Chatbox parser (Libraries / Utility)
README
# CBB - ChatBox Brigadier
A somewhat simple and somewhat complex SwitchCraft chatbox command parser.## Example Usage
```lua
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
```