added voice speaking analyzer

This commit is contained in:
Histmy 2023-06-15 18:45:27 +02:00
parent f0d86bd1f0
commit 0671d9dfa7
6 changed files with 406 additions and 3462 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ config.json
out out
res/customKomandy.json res/customKomandy.json
res/customAliasy.json res/customAliasy.json
zaznamy.dlog

3838
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.50.1", "version": "3001.50.2",
"description": "Toto je velmi kvalitní bot.", "description": "Toto je velmi kvalitní bot.",
"repository": { "repository": {
"url": "https://github.com/Histmy/Denim-Bot/" "url": "https://github.com/Histmy/Denim-Bot/"

View File

@ -7,6 +7,7 @@ import { Modul } from "../utils/types";
import fetch from "node-fetch"; import fetch from "node-fetch";
import { adminLog, formatCas, log, sendDM } from "../utils/utils"; import { adminLog, formatCas, log, sendDM } from "../utils/utils";
import { emouty } from "../utils/emotes"; import { emouty } from "../utils/emotes";
import { appendFileSync } from "fs";
const zpravy = new Map<string, Map<string, number[]>>(); const zpravy = new Map<string, Map<string, number[]>>();
const dobaOmezení = 20_000; const dobaOmezení = 20_000;
@ -90,6 +91,9 @@ const exp: Modul = {
// Nastavení clienta // Nastavení clienta
client = module.exports.client; client = module.exports.client;
// Záznam
appendFileSync("zaznamy.dlog", `ziju${Date.now().toString(36)}\n`);
// OG onReady // OG onReady
log("A jedeš!"); log("A jedeš!");
if (process.argv.length >= 4) adminLog(client, "pošel jsem"); if (process.argv.length >= 4) adminLog(client, "pošel jsem");

View File

@ -3,10 +3,10 @@ import { ChannelType, Client, Guild, StageChannel, User, VoiceChannel } from "di
import { once } from "events"; import { once } from "events";
import { JoinHovna, MuzikaFace, SRecord } from "./types"; import { JoinHovna, MuzikaFace, SRecord } from "./types";
import { Readable } from "node:stream"; import { Readable } from "node:stream";
import { existsSync } from "fs"; import { appendFileSync, existsSync } from "fs";
const pripojeni: SRecord<PlayerSubscription> = {}; const pripojeni: SRecord<PlayerSubscription> = {};
const timeAnouncability: Record<string, boolean> = {}; const timeAnouncability: SRecord<boolean> = {};
if (!existsSync("config.json")) throw new Error("config.json neexistuje"); if (!existsSync("config.json")) throw new Error("config.json neexistuje");
process.env = { ...process.env, ...require("../../config.json") }; process.env = { ...process.env, ...require("../../config.json") };
@ -84,6 +84,7 @@ export async function joinVoice(channel: VoiceChannel | StageChannel | string, g
conn = joinVoiceChannel({ conn = joinVoiceChannel({
channelId, channelId,
guildId, guildId,
selfDeaf: false,
adapterCreator: guilda.voiceAdapterCreator adapterCreator: guilda.voiceAdapterCreator
}); });
@ -93,6 +94,23 @@ export async function joinVoice(channel: VoiceChannel | StageChannel | string, g
throw err; throw err;
}); });
//#region Dočasná statistika mluvení ve vojsu
appendFileSync("zaznamy.dlog", `nazdardebile${Date.now().toString(36)}\n`);
conn.receiver.speaking.on("start", id => {
appendFileSync("zaznamy.dlog", `${parseInt(id).toString(36)} ${Date.now().toString(36)}\n`);
});
conn.receiver.speaking.on("end", id => {
appendFileSync("zaznamy.dlog", `${Date.now().toString(36)} ${parseInt(id).toString(36)}\n`);
});
conn.on("stateChange", (_, now) => {
if (now.status !== VoiceConnectionStatus.Disconnected && now.status !== VoiceConnectionStatus.Destroyed) return;
appendFileSync("zaznamy.dlog", `odtahnuljsem${Date.now().toString(36)}\n`);
});
//#endregion
if (!prev) { if (!prev) {
const player = createAudioPlayer(); const player = createAudioPlayer();
player.on("error", e => log("chyba pri hrani", e)); player.on("error", e => log("chyba pri hrani", e));

View File

@ -22,6 +22,7 @@ do
echo Poslo to dostatecne malo, restartuju echo Poslo to dostatecne malo, restartuju
else else
echo Poslo to moc, seru na to echo Poslo to moc, seru na to
echo osel$(date +"%s") >> zaznamy.dlog
break break
fi fi
i=$(($i+1)) i=$(($i+1))