added SRecord type for no good reason whatsoever
This commit is contained in:
parent
33d4d9ef87
commit
9c3dc5af59
17
src/app.ts
17
src/app.ts
@ -1,19 +1,20 @@
|
|||||||
import { Client, Intents } from "discord.js";
|
import { Client, Intents } from "discord.js";
|
||||||
import { readdirSync } from "fs";
|
import { readdirSync } from "fs";
|
||||||
import { EventSOn, Komand, ListenerFunkce, Modul, SuperListenerFunkce } from "./utils/types";
|
import { EventSOn, Komand, ListenerFunkce, Modul, SRecord, SuperListenerFunkce } from "./utils/types";
|
||||||
import { formatCas, loadEnv, oddiakritikovat } from "./utils/utils.js";
|
import { formatCas, loadEnv, oddiakritikovat } from "./utils/utils.js";
|
||||||
|
|
||||||
|
loadEnv();
|
||||||
|
|
||||||
const ints = Intents.FLAGS;
|
const ints = Intents.FLAGS;
|
||||||
const client = new Client({ intents: [ints.GUILDS, ints.GUILD_VOICE_STATES, ints.GUILD_PRESENCES, ints.GUILD_MESSAGES] });
|
const client = new Client({ intents: [ints.GUILDS, ints.GUILD_VOICE_STATES, ints.GUILD_PRESENCES, ints.GUILD_MESSAGES] });
|
||||||
loadEnv();
|
|
||||||
|
|
||||||
const prefix = process.env.prefix || "more";
|
const prefix = process.env.prefix || "more";
|
||||||
const modulFolder = `${__dirname}/modules/`;
|
const modulFolder = `${__dirname}/modules/`;
|
||||||
const eventy: Record<string, ListenerFunkce[]> = {};
|
const eventy: SRecord<ListenerFunkce[]> = {};
|
||||||
const superEventy: Record<string, SuperListenerFunkce[]> = {};
|
const superEventy: SRecord<SuperListenerFunkce[]> = {};
|
||||||
const komandy: Record<string, Komand> = {};
|
const komandy: SRecord<Komand> = {};
|
||||||
const aliasy: Record<string, string> = {};
|
const aliasy: SRecord<string> = {};
|
||||||
const kuldan_log: Record<string, Record<string, number>> = {};
|
const kuldan_log: SRecord<SRecord<number>> = {};
|
||||||
|
const komandyNaPoslani: KoamndNaExport[] = [];
|
||||||
|
|
||||||
const runEvent = (name: string, args: any[]) => {
|
const runEvent = (name: string, args: any[]) => {
|
||||||
for (const listener of superEventy[name] || []) {
|
for (const listener of superEventy[name] || []) {
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { ActivityType, Message, PresenceStatusData } from "discord.js";
|
import { ActivityType, Message, PresenceStatusData } from "discord.js";
|
||||||
import { emouty } from "../utils/emotes";
|
import { emouty } from "../utils/emotes";
|
||||||
import { Modul } from "../utils/types";
|
import { Modul, SRecord } from "../utils/types";
|
||||||
import { formatter, ping } from "../utils/utils";
|
import { formatter, ping } from "../utils/utils";
|
||||||
|
|
||||||
const changeStatus = (mes: Message, status: PresenceStatusData) => {
|
const changeStatus = (mes: Message, status: PresenceStatusData) => {
|
||||||
@ -68,7 +68,7 @@ const exp: Modul = {
|
|||||||
if (!(presence && Object.keys(presence).length)) {
|
if (!(presence && Object.keys(presence).length)) {
|
||||||
embed.description = "*Všude je offline*";
|
embed.description = "*Všude je offline*";
|
||||||
} else {
|
} else {
|
||||||
const zarizeni: Record<string, string> = { desktop: "Počítač", mobile: "Mobil", web: "Web" };
|
const zarizeni: SRecord<string> = { desktop: "Počítač", mobile: "Mobil", web: "Web" };
|
||||||
const statusy = { online: "🟢", idle: "🟡", dnd: "🔴" };
|
const statusy = { online: "🟢", idle: "🟡", dnd: "🔴" };
|
||||||
const uStatusy: string[] = [];
|
const uStatusy: string[] = [];
|
||||||
const klice = Object.keys(presence) as ("web" | "mobile" | "desktop")[];
|
const klice = Object.keys(presence) as ("web" | "mobile" | "desktop")[];
|
||||||
|
|||||||
@ -3,11 +3,11 @@
|
|||||||
import { GuildMember, Message, Role, VoiceState } from "discord.js";
|
import { GuildMember, Message, Role, VoiceState } from "discord.js";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { emouty } from "../utils/emotes";
|
import { emouty } from "../utils/emotes";
|
||||||
import { Modul, Spinkackar } from "../utils/types";
|
import { Modul, Spinkackar, SRecord } from "../utils/types";
|
||||||
import { formatCas, formatter, oddiakritikovat, ping } from "../utils/utils";
|
import { formatCas, formatter, oddiakritikovat, ping } from "../utils/utils";
|
||||||
|
|
||||||
let spinkacky: Record<string, Spinkackar>;
|
let spinkacky: SRecord<Spinkackar>;
|
||||||
const budouciSpinky: Record<string, NodeJS.Timeout> = {};
|
const budouciSpinky: SRecord<NodeJS.Timeout> = {};
|
||||||
|
|
||||||
const contactSpinkServer = async (akce: string, id: string, nick: string = "", avatar: string | null = "") => {
|
const contactSpinkServer = async (akce: string, id: string, nick: string = "", avatar: string | null = "") => {
|
||||||
const options = `heslo=${process.env.spinkPass}&akce=${akce}&id=${id}&nick=${encodeURIComponent(nick)}&avatar=${encodeURIComponent(avatar ?? "")}`;
|
const options = `heslo=${process.env.spinkPass}&akce=${akce}&id=${id}&nick=${encodeURIComponent(nick)}&avatar=${encodeURIComponent(avatar ?? "")}`;
|
||||||
@ -17,7 +17,7 @@ const contactSpinkServer = async (akce: string, id: string, nick: string = "", a
|
|||||||
|
|
||||||
const syncSpink = () => {
|
const syncSpink = () => {
|
||||||
fetch("https://spinkacek.ga/api/spinkacky")
|
fetch("https://spinkacek.ga/api/spinkacky")
|
||||||
.then(r => r.json() as Promise<{ spinkacky: Record<string, Spinkackar>; }>)
|
.then(r => r.json() as Promise<{ spinkacky: SRecord<Spinkackar>; }>)
|
||||||
.then(d => {
|
.then(d => {
|
||||||
const data = d.spinkacky;
|
const data = d.spinkacky;
|
||||||
const keys = Object.keys(data);
|
const keys = Object.keys(data);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Trekování statusů všech lidí o kterých bot ví
|
// Trekování statusů všech lidí o kterých bot ví
|
||||||
import { Client, Guild, Presence, User } from "discord.js";
|
import { Client, Guild, Presence, User } from "discord.js";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { FakePresence, Modul, StatusyINaFounu, UserChange, ZmenovejObjekt } from "../utils/types";
|
import { FakePresence, Modul, SRecord, StatusyINaFounu, UserChange, ZmenovejObjekt } from "../utils/types";
|
||||||
|
|
||||||
const role = { online: "Online", idle: "Idle", dnd: "DND", offline: "Offline" };
|
const role = { online: "Online", idle: "Idle", dnd: "DND", offline: "Offline" };
|
||||||
const statusy = { Offline: "0", Online: "1", Idle: "2", DND: "3", OnlinePhone: "11", IdlePhone: "12", DNDPhone: "13" };
|
const statusy = { Offline: "0", Online: "1", Idle: "2", DND: "3", OnlinePhone: "11", IdlePhone: "12", DNDPhone: "13" };
|
||||||
@ -24,7 +24,7 @@ const prepSend = (zmeny: UserChange[]) => {
|
|||||||
poslatData({ changes });
|
poslatData({ changes });
|
||||||
};
|
};
|
||||||
|
|
||||||
const poslatData = (data: Record<string, any>) => {
|
const poslatData = (data: SRecord<any>) => {
|
||||||
data.pwd = process.env.statPass;
|
data.pwd = process.env.statPass;
|
||||||
fetch("http://deadfish.cz:4629/endpoint-pro-denimka/", { method: "POST", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) });
|
fetch("http://deadfish.cz:4629/endpoint-pro-denimka/", { method: "POST", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
import { getVoiceConnection, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice";
|
import { getVoiceConnection, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice";
|
||||||
import { GuildMember, VoiceChannel } from "discord.js";
|
import { GuildMember, VoiceChannel } from "discord.js";
|
||||||
import { emouty } from "../utils/emotes";
|
import { emouty } from "../utils/emotes";
|
||||||
import { Modul, MuzikaFace } from "../utils/types";
|
import { Modul, MuzikaFace, SRecord } from "../utils/types";
|
||||||
import { handlePrevVoice, joinVoice, play } from "../utils/utils";
|
import { handlePrevVoice, joinVoice, play } from "../utils/utils";
|
||||||
|
|
||||||
const timeouty: Record<string, NodeJS.Timeout> = {};
|
const timeouty: SRecord<NodeJS.Timeout> = {};
|
||||||
|
|
||||||
const vypocitatCas = (conn: VoiceConnection) => {
|
const vypocitatCas = (conn: VoiceConnection) => {
|
||||||
const c = new Date();
|
const c = new Date();
|
||||||
|
|||||||
@ -21,8 +21,10 @@ interface SuperObject {
|
|||||||
|
|
||||||
export type EventSOn = `on_${keyof ClientEvents}` | `super_on_${keyof ClientEvents}`;
|
export type EventSOn = `on_${keyof ClientEvents}` | `super_on_${keyof ClientEvents}`;
|
||||||
|
|
||||||
|
export type SRecord<T> = Record<string, T>;
|
||||||
|
|
||||||
export type Modul = {
|
export type Modul = {
|
||||||
more_komandy?: Record<string, RunFunkce | KomandRaw | string>;
|
more_komandy?: SRecord<RunFunkce | KomandRaw | string>;
|
||||||
client?: Client<boolean>;
|
client?: Client<boolean>;
|
||||||
} & { [key in EventSOn]?: ListenerFunkce | SuperObject | SuperListenerFunkce; };
|
} & { [key in EventSOn]?: ListenerFunkce | SuperObject | SuperListenerFunkce; };
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import { AudioPlayerStatus, AudioResource, createAudioPlayer, createAudioResource, entersState, getVoiceConnection, joinVoiceChannel, PlayerSubscription, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice";
|
import { AudioPlayerStatus, AudioResource, createAudioPlayer, createAudioResource, entersState, getVoiceConnection, joinVoiceChannel, PlayerSubscription, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice";
|
||||||
import { Guild, StageChannel, VoiceChannel } from "discord.js";
|
import { Guild, StageChannel, VoiceChannel } from "discord.js";
|
||||||
import { once } from "events";
|
import { once } from "events";
|
||||||
import { MuzikaFace } from "./types";
|
import { MuzikaFace, SRecord } from "./types";
|
||||||
import { existsSync } from "fs";
|
import { existsSync } from "fs";
|
||||||
import { Readable } from "node:stream";
|
import { Readable } from "node:stream";
|
||||||
|
|
||||||
const pripojeni: Record<string, PlayerSubscription> = {};
|
const pripojeni: SRecord<PlayerSubscription> = {};
|
||||||
|
|
||||||
export const oddiakritikovat = (a: string) => {
|
export const oddiakritikovat = (a: string) => {
|
||||||
return a
|
return a
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user