Error with discord bot using go and python
I am new to asking questions in a place like this, so please forgive me if there are any problems
I have created a discord bot that uses Go as its main language and responds with openai api(python). When I run it, I get an error that python3 not found (I modified the code to say "python" and get the same error). How can this be resolved?
[error message]
Command failed: exit status 127, Stderr: /bin/sh: 1: python3: not found
Solution:Jump to solution
this is the golang package I've used for a chatgpt telegram bot
https://github.com/ayush6624/go-chatgpt...
37 Replies
Project ID:
N/A
N/A
Add python to a nixpacks.toml as a provider https://nixpacks.com/docs/configuration/file
Configuration File Reference | Nixpacks
App source + Nix packages + Docker = Image
also golang has a good openapi package
Thank you for your reply.
Create a file called "nixpacks.toml",
providers = ['...' , 'python']
I tried typing it in, but I still get the same error
What directory is the file in?
Please share your repo if possible
Oh, really? Then maybe it is better that way. I'm trying to replace the bot I've been creating all in python with go...
that's very admirable
It's a private repository, but it's not open to the public, so it's fine if you want to show it to others. I don't know how to do this
hehe(???)
adding python to the providers wouldn't work, nixpacks runs your go app in a slim image that only copy's over the contents of the repo, leaving out python
Ah didn't know that. This error in js is fixed with the nixpacks file
golang's provider is special
I trust Brody on the Go side, if they say that Go works for the bot then Go works
and as aleks has told me before, you'd actually wanna add python(38/310/311) as a nixPkgs instead of a provider
we can get it to stop running your go app in a slim image if youd like to use python for the time being roko?
To be honest, I was motivated to try a statically typed language because I often fell down with python, and I would be happy if I could think in the direction of eradicating python in my programs if possible (is this the answer?)
hell yeah I love to hear that
By the way, I tried to install python in a dockerfile earlier and it looked like I could do it, so can I do it in that direction? I thought so, but I didn't understand the specification of dockerfile, so I was dreary(?)
you totally could do that, but I recommend sticking with nixpacks unless you have a decent reason to not want to use it
Well, but I'll go in this direction for now
"golang has a good openapi package"
ok, thanks
also you can return more than one value from a go function, so you'd want to have the return type of the function be
(string, error)
so when there's an error you can do a return "", err
Oh, I knew it.
Today is actually the first time I've touched golang, and I'm writing code while talking to chatgpt. But I had a sneaking suspicion that I could do something like you talk about while writing lol
I assume the python script is talking to chatgpt right?
yes, I am building a bot using openai api, talking to the web version of chatgpt
Solution
this is the golang package I've used for a chatgpt telegram bot
https://github.com/ayush6624/go-chatgpt
you might be
I just really like go 🙂
I"ll try this for now. Thanks a lot. I'll close this thread
no need to close
I will just simply mark as solved
You can also do this with python
Multiple returns are returned as a tuple which you can access the same way
I won't stand for this python slander
haha I didn't say you can't do it with python, I only said that because the go function they showed was a single return value
<:ross_gun:786867306192961576>
python is king, he says nervously
The package was successfully completed using the previously mentioned package! Thank you so much
no problem!
I personally just have a piece of junk brain that makes more mistakes with dynamic typing... sorry if I offended you
no worries you didnt say anything bad at all, im the same way, i work better with go then i would python or javascript