Compare commits

...

11 Commits

Author SHA1 Message Date
neru 71e3dc9083 fix: only lint at /src 2026-01-10 09:10:02 -03:00
neru a4c70f5b09 feat: add config 2026-01-10 09:08:56 -03:00
neru bd66e7aa70 style: run format:apply 2026-01-10 09:08:24 -03:00
neru aed1ee515a feat: populate script list 2026-01-10 09:08:14 -03:00
neru 1a3bc54bcb feat: add .prettierrc 2026-01-10 09:07:52 -03:00
neru 24f121f1ad chore: add/configure eslint 2026-01-10 09:07:15 -03:00
neru 610611e1d9 chore: update package-lock 2026-01-10 09:05:37 -03:00
neru 857ae3e01a fix: add missing dotenv dep 2026-01-10 09:05:32 -03:00
neru 8de32af061 chore: add prettier 2026-01-10 09:05:24 -03:00
neru 86dea5b14c chore: ignore .env file 2026-01-10 08:51:30 -03:00
neru 706123ff44 chore: add discord.js 2026-01-10 08:50:03 -03:00
7 changed files with 1888 additions and 73 deletions
+2
View File
@@ -1,2 +1,4 @@
node_modules/* node_modules/*
dist/* dist/*
.env
+9
View File
@@ -0,0 +1,9 @@
{
"semi": true,
"singleQuote": true,
"jsxSingleQuote": true,
"arrowParens": "always",
"trailingComma": "none",
"bracketSpacing": true,
"useTabs": true
}
+9
View File
@@ -0,0 +1,9 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import { defineConfig } from "eslint/config";
export default defineConfig([
{ files: ["src/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } },
tseslint.configs.recommended,
]);
+1750 -4
View File
File diff suppressed because it is too large Load Diff
+19 -4
View File
@@ -4,8 +4,15 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "npx tsc", "build": "tsc",
"start": "node dist/index.js" "start": "node dist/index.js",
"dev": "tsx watch src/index.ts",
"watch": "tsc --watch",
"clean": "rm -rf dist",
"build:clean": "npm run clean && npm run build",
"lint": "eslint",
"format": "prettier --check './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc",
"format:apply": "prettier --write './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -16,11 +23,19 @@
"license": "ISC", "license": "ISC",
"type": "commonjs", "type": "commonjs",
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.39.2",
"@types/node": "^25.0.5", "@types/node": "^25.0.5",
"eslint": "^9.39.2",
"globals": "^17.0.0",
"jiti": "^2.6.1",
"tsx": "^4.21.0", "tsx": "^4.21.0",
"typescript": "^5.9.3" "typescript": "^5.9.3",
"typescript-eslint": "^8.52.0"
}, },
"dependencies": { "dependencies": {
"colorts": "^0.1.63" "colorts": "^0.1.63",
"discord.js": "^14.25.1",
"dotenv": "^17.2.3",
"prettier": "^3.7.4"
} }
} }
+35
View File
@@ -0,0 +1,35 @@
export interface Config {
token: string;
client_id: string;
owner_id: string | undefined;
tts_default_mode: string | undefined;
tts_default_voice: string | undefined;
tts_azure_key: string | undefined;
tts_elevenlabs_key: string | undefined;
steam_webapi_key: string | undefined;
}
function loadConfig(): Config {
const token = process.env.DISCORD_TOKEN;
const client_id = process.env.DISCORD_ID;
if (!token) throw new Error('DISCORD_TOKEN environment variable is not set.');
if (!client_id)
throw new Error('DISCORD_ID environment variable is not set.');
return {
token,
client_id,
owner_id: process.env.DISCORD_OWNER_ID,
tts_default_mode: process.env.DEFAULT_TTS_MODE,
tts_default_voice: process.env.DEFAULT_TTS_VOICE,
tts_azure_key: process.env.TTS_AZURE_KEY,
tts_elevenlabs_key: process.env.TTS_ELEVENLABS_KEY,
steam_webapi_key: process.env.STEAM_WEBAPI_KEY
};
}
export const config = loadConfig();
+7 -8
View File
@@ -23,9 +23,7 @@ function getCallerFrame(shift: number = 0): NodeJS.CallSite | undefined {
if (!loggedStack) return undefined; if (!loggedStack) return undefined;
if (shift > 0) if (shift > 0) for (let i = 0; i < shift; i++) loggedStack.shift();
for (let i = 0; i < shift; i++)
loggedStack.shift();
return loggedStack[1]; return loggedStack[1];
} }
@@ -34,10 +32,10 @@ function getCallerFrame(shift: number = 0): NodeJS.CallSite | undefined {
logger logger
*/ */
const LOG_TYPES = { const LOG_TYPES = {
Info: "[Info]".green, Info: '[Info]'.green,
Verbose: "[Verbose]".blue, Verbose: '[Verbose]'.blue,
Warning: "[Warning]".yellow, Warning: '[Warning]'.yellow,
Error: "[Error]".red, Error: '[Error]'.red
} as const; } as const;
export class Logger { export class Logger {
@@ -90,7 +88,8 @@ export class Logger {
} }
private getCallerInfo(caller: NodeJS.CallSite): string { private getCallerInfo(caller: NodeJS.CallSite): string {
const functionName = caller.getFunctionName()?.replace(/\[.*\]/, '') || '<anonymous>'; const functionName =
caller.getFunctionName()?.replace(/\[.*\]/, '') || '<anonymous>';
const fileName = caller.getFileName() || 'unknown'; const fileName = caller.getFileName() || 'unknown';
const relativePath = path.relative(process.cwd(), fileName); const relativePath = path.relative(process.cwd(), fileName);