Use Google's Gemini as a chatbot on your Discord server.
This is a cog module for Discord bots. You have to load into a bot supporting cogs - like ServerBot.
It's a hybrid command - works as prefix and slash command at once.
If AI generates response longer than allowed message length on Discord, bot will save its response to file and send it as a file.
Uses Gemini API (uses gemini-2.5-flash language model as default) - you have to get a Gemini API key (on the Google AI Studio page) and add it to the .env file in the 'AI_token' field.
In this file you can set language model (gemini-2.5-flash as default) in the 'AI_model' field, and instructions for a model in a 'instructions' field.
Basic functionality of admin privileges/security/etc that uses .env file works as the same way as in ServerBot - you can read about that in ServerBot Manual.
If your bot does not use .env file, you can type everything inside file, or just create the .env file using .aimgr update-env
(recommended; to use this command you have to be 'admin' of this module/bot - type your Discord UserID inside ai.py in 'admin_usr' variable as an alternative value.), fill the values and restart your bot.
AI_token = ''
AI_model = 'gemini-2.5-flash'
instructions = 'Always answer in users language. Be precise and truthseeking. Do not answer to illegal, harmful, sexual or violent content.'
admin_usr = ['']
extendedErrMess = 'No'
| Discord Bot | Supported Since | Notes |
|---|---|---|
| ServerBot | v1.12.0+ | Older releases had AI command built into main file. |