Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Request #8

Open
Walkercito opened this issue Nov 25, 2023 · 3 comments
Open

Bad Request #8

Walkercito opened this issue Nov 25, 2023 · 3 comments

Comments

@Walkercito
Copy link

Walkercito commented Nov 25, 2023

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.

@Nipun1212
Copy link
Owner

hi I got exam going on I'll fix it after that, claude updated their api a while ago and hence it's causing the issues

@Walkercito
Copy link
Author

Thanks, and no worries man, we can wait 👾

@Walkercito
Copy link
Author

Nothing yet? :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants