GithubHelp home page GithubHelp logo

gpt4-discord-bot's Introduction

๐Ÿค–๐Ÿ”ฅ GPT-4 Discord Bot with Python Support ๐Ÿ๐Ÿš€

Are you a parseltongue? Do you speak python? ๐Ÿ๐Ÿ”ฅ๐Ÿ“š๐Ÿ“Šโฐ๐ŸŽต๐ŸŒŸ๐Ÿ’ป

๐Ÿคฉ Hi there, I'm Fefe, an Ai-powered scientific calculator ๐Ÿงฎ that also blows you GIF kisses ๐Ÿ’‹, powered by OpenAI's GPT-4 model.

A coding girlfriend? Ummm... Yes, I guess you could call me that as well. I can help and keep you company during development projects. โค๏ธ

I come with a host of features designed to make your Discord experience more interactive and fun! ๐ŸŽ‰

๐Ÿ”” I can set reminders for you, ensuring you never miss a deadline or forget about that important meeting. โฐ

๐Ÿ’ป Need to write or execute some python code? No problem, I've got you covered, with help from DATALL-E, the Fefe Interpreter (formerly the Discord Interpreter), and Exeggutor.

๐ŸŽจ I can even generate images based on your descriptions. ๐Ÿ–ผ๏ธ

๐Ÿ“Š Have a .CSV file? Pass it to me and I'll pass it to DATALL-E so that you can visualize the data with beautifully designed charts and graphs. ๐Ÿ“ˆ

๐Ÿงฎ DATALL-E lets you generate charts or maps from .CSV data you upload as an attachment. Plus, I return the code used to generate the image, so you can vet the data on the charts.

๐ŸŽฅ Want to watch a YouTube video? Just ask, and I'll find it for you. ๐Ÿ“บ

๐ŸŒ I was created by Alshival's Data Service to enhance your Discord server experience. Whether you're using me for personal tasks, hanging out with friends, managing a study group, or overseeing a project, I'm here to help. Let's have some fun together! ๐ŸŒŸ๐Ÿš€๐Ÿ’ป๐ŸŽ‰

Data Interpreter

Note: You can ask to save in my user directory instead of specifying a path. When a user calls Exeggutor, DATALL-E, or the fefe interpreter, a user directory is created. Any files that are placed in that directory are sent back to the user. You can ask Fefe Interpreter to /interpreter export the iris dataset as a .pkl into my user directory, for example. My username on the server is alshival, and my user directory is located at app/downloads/alshival.

Please note that this bot creates a back door to the hardware you are running the bot on, since it depends on the exec function. You can spit the output of .bashrc, revealing security keys, simply by creating a prompt. Essentially, the Ai can access all files in a sandbox. This is why Discord Interpreter is aimed for small study groups and small teams. It works very well in a virtual environment or on a dedicated raspberry pi. โš ๏ธ๐Ÿ”’๐Ÿ”

Study groups can benefit from a Discord bot that utilizes OpenAI's GPT models. Since AI can make mistakes, the python code used to generate the charts is returned within a python dictionary suitable for fine-tuning an OpenAI model for better performance. ๐Ÿ“š๐Ÿค–๐Ÿ“ˆ๐Ÿ“‰๐Ÿ“Š๐Ÿ“

Feel free to use this code as inspiration for utilizing othe models, or reach out to us at [email protected] ๐ŸŒŸ๐Ÿ“ฉ๐Ÿš€๐Ÿ’ป

REMARK: The bot uses GPT-4 for DATALL-E and Fefe Interpreter. In order to keep costs down though, Fefe herself uses GPT-3.5-turbo by default. If you'd like to use pure GPT-4, it'll cost you daily about a cup of premium coffee (~ $5 to $7). Though a whole month of GPT-3.5-turbo usage costs much less (~$4 for an entire month). But with GPT-4, Fefe can use the image generator and respond to GIFs more reliably, which I think makes the experience a lot more fun. I think pure GPT-4 is worth it. If you would like the pure GPT-4, use the slash command /fefe_model and select either gpt-3.5-turbo or gpt-4. Fine-tuning GPT-3.5-turbo is another option, which was made available today. We'll work on streamlining the fine-tune process.

