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",
|
"name": "denim_3001",
|
||||||
"version": "3001.60.0",
|
"version": "3001.60.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "denim_3001",
|
"name": "denim_3001",
|
||||||
"version": "3001.60.0",
|
"version": "3001.60.1",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/voice": "^0.17.0",
|
"@discordjs/voice": "^0.17.0",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "denim_3001",
|
"name": "denim_3001",
|
||||||
"version": "3001.60.0",
|
"version": "3001.60.1",
|
||||||
"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/"
|
||||||
|
|||||||
20
src/app.ts
20
src/app.ts
@ -1,7 +1,7 @@
|
|||||||
import { ButtonStyle, ChannelType, Client, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials } from "discord.js";
|
import { ButtonStyle, ChannelType, Client, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials } from "discord.js";
|
||||||
import { readdirSync } from "fs";
|
import { readdirSync } from "fs";
|
||||||
import { CUser, KomandNaExport, Komand, ListenerFunkce, Modul, SRecord, SuperListenerFunkce, CClient, HelpServer, KomandRaw } from "./utils/types";
|
import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, SRecord, SuperListenerFunkce } from "./utils/types";
|
||||||
import { adminLog, formatCas, oddiakritikovat, log, rand, prefix, nabidni, send } from "./utils/utils.js";
|
import { adminLog, areStatusesSame, formatCas, log, nabidni, oddiakritikovat, prefix, rand, send } from "./utils/utils.js";
|
||||||
import levenshtein from "js-levenshtein";
|
import levenshtein from "js-levenshtein";
|
||||||
import { emouty } from "./utils/emotes";
|
import { emouty } from "./utils/emotes";
|
||||||
import { lidiCoMajDenimPremium, setClient } from "./utils/denim-Spravce";
|
import { lidiCoMajDenimPremium, setClient } from "./utils/denim-Spravce";
|
||||||
@ -344,13 +344,23 @@ client.on("messageCreate", async mes => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Simulation of userPresenceUpdate event
|
// Simulation of userPresenceUpdate event
|
||||||
client.on("presenceUpdate", (bef, aft) => {
|
client.on("presenceUpdate", async (bef, aft) => {
|
||||||
const user = aft.user as CUser | null;
|
const user = aft.user as CUser | null;
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
if (!user.presence) user.presence = {};
|
if (!user.presence) user.presence = {};
|
||||||
|
|
||||||
if (JSON.stringify(aft.clientStatus) == JSON.stringify(user.presence)) return;
|
if (areStatusesSame(aft.clientStatus, user.presence)) return;
|
||||||
user.presence = aft.clientStatus || {};
|
|
||||||
|
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]);
|
runEvent("userPresenceUpdate", [bef, aft]);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
|
/*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 { existsSync } from "fs";
|
||||||
import { MysqlError, createPool } from "mysql";
|
import { MysqlError, createPool } from "mysql";
|
||||||
|
|
||||||
@ -221,3 +221,24 @@ export async function send(mes: Message, co: string | MessageCreateOptions) {
|
|||||||
|
|
||||||
return nova;
|
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