New chat.send_message(), Async, Fixes
New Release! List of changes:
- Add user.get_history in async
- Fix
chat.new_chat() - New
chat.send_message() - New
chat.get_history() character.get_info()rename tocharacter.info()and rewritten- Add
character.search() - Add
user.recent() - Fix small bugs
More detailed
Fix chat.new_chat()
This function has been rewritten and now returns a json response, and also gets a response faster than the site (thanks to HearYourWaifu)
Add character.search()
Now you can search for characters
character.search('TEXT')
Add user.recent()
Now you can view the latest chats
user.recent()
Fix Async
in previous versions, the asynchronous code was not finalized, now it is fully working
import asyncio
from characterai import pyAsyncCAI
async def main():
client = pyAsyncCAI('TOKEN')
await client.start(headless=True)
while True:
message = input('You: ')
data = await client.chat.send_message('TOKEN', message, wait=True)
print(f"{data['src_char']['participant']['name']}: {data['replies'][0]['text']}")
asyncio.run(main())