Anna is an energetic and slightly scatterbrained Discord bot inspired by the character Anna Yanami from "Too Many Losing Heroines!". She aims to be helpful while bringing a bit of her quirky personality to your server. Her knowledge is limited to early 2023, so for the latest information, use the ~search command!
Here's what Anna can do:
- Chat & Ask: Use the
~writeor~askcommand to have a chat with Anna, powered by the Gemini AI. - Web Search: Need up-to-date info? Use
~search <your query>to get a summary from the web. - Math: Can answer simple math questions with the Wolfram|Alpha API.
- Greetings: Say hello with
~hello. - Date: Find out the current date with
~today. - Moderation: (Requires appropriate permissions)
~purge <amount>: Delete a specified number of messages (1-100).~ban <member> [reason]: Ban a member from the server.~kick <member> [reason]: Kick a member from the server.~timeout <member> <duration> [reason]: Timeout a member (e.g.,10s,5m,1h,1d, max28d).~removetimeout <member>or~rt <member>or~untimeout <member>: Remove a timeout from a member.
- Help: Get a list of commands with
~help, or details on a specific command with~help <command_name>.
To run Anna yourself, follow these steps:
-
Clone the repository:
git clone https://github.com/soquincy/Yanami.git cd Yanami -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.envfile in the same directory as your bot script. - Add the following environment variables, replacing the placeholders with your actual values:
BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN GOOGLE_API_KEY=YOUR_GEMINI_API_KEY CHANNEL_ID=YOUR_DISCORD_CHANNEL_ID GOOGLE_CUSTOM_SEARCH_API_KEY=YOUR_GOOGLE_CUSTOM_SEARCH_API_KEY SEARCH_ENGINE_ID=YOUR_GOOGLE_CUSTOM_SEARCH_ENGINE_ID WOLFRAM_APPID_SHORT=YOUR_WOLFRAM_APPID_SHORT WOLFRAM_APPID_LL=YOUR_WOLFRAM_APPID_LLM - Get your Discord Bot Token: Create a bot application on the Discord Developer Portal and get its token.
- Get your Gemini API Key: You can obtain a Gemini API key from the Google Cloud AI Platform.
- Get your Discord Channel ID: Enable Developer Mode in Discord (User Settings > Advanced) and then right-click on the desired channel and select "Copy ID".
- Get your Google Custom Search API Key and Engine ID: Set up a Custom Search Engine on the Google Cloud Console and obtain your API key and Search Engine ID.
- Get your Wolfram|Alpha App IDs: Log in or create a Wolfram Account here then get 'LLM API' and 'Short Answers API' App IDs.
- Create a
-
Run the bot:
python bot.py
(Replace
bot.pywith the actual name in case you changed it.)
Contributions to the project are welcome! If you have suggestions or want to add new features, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.
- discord.py for providing the Discord API wrapper.
- Google Generative AI for the Gemini API.
- Google Cloud Custom Search API for the web search functionality.
- The creator of "Too Many Losing Heroines!" for the inspiration behind Anna's character.