Hello, I am a bot used for various meaningless tasks on the /r/Seattle discord server.
This is a hobbyist project and nobody should ever in their right mind take a dependency on any code or configurations found within.
If you find a bug or have an idea for an improvement or a new feature - please create an issue!
Pull requests will be reviewed but please, be gentle.
If you do (for whatever reason) decide to fork/clone/run this amazing bot on your own, there are a few different ways to do so.
Create a .vscode/launch.json configuration entry like so:
{
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch seabot",
"program": "${workspaceFolder}/src/server.ts",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
}
]
}New - webpack! Now you can pack the site for dev or production readiness.
- Clone the repo
npm ito install all dependent packagesnpm startto pack the thing up and kick it off, or separately:npm run pack:dev,npm run seabot
Seabot now runs inside a container, you can run docker build . to build the container image.
To build it, tag it, and launch it with a local .env file:
docker build -t seabot . && docker run --env-file .env seabot
*Currently the container contains node_modules so it's beefy rather than slim, but launches faster inside the web app (theoretically, as opposed to installing npm modules at first launch) so container health checks are happier.
In order for the bot to be useful, you'll need environment variables set to do various things. Create a file at the project root named .env and fill it with Key=value pairs.
There are a lot to customize, but you really only need botToken.
Feature-dependent variables:
weatherAPIKey: key for weather APIairQualityAPIKey: key for air quality APIcosmosHost: cosmos database hostcosmosAuthKey: cosmos auth key
Customization:
DAYS_WITHOUT_BACKGROUND: url / image link to override url fordays withoutimageDAYS_SINCE_MEME_TRIGGER_WORDS: words to trigger "days without saying" meme -Piss,etcTELEMETRY_DB_PATH: file path override for local telemetry DB path
Other:
seabotDEBUG: codebase standard debug flag - extra debug logging
Seabot also has a prod config file (and a dev version here) for server-specific channel / role IDs
and other various config. If you are debugging locally, change devConfig - because webpack:dev will write this to the output directory and use it.
Seabot uses two forms of databases.
cosmos db (azure hosted, free tier available) is only used for the /incident commands, Seabot should still work without it.
cosmosHost=https://your-db.documents.azure.com:443/
cosmosAuthKey=dIcKbUtTDiCkBuTtdIcKbUtT==
Seabot uses a local sqlite db for message telemetry (dashboards) and tracking funny words.
Customize which words with DAYS_SINCE_MEME_TRIGGER_WORDS, and customize the path of your DB with TELEMETRY_DB_PATH. Seabot uses a container-mounted storage blob in production, so it defaults to /mnt/telemetry/telemetry.db.
// Bot status from pipeline run (currently unused)
export const BOT_RELEASE_VERSION = process.env['botReleaseVersion'] || undefined;
export const BOT_RELEASE_REASON = process.env['botReleaseReason'] || undefined;
export const BOT_RELEASE_DESCRIPTION = process.env['botReleaseDescription'] || undefined;
export const BOT_RELEASE_COMMIT = process.env['botReleaseCommit'] || undefined;
// Valheim server password (currently unused)
export const access = process.env["valheim_server_password"];