Skip to content

TheSoftDiamond/Kazushin

 
 

Repository files navigation

Forks Stargazers Issues


Logo

Kazushin

Kazushin, a fork of this project, is a Twitch Chat Bot that reads chat and generates text-to-speech responses using OpenAI API and Google Cloud API. It comes with profanity detection, and more built-in.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. Getting Started
  2. Usage
  3. Roadmap
  4. Contributing
  5. License
  6. Acknowledgments

Getting Started

Prerequisites

In order to install the prerequisites, you will need to run the following command in a command line:

  • pip
    pip install -r requirements.txt

Installation

  1. Clone the repo or fork it
    git clone https://github.com/TheSoftDiamond/Kazushin.git
  2. Grab an OpenAI API key from OpenAPIKey, and Twitch Token from TwitchApps
    2a. Strip the oauth: from the Twitch Token
  3. Create a Google Cloud Project with TTS Service enabled and download the JSON credentials file andd add it to root folder. See here for more info.
  4. Enter API Keys in creds.py:
# You're Twitch Token 
TWITCH_TOKEN = ""
# Your TWITCH Channel Name
TWITCH_CHANNEL = ""
# Your OpenAI API Key
OPENAI_API_KEY = ""
# Your Google Cloud JSON Path
GOOGLE_JSON_PATH = ""
# Your TWITCH BOT CHANNEL Token (Copy TWITCH_TOKEN if same channel as TWITCH_CHANNEL)
BOT_ACCOUNT_TWITCH_OAUTH = ""
# Your TWITCH BOT CHANNEL Name - This is the channel that will post messages to chat
BOT_ACCOUNT_TWITCH_CHANNEL = ""
# The channel to send the bot's messages to this channel
SENDMESSAGE_TO_THIS_CHANNEL = ""
  1. In settings.py, change the bot name and more settings:
import sys #Do not remove this line

##### AI SPECIFIC Settings #####

# AI's Name 
AINAME = 'AINAME'
# Conversation History
CONVERSATION_LIMIT = 10

### TTS SETTING ###
#For more info on this section, see https://cloud.google.com/text-to-speech/docs/voices

#Language Code
languageCode = "en-US"
#Name of Voice Model 
voiceName = "en-US-Polyglot-1"
#Gender (Accepts MALE/FEMALE)
ssmlGender = "MALE"

##### REDEEM DETECTION SETTINGS #####

# Should the bot listen for a specific redeem?
doRedeem = True
# Redeem ID
redeemID = ''

##### BITS DETECTION SETTINGS #####

# Should the bot listen for bits donations?
doBits = True
# Lower Bits Detection Number 
bitsLookAtLowNumber = 100
# Higher Bits Detection Number
bitsLookAtHighNumber = sys.maxsize
#Cooldown Timer in seconds
cooldownBits = 120
#Log to Twitch Chat?
bitsMessageLogChat = True

##### MESSAGE DETECTION SETTINGS #####

# Should we listen in for raw messages with the prefix?
doRawMessages = False
# AI NAME to Detect
detectMSGName = 'AINAME'
# Prefix
prefix = '!'
#Cooldown Timer in seconds
cooldownMsg = 120
#Log to Twitch Chat?
rawMessageLogChat = True

##### MESSAGE SPECIFIC SETTINGS #####

# Should the bot send messages to chat?
PostMSGtoChat = True
# Should block list be on?
blockList = False
# Profanity Filter Check
doProfanityCheck = True
# Minimum message length of message to AI to get a response (not related to message detection events)
globalminimumLength = 3
# Max Message Length (200-500), but would recommend leaving it at 500
globalmaximumLength = 500

(back to top)

Features

  • Separate conversations per user.
  • Coversation History (last 10 messages. for every user). Can be changed.
  • Profanity Filter (Can be turned on and off)
  • Detect Cheers. Customizable in amounts
  • Listens for messages from chat
  • Post the bot's messages in chat. (Can be turned on and off)
  • Prevent certain users from interacting with bot (use blocklist.py) - Since Version 1.0.5

Usage

After finishing installing Kazunshin, you will most likely want to do some post-installation setup. Then after that, you can run the main_usercontext.py file.

(back to top)

Roadmap

  • Make the python bot have user prompt context on a per person basis.
    • Would require the user to create a file called prompt_chat_USERNAME.txt, otherwise uses default prompt if the file doesn't exist. As to prevent potential hundreds of files from being created if this feature was added..
  • Ability to block a list of users from interacting with the bot in chat.

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License.

(back to top)

Acknowledgments

(back to top)