The library is no longer working, at least not to me. Correct me if I'm wrong.
I've created a ChatBot for my and a group of closer friends, but a few days back it suddenly stopped working prompting this error: 400 Bad Request (error code: 50006): Cannot send an empty message. It is a Discord bot, so I'm going to leave here the code that was working until a few days as I mentioned.
class GenerateResponse(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.cookie = settings.COOKIE
self.claude = Claude(self.cookie)
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
if message.author == self.bot.user:
return
if "claude" in message.content.lower():
prompt = message.content
async with message.channel.typing():
try:
response = self.generate_response(prompt)
await message.channel.send(response)
except Exception as e:
await message.channel.send(f"Ocurrió un error al generar la respuesta: {e}")
def generate_response(self, prompt):
try:
response = self.claude.get_answer(prompt)
return response
except Exception as e:
return f"Ocurrió un error: {e}"
@commands.command()
async def new(self, ctx):
self.claude.create_new_conversation()
await ctx.send('Listo')
async def setup(bot):
await bot.add_cog(GenerateResponse(bot))
This is the Cog Class that is called when a new response is generated. After this, I tried the example code to see if it was a problem of mine and it print nothing but an empty line, and also in the Claude Chat no message is send.
The library is no longer working, at least not to me. Correct me if I'm wrong.
I've created a ChatBot for my and a group of closer friends, but a few days back it suddenly stopped working prompting this error:
400 Bad Request (error code: 50006): Cannot send an empty message
. It is a Discord bot, so I'm going to leave here the code that was working until a few days as I mentioned.This is the Cog Class that is called when a new response is generated. After this, I tried the example code to see if it was a problem of mine and it print nothing but an empty line, and also in the Claude Chat no message is send.