#Connecting to localhost with my discord Bot

1 messages · Page 1 of 1 (latest)

brisk eagle
#

Hi guys, I made a small Discord Bot with node.js, it is connecting to my channel. With /mind it should interact with the invokeAPI (localhost:9090) but it gives me some errors. I would share the code, just to ge tit done, its about 60 code lines yet. I could not find anything helpful in the documentation, but I might missed it.

graceful girder
#

What errors you getting?

brisk eagle
#

its a very long error message, lets see if I can partially copy it

#

PS D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main> npm start

[email protected] start
node index.js

Logged in as Arty#7655!
Arty is connected to http://127.0.0.1:9090/images/generate
Error: Request failed with status code 405
at createError (D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main\node_modules\axios\lib\core\createError.js:16:15)
at settle (D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main\node_modules\axios\lib\adapters\http.js:293:11)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [Function: httpAdapter],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: {
Accept: 'application/json, text/plain, /',
'Content-Type': 'application/json',
'User-Agent': 'axios/0.24.0',
'Content-Length': 33
},
method: 'post',
url: 'http://127.0.0.1:9090/images/generate',
data: '{"text":"a house","format":"png"}'
},

#

all in all, it says methood not allowed, I am calling it with post, its sending a message from my channel to the invokeAPI, thats where it is failing

zealous temple
#

I guess you are using the old legacy http server?

brisk eagle
#

I dont know, using the newest InvokeAI, its all working with ausbitbanks bot, just my own code fails. I need to know about the endpoints and with what commands invokeAI API works...could not find it yet

zealous temple
#

Oh, yeah there’s no http api with the current web server and no documentation. It’s only intended for the web ui. We are migrating to a documented api soon. Until then the web server is not supported for external consumption. You need to check with @compact harbor for how to use it or review the web server code. It’s all socket.io

brisk eagle
#

allright, thanks for youre answer, so I was at least researching into the correct thing, I discovered that his .js opens up a websocket connection but was not able to integrate it into my simple 50 code line bot. Is there any API I can use? how about the dev cli mode or just the simple codeline?

zealous temple
zealous temple
brisk eagle
#

ah allright, maybe I wait with it, or I get to work, already working on it with socket.io, as I do not just want to copy the code from ausbit its a bit more complicated for me to solve it...:D

zealous temple
brisk eagle
#

I mean, its no problem for me not having an API right now, testing it with the socket. Alternatively I would have to write my own core version of what invoke is, soooo, I am very happy you guys doing it 😄 😄

zealous temple
#

Haha yeah it’s a LOT of work.

#

And we are thrilled when people use it 🙂