CharacterAI
CharacterAI copied to clipboard
How to continue to chat with a specific character?
This is my code:
from characterai import aiocai
import asyncio
from datetime import datetime
async def main():
char = input('CHAR ID: ')
client = aiocai.Client('a9ec003a613b2c639b415062701827c1fd2d2d24')
me = await client.get_me()
async with await client.connect() as chat:
new, answer = await chat.new_chat(
char, me.id
)
print(f'{answer.name}: {answer.text}')
while True:
text = input('YOU: ')
message = await chat.send_message(
char, new.chat_id, text
)
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f'{[{now}]}-{message.name}: {message.text}')
asyncio.run(main())
How to continue to chat with a specific character? The current codes cannot continue to chat, always from the scratch.