starting in on rolls

main
Matt Huntington 8 hours ago
parent c8da4f4977
commit 9fdf3a3f10

@ -17,13 +17,16 @@ function formatResponse(text) {
.replace(/^(.*)$/, "<p>$1</p>"); .replace(/^(.*)$/, "<p>$1</p>");
} }
Hooks.on("createChatMessage", async (message, options, userId) => { Hooks.on("createChatMessage", async (chatData, options, userId) => {
if (message.speaker.alias === 'AI DM') return console.log(chatData);
if (chatData.speaker?.alias === 'AI DM' || chatData.isRoll) return
})
Hooks.on("chatMessage", async (chatLog, message, chatData) => {
const response = await fetch('https://ai-dm-api.artisan.al/prompt', { const response = await fetch('https://ai-dm-api.artisan.al/prompt', {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content:message.content }) body: JSON.stringify({ content:message })
}); });
const data = await response.json(); const data = await response.json();
console.log(data); console.log(data);
@ -32,6 +35,7 @@ Hooks.on("createChatMessage", async (message, options, userId) => {
speaker: { alias: 'AI DM'}, speaker: { alias: 'AI DM'},
style: CONST.CHAT_MESSAGE_STYLES.IC style: CONST.CHAT_MESSAGE_STYLES.IC
}); });
}) })
Hooks.once("ready", () => { Hooks.once("ready", () => {
console.log('Claude listening...'); console.log('Claude listening...');

Loading…
Cancel
Save