Ai ask or smth
Description
this command is used for asking ai and stuff the current ai model is 3.6 flash by Google you need 2 variables: aiResetAt value 0 aiUses value 0 these variables are used to not make the API key be used too much and please replace YOUR_ GEMINI _ API_KEY with your API key
Trigger
!ai
BDScript Code
$nomention
$defer
$if[$getTimestamp[s]>$getVar[aiResetAt;$authorID]]
$setVar[aiUses;0;$authorID]
$setVar[aiResetAt;$sum[$getTimestamp[s];86400];$authorID]
$endif
$if[$getVar[aiUses;$authorID]>=5]
$title[⏳ Rate limited]
$description[You've used all 5 replies for now. Resets <t:$getVar[aiResetAt;$authorID]:R>.]
$color[#ED4245]
$addTimestamp
$else
$if[$message[1;question]==]
$title[🤖 AI Chat]
$description[Ask me something! Example: `!ai What's the capital of Japan?` or `/ai question:...`
You have $calculate[5-$getVar[aiUses;$authorID]] use(s) left today.]
$color[#5865F2]
$addTimestamp
$else
$jsonParse[{"system_instruction":{"parts":[{"text":"You are a friendly, helpful assistant chatting in a Discord server. Keep replies concise."}\]},"contents":[{"parts":[{"text":""}\]}\]}]
$jsonSetString[contents;0;parts;0;text;$message[1;question]]
$httpAddHeader[Content-Type;application/json]
$httpAddHeader[x-goog-api-key;YOUR_GEMINI_API_KEY]
$httpPost[https://generativelanguage.googleapis.com/v1beta/models/gemini-3.6-flash:generateContent;$jsonStringify]
$var[reply;$httpResult[candidates;0;content;parts;0;text]]
$if[$var[reply]==]
$title[⚠️ Something went wrong]
$description[**Status:** $httpStatus
$httpResult]
$color[#ED4245]
$addTimestamp
$else
$setVar[aiUses;$sum[$getVar[aiUses;$authorID];1];$authorID]
$title[🤖 AI Reply]
$description[$var[reply]]
$color[#5865F2]
$footer[Asked by $username • $calculate[5-$getVar[aiUses;$authorID]] left today]
$addTimestamp
$endif
$endif
$endif
Copied to clipboard!