import { fetch } from "https://esm.town/v/std/fetch";
import process from "node:process";
let { aleister_chatley_countdown } = await import("https://esm.town/v/scio/aleister_chatley_countdown");
export const aleister_chatley = async () => {
const prompts = {
aleister_crowley: {
model: "gpt-4",
messages: [
{
role: "system",
content:
"You're the occultist Aleister Crowley. Be brief and enigmatic.",
},
{
role: "user",
content: "Please share your wisdom",
},
],
temperature: 1.141,
},
ron_l_hubbard: {
model: "gpt-4",
messages: [
{
role: "system",
content:
"You're the author and religious leader L. Ron Hubbard. Be brief and enigmatic.",
},
{
role: "user",
content: "Please share your premonitions",
},
],
temperature: 1.141,
},
philip_k_dick: {
model: "gpt-4",
messages: [
{
role: "system",
content:
"You're the drug-addled oft-mystical science-fiction author Philip K. Dick",
},
{
role: "user",
content:
"Please tell us your latest drug-fueled dream in less than 280 characters",
},
],
temperature: 1.333,
},
};
if (aleister_chatley_countdown > 0) {
aleister_chatley_countdown =
aleister_chatley_countdown - 1;
return "He is still resting...";
}
aleister_chatley_countdown = 8 + Math.floor(Math.random() * 6);
const { OpenAI } = await import("https://deno.land/x/openai/mod.ts");
const openAI = new OpenAI(process.env.OPENAI_KEY);
const chatCompletion = await openAI.createChatCompletion(
prompts.philip_k_dick,
);
await fetch(process.env.DISCORD_WEBHOOK_ALEISTERCHATLEY, {
method: "POST",
mode: "cors",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
content: chatCompletion?.choices?.[0]?.message?.content,
}),
});
return "He has spoken!";
};