peacecwz / chatgpt-telegram

Run your own GPTChat Telegram bot, with a single command!
MIT License
1 stars 1 forks source link

LoadSessionFromCookie try get filepath to cookies.json from chtagpt.json instead .env #1

Open permblackshark opened 1 year ago

permblackshark commented 1 year ago

func (cfg *Config) LoadSessionFromCookie() error {
filePath := cfg.v.GetString("COOKIE_FILE")

cfg - is chatgpt.json

so, i mod main.go, config.go and env_config.go

peacecwz commented 1 year ago

Hi, @permblackshark I pushed a new code. I removed reading old configs. If you tried the old version and after that when you tried it. I could not work. I removed the reading old config.

  1. Clone or pull the latest commits
  2. Login to ChatGPT with your account in Chrome Browser
  3. Export cookies with Chrome Extension
  4. Put cookies.json file into project root directory
  5. Add COOKIE_FILE=cookies.json into .env file

That's it 🎉 I hope It will be work

BrellBrell commented 1 year ago

Hi, @permblackshark I pushed a new code. I removed reading old configs. If you tried the old version and after that when you tried it. I could not work. I removed the reading old config.

  1. Clone or pull the latest commits
  2. Login to ChatGPT with your account in Chrome Browser
  3. Export cookies with Chrome Extension
  4. Put cookies.json file into project root directory
  5. Add COOKIE_FILE=cookies.json into .env file

That's it 🎉 I hope It will be work

I'm using your project, but I still get an error in the bot Error: Couldn't get access token: failed to decode response: invalid character '<' looking for beginning of value

permblackshark commented 1 year ago

@BrellBrell Hi I think it's cloudflare guard. app can't get token because get 403 code from cloudflare. Probably need workaround with JA3 fingeprint like https://github.com/Danny-Dasilva/CycleTLS