Skip to main content

Your DiscordBot for a safer environment

Project description

ChatWizard

Discord bot to encourage positiveness within a server by analyzing and scoring each member's behavior.

Build Status codecov Documentation Status

Overview

ChatWizard is a Discord bot that encourages positivity within a server by analyzing and scoring each member's behavior. It uses OpenAI's GPT-3.5-turbo to assess members based on factors such as helpfulness, language use, friendliness, and humor. With ChatWizard, you can create a more welcoming, engaging, and supportive environment for everyone in your server.

Features

  • Analyzes and scores server members based on grammar, friendliness, and humor values of their messages.
  • Encourages and rewards positive contributions to the server.
  • Provides a score breakdown so members can see how they're performing in each category.
  • Logs all messages sent, making it easy to review member behavior.

Demo

Demo Image

Dependencies

  1. Python 3.6 or higher
  2. discord.py module (v1.7.3 or higher)
  3. openai module (v0.11.1 or higher)
  4. OpenAI API key (v4)
  5. A Discord user account and server

Installation

  1. Clone this repository:
git clone https://github.com/ulasonat/ChatWizard.git
  1. Install the required third-party packages:
pip install discord
pip install openai
  1. Set up the following environment variables, replacing your_discord_api_key and your_openai_api_key with your actual API keys:

    For bash:

    export DISCORD_API_KEY="your_discord_api_key"
    export OPENAI_API_KEY="your_openai_api_key"
    

    For Windows cmd:

    set DISCORD_API_KEY="your_discord_api_key"
    set OPENAI_API_KEY="your_openai_api_key"
    
  2. Invite the bot to your server through Discord Developer Portal.

  3. Usage

To run the application, execute the following command in your terminal/cmd prompt:

python main.py <openai_api_key> <discord_api_key>

Alternatively, you can import the library and call the main.run function by passing the Discord API key, OpenAI API key as arguments. Then, run the bot using the run method.

run(discord_api_key, openai_api_key)

Moreover, you can have instances of either OpenAIHandler or DiscordBot classes, and use the functions available. If you want to use our library to get a humor score for the sentence, you can do the following:

from openai_handler import OpenAIHandler

openai_handler = OpenAIHandler(
    api_key=open_ai_api_key,
    grammar_prompt_path=grammar_prompt_path,
    friendliness_prompt_path=friendliness_prompt_path,
    humor_prompt_path=humor_prompt_path,
)

worst_joke_ever = 'Why did the tomato turn red? Because it saw the salad dressing!'

humor_score = openai_handler.get_humor_score(worst_joke_ever)

More examples are included in our project's website.

Bot Commands

  • To get help: !help
  • To view your scores: !me
  • To reset your scores: !reset

After sending a message, ChatWizard will reply with an embed showing the score breakdown for that message.

Contributing

Contributions are welcome! Please feel free to submit a pull request for any bug fixes or new features you would like to add. Check the CONTRIBUTING.md for details!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatwizard-0.2.0.tar.gz (96.8 kB view details)

Uploaded Source

File details

Details for the file chatwizard-0.2.0.tar.gz.

File metadata

  • Download URL: chatwizard-0.2.0.tar.gz
  • Upload date:
  • Size: 96.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for chatwizard-0.2.0.tar.gz
Algorithm Hash digest
SHA256 51fbac3fe4d79152927a0ec5af539cf8a114a4f3081b3d1831c1d54d4681ccfa
MD5 9f469927e569533811fbb961177cf764
BLAKE2b-256 cd5214fe438ae9f3c22f459895052117cb764b23154142b25114dc4a99882670

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page