Skip to content

Lin-Rexter/AI_Hub_Discord-Bot

Repository files navigation

License: MIT Python: 3.9+

🤖AI-Hub-Discord-Bot🤖

Deploy your own multi-AI application Discord bot.

Demo

[English] [中文]

⚠️ | Coming soon: Code refactoring and improved command usage! (05/09/2023) | ⚠️


Features💡

Example🕹️

  • 🤖ChatGPT

/gpt
ChatGPT
  • 🤖Bing ChatGPT

/gpt4
Bing ChatGPT
  • 🎨Bing Image Creator

/img
Bing Image Creator

Commands🤖

[ChatGPT]:
	/gpt:
	   + <prompts [message]>
	   
	   + <api_key [OpenAI API Key]>
	   
	   + <model [System, User(Default), Assistant]>
	   
	   + <engine [gpt-3.5-turbo(Default), gpt-4, gpt-4-32k]> # GPT model
	   
	   + <top_p [0.0~1.0, https://platform.openai.com/docs/api-reference/chat/create#chat/create-top_p]>
	   
	   + <temperature [0.0~2.0, https://platform.openai.com/docs/api-reference/chat/create#chat/create-temperature]>
	   
	   + <presence_penalty [-2.0 ~ 2.0, https://platform.openai.com/docs/api-reference/completions/create#completions/create-presence_penalty]>
	   
	   + <frequency_penalty [-2.0 ~ 2.0, https://platform.openai.com/docs/api-reference/completions/create#completions/create-frequency_penalty]>
	   
	   + <reply_count [Defaults: 1, https://platform.openai.com/docs/api-reference/completions/create#completions/create-n]>
	   
	   + <rollback> [Rollback the conversation by n messages]
	   
	   + <reset> [Reset the conversation]
	   
	   + coming soon...

[Bing ChatGPT]:
	/gpt4:
	   + <prompts [message]>
	   
	   + <style [Creative, Balanced(Default), Precise]> # Conversation style

[Bard]:
	/bard:
	   + <prompts [message]>
	   
	   + <token [SESSION("__Secure-1PSID" cookie, https://github.com/acheong08/Bard#authentication)]>

[Bing Image Creator]:
	/img:
	   + <prompts [image description]>
	   
	   + <width> # Image width
	   
	   + <height> # Image height
	   
	   + <auth_cookies [_U cookie, https://github.com/acheong08/BingImageCreator#getting-authentication]>

[DALL·E]:
	/dall:
	   + <prompts [image description]>
	   
	   + <api_key [OpenAI API Key]>
	   
	   + <parameter [1~10, https://platform.openai.com/docs/api-reference/images/create#images/create-n]>
	   
	   + <size [256x256, 512x512, 1024x1024]>

[Command Description]:
	/help

More...

Supported languages🌎

  • Chinese
  • English (coming soon...)

How to create and deploy🚀

  • Deploy on Cloud

    Free Plan: $5.00 of usage each month with an execution time limit of 500 hours. 512MB of RAM, 2 vCPU and 1GB of Disk.

    Deploy on Railway

  • Local Deployment

    1. Clone this Repository

    git clone https://github.com/Lin-Rexter/AI_Hub_Discord-Bot.git

    2. Set Environment Variables

    2-1. Rename the file .env.example to .env

    2-2.

    ### "OPENAI_API_KEY", "AUTH_COOKIE", "BARD_TOKEN", "CHATGPT_MODEL", "RESPONSE_STYLE": The value returned from the command will be used first.
    
    # Discord:
    # Discord Bot token # https://discord.com/developers/applications
    DISCORD_TOKEN = ""
    # Discord Administrator ID(Administrator ID to mention when an unexpected error occurred in executing the command)
    DISCORD_ADMIN_ID = ""
    
    # ChatGPT(Official)、 DALL·E:
    # [ChatGPT,DALL·E authentication](OpenAI API key) # https://platform.openai.com/account/api-keys
    OPENAI_API_KEY = ""
    # Default ChatGPT_Model(gpt-3.5-turbo, gpt-4, gpt-4-32k)
    CHATGPT_MODEL = "gpt-3.5-turbo"
    
    # Bing Image Creator:
    # Bing Image Creator authentication(_U cookie) # https://github.com/acheong08/BingImageCreator#getting-authentication
    # If you use cookies.json(Step 3), you do not need to set
    AUTH_COOKIE = ""
    
    # Google Bard:
    # Google Bard authentication[SESSION("__Secure-1PSID" cookie)] # https://github.com/acheong08/Bard#authentication
    BARD_TOKEN = ""
    
    # Bing ChatGPT:
    # Default Bing ChatGPT response style(creative, balanced, precise)
    RESPONSE_STYLE = "balanced"
    # Bing ChatGPT authentication(Paste cookies: https://github.com/acheong08/EdgeGPT#getting-authentication-required)
    BING_CHAT_COOKIES = 

    3-1. Rename the file cookies.example.json to cookies.json

    3-2. Paste cookies into cookies.json

    3-1. Edit poetry config settings If you prefer to have the virtual environment in the project directory

    poetry config virtualenvs.in-project true

    3-2. Installs the dependencies specified in pyproject.toml

    poetry install

    3-3. Activating the virtual environment

    • Use default Python version
    poetry shell
    poetry env use 3.9

    3-4. Run Bot

    • If you use poetry shell
    python ./bot.py
    • If you not use poetry shell
    poetry run python ./bot.py

License

MIT