moved main.js and added puckoapi init
This commit is contained in:
parent
5cacca37a1
commit
05b035dc9c
27
scripts/main.js
Normal file
27
scripts/main.js
Normal file
@ -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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user