From 05b035dc9cac19ab698bfa857a6488dd33309801 Mon Sep 17 00:00:00 2001 From: KungKurt Date: Sun, 23 Feb 2025 13:57:32 +0100 Subject: [PATCH] moved main.js and added puckoapi init --- scripts/main.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/main.js diff --git a/scripts/main.js b/scripts/main.js new file mode 100644 index 0000000..faab1a7 --- /dev/null +++ b/scripts/main.js @@ -0,0 +1,27 @@ +import { PuckoPruttApi } from "./puckoapi/puckoapi.js" +import { puckocommand } from "./puckochat/commands.js" + +Hooks.on("init", async function() { + console.log("[puckoprutt] Hello Init"); + var puckoprutt = new PuckoPruttApi(); +}); + +Hooks.on("ready", async function() { + console.log("[puckoprutt] Hello Ready"); +}); + +Hooks.on("chatMessage", (log, message, data) => { + let to_send = ""; + let user = game.users.get(data.user); + let world = game.world.id; + + if(message[0] === "!") to_send = puckocommand(user, world, log, message.slice(1).split(" "), data); + + if(to_send !== "") { + ChatMessage.create({ + user: game.actors.getName("puckoprutt"), + speaker: ChatMessage.getSpeaker({actor: game.actors.getName("puckoprutt"), alias: "Almighty God"}), + content: to_send + }); + } +}); \ No newline at end of file