GPTDiscord: [BUG] Unable to set ALLOWED_GUILDS

Describe the bug I added the new params to env and hit:

cooper@us:~$ docker run --name gpt3discord -v /containers/gpt3discord/env:/bin/.env -v /containers/gpt3discord/data:/data gpt3discord:latest
Traceback (most recent call last):
  File "/bin/gpt3discord", line 10, in <module>
    from cogs.draw_image_generation import DrawDallEService
  File "/usr/local/lib/python3.9/site-packages/cogs/draw_image_generation.py", line 18, in <module>
    ALLOWED_GUILDS = EnvService.get_allowed_guilds()
  File "/usr/local/lib/python3.9/site-packages/models/env_service_model.py", line 23, in get_allowed_guilds
    raise ValueError(
ValueError: ALLOWED_GUILDS is not defined properly in the environment file!Please copy your server's guild ID and put it into ALLOWED_GUILDS in the .env file.For example a line should look like: `ALLOWED_GUILDS="971268468148166697"`f

My env:

cooper@us:~/repos/GPT3Discord$ cat /containers/gpt3discord/env
DATA_DIR="/data"

OPENAI_TOKEN="NO"

DISCORD_TOKEN="NONO"

ALLOWED_GUILDS="811050810460078100"
ALLOWED_ROLES="Admin,gpt"
DEBUG_GUILD="811050810460078100"
DEBUG_CHANNEL="1058174617287663689"

To Reproduce Run from trunk with my config

Expected behavior Start and download the files …

Close away if you’re working on this. I found this trying to move to latest published docker containers via ansible.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 53 (31 by maintainers)

Most upvoted comments

It should be fixed properly after #53 is merged, there’s another current bug not related to this for /gpt converse, remove self.awaiting_thread_responses.remove(thread.id) on line 1207 of gpt_3_commands_and_converser.py it’s an older bug that snuck it’s way in again with the recent permanent memory release @MX10-AC2N Permissions can also just be needing to reduce it to 1 role due to how messy the env parsing of docker is when removing quotes or remove the whole role lines to let anyone use it

#53 has been merged and the bug with awaiting thread responses was also fixed, the docker instructions have been updated, big thanks to @justinmcp and @Hikari-Haru and @cooperlees for this

While a little hacky, I had it working just fine with passing --env-file to docker and removing quotes from the .env file on the current main branch. So can’t notice any other docker specific regressions other than opener files not being able to be opened from the shared data directory. So it looked a little something like docker run -d --name gpt3discord --env-file ./.env -v /home/bots/discord_bots/GPT3Discord/docker/:/data gpt3discord docker parses env files in a weird way so I had to remove the quotes just to test

image

This is how I ran it locally on windows, and this is what my .env file looks like:

DISCORD_TOKEN="MTAVH5OybnQgbiLu-gKt4"
OPENAI_TOKEN="sk-cobNReT"
DEBUG_GUILD="971268468148166697"
DEBUG_CHANNEL="971269959596515378"
ALLOWED_GUILDS = "971268468148166697"
ADMIN_ROLES="Admin"
MODERATIONS_ALERT_CHANNEL="971269959596515378"
PINECONE_TOKEN=""