Patch na iOS, fuj. (60.1)
This commit is contained in:
parent
a65542aa88
commit
6ad61a025f
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.60.0",
|
||||
"version": "3001.60.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "denim_3001",
|
||||
"version": "3001.60.0",
|
||||
"version": "3001.60.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.17.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.60.0",
|
||||
"version": "3001.60.1",
|
||||
"description": "Toto je velmi kvalitní bot.",
|
||||
"repository": {
|
||||
"url": "https://github.com/Histmy/Denim-Bot/"
|
||||
|
||||
24
src/app.ts
24
src/app.ts
@ -1,7 +1,7 @@
|
||||
import { ButtonStyle, ChannelType, Client, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials } from "discord.js";
|
||||
import { readdirSync } from "fs";
|
||||
import { CUser, KomandNaExport, Komand, ListenerFunkce, Modul, SRecord, SuperListenerFunkce, CClient, HelpServer, KomandRaw } from "./utils/types";
|
||||
import { adminLog, formatCas, oddiakritikovat, log, rand, prefix, nabidni, send } from "./utils/utils.js";
|
||||
import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, 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";
|
||||
import { lidiCoMajDenimPremium, setClient } from "./utils/denim-Spravce";
|
||||
@ -294,14 +294,14 @@ client.on("messageCreate", async mes => {
|
||||
const komandBez = oddiakritikovat(komandSDiakritikou).toLowerCase();
|
||||
// const cmdName = client.aliasy[komandBez] ?? komandBez;
|
||||
let cmdName = komandBez;
|
||||
|
||||
|
||||
const aliasCelej = client.aliasy[komandBez];
|
||||
if (aliasCelej) {
|
||||
const [aliasCmdName, ...aliasArgs] = aliasCelej.split(" ");
|
||||
cmdName = aliasCmdName;
|
||||
args.unshift(...aliasArgs);
|
||||
}
|
||||
|
||||
|
||||
const celArgs = args.join(" ");
|
||||
|
||||
if (await runEvent("messageCreate", [mes, cmdName])) return;
|
||||
@ -344,13 +344,23 @@ client.on("messageCreate", async mes => {
|
||||
});
|
||||
|
||||
// Simulation of userPresenceUpdate event
|
||||
client.on("presenceUpdate", (bef, aft) => {
|
||||
client.on("presenceUpdate", async (bef, aft) => {
|
||||
const user = aft.user as CUser | null;
|
||||
if (!user) return;
|
||||
if (!user.presence) user.presence = {};
|
||||
|
||||
if (JSON.stringify(aft.clientStatus) == JSON.stringify(user.presence)) return;
|
||||
user.presence = aft.clientStatus || {};
|
||||
if (areStatusesSame(aft.clientStatus, user.presence)) return;
|
||||
|
||||
const naCo = aft.clientStatus || {};
|
||||
user.presence = naCo;
|
||||
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
|
||||
if (!areStatusesSame(naCo, user.presence)) {
|
||||
log("status se rychle nezmenil pro ", user.username, ": ", naCo, " -> ", user.presence);
|
||||
adminLog(client, "stalo se to");
|
||||
return;
|
||||
}
|
||||
|
||||
runEvent("userPresenceUpdate", [bef, aft]);
|
||||
});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
|
||||
|
||||
import { APIEmbed, ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, CacheType, ChannelType, Client, ComponentType, Message, MessageCreateOptions, ReadonlyCollection, TextBasedChannel, User } from "discord.js";
|
||||
import { APIEmbed, ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, CacheType, ChannelType, Client, ClientPresenceStatusData, ComponentType, Message, MessageCreateOptions, ReadonlyCollection, TextBasedChannel, User } from "discord.js";
|
||||
import { existsSync } from "fs";
|
||||
import { MysqlError, createPool } from "mysql";
|
||||
|
||||
@ -221,3 +221,24 @@ export async function send(mes: Message, co: string | MessageCreateOptions) {
|
||||
|
||||
return nova;
|
||||
}
|
||||
|
||||
export const areStatusesSame = (object1?: ClientPresenceStatusData | null, object2?: ClientPresenceStatusData | null) => {
|
||||
|
||||
if ((object1 === null || object1 === undefined) && (object2 === null || object2 === undefined)) return true;
|
||||
|
||||
if (object1 === null || object2 === null || object1 === undefined || object2 === undefined) return false;
|
||||
|
||||
const objKeys1 = Object.keys(object1) as (keyof ClientPresenceStatusData)[];
|
||||
const objKeys2 = Object.keys(object2);
|
||||
|
||||
if (objKeys1.length !== objKeys2.length) return false;
|
||||
|
||||
for (const key of objKeys1) {
|
||||
const value1 = object1[key];
|
||||
const value2 = object2[key];
|
||||
|
||||
if (value1 !== value2)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user