diff --git a/.env.example b/.env.example index 032cbe9..a443930 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,9 @@ +# These are needed no matter what DISCORD_TOKEN= -OWNER_ID= SAY_LOGS_CHANNEL= LOGS_CHANNEL= + +# These arent needed outside of production MAVEN_REPO= GITHUB_STATUS_CHANNEL= GITHUB_SECRET= diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fc20a6e..3cb9426 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,6 +2,7 @@ name: Docker on: push: + branches: [main] env: REGISTRY: ghcr.io diff --git a/src/commands/_commands.ts b/src/commands/_commands.ts index 4aeb494..20a1aa4 100644 --- a/src/commands/_commands.ts +++ b/src/commands/_commands.ts @@ -5,12 +5,10 @@ import { warnCommand } from './moderation/warn.command'; import { sayCommand } from './util/say.command'; import { tagCommand } from './util/tag.command'; -export const commands: Command[] = [ - sayCommand, - tagCommand, - warnCommand, - listWarningsCommand, - deleteWarningCommand, -]; +export const commands: Command[] = [sayCommand, tagCommand]; + +if (process.env.NODE_ENV !== 'development') { + commands.push(warnCommand, deleteWarningCommand, listWarningsCommand); +} export default commands; diff --git a/src/logIssueAnalyzers/createVersion.ts b/src/logIssueAnalyzers/createVersion.ts index 0d083f7..37ea24a 100644 --- a/src/logIssueAnalyzers/createVersion.ts +++ b/src/logIssueAnalyzers/createVersion.ts @@ -7,7 +7,7 @@ export const createVersionAnalyzer: Analyzer = async (log) => { const matchesCreate = log.mods ? log.mods.get('create') == '0.5.1.b' : log.content.match(/create-(.)+-0\.5\.1\.b/); - const matchesSNR = log.mods.get('railways')?.includes('1.5.0'); + const matchesSNR = log.mods.get('railways')?.match(/1\.5\.0/); // Return an issue if both mods are present and the versions match. if (matchesCreate && matchesSNR) { return { @@ -15,5 +15,17 @@ export const createVersionAnalyzer: Analyzer = async (log) => { value: "Create: Steam 'n' Rails `1.5.0` is incompatible with `Create 0.5.1b`. Upgrade to `Create 0.5.1c` or downgrade Steam 'n' Rails.", }; } + + const matchesCreate2 = log.mods + ? log.mods.get('create') == '0.5.1.c' + : log.content.match(/create-(.)+-0\.5\.1\.c/); + const matchesSNR2 = log.mods.get('railways')?.match(/1\.4\.3/); + // Return an issue if both mods are present and the versions match. + if (matchesCreate2 && matchesSNR2) { + return { + name: 'Version error', + value: "Create: Steam 'n' Rails `1.4.3` is incompatible with `Create 0.5.1c`. Upgrade Steam 'n' Rails to `1.5.0`.", + }; + } return null; }; diff --git a/src/types/environment.d.ts b/src/types/environment.d.ts index 7f3adf6..3100f81 100644 --- a/src/types/environment.d.ts +++ b/src/types/environment.d.ts @@ -4,7 +4,6 @@ declare global { namespace NodeJS { interface ProcessEnv { DISCORD_TOKEN: string; - OWNER_ID: string; SAY_LOGS_CHANNEL: string; LOGS_CHANNEL: string; MAVEN_REPO: string; @@ -15,7 +14,7 @@ declare global { FAIL_EMOJI: string; WEBSERVER_PORT: string; DATABASE_URL: string; - NODE_ENV: 'development' | 'production'; + NODE_ENV: 'development' | 'dev-prod' | 'production'; } } } diff --git a/src/webserver.ts b/src/webserver.ts index 41f3396..b0a3ecc 100644 --- a/src/webserver.ts +++ b/src/webserver.ts @@ -14,6 +14,6 @@ app.post('/github-webhook', function (req, res) { handleWebhook(client, req, res); }); -const port = process.env.WEBSERVER_PORT; +const port = process.env.WEBSERVER_PORT || 3000; app.listen(port); console.log(`Webserver is running on port: ${port}`);