This bot allows you to communicate with your character.ai bots inside a discord chat, making use of node_characterai.
Note
People have reported issues connecting their characters since recent Character.AI updates. There haven't been any direct fixes discovered yet.
Installing the correct packages can be done with the following npm command:
npm iTo be able to run this code locally your device will need to have Node.JS installed, which can be found here
Make sure to create a new file named config.json in the main file path of your project! Here you can store your bot token for the code to use.
{
"token": "Discord bot token",
"authToken": "C.ai Access token",
"defaultCharacter": "C.ai Character ID"
}The .gitignore file can be removed from your project folder.
This acccess token will be used to authenticate the requests used by the code.
- Go to https://character.ai/ in your browser.
- Open the developer tools. (
F12,Ctrl+Shift+I, orCmd+J) - Go to the
Applicationtab. - Go to
Storageand open thecookiesdropdown. - Inside this dropdown list open
https://character.ai - Find the
HTTP_AUTHORIZATIONentry and copy the value behind token.
This replaces the old chat ID value, but is still retrieved the same, simply navigate to your character and copy the value behind /chat/.

To run the code and make your Discord bot available run the following command in an intergrated terminal.
node index.jsFor support join the Ginger Productions Discord server.
