Closed sushipro-314 closed 1 year ago
Oh btw I did await inside a function
Didn't you read the docs? You have to use the .start()
function, here:
from characterai import PyAsyncCAI
caiToken = "YOUR_TOKEN"
cclient = PyAsyncCAI(caiToken)
cclient.start()
print(f"{char}: {msg}")
data = await cclient.chat.send_message(char, msg)
ok thank you! sorry i'm somewhat knew to python so i was confused. i'll try it tomorrow when i'm at my computer.
Ok i tested it, it still says the same error, whether I add the cclient.start() or not.
That shouldn't happen, try adding page = None
at the top of the PyAsyncCAI file
It gives me a different error when I add the code page = None
to the file.
AttributeError: 'NoneType' object has no attribute 'goto'
Try re-installing the library, use pip uninstall characterai
and then pip install characterai
File MYDIRECTORY/venv\lib\site-packages\characterai\pyasynccai.py", line 16, in goto await page.goto(f'https://beta.character.ai/{link}') NameError: name 'page' is not defined
This is the error when I try sending a message to the api with my code below: (not all of the code is shown below because of the other project i'm working on, a discord bot)
from characterai import PyAsyncCAI
caiToken = "CENSORED"
cclient = PyAsyncCAI(caiToken) print(f"{char}: {msg}") data = await cclient.chat.send_message(char, msg)