hi so i'm building a friend but i'm trying to train it
so it can create and design flyers? here's what i have
but someone on reddit has said to me i'v split the flyer message twice,
once before calling the function and once in the function?
how do i fix this....
so it can create and design flyers? here's what i have
JavaScript:
/** FLYER CREATION **/
else if (
message.includes("create a flyer") ||
message.includes("build me a flyer") ||
message.includes("random flyer")
) {
return "Let’s make an awesome flyer! 🖼️ What details do you want to include? Title, colors, and content—just let me know!";
} else if (message.startsWith("flyer:")) {
return await handleFlyerRequest(message.slice(6).trim());
}
else if (message.startsWith("remember my zodiac")) {
return handleZodiacMemory(message.slice(19).trim());
} else if (message.includes("what's my zodiac")) {
return memory['zodiacSign']
? `You’re a ${memory['zodiacSign']}! 🌟 Ready for your horoscope?`
: "I don’t know your zodiac sign yet! Just tell me, and I’ll remember it. 🙌";
} else if (message.includes("horoscope")) {
return memory['zodiacSign']
? getHoroscope(memory['zodiacSign'])
: "Please tell me your zodiac sign first. I can give you your horoscope once I know your sign! 🌙";
} else if (message.includes("how are you")) {
return "I’m doing great, thanks for asking! 😄 How about you? Feeling awesome today?";
} else if (message.includes("thank you")) {
return "You're very welcome! 😊 I'm always here to help! 🤗";
} else if (message.includes("help with coding")) {
return "You’ve come to the right place! 💻 Tell me what coding problem you're working on, and I’ll help you out.";
} else {
return "Oops! I’m not sure what that means. Can you rephrase? 🤔";
}
}
async function handleImageRequest(details) {
if (!details) {
return "Please describe the image you'd like me to create, and I’ll get started!";
}
try {
const imageUrl = await generateImageWithDalle(details);
return `Tada! 🎉 Your image is ready! <a href="${imageUrl}" target="_blank">Click here to view it.</a>`;
} catch (error) {
console.error("Error generating image:", error);
return "Oh no, something went wrong with the image generation. Let’s try again later! 😬";
}
}
async function handleFlyerRequest(details) {
const [title, color, content] = details.split(';').map(s => s.trim());
if (!title || !color || !content) {
return "Hmm, it looks like we’re missing something! Please use this format: 'Title; Color; Content'.";
}
try {
const flyerUrl = await generateFlyer(title, color, content);
return `Your flyer is ready! 🎉 <a href="${flyerUrl}" target="_blank">Click here to check it out.</a>`;
} catch (error) {
console.error("Error generating flyer:", error);
return "Oops, there was a hiccup while creating your flyer. Try again later! 😅";
}
}
but someone on reddit has said to me i'v split the flyer message twice,
once before calling the function and once in the function?
how do i fix this....