Wildric-Auric / MidJourney-Wrapper

MidJourney wrapper in Discord.
Creative Commons Zero v1.0 Universal
696 stars 149 forks source link

discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed #14

Closed vst212 closed 1 year ago

vst212 commented 1 year ago

C:\Users\Administrator\Desktop\MidJourney-Wrapper-main>python main.py Ignoring exception in on_connect Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 352, in _run_event await coro(*args, **kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 793, in on_connect await self.register_commands() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 460, in register_commands await self.http.bulk_upsert_command_permissions( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 338, in request raise HTTPException(response, data) discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed

do you know any reason that he error 405 in program first one. error 401 when prompt submitted image

polm15 commented 1 year ago

Try Updating Py-cord it solved the issue for me , still getting "Request has failed; please try later" tho

vst212 commented 1 year ago

Try Updating Py-cord it solved the issue for me , still getting "Request has failed; please try later" tho

thx, fixed for that, how if you faced error 401 unauthorized? But I am so sure that the API key is correct.

Wildric-Auric commented 1 year ago

@vst212 try debugging more, we don't have enough info

Shawn-yzXiao commented 1 year ago

I got this error as well, did you find any solution for that? I believe my py-cord version is up-to-date 2.0.0 ### discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed

Wildric-Auric commented 1 year ago

I tried the bot today, and it seems that can't reproduce the error, everything works fine for me.

hassan-suriya commented 1 year ago

It should me this error. I uninstalled py-cord:

pip uninstall py-cord

and installed it again:

pip install py-cord

BoredMind commented 1 year ago

I am also seeing this issue. Spawning from https://github.com/Wildric-Auric/MidJourney-Wrapper/issues/15

I thought it was my environment, so I used a completely fresh VM of Ubuntu 22.10 and still get the Method not allowed error and Request has failed; please try later whenever I try to invoke the /mj_imagine command

Wildric-Auric commented 1 year ago

I just used WSL to launch the bot and it worked; does the command /Hello work for you?

BoredMind commented 1 year ago

/hello hello

Returns hello into the chat.

rikuddo91 commented 1 year ago

I just tested Windows 10, as well as Raspberry Pi, and Linux Debian. It worked on Windows for one time, but now getting Request has failed; please try later

Same error on Linux and Pi too.

krixoko commented 1 year ago

I am getting 400 error

krixoko commented 1 year ago

I am getting 400 error

after new release , everything ok now

BoredMind commented 1 year ago

I no longer get any errors when the bot starts but now get this error when I do any /mj_imagine prompt:

python3 main.py
Logged in as Bot ####
Ignoring exception in command mj_imagine:
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.10/site-packages/discord/commands/core.py", line 124, in wrapped
    ret = await coro(arg)
  File "/home/pi/.local/lib/python3.10/site-packages/discord/commands/core.py", line 982, in _invoke
    await self.callback(ctx, **kwargs)
  File "/home/pi/MidJourney-Wrapper/main.py", line 27, in mj_imagine
    print(response.txt)
AttributeError: 'Response' object has no attribute 'txt'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.10/site-packages/discord/bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "/home/pi/.local/lib/python3.10/site-packages/discord/commands/core.py", line 375, in invoke
    await injected(ctx)
  File "/home/pi/.local/lib/python3.10/site-packages/discord/commands/core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'Response' object has no attribute 'txt'
Wildric-Auric commented 1 year ago

@BoredMind Well, it's reponse.text not response.txt...

BoredMind commented 1 year ago

It's in the main.py in the repo:

https://github.com/Wildric-Auric/MidJourney-Wrapper/blob/a19c75f071bc27e1b9f6bf5688ae951bfeec27a3/main.py#L27