Skip to content

Commit

Permalink
docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
ProducerMatt committed Sep 20, 2023
1 parent a3f968e commit 0a6c339
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ Not required:
- `BOT_DEV_IDS`: list of user ids of bot devs. You may want to include `BOT_VIP_IDS` here.
- `BOT_CONTROL_CHANNEL_IDS`: list of channels where control commands are accepted.
- `BOT_PRIVATE_CHANNEL_ID`: single channel where private Stampy status updates are sent
- `BOT_ERROR_CHANNEL_ID`: (defaults to private channel) low level error tracebacks from Python. with this variable they can be shunted to a seperate channel.
- `CODA_API_TOKEN`: token to access Coda. Without it, modules `Questions` and `QuestionSetter` will not be available and `StampyControls` will have limited functionality.
- `BOT_REBOOT`: how Stampy reboots himself. Unset, he only quits, expecting an external `while true` loop (like in `runstampy`/Dockerfile). Set to `exec` he will try to relaunch himself from his own CLI arguments.
- `STOP_ON_ERROR`: Dockerfile/`runstampy` only, unset `BOT_REBOOT` only. If defined, will only restart Stampy when he gets told to reboot, returning exit code 42. Any other exit code will cause the script to just stop.
- `BE_SHY`: Stamp won't respond when the message isn't specifically to him.
- `BE_SHY`: Stamp never responds when the message isn't specifically to him.
- `CHANNEL_WHITELIST`: channels Stampy is allowed to respond to messages in
- `IS_ROB_SERVER`: If defined, Rob Miles server-specific stuff is enabled. Servers other than Rob Miles Discord Server and Stampy Test Server should not enable it, Otherwise some errors are likely to occur.
- `IS_ROB_SERVER`: If defined, Rob Miles server-specific stuff is enabled. This is a convenience option for the Rob Miles sysadmins. Servers other than Rob Miles Discord Server and Stampy Test Server should not enable it, otherwise your custom config won't be read.

Specific modules (excluding LLM stuff):

Expand All @@ -93,6 +94,7 @@ LLM stuff:
- `GPT4_WHITELIST_ROLE_IDS`: if the above is unset, Stampy responds with GPT4 only for users with these roles.
- `USE_HELICONE`: if set, GPT prompts call the helicone API rather than OpenAI.
- `LLM_PROMPT`: What prompt is the language model being fed? This describes the personality and behavior of the bot.
- `DISABLE_PROMPT_MODERATION`: don't check safety of prompts for LLM

## Docker

Expand Down
27 changes: 4 additions & 23 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,30 +126,21 @@ def getenv_unique_set(var_name: str, default: T = frozenset()) -> Union[frozense
else:
enabled_modules = enabled_modules_var

# user-configured from dotenv
# SEE README: ENVIRONMENT VARIABLES
discord_guild: str
# Factoid.py
factoid_database_path: str
# VIPs have full access + special permissions
bot_vip_ids: frozenset
# devs have less but can do maintainence like reboot
bot_dev_roles: frozenset
bot_dev_ids: frozenset
# control channel is where maintainence commands are issued
bot_control_channel_ids: frozenset
# private channel is where stampy logging gets printed
bot_private_channel_id: str
# NOTE: Rob's invite/member management functions, not ported yet
bot_error_channel_id: str
member_role_id: Optional[str]
# bot_reboot is how stampy reboots himself
valid_bot_reboot_options = Literal["exec", False]
bot_reboot: valid_bot_reboot_options
# GPT STUFF
paid_service_all_channels: bool
# if above is false, where can paid services be used?
paid_service_channel_ids: frozenset
paid_service_for_all: bool
# if above is false, who gets to use paid services?
paid_service_whitelist_role_ids: frozenset
gpt4: bool
gpt4_for_all: bool
Expand All @@ -158,7 +149,6 @@ def getenv_unique_set(var_name: str, default: T = frozenset()) -> Union[frozense
llm_prompt: str
be_shy: bool
channel_whitelist: Optional[frozenset[str]]
bot_error_channel_id: str
disable_prompt_moderation: bool

is_rob_server = getenv_bool("IS_ROB_SERVER")
Expand Down Expand Up @@ -223,33 +213,25 @@ def getenv_unique_set(var_name: str, default: T = frozenset()) -> Union[frozense
}[ENVIRONMENT_TYPE]
disable_prompt_moderation = False
else:
# user-configured from dotenv
# SEE README: ENVIRONMENT VARIABLES
discord_guild = getenv("DISCORD_GUILD")
# Factoid.py
factoid_database_path = getenv(
"FACTOID_DATABASE_PATH", default="./database/Factoids.db"
)
# VIPs have full access + special permissions
bot_vip_ids = getenv_unique_set("BOT_VIP_IDS", frozenset())
# devs have less but can do maintainence like reboot
bot_dev_roles = getenv_unique_set("BOT_DEV_ROLES", frozenset())
bot_dev_ids = getenv_unique_set("BOT_DEV_IDS", frozenset())
# control channel is where maintainence commands are issued
bot_control_channel_ids = getenv_unique_set("BOT_CONTROL_CHANNEL_IDS", frozenset())
# private channel is where stampy logging gets printed
bot_private_channel_id = getenv("BOT_PRIVATE_CHANNEL_ID")
bot_error_channel_id = getenv("BOT_ERROR_CHANNEL_ID", bot_private_channel_id)
# NOTE: Rob's invite/member management functions, not ported yet
member_role_id = getenv("MEMBER_ROLE_ID", default=None)
# bot_reboot is how stampy reboots himself
bot_reboot = cast(valid_bot_reboot_options, getenv("BOT_REBOOT", default=False))
# GPT STUFF
paid_service_all_channels = getenv_bool("PAID_SERVICE_ALL_CHANNELS")
# if above is false, where can paid services be used?
paid_service_channel_ids = getenv_unique_set(
"PAID_SERVICE_CHANNEL_IDS", frozenset()
)
paid_service_for_all = getenv_bool("PAID_SERVICE_FOR_ALL")
# if above is false, who gets to use paid services?
paid_service_whitelist_role_ids = getenv_unique_set(
"PAID_SERVICE_ROLE_IDS", frozenset()
)
Expand All @@ -260,7 +242,6 @@ def getenv_unique_set(var_name: str, default: T = frozenset()) -> Union[frozense
llm_prompt = getenv("LLM_PROMPT", default=stampy_default_prompt)
be_shy = getenv_bool("BE_SHY")
channel_whitelist = getenv_unique_set("CHANNEL_WHITELIST", None)
bot_error_channel_id = getenv("BOT_ERROR_CHANNEL_ID", bot_private_channel_id)
disable_prompt_moderation = getenv_bool("DISABLE_PROMPT_MODERATION")

discord_token: str = getenv("DISCORD_TOKEN")
Expand Down

0 comments on commit 0a6c339

Please sign in to comment.