počátek
This commit is contained in:
parent
edeaba692f
commit
38f04f3612
30
dlog3.md
Normal file
30
dlog3.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Dokumentace k logovacímu souboru DLOG verze 3.0
|
||||
|
||||
YOYO, čusák lidi! Vítejte u mojí další dokumentace. Tentokrát se podíváme na žhavou novinku: "DLOG verze 3.0"! Ačkoli se může zdát, že tento formát je vylepšení předchozí verze a uchovává data stejného typu, není tomu vůbec tak. Autor (já) byl pouze příliš líný vymýšlet jinou příponu a tak stvořil tuhle prasárnu.
|
||||
|
||||
Každopádně dostatek preamblu a jdeme se do toho pustit!
|
||||
|
||||
Obsah:
|
||||
1. [Popis souboru](#popis-souboru)
|
||||
1. [Header](#header)
|
||||
|
||||
## Popis souboru
|
||||
|
||||
K čemu že tento formát slouží? V souboru `.dlog` obsahující [header DLOGu verze 3.0](#header) se nachází záznamy o změnách statusů uživatelů Discordu, o kterých má Denim3001 přehled. Data v takto uloženém souboru slouží pro analýzu fekálnosti těchto dat posílaných Discordem. V souboru se nachází několik typů změn statusů, které jsou popsané níže.
|
||||
|
||||
## Header
|
||||
|
||||
První částí tohoto formátu je header. Ano, je to tak. Skutečně se autor od posledních dvou odpadních formátů poučil a nyní ho nezapoměl specifikovat.
|
||||
|
||||
Na headeru není vůbec nic zajímavého. Jedinou informaci kterou předává, je to, že se jedná o nový počátek DLOGu verze 3.0. Hádám že trochu zajímavé může být to, že soubor s příponou `.dlog` obsahující DLOG verze 3.0 může obsahovat více těchto headerů, neboli distinktních záznamů. Je to proto, že kdyby bot pošel, tak aby šlo poznat, která data spolu souvisí, a která nikoli.
|
||||
|
||||
### Příklad
|
||||
Header vypadá pokaždé přesně takto:
|
||||
```
|
||||
|
||||
|
||||
|
||||
DLOG3.0
|
||||
|
||||
```
|
||||
Ano, i včetně všech bílých znaků.
|
||||
17
src/app.ts
17
src/app.ts
@ -1,6 +1,6 @@
|
||||
import { ButtonStyle, ChannelType, Client, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials } from "discord.js";
|
||||
import { readdirSync } from "fs";
|
||||
import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, SRecord, SuperListenerFunkce } from "./utils/types";
|
||||
import { appendFileSync, readdirSync } from "fs";
|
||||
import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, SMessage, SRecord, SuperListenerFunkce } from "./utils/types";
|
||||
import { adminLog, areStatusesSame, formatCas, log, nabidni, oddiakritikovat, prefix, rand, send } from "./utils/utils.js";
|
||||
import levenshtein from "js-levenshtein";
|
||||
import { emouty } from "./utils/emotes";
|
||||
@ -19,6 +19,8 @@ const kuldan_log: SRecord<SRecord<number>> = {};
|
||||
const komandyNaPoslani: KomandNaExport[] = [];
|
||||
const helpServer: HelpServer = require("./utils/helpServer");
|
||||
|
||||
appendFileSync("statlog.dlog", "\n\n\nDLOG3.0\n\n");
|
||||
|
||||
client.on("error", err => {
|
||||
log(err);
|
||||
adminLog(client, "nejaka chyba na klijentovi", err);
|
||||
@ -223,7 +225,7 @@ function renderMessage(expression: string, args: string[]) {
|
||||
}
|
||||
}
|
||||
|
||||
function handle(e: unknown, mesOrInt: Message | CommandInteraction) {
|
||||
function handle(e: unknown, mesOrInt: SMessage | CommandInteraction) {
|
||||
if (process.env.dieOnError) throw e;
|
||||
log("error pri spousteni akce", e as Error);
|
||||
const admin = process.env.adminID;
|
||||
@ -233,9 +235,9 @@ function handle(e: unknown, mesOrInt: Message | CommandInteraction) {
|
||||
mesOrInt.reply(txt);
|
||||
}
|
||||
|
||||
async function runKomand(mes: Message, cmd: Komand, cmdName: string, arg: string): Promise<unknown>;
|
||||
async function runKomand(mes: SMessage, cmd: Komand, cmdName: string, arg: string): Promise<unknown>;
|
||||
async function runKomand(interaction: CommandInteraction, cmd: Komand, cmdName: string): Promise<unknown>;
|
||||
async function runKomand(mesOrInt: Message | CommandInteraction, cmd: Komand, cmdName: string, arg?: string) {
|
||||
async function runKomand(mesOrInt: SMessage | CommandInteraction, cmd: Komand, cmdName: string, arg?: string) {
|
||||
const jeMes = mesOrInt instanceof Message;
|
||||
|
||||
if (jeMes && cmd.slashRun) {
|
||||
@ -250,7 +252,7 @@ async function runKomand(mesOrInt: Message | CommandInteraction, cmd: Komand, cm
|
||||
}
|
||||
|
||||
if (cmd.premium && !lidiCoMajDenimPremium.includes(jeMes ? mesOrInt.author.id : mesOrInt.member?.user.id || "")) {
|
||||
return send(mesOrInt as Message, "sorka bracho tuto je koamnd jenom pro curaki co platy");
|
||||
return send(mesOrInt as SMessage, "sorka bracho tuto je koamnd jenom pro curaki co platy");
|
||||
}
|
||||
|
||||
const akce = cmd.run ?? cmd.slashRun!;
|
||||
@ -292,7 +294,6 @@ client.on("messageCreate", async mes => {
|
||||
}
|
||||
|
||||
const komandBez = oddiakritikovat(komandSDiakritikou).toLowerCase();
|
||||
// const cmdName = client.aliasy[komandBez] ?? komandBez;
|
||||
let cmdName = komandBez;
|
||||
|
||||
const aliasCelej = client.aliasy[komandBez];
|
||||
@ -349,6 +350,8 @@ client.on("presenceUpdate", async (bef, aft) => {
|
||||
if (!user) return;
|
||||
if (!user.presence) user.presence = {};
|
||||
|
||||
appendFileSync("statlog.dlog", `r`);
|
||||
|
||||
if (areStatusesSame(aft.clientStatus, user.presence)) return;
|
||||
|
||||
const naCo = aft.clientStatus || {};
|
||||
|
||||
@ -243,3 +243,7 @@ export const areStatusesSame = (object1?: ClientPresenceStatusData | null, objec
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export function statusToDLOG3(status: ClientPresenceStatusData) {
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user