🎉First commit
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
out
|
||||
.env
|
||||
dist
|
||||
11
eslint.config.mjs
Normal file
11
eslint.config.mjs
Normal file
@@ -0,0 +1,11 @@
|
||||
// @ts-check
|
||||
import eslint from "@eslint/js"
|
||||
import eslintConfigPrettier from "eslint-config-prettier";
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default defineConfig(
|
||||
eslint.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
eslintConfigPrettier
|
||||
)
|
||||
39
package.json
Normal file
39
package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "country_wars_reborn",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prepare": "ts-patch install -s"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"packageManager": "pnpm@10.20.0",
|
||||
"dependencies": {
|
||||
"bufferutil": "^4.0.9",
|
||||
"discord.js": "^14.24.2",
|
||||
"dotenv": "^17.2.3",
|
||||
"msgpack-lite": "^0.1.26",
|
||||
"pino": "^10.1.0",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"sequelize": "^6.37.7",
|
||||
"sequelize-typescript": "^2.1.6",
|
||||
"sqlite3": "^5.1.7",
|
||||
"stream-chain": "^3.4.0",
|
||||
"stream-json": "^1.9.1",
|
||||
"typia": "^10.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@types/msgpack-lite": "^0.1.12",
|
||||
"@types/node": "^24.10.0",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"prettier": "^3.6.2",
|
||||
"ts-patch": "^3.3.0",
|
||||
"typescript": "~5.9.3",
|
||||
"typescript-eslint": "^8.46.4"
|
||||
}
|
||||
}
|
||||
2948
pnpm-lock.yaml
generated
Normal file
2948
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
onlyBuiltDependencies:
|
||||
- bufferutil
|
||||
- sqlite3
|
||||
0
src/database/models/player.model.ts
Normal file
0
src/database/models/player.model.ts
Normal file
38
src/index.ts
Normal file
38
src/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Client, GatewayIntentBits, IntentsBitField } from "discord.js";
|
||||
import { config } from "dotenv";
|
||||
import path from "path";
|
||||
import pino, { transport } from "pino";
|
||||
import { Sequelize } from "sequelize-typescript";
|
||||
|
||||
config()
|
||||
|
||||
const transporter = transport({
|
||||
target: "pino/file",
|
||||
options: {
|
||||
destination: path.join(__dirname, "logs", `latest.log.json`) }
|
||||
}
|
||||
)
|
||||
const logger = pino(transporter)
|
||||
|
||||
const intents = new IntentsBitField()
|
||||
.add(GatewayIntentBits.Guilds)
|
||||
.add(GatewayIntentBits.GuildMembers)
|
||||
.add(GatewayIntentBits.MessageContent)
|
||||
.add(GatewayIntentBits.GuildMessagePolls)
|
||||
.add(GatewayIntentBits.GuildMessageReactions)
|
||||
|
||||
const client = new Client({
|
||||
presence: {},
|
||||
intents: intents
|
||||
})
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
models: [path.join(__dirname + 'database/**/*.model.ts')],
|
||||
dialect: "sqlite",
|
||||
storage: "database.sqlite",
|
||||
logging: false
|
||||
})
|
||||
|
||||
Promise.all([client.login(process.env.TOKEN), sequelize.authenticate()]).then(async () => {
|
||||
|
||||
})
|
||||
18
src/pack_logs.ts
Normal file
18
src/pack_logs.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { createReadStream, createWriteStream, ReadStream } from "fs";
|
||||
import path from "path";
|
||||
import chain from "stream-chain";
|
||||
import parser from "stream-chain/jsonl/parser.js";
|
||||
import { createEncodeStream } from "msgpack-lite";
|
||||
import { createGzip } from "zlib";
|
||||
|
||||
function pack_latest() {
|
||||
chain([
|
||||
createReadStream(path.join(__dirname, "logs", "latest.log.json")),
|
||||
parser(),
|
||||
createEncodeStream(),
|
||||
createGzip(),
|
||||
createWriteStream(path.join(__dirname, "logs", `${Date.now()}.log.msgpack.gz`))
|
||||
])
|
||||
}
|
||||
|
||||
pack_latest()
|
||||
51
tsconfig.json
Normal file
51
tsconfig.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
// Visit https://aka.ms/tsconfig to read more about this file
|
||||
"compilerOptions": {
|
||||
// File Layout
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
// Environment Settings
|
||||
// See also https://aka.ms/tsconfig/module
|
||||
"module": "nodenext",
|
||||
"target": "esnext",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
// For nodejs:
|
||||
"lib": [
|
||||
"esnext"
|
||||
],
|
||||
// "types": ["node"],
|
||||
// and npm install -D @types/node
|
||||
// Other Outputs
|
||||
// "sourceMap": true,
|
||||
// "declaration": true,
|
||||
// "declarationMap": true,
|
||||
// Stricter Typechecking Options
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
// Style Options
|
||||
// "noImplicitReturns": true,
|
||||
// "noImplicitOverride": true,
|
||||
// "noUnusedLocals": true,
|
||||
// "noUnusedParameters": true,
|
||||
// "noFallthroughCasesInSwitch": true,
|
||||
// "noPropertyAccessFromIndexSignature": true,
|
||||
// Recommended Options
|
||||
"strict": true,
|
||||
"jsx": "react-jsx",
|
||||
"isolatedModules": true,
|
||||
"noUncheckedSideEffectImports": true,
|
||||
"moduleDetection": "force",
|
||||
"skipLibCheck": true,
|
||||
"plugins": [
|
||||
{
|
||||
"transform": "typia/lib/transform"
|
||||
}
|
||||
],
|
||||
"strictNullChecks": true
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user