npm-ai-console
Version:
A funny AI-powered console logger with sarcastic, hype, and confused modes
64 lines (54 loc) β’ 1.66 kB
JavaScript
// index.js
const MODES = {
sarcastic: [
"Oh wow, you logged that? Groundbreaking.",
"Next you'll tell me the sky is blue.",
"Did you even test this? I doubt it.",
"I'm a sophisticated AI, but this is just sad.",
"Congratulations on logging something useless."
],
hype: [
"You're killing it! Keep those logs coming!",
"Build succeeded! You rock!",
"That's some grade-A coding right there.",
"You're on fire π₯ Keep pushing!",
"All systems GO! Let's crush it!"
],
confused: [
"Umm... what was that again?",
"I'm not sure I understand, but sure!",
"Can you say that again, human?",
"Is this a log or a cry for help?",
"π€... beep boop... lost in translation..."
]
};
const MEMES = [
"This is fine. πΆπ₯",
"Iβm not a robot π€",
"Keep calm and code on.",
"404: Motivation not found.",
"To code or not to code, that is the question."
];
let currentMode = "sarcastic";
function getRandomItem(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
function aiLog(...args) {
// Log original messages
console.log(...args);
// Random chance to throw a meme (20%)
if (Math.random() < 0.2) {
console.log("AI meme says:", getRandomItem(MEMES));
}
// AI comment based on mode
const comment = getRandomItem(MODES[currentMode]);
console.log("AI says:", comment);
}
function setMode(mode) {
if (!MODES[mode]) {
console.warn(`Mode "${mode}" not found. Available modes: ${Object.keys(MODES).join(", ")}`);
return;
}
currentMode = mode;
}
module.exports = { aiLog, setMode };