diff --git a/commands-experiment/goosemodModule.json b/commands-experiment/goosemodModule.json new file mode 100644 index 0000000..292a2c6 --- /dev/null +++ b/commands-experiment/goosemodModule.json @@ -0,0 +1,11 @@ +{ + "main": "index.js", + + "name": "CommandsExperiment", + "description": "GooseMod commands experiment [requires GMv7.3.0 or higher]", + "tags": ["test"], + + "authors": ["186496078273708033"], + + "version": "1.0.0" +} diff --git a/commands-experiment/index.js b/commands-experiment/index.js new file mode 100644 index 0000000..5f5e76b --- /dev/null +++ b/commands-experiment/index.js @@ -0,0 +1,41 @@ +import {commands, internalMessage} from '@goosemod/patcher'; + +export default { + goosemodHandlers: { + onImport: () => { + commands.add( + "command-name", + "command-description", + (...args) => console.log(args), + [ + { + type: 3, + name: "command-string-parameter", + description: "parameter-description", + required: false + } + ] + ); + commands.add( + "echo", + "Prints out all of the message's text in an internal message.", + (args) => { + internalMessage(args.text[0].text); + console.log(args); + }, + [ + { + type: 3, + name: "text", + description: "Text to be printed in an internal message.", + required: true + } + ] + ); + }, + onRemove: () => { + commands.remove("command-name"); + commands.remove("echo"); + }, + }, +};