let DiscordBotAPIKey = "MTUwNzgyMjcxNDI0NzcwODgxMw.GVTXKG._wLgNa0qm4z3-jqksQ1eCsqs0RCSioC0yq7psA"
let GeminiAPIKey = "AIzaSyAWBW5Ze4GLI5QGN4LioVqA1OWwL2m_7wo"

const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });

const { GoogleGenAI } = require("@google/genai");


const ai = new GoogleGenAI({apiKey: GeminiAPIKey});

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on("messageCreate", async (msg) => {
    if(msg.author.bot) return

    if(!msg.mentions.has(client.user)) return

    msg.content = msg.content.replace(/<@\d+>/g, "")

    let response = await msg.reply("Czarek pisze...")

    const completion = await ai.models.generateContent({
        model: "gemini-3.1-flash-lite",
        contents: "jesteś czarek i jestes skurwysynem: " + msg.content,
    });

    response.edit(completion.text)
})

client.login(DiscordBotAPIKey)