Skip to content

UmstadAI/Thread-Uploader

Repository files navigation

Thread Uploader for Discord

Introduction

Thread Uploader is a Python-based tool designed for MINA Protocol Discord moderators. It automates the process of fetching, processing, and uploading the latest Discord threads in the zkapps-developers and zkapps-questions channels to a zkApp Umstad Vector DB.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Python installed on your system.
  • A Discord bot with read message history moderation privileges.
  • Access to OpenAI and Pinecone services.

Installation

Follow these steps to install Thread Uploader:

  1. Clone the Repository

    git clone https://github.com/UmstadAI/Thread-Uploader.git
    cd Thread-Uploader
  2. Set Up Virtual Environment

    virtualenv venv
    source venv/bin/activate  # For Unix or MacOS
    venv\Scripts\activate  # For Windows
  3. Install Dependencies

    pip install -r requirements.txt

Configuration

  1. Environment Variables

    • Duplicate the .env.example file and rename it to .env.
    • Fill in the necessary details in .env:
      • DISCORD_TOKEN: Your Discord Bot Token.
      • OPENAI_API_KEY: Your OpenAI API Key.
      • PINECONE_API_KEY: Your Pinecone API Key.
      • PINECONE_ENVIRONMENT: Your Pinecone Environment.
      • ISSUE_VECTOR_TYPE: Your specified Vector Type.
  2. Activate the Virtual Environment Ensure that the virtual environment is activated whenever you work with the project.

Setting the Thread Fetching Time Limit

Moderators can dynamically set the time limit for thread fetching by changing the AFTER_DAYS = 7 in the getter.py. So, now it will get threads which are created before 7 days ago.

GPT Model

You can also use gpt-4-1106-preview model depends on tha API consistency. Sometimes it stuck. When it is stable, using gpt4 would be better to process.

So, you can change the model in the processor.py:

response = client.chat.completions.create(
        model="gpt-4-1106-preview",
        response_format={"type": "json_object"},
        temperature=0.8,
        messages=[
            {"role": "system", "content": PROMPT},
            {"role": "user", "content": str(contents)},
        ],
    )

Usage

To run the Thread Uploader, execute the following command in the project directory:

python task_runner.py

Support

For support, contact berkingurcan@gmail.com

Contributing

Contributions to the Thread Uploader project are welcome. Please adhere to the project's code of conduct in your interactions.

About

Thread getter and uploader for discord mods

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages