diff --git a/bot/.editorconfig b/bot/.editorconfig index aa4d75544..bab41260b 100644 --- a/bot/.editorconfig +++ b/bot/.editorconfig @@ -2,8 +2,6 @@ root = true [*] insert_final_newline = true - -[*.{ts,test.ts}] charset = utf-8 indent_style = tab indent_size = 4 diff --git a/bot/.eslintrc b/bot/.eslintrc index 5cf2f5660..88741e04c 100644 --- a/bot/.eslintrc +++ b/bot/.eslintrc @@ -63,6 +63,12 @@ "argsIgnorePattern": "logger" } ], + "@typescript-eslint/consistent-type-assertions": [ + "error", + { + "assertionStyle": "as" + } + ], // breaks with baseUrl "import/no-unresolved": "off", "require-await": "warn", diff --git a/bot/.gitignore b/bot/.gitignore index a7a0cfbba..d9693c77f 100644 --- a/bot/.gitignore +++ b/bot/.gitignore @@ -2,6 +2,16 @@ node_modules .idea .vscode yarn-error.log +.pnpm-debug.log .env +js + conf.json5 -js \ No newline at end of file +*.conf.json5 + +!example/conf.json5 + +# Weird Redis Dumps +*.rdb + +logs \ No newline at end of file diff --git a/bot/example/conf.json5 b/bot/example/conf.json5 new file mode 100644 index 000000000..ee38eee6c --- /dev/null +++ b/bot/example/conf.json5 @@ -0,0 +1,25 @@ +// This is an example conf.json5 file, which shows how you should control +// this bot. + +{ + TACHI_SERVER_LOCATION: "https://tachi.example.com", + HTTP_SERVER: { + URL: "https://tachi-bot.example.com", + PORT: 8000, + }, + OAUTH: { + CLIENT_SECRET: "CSfoobar", + CLIENT_ID: "CIfoobar", + }, + DISCORD: { + TOKEN: "foobar", + SERVER_ID: "123123123", + GAME_CHANNELS: { + bms: "1234", + usc: "1235", + // ... add more incase needed. + }, + // A list of user IDs for users who should be allowed to do more stuff. + ADMIN_USERS: [], + }, +} diff --git a/bot/example/example.env b/bot/example/example.env new file mode 100644 index 000000000..c7c7311d9 --- /dev/null +++ b/bot/example/example.env @@ -0,0 +1,2 @@ +MONGO_URL="127.0.0.1:27017/tachi_bot_db" +NODE_ENV="dev" \ No newline at end of file diff --git a/bot/package.json b/bot/package.json index b62774260..412a73ad8 100644 --- a/bot/package.json +++ b/bot/package.json @@ -1,44 +1,48 @@ -{ - "name": "tachi-bot", - "version": "1.0.0", - "main": "src/index.ts", - "license": "MIT", - "scripts": { - "start": "ts-node -r dotenv/config src/index.ts", - "setup": "./scripts/createEnv.sh", - "lint": "eslint . --fix" - }, - "devDependencies": { - "@types/express": "4.17.13", - "@types/express-serve-static-core": "4.17.24", - "@types/jest": "27.0.1", - "@types/json5": "2.2.0", - "@types/lodash": "4.14.172", - "@types/node": "16.7.10", - "@typescript-eslint/eslint-plugin": "5.10.2", - "@typescript-eslint/parser": "5.10.2", - "discord-api-types": "0.22.0", - "eslint": "8.8.0", - "eslint-config-prettier": "8.3.0", - "eslint-plugin-import": "2.25.4", - "eslint-plugin-prettier": "4.0.0", - "jest": "27.0.6", - "prettier": "2.6.0", - "typescript": "4.3.5" - }, - "dependencies": { - "@discordjs/builders": "0.5.0", - "@discordjs/rest": "0.1.0-canary.0", - "axios": "0.21.4", - "discord.js": "13.1.0", - "dotenv": "10.0.0", - "express": "4.17.1", - "json5": "2.2.0", - "lodash": "4.17.21", - "node-fetch": "3.2.0", - "prudence": "0.9.6", - "tachi-common": "0.6.11", - "ts-node": "10.2.0", - "winston": "3.3.3" - } +{ + "name": "tachi-bot", + "version": "1.0.0", + "main": "src/index.ts", + "license": "MIT", + "scripts": { + "build": "tsc", + "start": "pnpm build && node js/main.js", + "lint": "eslint . --fix" + }, + "devDependencies": { + "@types/express": "4.17.13", + "@types/express-serve-static-core": "4.17.24", + "@types/jest": "27.0.1", + "@types/json5": "2.2.0", + "@types/lodash": "4.14.172", + "@types/node": "16.7.10", + "@typescript-eslint/eslint-plugin": "5.10.2", + "@typescript-eslint/parser": "5.10.2", + "discord-api-types": "0.22.0", + "eslint": "8.8.0", + "eslint-config-prettier": "8.3.0", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-prettier": "4.0.0", + "prettier": "2.6.0", + "typescript": "4.6.2" + }, + "dependencies": { + "@discordjs/builders": "0.5.0", + "@discordjs/rest": "0.1.0-canary.0", + "@types/bson": "1.0.11", + "@types/luxon": "^2.3.1", + "deepmerge": "^4.2.2", + "discord.js": "13.6.0", + "dotenv": "10.0.0", + "express": "4.17.1", + "json5": "2.2.0", + "lodash": "4.17.21", + "luxon": "^2.3.1", + "mei-logger": "^1.0.3", + "monk": "7.3.4", + "node-fetch": "2.6.7", + "prudence": "0.9.6", + "sync-fetch": "^0.3.1", + "tachi-common": "0.6.11", + "ts-node": "10.2.0" + } } \ No newline at end of file diff --git a/bot/src/pages/account-linked.html b/bot/pages/account-linked.html similarity index 96% rename from bot/src/pages/account-linked.html rename to bot/pages/account-linked.html index 2821d45f9..7062225f1 100644 --- a/bot/src/pages/account-linked.html +++ b/bot/pages/account-linked.html @@ -70,6 +70,8 @@