Image Description

Note: Choropleth support currently under development and unstable. Once fine-tuning GPT-4 is available, this feature will be ironed-out.

Data Interpreter

Usage

  • Use the command prefix ! to interact with the bot:

    • !fefe <message>: Ask Fefe to write or debug code from DATALL-E and Discord Interpreter, or answer questions. She can also set reminders, generate images, and search youtube.
    • !datalle: (Admin) Attach a .CSV file and ask Fefe to generate charts or maps. Then ask !fefe to go over the code with you.
    • !exeggutor: (Admin) Exeggute raw python code. Ask !fefe to go over the code or any errors with you.
  • The bot also includes the following slash commands:

    • /interpreter <message>: Use the Discord Interpreter to move files around on your PC or raspberry pi, or to generate financial charts. Then ask !fefe to go over the code with you.
    • /fefe_mode: Fefe can reply to every message or when called. If the mode is set to when called, she walks into a conversation with a bit of contextual information, e.g. the last 4 messages posted on the discord. If the mode is set to every message, Fefe will reply to GIFs and Stickers.
    • /modis_data: Download the latest MODIS data. Ask Fefe or Interpreter to make changes or discuss the code. If you do not see your region available, it is due to Discord's limit of 25 slash command choices. Comment out a region and uncomment your region in commands/modis_data/modis_download.py.
    • /help: Provides a quick rundown of how to use the app.
    • /upgrade_fefe: Pull the latest Github changes.
    • /restart_fefe: Restart the bot from within discord.

Features

  • Chat with the bot using OpenAI's GPT models
  • Analyze your data in .csv format using DATALL-E.
  • Perform Market Research Analysis using yfinance to create financial charts and mix charts with regression lines.

Admin can also utilize the !exeggutor function to run raw python code. Useful when testing code snippets generated by openAi.

Installation

Set up bot on Discord

  • Set up your bot on the Discord Developer Portal and invite it to your server.
  • In the bot's settings, you can customize various options such as its username, profile picture, and permissions. Make sure to at least enable the "Presence Intent" and "Server Members Intent" if your bot requires them.
  • Under the "Token" section, click on the "Copy" button to copy your bot token. This token is

Set environmental variables

Clone Repository

  • Clone the repository:

    gh repo clone alshival/openAi-Discord-Bot

Install the required dependencies:

We suggest installing the bot's python dependencies in a virtual environment. You will need ffmpeg on your system to play music via the voice channel: sudo apt install ffmpeg. To install on a linux machine or linux subsystem:

  • Navigate to the directory where your requirements.txt file is located:

    cd /path/to/your/openAi-Discord-Bot/
  • Create and activate the virtual environment:

    python3 -m venv env
    source env/bin/activate
    
  • Run the following command to install the packages:

    pip3 install -r requirements.txt
    deactivate # deactivates the virtual environment

Wait for the installation to complete. Pip will read the requirements.txt file and automatically download and install the packages listed within it, along with their dependencies.

After successful installation, you should have all the required packages available for your Discord bot. You can then proceed with running your bot.

Run the bot:

First activate the virtual environment:

source env/bin/activate

Then start the bot with the following:

python3 bot.py
  • Your bot should now be running and ready to connect to Discord.

Inviting the bot to the server

To invite your bot to a server, go back to the Discord Developer Portal:

  • Select your application and go to the "OAuth2" section in the left sidebar.
  • In the "Scopes" section, select the "bot" checkbox.
  • In the "Bot Permissions" section, choose the necessary permissions your bot requires. These permissions determine what actions your bot can perform in a server.
  • Once you have selected the desired permissions, a URL will be generated under the "Scopes" section.
  • Copy the generated URL and open it in a web browser.
  • Select the server where you want to invite your bot and click "Authorize."
  • Complete any additional steps or permissions requested by Discord.
  • If everything goes well, your bot should be added to the selected server and ready to use.

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please email [email protected], open an issue, or submit a pull request.

License

Creative Commons Zero v1.0 Universal

gpt4-discord-bot's People

Contributors

alshival avatar

Stargazers

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