Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/faizan45640/gemini-discord-bot
This repo contains the code of a discord bot made with discord.js. It includes gemini generative AI api to interact with users.
https://github.com/faizan45640/gemini-discord-bot
Last synced: about 1 month ago
JSON representation
This repo contains the code of a discord bot made with discord.js. It includes gemini generative AI api to interact with users.
- Host: GitHub
- URL: https://github.com/faizan45640/gemini-discord-bot
- Owner: faizan45640
- Created: 2024-07-21T14:50:10.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-21T15:55:05.000Z (5 months ago)
- Last Synced: 2024-07-21T17:27:50.884Z (5 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gemini-Discord-Bot
Project Name (Gemini Bot)
DescriptionThis Discord bot utilizes Google Generative AI to respond to user prompts in a safe and controlled manner. Users can send messages containing "ai " followed by their prompt, and the bot will generate creative text formats based on the input.
### Requirements
Node.js and npm (or yarn) installed on your system
A Discord bot token (obtainable from the Discord Developer Portal) (https://discord.com/developers/docs/intro)
A Google Cloud Project with the Google Generative AI API enabled (https://cloud.google.com/ai/generative-ai)
InstallationClone this repository or download the code.
Install the required dependencies:
Bash
npm install discord.js @google/generative-ai fs
Use code with caution.Create a file named config.json in the root directory of your project with the following content, replacing the placeholder with your actual Discord bot token:
JSON
{
"API_KEY": "your_discord_bot_token"
}
Use code with caution.### Configuration
Safety: The safe array in the code defines the sensitivity level for different content categories. You can adjust the threshold values (e.g., "BLOCK_LOW", "BLOCK_MODERATE") in the safe array within the code to control how strictly the AI model filters responses.
Running the BotStart a terminal or command prompt in the project directory.
Run the following command to start the bot:
Bash
node index.js // Replace with your main script name if different
Use code with caution.### Usage
Once the bot is running, users can interact with it by sending messages that start with "ai ". For example:
ai Write a poem about a cat
ai Create a funny story about a robot butler
The bot will respond with the generated text based on the prompt.### Additional Notes
This is a basic example, and you can extend it to handle more complex interactions and functionalities.
Be sure to follow the terms of service for both Discord and Google Generative AI when using this code.
Consider error handling and logging mechanisms for a more robust bot.
ContributingFeel free to fork this repository and make improvements! Pull requests are welcome.