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
res/customKomandy.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",
"version": "3001.50.1",
"version": "3001.50.2",
"description": "Toto je velmi kvalitní bot.",
"repository": {
"url": "https://github.com/Histmy/Denim-Bot/"

View File

@ -7,6 +7,7 @@ import { Modul } from "../utils/types";
import fetch from "node-fetch";
import { adminLog, formatCas, log, sendDM } from "../utils/utils";
import { emouty } from "../utils/emotes";
import { appendFileSync } from "fs";
const zpravy = new Map<string, Map<string, number[]>>();
const dobaOmezení = 20_000;
@ -90,6 +91,9 @@ const exp: Modul = {
// Nastavení clienta
client = module.exports.client;
// Záznam
appendFileSync("zaznamy.dlog", `ziju${Date.now().toString(36)}\n`);
// OG onReady
log("A jedeš!");
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 { JoinHovna, MuzikaFace, SRecord } from "./types";
import { Readable } from "node:stream";
import { existsSync } from "fs";
import { appendFileSync, existsSync } from "fs";
const pripojeni: SRecord<PlayerSubscription> = {};
const timeAnouncability: Record<string, boolean> = {};
const timeAnouncability: SRecord<boolean> = {};
if (!existsSync("config.json")) throw new Error("config.json neexistuje");
process.env = { ...process.env, ...require("../../config.json") };
@ -84,6 +84,7 @@ export async function joinVoice(channel: VoiceChannel | StageChannel | string, g
conn = joinVoiceChannel({
channelId,
guildId,
selfDeaf: false,
adapterCreator: guilda.voiceAdapterCreator
});
@ -93,6 +94,23 @@ export async function joinVoice(channel: VoiceChannel | StageChannel | string, g
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) {
const player = createAudioPlayer();
player.on("error", e => log("chyba pri hrani", e));

View File

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