Giter VIP home page Giter VIP logo

el-margo-bot's Introduction

El Margo Discord Bot

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.

Features

  • 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.

Getting Started

Prerequisites

  • Python 3.8 or higher
  • discord.py library
  • pytz for timezone handling
  • An active Discord bot token

Installation

  1. Clone the repository to your local machine:
    git clone https://github.com/maxiwee69/el-margo-bot.git
  2. Navigate to the bot directory:
    cd el-margo-bot
  3. Install the required Python packages:
    pip install -r requirements.txt

Configuration

  1. Add all your keys and tokens in the main.py at the top of the file.
  2. For the backend server configuration, refer to backend.js and ensure it is running and accessible.

Setting Up the Backend with Cloudflare workers

Step 1: Register for a Cloudflare Account

  1. Go to Cloudflare's website.
  2. Sign up for an account or log in if you already have one.

Step 2: Create a Worker

  1. Once logged in, navigate to the Workers section.
  2. Click on Create Worker.
  3. Choose the "Text to Image" template from the list of available templates.

Step 3: Deploy Your Backend Code

  1. In the Worker's dashboard, click on "Edit code" at the top right.
  2. Replace the existing code with the backend code from this repository.
  3. Save your changes.

Step 4: Configure Environment Variables

  1. Go to Settings > Variables within your Worker's dashboard.
  2. 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.

Step 5: Set Up Triggers

  1. Navigate to Settings > Triggers.
  2. Note the URL under Routes. It should look something like images.maxiwee.workers.dev. This is the endpoint for your backend.
  3. Copy this URL and paste it into the ai_backend variable in your main.py file.

Configuring Your Discord Bot

Step 1: Create a New Application

  1. Go to the Discord Developer Portal.
  2. Click on "New Application".
  3. Give your application a name and create it.

Step 2: Create a Bot User

  1. Within your application's settings, navigate to the Bot tab.
  2. Click on "Add Bot".
  3. You will see a token for your bot. If it isn't displayed, click "Reset Token" to generate a new one.
  4. Copy this token and paste it into the token variable in your main.py file.

Step 3: Set Up the Channel ID for Daily Reminders

  1. To get a channel ID, you need to enable Developer Mode in Discord. Go to User Settings > Advanced and toggle Developer Mode on.
  2. Right-click on the channel where you want the daily reminders to be sent and select "Copy ID".
  3. Paste this ID into the channel_id variable in your main.py file.

Final Steps

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 the SECRET_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!

Running the Bot

  1. Start the bot by running:
    python main.py
  2. Invite the bot to your Discord server using the invite URL generated through the Discord Developer Portal.

Usage

  • 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.

Contributing

Contributions to El Margo are welcome! Please feel free to fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • 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.

el-margo-bot's People

Contributors

maxiwee69 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.