Compare commits

...

14 Commits

Author SHA1 Message Date
neru 20e162dc32 chore: remove unused param 2026-05-06 01:00:36 -03:00
neru 09e10e4113 fix: make v3 default 2026-02-13 22:48:32 -03:00
neru cbb5a9a76a fix: uncomment ShortName 2026-02-11 02:39:09 -03:00
neru 9025831f3d feat: use refreshtoken instead of api token 2026-02-11 02:37:02 -03:00
neru 06926e5601 style: run format:apply 2026-02-11 02:36:44 -03:00
neru 85c35021b5 style: run format:apply 2026-02-11 02:36:38 -03:00
neru c44f92f777 fix: dont use any 2026-02-11 02:36:33 -03:00
neru 1927728b60 fix: remove spammy log msg 2026-02-11 02:29:17 -03:00
neru 99b06b574b feat: refactor everything, handle websocket close 2026-02-09 04:49:59 -03:00
neru 7c3a5f6b56 fix: discard lib, implement azure tts 2026-02-08 02:27:02 -03:00
neru 27a6807340 fix: actually add mimic 😢 2026-02-06 14:12:22 -03:00
neru 2fe0551dee style: run format:apply and misc lint changes 2026-02-06 14:05:24 -03:00
neru 91a4c6e40d feat: add mimic 2026-02-06 14:04:57 -03:00
neru 69ee765889 feat: add bot category 2026-02-06 14:03:21 -03:00
9 changed files with 368 additions and 404 deletions
-1
View File
@@ -8,7 +8,6 @@ services:
DISCORD_TOKEN: ${DISCORD_TOKEN} DISCORD_TOKEN: ${DISCORD_TOKEN}
DISCORD_OWNER_ID: ${DISCORD_OWNER_ID} DISCORD_OWNER_ID: ${DISCORD_OWNER_ID}
TTS_TIKTOK_SESSIONID: ${TTS_TIKTOK_SESSIONID} TTS_TIKTOK_SESSIONID: ${TTS_TIKTOK_SESSIONID}
TTS_ELEVENLABS_KEY: ${TTS_ELEVENLABS_KEY}
TTS_ELEVENLABS_REFRESHTOKEN: ${TTS_ELEVENLABS_REFRESHTOKEN} TTS_ELEVENLABS_REFRESHTOKEN: ${TTS_ELEVENLABS_REFRESHTOKEN}
restart: unless-stopped restart: unless-stopped
volumes: volumes:
-358
View File
@@ -16,7 +16,6 @@
"colorts": "^0.1.63", "colorts": "^0.1.63",
"discord.js": "^14.25.1", "discord.js": "^14.25.1",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"edge-tts-universal": "^1.3.3",
"node-audio-mixer": "^2.1.0", "node-audio-mixer": "^2.1.0",
"prettier": "^3.7.4", "prettier": "^3.7.4",
"prism-media": "^1.3.5", "prism-media": "^1.3.5",
@@ -3042,23 +3041,6 @@
"dev": true, "dev": true,
"license": "Python-2.0" "license": "Python-2.0"
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT"
},
"node_modules/axios": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
"integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.4",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -3240,19 +3222,6 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/callsites": { "node_modules/callsites": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -3337,18 +3306,6 @@
"node": ">=8.1.90" "node": ">=8.1.90"
} }
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": { "node_modules/concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -3361,15 +3318,6 @@
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/cross-fetch": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.1.0.tgz",
"integrity": "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==",
"license": "MIT",
"dependencies": {
"node-fetch": "^2.7.0"
}
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.6", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -3433,15 +3381,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/delegates": { "node_modules/delegates": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -3511,74 +3450,6 @@
"integrity": "sha512-iGCHkfUc5kFekGiqhe8B/mdaurD+lakO9txNnTvKtA6PISrw86LgqHvRzWYPyoE2Ph5aMIrCw9/uko6XHTKCwA==", "integrity": "sha512-iGCHkfUc5kFekGiqhe8B/mdaurD+lakO9txNnTvKtA6PISrw86LgqHvRzWYPyoE2Ph5aMIrCw9/uko6XHTKCwA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/edge-tts-universal": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/edge-tts-universal/-/edge-tts-universal-1.3.3.tgz",
"integrity": "sha512-jlUvYGsJ+o93FRPWQDQa/E7jqYbuLJAKKq9qvylo0/yHE1vtp4HCSzSAamviBewmpaNHlEJm+eEMimJXfu98zw==",
"license": "AGPL-3.0",
"dependencies": {
"axios": "^1.12.1",
"cross-fetch": "^4.1.0",
"https-proxy-agent": "^7.0.6",
"isomorphic-ws": "^5.0.0",
"uuid": "^11.1.0",
"ws": "^8.18.3",
"xml-escape": "^1.1.0"
},
"engines": {
"node": "^18.17 || ^20.9 || >=22",
"npm": ">=9"
}
},
"node_modules/edge-tts-universal/node_modules/agent-base": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
"integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
"license": "MIT",
"engines": {
"node": ">= 14"
}
},
"node_modules/edge-tts-universal/node_modules/https-proxy-agent": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
"integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.2",
"debug": "4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/edge-tts-universal/node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/emoji-regex": { "node_modules/emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@@ -3621,51 +3492,6 @@
"license": "MIT", "license": "MIT",
"optional": true "optional": true
}, },
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-set-tostringtag": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2",
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/esbuild": { "node_modules/esbuild": {
"version": "0.27.2", "version": "0.27.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz",
@@ -3997,42 +3823,6 @@
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"license": "MIT",
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/form-data": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs-constants": { "node_modules/fs-constants": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
@@ -4084,15 +3874,6 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0" "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
} }
}, },
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/gauge": { "node_modules/gauge": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz",
@@ -4114,43 +3895,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/get-tsconfig": { "node_modules/get-tsconfig": {
"version": "4.13.0", "version": "4.13.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.0.tgz", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.0.tgz",
@@ -4230,18 +3974,6 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/graceful-fs": { "node_modules/graceful-fs": {
"version": "4.2.11", "version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
@@ -4259,51 +3991,12 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-tostringtag": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"license": "MIT",
"dependencies": {
"has-symbols": "^1.0.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-unicode": { "node_modules/has-unicode": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-cache-semantics": { "node_modules/http-cache-semantics": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz",
@@ -4524,15 +4217,6 @@
"devOptional": true, "devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/isomorphic-ws": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz",
"integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==",
"license": "MIT",
"peerDependencies": {
"ws": "*"
}
},
"node_modules/jiti": { "node_modules/jiti": {
"version": "2.6.1", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz",
@@ -4730,36 +4414,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mimic-response": { "node_modules/mimic-response": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
@@ -5493,12 +5147,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
"node_modules/pump": { "node_modules/pump": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz",
@@ -6326,12 +5974,6 @@
} }
} }
}, },
"node_modules/xml-escape": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.1.0.tgz",
"integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==",
"license": "MIT License"
},
"node_modules/yallist": { "node_modules/yallist": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
-1
View File
@@ -41,7 +41,6 @@
"colorts": "^0.1.63", "colorts": "^0.1.63",
"discord.js": "^14.25.1", "discord.js": "^14.25.1",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"edge-tts-universal": "^1.3.3",
"node-audio-mixer": "^2.1.0", "node-audio-mixer": "^2.1.0",
"prettier": "^3.7.4", "prettier": "^3.7.4",
"prism-media": "^1.3.5", "prism-media": "^1.3.5",
+8
View File
@@ -0,0 +1,8 @@
import { CommandCategoryInfo } from '../../commands';
const info: CommandCategoryInfo = {
name: 'Bot',
description: 'Bot management commands'
};
export default info;
+100
View File
@@ -0,0 +1,100 @@
import {
ChatInputCommandInteraction,
MessageCreateOptions,
MessageFlags,
SlashCommandBuilder,
TextChannel
} from 'discord.js';
import { Command } from '../../commands';
const builder = new SlashCommandBuilder()
.setName('bot-mimic')
.setDescription('Makes the bot send a message')
.addStringOption((opt) =>
opt
.setName('content')
.setDescription('The text content of the message')
.setRequired(false)
)
.addAttachmentOption((opt) =>
opt
.setName('attachment')
.setDescription('An attachment for the message')
.setRequired(false)
)
.addStringOption((opt) =>
opt
.setName('reply')
.setDescription('The message ID that the bot should reply to')
.setRequired(false)
);
const command: Command = {
name: 'bot-mimic',
builder: builder,
ownerOnly: true,
execute: async (interaction: ChatInputCommandInteraction): Promise<void> => {
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
if (!interaction.channel?.isTextBased()) {
await interaction.editReply(
'This command can only be used in a text channel.'
);
return;
}
if (!interaction.channel.isSendable()) {
await interaction.editReply('Channel is not sendable');
return;
}
const content = interaction.options.getString('content');
const attachment = interaction.options.getAttachment('attachment');
const replyId = interaction.options.getString('reply');
if (!content && !attachment) {
await interaction.editReply(
'Unable to send empty message. Specify content or attachment, or both.'
);
return;
}
const channel = interaction.channel as TextChannel;
const message: MessageCreateOptions = {};
if (content) {
message.content = content;
}
if (replyId) {
try {
const replyMessage = await channel.messages.fetch(replyId);
message.reply = {
messageReference: replyMessage.id
};
} catch {
await interaction.editReply('Invalid message ID for reply.');
return;
}
}
if (attachment) {
message.files = [
{
attachment: attachment.proxyURL,
name: attachment.name
}
];
}
try {
await channel.send(message);
await interaction.editReply('Message sent successfully.');
} catch (error) {
console.error('Failed to send message:', error);
await interaction.editReply('Failed to send message.');
}
}
};
export default command;
-2
View File
@@ -9,8 +9,6 @@ import { DataTypes } from 'sequelize';
import { config } from '../../utils/config'; import { config } from '../../utils/config';
import { DatabaseManager } from '../../modules/db'; import { DatabaseManager } from '../../modules/db';
import * as fs from 'fs';
const URL_REGEX = /(?:https?|ftp):\/\/[\n\S]+/g; const URL_REGEX = /(?:https?|ftp):\/\/[\n\S]+/g;
const DISCORD_REGEX = /<(?::\w+:|@!*&*|#)[0-9]+>/g; // from: https://www.reddit.com/r/discordapp/comments/iibxms/if_anyone_needs_regex_to_match_an_emote_mention/ const DISCORD_REGEX = /<(?::\w+:|@!*&*|#)[0-9]+>/g; // from: https://www.reddit.com/r/discordapp/comments/iibxms/if_anyone_needs_regex_to_match_an_emote_mention/
+238 -18
View File
@@ -1,6 +1,39 @@
import { createHash, randomBytes } from 'crypto';
import { TTSModule, TTSResponse } from '../tts'; import { TTSModule, TTSResponse } from '../tts';
import { VoicesManager, Communicate } from 'edge-tts-universal'; import * as https from 'https';
import { WebSocket } from 'ws';
import { Logger } from '../../utils/log';
const CLIENT_TOKEN = '6A5AA1D4EAFF4E9FB37E23D68491D6F4';
const AZURE_ENDPOINT = 'speech.platform.bing.com';
const READALOUD_PATH = `/consumer/speech/synthesize/readaloud`;
const WEBSOCKET_URL = `wss://${AZURE_ENDPOINT}${READALOUD_PATH}/edge/v1?TrustedClientToken=${CLIENT_TOKEN}`;
const VOICES_PATH = `${READALOUD_PATH}/voices/list?TrustedClientToken=${CLIENT_TOKEN}`;
const CHROME_VERSION = '138.0.7204.157';
const SEC_VERSION = `1-${CHROME_VERSION}`;
const USER_AGENT = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROME_VERSION.split('.')[0]}.0.0.0 Safari/537.36 Edg/${CHROME_VERSION.split('.')[0]}.0.0.0`;
const WIN_EPOCH = 11644473600;
const WS_RECONNECT_DELAY = 2000;
const MAX_RECONNECT_ATTEMPTS = 5;
interface PendingRequest {
resolve: (value: TTSResponse) => void;
reject: (reason: Error) => void;
audioBuff: Buffer[];
}
interface VoiceInfo {
// Name: string;
ShortName: string,
// Gender: string,
// Locale: string,
}
class AzureTTS implements TTSModule { class AzureTTS implements TTSModule {
private voices: Array<string> | undefined = undefined; private voices: Array<string> | undefined = undefined;
@@ -8,35 +41,222 @@ class AzureTTS implements TTSModule {
public name: string = 'Azure'; public name: string = 'Azure';
public defaultVoice: string = 'en-US-AvaNeural'; public defaultVoice: string = 'en-US-AvaNeural';
private ready: boolean = false;
private readyPromise: Promise<void> | null = null;
private readyResolve: (() => void) | null = null;
private ws: WebSocket | undefined = undefined;
private reconnectAttempts: number = 0;
private reconnectTimer: NodeJS.Timeout | null = null;
private isReconnecting: boolean = false;
private log: Logger;
// Map keyed by X-RequestId
private pendingRequests: Map<string, PendingRequest> = new Map();
constructor() {
this.log = new Logger('Azure TTS');
this.initializeConnection();
}
async getVoices(): Promise<Array<string> | undefined> { async getVoices(): Promise<Array<string> | undefined> {
if (!this.voices) { if (this.voices) return this.voices;
const voiceMgr = await VoicesManager.create();
const voiceQuery = await voiceMgr.find({});
this.voices = voiceQuery.map((voice) => voice.ShortName); const options: https.RequestOptions = {
} hostname: AZURE_ENDPOINT,
path: `${VOICES_PATH}&Sec-MS-GEC=${this.genSecToken()}&Sec-MS-GEC-Version=${SEC_VERSION}`,
method: 'GET',
headers: {
Pragma: 'no-cache',
'Cache-Control': 'no-cache',
'User-Agent': USER_AGENT,
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9',
Authority: 'speech.platform.bing.com',
'Sec-CH-UA': `" Not;A Brand";v="99", "Microsoft Edge";v="${CHROME_VERSION.split('.')[0]}", "Chromium";v="${CHROME_VERSION.split('.')[0]}"`,
'Sec-CH-UA-Mobile': '?0',
Accept: '*/*',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty'
}
};
return this.voices; return new Promise((resolve) => {
const req = https.request(options, (res) => {
const chunks: Buffer[] = [];
res.on('data', (chunk) => chunks.push(chunk));
res.on('end', () => {
const body = Buffer.concat(chunks).toString();
this.voices = JSON.parse(body).map((v: VoiceInfo) => v.ShortName);
resolve(this.voices);
});
req.on('error', (err) => {
throw err;
});
res.on('aborted', () => {
throw new Error('Response aborted');
});
});
req.end();
});
} }
async generate(voice: string, text: string): Promise<TTSResponse> { async generate(voice: string, text: string): Promise<TTSResponse> {
const comm = new Communicate(text, { await this.readyPromise;
voice: voice if (!this.ready || !this.ws) return { error: 'Not initialized' };
const reqId = randomBytes(16).toString('hex');
const lang = voice.split('-').slice(0, 2).join('-');
return new Promise((resolve, reject) => {
this.pendingRequests.set(reqId, { resolve, reject, audioBuff: [] });
const headers = `X-RequestId:${reqId}\r\nContent-Type:application/ssml+xml\r\nPath:ssml\r\n\r\n`;
const ssml = `<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="${lang}"><voice name="${voice}"><prosody rate="default" pitch="default">${this.escapeXml(text)}</prosody></voice></speak>`;
this.ws?.send(headers + ssml, (err) => {
if (err) {
this.pendingRequests.delete(reqId);
reject(err);
}
});
}); });
const buffers: Buffer[] = [];
for await (const chunk of comm.stream()) {
if (chunk.type === 'audio' && chunk.data) {
buffers.push(chunk.data);
}
}
return { data: Buffer.concat(buffers) };
} }
canBeUsed(): boolean { canBeUsed(): boolean {
return true; return true;
} }
private initializeConnection(): void {
this.ready = false;
this.readyPromise = new Promise((resolve) => {
this.readyResolve = resolve;
this.connect();
});
}
private connect(): void {
const url = `${WEBSOCKET_URL}&Sec-MS-GEC=${this.genSecToken()}&Sec-MS-GEC-Version=${SEC_VERSION}`;
this.ws = new WebSocket(url, {
host: 'speech.platform.bing.com',
origin: 'chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold',
headers: {
Pragma: 'no-cache',
'User-Agent': USER_AGENT
}
});
this.ws.on('open', () => {
// this.log.verbose('WebSocket open');
this.reconnectAttempts = 0;
this.isReconnecting = false;
const config = `Content-Type:application/json; charset=utf-8\r\nPath:speech.config\r\n\r\n
{
"context": {
"synthesis": {
"audio": {
"metadataoptions": { "sentenceBoundaryEnabled": "false", "wordBoundaryEnabled": "true" },
"outputFormat": "audio-24khz-48kbitrate-mono-mp3"
}
}
}
}`;
this.ws?.send(config.trim());
this.ready = true;
this.readyResolve?.();
});
this.ws.on('message', (data: Buffer, isBinary: boolean) => {
this.handleIncomingMessage(data, isBinary);
});
this.ws.on('close', (/*code, reason*/) => {
this.ready = false;
// this.log.verbose(`WS Closed: ${code}`);
this.rejectAllPending(new Error('Connection closed'));
this.scheduleReconnect();
});
this.ws.on('error', (err) => {
this.log.error('WS Error:', err);
});
}
private scheduleReconnect() {
if (this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) return;
const delay = WS_RECONNECT_DELAY * Math.pow(2, this.reconnectAttempts++);
setTimeout(() => this.connect(), delay);
}
private handleIncomingMessage(data: Buffer, isBinary: boolean) {
const message = data.toString();
const reqId = message.match(/X-RequestId:(.*?)\r\n/)?.[1];
if (!reqId) return;
const request = this.pendingRequests.get(reqId);
if (!request) return;
if (isBinary) {
const separator = 'Path:audio\r\n';
const index = data.indexOf(separator);
if (index !== -1) {
request.audioBuff.push(data.subarray(index + separator.length));
}
} else {
if (message.includes('Path:turn.end')) {
request.resolve({ data: Buffer.concat(request.audioBuff) });
this.pendingRequests.delete(reqId);
} else if (
message.includes('Path:turn.error') ||
message.includes('Path:error')
) {
request.reject(new Error('Azure synthesis error'));
this.pendingRequests.delete(reqId);
}
}
}
private rejectAllPending(err: Error) {
for (const [id, req] of this.pendingRequests) {
req.reject(err);
this.pendingRequests.delete(id);
}
}
private genSecToken(): string {
const ticks =
BigInt(Math.floor(Date.now() / 1000 + Number(WIN_EPOCH))) * 10000000n;
const roundedTicks = ticks - (ticks % 3000000000n);
const strToHash = `${roundedTicks}${CLIENT_TOKEN}`;
const hash = createHash('sha256');
hash.update(strToHash, 'ascii');
return hash.digest('hex').toUpperCase();
}
private escapeXml(unsafe: string): string {
return unsafe.replace(/[<>&"']/g, (c) => {
switch (c) {
case '<':
return '&lt;';
case '>':
return '&gt;';
case '&':
return '&amp;';
case '"':
return '&quot;';
case "'":
return '&apos;';
default:
return c;
}
});
}
} }
export default new AzureTTS(); export default new AzureTTS();
+22 -22
View File
@@ -5,10 +5,9 @@ import * as https from 'https';
const ELEVENLABS_API_ENDPOINT = 'api.elevenlabs.io'; const ELEVENLABS_API_ENDPOINT = 'api.elevenlabs.io';
const FIREBASE_API_KEY = "AIzaSyBSsRE_1Os04-bxpd5JTLIniy3UK4OqKys"; const FIREBASE_API_KEY = 'AIzaSyBSsRE_1Os04-bxpd5JTLIniy3UK4OqKys';
const FIREBASE_URL = `https://securetoken.googleapis.com/v1/token?key=${FIREBASE_API_KEY}`; const FIREBASE_URL = `https://securetoken.googleapis.com/v1/token?key=${FIREBASE_API_KEY}`;
/* /*
TO-DO: Implement previous text TO-DO: Implement previous text
*/ */
@@ -72,10 +71,9 @@ export class ElevenLabsTTS implements TTSModule {
constructor() { constructor() {
this.settings = ElevenLabsTTS.DEFAULT_SETTINGS; this.settings = ElevenLabsTTS.DEFAULT_SETTINGS;
this.modelId = 'eleven_flash_v2_5'; this.modelId = 'eleven_v3';
if (this.canBeUsed()) if (this.canBeUsed()) this.initializationPromise = this.init();
this.initializationPromise = this.init();
this.setSettings = this.setSettings.bind(this); this.setSettings = this.setSettings.bind(this);
this.setModel = this.setModel.bind(this); this.setModel = this.setModel.bind(this);
@@ -84,10 +82,7 @@ export class ElevenLabsTTS implements TTSModule {
private async init(): Promise<void> { private async init(): Promise<void> {
await this.ensureSession(); await this.ensureSession();
await Promise.all([ await Promise.all([this.fetchVoices(), this.fetchModels()]);
this.fetchVoices(),
this.fetchModels()
]);
} }
/* /*
@@ -153,7 +148,7 @@ export class ElevenLabsTTS implements TTSModule {
} }
canBeUsed(): boolean { canBeUsed(): boolean {
return config.tts_elevenlabs_refreshtoken != undefined && config.tts_elevenlabs_key != undefined; return config.tts_elevenlabs_refreshtoken != undefined;
} }
/* /*
@@ -178,13 +173,15 @@ export class ElevenLabsTTS implements TTSModule {
} }
private async fetchVoices(): Promise<void> { private async fetchVoices(): Promise<void> {
if (!this.session) return;
const opt: https.RequestOptions = { const opt: https.RequestOptions = {
hostname: ELEVENLABS_API_ENDPOINT, hostname: ELEVENLABS_API_ENDPOINT,
path: '/v2/voices', path: '/v2/voices',
method: 'GET', method: 'GET',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'xi-api-key': config.tts_elevenlabs_key, Authorization: `Bearer ${this.session.idToken}`,
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}; };
@@ -213,13 +210,15 @@ export class ElevenLabsTTS implements TTSModule {
} }
private async fetchModels(): Promise<void> { private async fetchModels(): Promise<void> {
if (!this.session) return;
const opt: https.RequestOptions = { const opt: https.RequestOptions = {
hostname: ELEVENLABS_API_ENDPOINT, hostname: ELEVENLABS_API_ENDPOINT,
path: '/v1/models', path: '/v1/models',
method: 'GET', method: 'GET',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'xi-api-key': config.tts_elevenlabs_key, Authorization: `Bearer ${this.session.idToken}`,
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}; };
@@ -244,31 +243,32 @@ export class ElevenLabsTTS implements TTSModule {
} }
private async ensureSession(): Promise<void> { private async ensureSession(): Promise<void> {
if (this.session && Date.now() < this.session.expiresAt - 300000) if (this.session && Date.now() < this.session.expiresAt - 300000) return;
return;
const refreshToken = this.session?.refreshToken || config.tts_elevenlabs_refreshtoken; const refreshToken =
if (!refreshToken) throw new Error("No refresh token available"); this.session?.refreshToken || config.tts_elevenlabs_refreshtoken;
if (!refreshToken) throw new Error('No refresh token available');
const response = await fetch(FIREBASE_URL, { const response = await fetch(FIREBASE_URL, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
'Referer': 'https://elevenlabs.io/', Referer: 'https://elevenlabs.io/',
'Origin': 'https://elevenlabs.io' Origin: 'https://elevenlabs.io'
}, },
body: new URLSearchParams({ body: new URLSearchParams({
grant_type: 'refresh_token', grant_type: 'refresh_token',
refresh_token: refreshToken, refresh_token: refreshToken
}), })
}); });
if (!response.ok) throw new Error(`Auth Refresh Failed: ${await response.text()}`); if (!response.ok)
throw new Error(`Auth Refresh Failed: ${await response.text()}`);
const data = await response.json(); const data = await response.json();
this.session = { this.session = {
idToken: data.id_token, idToken: data.id_token,
refreshToken: data.refresh_token, refreshToken: data.refresh_token,
expiresAt: Date.now() + (parseInt(data.expires_in) * 1000) expiresAt: Date.now() + parseInt(data.expires_in) * 1000
}; };
} }
} }
-2
View File
@@ -6,7 +6,6 @@ export interface Config {
tts_default_mode: string | undefined; tts_default_mode: string | undefined;
tts_default_voice: string | undefined; tts_default_voice: string | undefined;
tts_elevenlabs_key: string | undefined;
tts_elevenlabs_refreshtoken: string | undefined; tts_elevenlabs_refreshtoken: string | undefined;
tts_tiktok_sessionid: string | undefined; tts_tiktok_sessionid: string | undefined;
@@ -30,7 +29,6 @@ function loadConfig(): Config {
owner_id: process.env.DISCORD_OWNER_ID, owner_id: process.env.DISCORD_OWNER_ID,
tts_default_mode: process.env.DEFAULT_TTS_MODE, tts_default_mode: process.env.DEFAULT_TTS_MODE,
tts_default_voice: process.env.DEFAULT_TTS_VOICE, tts_default_voice: process.env.DEFAULT_TTS_VOICE,
tts_elevenlabs_key: process.env.TTS_ELEVENLABS_KEY,
tts_elevenlabs_refreshtoken: process.env.TTS_ELEVENLABS_REFRESHTOKEN, tts_elevenlabs_refreshtoken: process.env.TTS_ELEVENLABS_REFRESHTOKEN,
steam_webapi_key: process.env.STEAM_WEBAPI_KEY, steam_webapi_key: process.env.STEAM_WEBAPI_KEY,
aws_access_id: process.env.AWS_ACCESS_ID, aws_access_id: process.env.AWS_ACCESS_ID,