Skip to content

This a very basic discord bot linking to GPT3 (openai and AI21). By defaults it is Kirby, but can be any real or virtual bot (just need more or less training prompt).

Notifications You must be signed in to change notification settings

AlexisTM/gpt3-discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI Discord bot

NOTE: More features are available in the Rust version: https://github.com/AlexisTM/discord-god-rust

This is an OpenAI discord bot replying as Kirby.

Environment keys:

  • OPENAI_KEY
  • AI21_API_KEY
  • DISCORD_BOT_TOKEN

Come and test on Discord!: https://discord.gg/Y8XPcj2Q

Commands

  • Kirby are you there?: Replies yes if the server runs
  • Kirby enable: Allow Kirby god to randomly jump into conversations (15% chance of reply)
    • Kirby disable: Disable the Kirby mode of the channel
  • Kirby god: : Answers as a Kirby god.
    • Remembers the 5 last prompts & answers
    • Clean the memory with Kirby clean
  • Marv: => Answers as a chatbot that reluctantly answers questions. Not maintained ;)

Installation

git clone https://github.com/AlexisTM/gpt3-discord-bot

cd gpt3-discord-bot
python3 -m pip install -r requirements.txt --user

export DISCORD_BOTOKEN="sometoken" 
export OPENAI_KEY="someothertoken"
export AI21_API_KEY="yetanothertoken"

python3 main.py

Notes:

  • You can directly speak to the bot for a direct chat to Kirby
  • The 5 message memory is over the same channel. I will eventually add the user name in the memory for more coherence.
  • AI21 is free with enough fun for a day, but is much less smart than OpenAI's version in my biased opinion.

Wow, Kirby is so funny

Technical help on how to make a Discord bot:

Create a bot application: https://discordpy.readthedocs.io/en/stable/discord.html

Configure intents for your bot: https://discordpy.readthedocs.io/en/stable/intents.html

In the oauth section of discord dev portal, make a link to allow your bot to join your server such as:

https://discord.com/api/oauth2/authorize?client_id=APPID&permissions=2215115840&scope=bot

In this case, we only need the bot scope and READ/WRITE messages permissions/

About

This a very basic discord bot linking to GPT3 (openai and AI21). By defaults it is Kirby, but can be any real or virtual bot (just need more or less training prompt).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages