Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71e3dc9083 | |||
| a4c70f5b09 | |||
| bd66e7aa70 | |||
| aed1ee515a | |||
| 1a3bc54bcb | |||
| 24f121f1ad | |||
| 610611e1d9 | |||
| 857ae3e01a | |||
| 8de32af061 | |||
| 86dea5b14c | |||
| 706123ff44 |
@@ -1,2 +1,4 @@
|
||||
node_modules/*
|
||||
dist/*
|
||||
|
||||
.env
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": true,
|
||||
"arrowParens": "always",
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": true,
|
||||
"useTabs": true
|
||||
}
|
||||
@@ -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,
|
||||
]);
|
||||
Generated
+1750
-4
File diff suppressed because it is too large
Load Diff
+19
-4
@@ -4,8 +4,15 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "npx tsc",
|
||||
"start": "node dist/index.js"
|
||||
"build": "tsc",
|
||||
"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": {
|
||||
"type": "git",
|
||||
@@ -16,11 +23,19 @@
|
||||
"license": "ISC",
|
||||
"type": "commonjs",
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@types/node": "^25.0.5",
|
||||
"eslint": "^9.39.2",
|
||||
"globals": "^17.0.0",
|
||||
"jiti": "^2.6.1",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.9.3"
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.52.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"colorts": "^0.1.63"
|
||||
"colorts": "^0.1.63",
|
||||
"discord.js": "^14.25.1",
|
||||
"dotenv": "^17.2.3",
|
||||
"prettier": "^3.7.4"
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -23,9 +23,7 @@ function getCallerFrame(shift: number = 0): NodeJS.CallSite | undefined {
|
||||
|
||||
if (!loggedStack) return undefined;
|
||||
|
||||
if (shift > 0)
|
||||
for (let i = 0; i < shift; i++)
|
||||
loggedStack.shift();
|
||||
if (shift > 0) for (let i = 0; i < shift; i++) loggedStack.shift();
|
||||
|
||||
return loggedStack[1];
|
||||
}
|
||||
@@ -34,10 +32,10 @@ function getCallerFrame(shift: number = 0): NodeJS.CallSite | undefined {
|
||||
logger
|
||||
*/
|
||||
const LOG_TYPES = {
|
||||
Info: "[Info]".green,
|
||||
Verbose: "[Verbose]".blue,
|
||||
Warning: "[Warning]".yellow,
|
||||
Error: "[Error]".red,
|
||||
Info: '[Info]'.green,
|
||||
Verbose: '[Verbose]'.blue,
|
||||
Warning: '[Warning]'.yellow,
|
||||
Error: '[Error]'.red
|
||||
} as const;
|
||||
|
||||
export class Logger {
|
||||
@@ -90,7 +88,8 @@ export class Logger {
|
||||
}
|
||||
|
||||
private getCallerInfo(caller: NodeJS.CallSite): string {
|
||||
const functionName = caller.getFunctionName()?.replace(/\[.*\]/, '') || '<anonymous>';
|
||||
const functionName =
|
||||
caller.getFunctionName()?.replace(/\[.*\]/, '') || '<anonymous>';
|
||||
const fileName = caller.getFileName() || 'unknown';
|
||||
const relativePath = path.relative(process.cwd(), fileName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user