32 lines
952 B
JavaScript
32 lines
952 B
JavaScript
import PuckoPruttApi from "./puckoapi/puckoapi.js";
|
|
import puckocommand from "./puckochat/commands.js";
|
|
|
|
let puckoprutt = null;
|
|
Hooks.once("setup", async function() {
|
|
puckoprutt = new PuckoPruttApi();
|
|
});
|
|
|
|
Hooks.on("init", async function() {
|
|
console.log("[puckoprutt] Hello Init");
|
|
});
|
|
|
|
Hooks.on("ready", async function() {
|
|
console.log("[puckoprutt] Hello Ready");
|
|
ui.notifications.notify("Puckoprutt greets you to the world of: " + game.world.title)
|
|
});
|
|
|
|
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
|
|
});
|
|
}
|
|
}); |