style: run format:apply

This commit is contained in:
2026-01-15 14:36:33 -03:00
parent 14194d07ff
commit 6d21c3deca
4 changed files with 197 additions and 194 deletions
+4 -1
View File
@@ -255,7 +255,10 @@ export class CommandManager {
if (command.requiresAdmin) { if (command.requiresAdmin) {
const member = interaction.member as GuildMember; const member = interaction.member as GuildMember;
if (!member.permissions.has(PermissionFlagsBits.Administrator) && member.id != config.owner_id) { if (
!member.permissions.has(PermissionFlagsBits.Administrator) &&
member.id != config.owner_id
) {
await interaction.reply({ await interaction.reply({
content: content:
"You don't have the permissions required to execute this command.", "You don't have the permissions required to execute this command.",
+2 -2
View File
@@ -135,7 +135,8 @@ export class MixedStream {
}); });
transcoder.on('end', () => { transcoder.on('end', () => {
const durationMs = (totalBytes / 192000) * 1000 * (1 + DURATION_MARGIN_PCT); const durationMs =
(totalBytes / 192000) * 1000 * (1 + DURATION_MARGIN_PCT);
setTimeout(() => { setTimeout(() => {
source.unpipe(transcoder); source.unpipe(transcoder);
@@ -153,7 +154,6 @@ export class MixedStream {
}); });
source.pipe(transcoder).pipe(mixerInput); source.pipe(transcoder).pipe(mixerInput);
}); });
} }
+13 -13
View File
@@ -1,11 +1,12 @@
import { config } from "../../utils/config"; import { config } from '../../utils/config';
import { TTSModule, TTSResponse } from "../tts" import { TTSModule, TTSResponse } from '../tts';
import * as https from 'https'; import * as https from 'https';
import * as zlib from 'zlib'; import * as zlib from 'zlib';
import TIKTOK_TTS_VOICES from './tiktok_voices.json'; import TIKTOK_TTS_VOICES from './tiktok_voices.json';
const TIKTOK_TTS_ENDPOINT = 'https://api16-normal-v6.tiktokv.com/media/api/text/speech/invoke' const TIKTOK_TTS_ENDPOINT =
'https://api16-normal-v6.tiktokv.com/media/api/text/speech/invoke';
class TikTokTTS implements TTSModule { class TikTokTTS implements TTSModule {
public name: string = 'TikTok'; public name: string = 'TikTok';
@@ -26,12 +27,13 @@ class TikTokTTS implements TTSModule {
path: endpoint.pathname + path, path: endpoint.pathname + path,
method: 'POST', method: 'POST',
headers: { headers: {
'User-Agent': 'com.zhiliaoapp.musically/2022600030 (Linux; U; Android 7.1.2; es_ES; SM-G988N; Build/NRD90M;tt-ok/3.12.13.1)', 'User-Agent':
'Cookie': `sessionid=${config.tiktok_session_id}`, 'com.zhiliaoapp.musically/2022600030 (Linux; U; Android 7.1.2; es_ES; SM-G988N; Build/NRD90M;tt-ok/3.12.13.1)',
Cookie: `sessionid=${config.tiktok_session_id}`,
'Accept-Encoding': 'gzip,deflate,compress', 'Accept-Encoding': 'gzip,deflate,compress',
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
} };
return new Promise((resolve) => { return new Promise((resolve) => {
const req = https.request(options, (res) => { const req = https.request(options, (res) => {
@@ -44,11 +46,10 @@ class TikTokTTS implements TTSModule {
try { try {
const buffer = Buffer.concat(chunks); const buffer = Buffer.concat(chunks);
// Handle decompression if needed
const decompressBuffer = (buf: Buffer): Promise<Buffer> => { const decompressBuffer = (buf: Buffer): Promise<Buffer> => {
return new Promise((decompressResolve, decompressReject) => { return new Promise((decompressResolve, decompressReject) => {
if (encoding === 'gzip' || encoding === 'deflate') { if (encoding === 'gzip' || encoding === 'deflate') {
zlib.unzip(buf, (err: any, decompressed: Buffer<ArrayBufferLike> | PromiseLike<Buffer<ArrayBufferLike>>) => { zlib.unzip(buf, (err: Error | null, decompressed: Buffer) => {
if (err) decompressReject(err); if (err) decompressReject(err);
else decompressResolve(decompressed); else decompressResolve(decompressed);
}); });
@@ -78,7 +79,6 @@ class TikTokTTS implements TTSModule {
.catch((err) => { .catch((err) => {
resolve({ error: `Decompression/Parse error: ${err.message}` }); resolve({ error: `Decompression/Parse error: ${err.message}` });
}); });
} catch (err) { } catch (err) {
resolve({ error: `Parse error: ${err}` }); resolve({ error: `Parse error: ${err}` });
} }
@@ -103,13 +103,13 @@ class TikTokTTS implements TTSModule {
handleStatusError(code: number): string { handleStatusError(code: number): string {
switch (code) { switch (code) {
case 1: case 1:
return "Session ID may be invalid or expired"; return 'Session ID may be invalid or expired';
case 2: case 2:
return "Text is too long"; return 'Text is too long';
case 4: case 4:
return "Invalid voice"; return 'Invalid voice';
case 5: case 5:
return "No session id."; return 'No session id.';
} }
return `Unknown error code: ${code}`; return `Unknown error code: ${code}`;
} }