El Margo is a Discord bot designed to enhance your Discord server's interactivity and functionality. With features like daily reminders, image generation based on user prompts, and personalized user data handling, El Margo aims to provide a unique and engaging experience for server members. The bot's image generation feature is powered by a backend server, details of which can be found in backend.js
.
- Daily Reminders: Sends a custom message every day at 17:00 CET/CEST to a designated channel, tagging all members with a friendly reminder to join for a game session.
- Image Generation: Generates images based on user prompts. Users can specify the number of images they want generated by appending a semicolon and a number to their prompt.
- User Data Handling: For every user that interacts with the bot, a personal folder is created using their Discord handle. This folder stores all generated images alongside a text file for each prompt used, named with the date and time of creation.
- Python 3.8 or higher
discord.py
librarypytz
for timezone handling- An active Discord bot token
- Clone the repository to your local machine:
git clone https://github.com/maxiwee69/el-margo-bot.git
- Navigate to the bot directory:
cd el-margo-bot
- Install the required Python packages:
pip install -r requirements.txt
- Add all your keys and tokens in the
main.py
at the top of the file. - For the backend server configuration, refer to
backend.js
and ensure it is running and accessible.
- Go to Cloudflare's website.
- Sign up for an account or log in if you already have one.
- Once logged in, navigate to the Workers section.
- Click on Create Worker.
- Choose the "Text to Image" template from the list of available templates.
- In the Worker's dashboard, click on "Edit code" at the top right.
- Replace the existing code with the backend code from this repository.
- Save your changes.
- Go to Settings > Variables within your Worker's dashboard.
- Add an Environment Variable named
SECRET_KEY
. Set its value to a secret key of your choice. This key will be used to authenticate requests to your backend.
- Navigate to Settings > Triggers.
- Note the URL under Routes. It should look something like
images.maxiwee.workers.dev
. This is the endpoint for your backend. - Copy this URL and paste it into the
ai_backend
variable in yourmain.py
file.
- Go to the Discord Developer Portal.
- Click on "New Application".
- Give your application a name and create it.
- Within your application's settings, navigate to the Bot tab.
- Click on "Add Bot".
- You will see a token for your bot. If it isn't displayed, click "Reset Token" to generate a new one.
- Copy this token and paste it into the
token
variable in yourmain.py
file.
- To get a channel ID, you need to enable Developer Mode in Discord. Go to User Settings > Advanced and toggle Developer Mode on.
- Right-click on the channel where you want the daily reminders to be sent and select "Copy ID".
- Paste this ID into the
channel_id
variable in yourmain.py
file.
Ensure all the variables in your main.py
file are correctly set:
ai_backend
should have the URL of your Cloudflare Worker.token
should have your Discord bot's token.secret_key
should match theSECRET_KEY
you set in your Worker's environment variables.channel_id
should be the ID of the Discord channel for daily reminders.
With these steps completed, your backend should be set up, and your Discord bot configured to interact with it. You can now run your bot and enjoy its features!
- Start the bot by running:
python main.py
- Invite the bot to your Discord server using the invite URL generated through the Discord Developer Portal.
- Daily Message: Automatically sends at 17:00 CET/CEST to the configured channel with the message "@everyone kommt cs2 ihr pisser".
- Image Generation: Mention the bot followed by your prompt in a message. Optionally, specify the number of images after a semicolon.
@ElMargo your prompt here; 2
- Data Handling: The bot automatically creates and manages user-specific folders for storing generated content. Each interaction is saved with a timestamp for easy reference.
Contributions to El Margo are welcome! Please feel free to fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the
discord.py
community for the comprehensive library and documentation. - Special thanks to all the contributors and users of El Margo for their ideas and feedback.
- The backend server setup in
backend.js
is crucial for the image generation feature, and its development was a significant part of this project.