From 4676a8d90e0e943afa40b9d46d3b22707dd6b2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=95=E3=82=BA=E3=82=AD?= Date: Thu, 25 Mar 2021 00:23:07 +0100 Subject: [PATCH] Added commands experiments (requires GooseMod 7.3.0-dev) --- commands-experiment/goosemodModule.json | 11 +++++++ commands-experiment/index.js | 41 +++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 commands-experiment/goosemodModule.json create mode 100644 commands-experiment/index.js 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"); + }, + }, +};