Simple setup, just define your variables in .env and you'll be done!
After cloning this repo onto your machine, follow these steps:
- Create a virtual environment
python -m venv .
- Install required packages
pip install -r requirements.txt
- Run get_character_ai_token.py and follow the instructions.
- Copy your token and paste it into your
.env
file
- Open Discord on your browser, make sure you're logged in.
- Open Developer tools by clicking F12 or right-clicking on the page and selecting "Inspect".
- Run this code in the console:
// From: https://stackoverflow.com/a/69868564/23834759 (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken()
- Copy your token then paste it into your
.env
file
- Visit old.character.ai and login. Go to your bot and copy the bot's ID from the url.
Example
Url: https://character.ai/chat/_20YpNNtOgwmdCTaCc-BrHvVdH09DimZDGWX62PyxJ8
Bot ID: _20YpNNtOgwmdCTaCc-BrHvVdH09DimZDGWX62PyxJ8 - Save the Bot ID in the
.env
file
- This is the final step
- Run main.py and wait for the bot to start!
Get your discord token, character AI token, and your character AI's bot id. Then put them all in a .env
file in the root directory.
DISCORD_TOKEN="<Your Discord Token>"
CHARACTER_AI_TOKEN="<Your C.AI token>"
CHARACTER_ID="<Character ID>"
There's some built-in custom commands that I've added, but you can remove them or even add your own
-!botset <Bot ID>
- Changes the current bot
-!refresh
- Refreshes configuration (whitelist)
- The bot is a python script, so you'll need to run it with python
- And plus, it's simple enough to understand the steps to run this
Self Discord Bot with CharacterAI by Harper Pomeranian is licensed under CC BY 4.0