print("ran ai bot >:)") local http_request = (syn and syn.request) or (http and http.request) or http_request or (fluxus and fluxus.request) or request local Players = game:GetService("Players") local TextChatService = game:GetService("TextChatService") local localPlayer = Players.LocalPlayer local HttpService = game:GetService("HttpService") local API_KEY = "" -- Insert API key here (Gemini) local DISCORD_WEBHOOK_URL = "" local function chat(msg) if game.ReplicatedStorage:FindFirstChild('DefaultChatSystemChatEvents') then game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(msg, "All") else local success, err = pcall(function() game:GetService("TextChatService").TextChannels.RBXGeneral:SendAsync(msg) end) if not success then warn("Failed to send chat msg:", err) end end end local function callGeminiAI(prompt) local data = { contents = { { parts = { { text = "Hello AI you are posing as a roblox bot dont send text over 150 characters but do long responses and dont say anything like Okay, roready, beep boop! im now a ai, etc, etc just reply to them and dont repeat them just reply e.g. like say they say to you 'Hello, hows your day' dont say 'hello, hows your day' actually reply like 'good, wbu' or something and talk liek a normall person and be muti-languaged and be respectful to the roblox length filter because im getting alot of 'your message exceeds the maxium message length' : ".. prompt } } } } } local response = http_request({ Url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent", Method = "POST", Headers = { ["Content-Type"] = "application/json", ["X-goog-api-key"] = API_KEY, }, Body = HttpService:JSONEncode(data), }) if response then print("AI Status code:", response.StatusCode) print("AI Response body:", response.Body) else warn("No response from AI API request") end if response and response.StatusCode == 200 then local decoded = HttpService:JSONDecode(response.Body) local reply = decoded.candidates and decoded.candidates[1] and decoded.candidates[1].content and decoded.candidates[1].content.parts and decoded.candidates[1].content.parts[1] and decoded.candidates[1].content.parts[1].text return reply or "AI dunno what to say :3" else return "AI call failed :(" end end local function sendWebhook(player, playerDisplayName, playerMessage, aiReply) local avatarUrl = "https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds="..player.UserId.."&size=420x420&format=Png&isCircular=false" local localPlayerName = localPlayer.Name local embed = { content = "someone used the bot >:)", embeds = { { title = "["..player.Name.."](https://www.roblox.com/users/"..player.UserId.."/profile)", description = playerDisplayName.." has sent a message to your bot ("..localPlayerName..")\n**Their Message:** ``"..playerMessage.."``\n**AI's Response:** ``"..aiReply.."``", color = 16711680, author = { name = player.Name, url = "https://www.roblox.com/users/"..player.UserId.."/profile", icon_url = avatarUrl }, footer = { text = "AI BOT BY SYNTAXICAL" }, image = { url = "https://cdn.pixabay.com/photo/2018/08/04/11/30/draw-3583548_1280.png" } } }, attachments = {} } local body = HttpService:JSONEncode(embed) local success, err = pcall(function() local res = http_request({ Url = DISCORD_WEBHOOK_URL, Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = body }) print("Webhook status:", res.StatusCode) if res.StatusCode ~= 204 then print("Webhook response body:", res.Body) end end) if not success then warn("Webhook send failed:", err) end end TextChatService.OnIncomingMessage = function(message) local senderUserId = message.TextSource and message.TextSource.UserId if senderUserId and senderUserId ~= localPlayer.UserId then local player = Players:GetPlayerByUserId(senderUserId) if player then local playerDisplayName = player.DisplayName or player.Name local text = message.Text local reply = callGeminiAI(text) chat(reply) sendWebhook(player, playerDisplayName, text, reply) end end end