Compare commits

..

1 Commits
main ... pr-5

Author SHA1 Message Date
411c399ff3
Zvýšení verze a oprava formátování 2024-12-03 16:06:12 +01:00
25 changed files with 371 additions and 1207 deletions

656
package-lock.json generated
View File

@ -1,52 +1,56 @@
{ {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.62.9", "version": "3001.61.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.62.9", "version": "3001.61.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@discordjs/voice": "^0.19.0", "@discordjs/voice": "^0.17.0",
"@distube/ytdl-core": "^4.16.12", "discord.js": "^14.16.3",
"@snazzah/davey": "^0.1.7",
"discord.js": "^14.23.2",
"js-levenshtein": "^1.1.6", "js-levenshtein": "^1.1.6",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"opusscript": "^0.1.1", "opusscript": "^0.1.1",
"play-dl": "github:xuc323/play-dl", "play-dl": "https://gitea.deadfish.cz/Histmy/play-dl-fix/archive/main.tar.gz",
"tiny-typed-emitter": "^2.1.0", "tiny-typed-emitter": "^2.1.0",
"tweetnacl": "^1.0.3", "tweetnacl": "^1.0.3",
"valibot": "^1.1.0" "valibot": "^0.42.1"
}, },
"devDependencies": { "devDependencies": {
"@types/js-levenshtein": "^1.1.3", "@types/js-levenshtein": "^1.1.3",
"@types/mysql": "^2.15.27" "@types/mysql": "^2.15.26"
} }
}, },
"node_modules/@discordjs/builders": { "node_modules/@discordjs/builders": {
"version": "1.12.2", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.12.2.tgz", "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.9.0.tgz",
"integrity": "sha512-AugKmrgRJOHXEyMkABH/hXpAmIBKbYokCEl9VAM4Kh6FvkdobQ+Zhv7AR6K+y5hS7+VQ7gKXPYCe1JQmV07H1g==", "integrity": "sha512-0zx8DePNVvQibh5ly5kCEei5wtPBIUbSoE9n+91Rlladz4tgtFbJ36PZMxxZrTEOQ7AHMZ/b0crT/0fCy6FTKg==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/formatters": "^0.6.1", "@discordjs/formatters": "^0.5.0",
"@discordjs/util": "^1.1.1", "@discordjs/util": "^1.1.1",
"@sapphire/shapeshift": "^4.0.0", "@sapphire/shapeshift": "^4.0.0",
"discord-api-types": "^0.38.26", "discord-api-types": "0.37.97",
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"ts-mixer": "^6.0.4", "ts-mixer": "^6.0.4",
"tslib": "^2.6.3" "tslib": "^2.6.3"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=18"
}, },
"funding": { "funding": {
"url": "https://github.com/discordjs/discord.js?sponsor" "url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@discordjs/builders/node_modules/discord-api-types": {
"version": "0.37.97",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
"license": "MIT"
},
"node_modules/@discordjs/collection": { "node_modules/@discordjs/collection": {
"version": "1.5.3", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz",
@ -57,24 +61,30 @@
} }
}, },
"node_modules/@discordjs/formatters": { "node_modules/@discordjs/formatters": {
"version": "0.6.1", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.6.1.tgz", "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.5.0.tgz",
"integrity": "sha512-5cnX+tASiPCqCWtFcFslxBVUaCetB0thvM/JyavhbXInP1HJIEU+Qv/zMrnuwSsX3yWH2lVXNJZeDK3EiP4HHg==", "integrity": "sha512-98b3i+Y19RFq1Xke4NkVY46x8KjJQjldHUuEbCqMvp1F5Iq9HgnGpu91jOi/Ufazhty32eRsKnnzS8n4c+L93g==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"discord-api-types": "^0.38.1" "discord-api-types": "0.37.97"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=18"
}, },
"funding": { "funding": {
"url": "https://github.com/discordjs/discord.js?sponsor" "url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@discordjs/formatters/node_modules/discord-api-types": {
"version": "0.37.97",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
"integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
"license": "MIT"
},
"node_modules/@discordjs/rest": { "node_modules/@discordjs/rest": {
"version": "2.6.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.6.0.tgz", "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.4.0.tgz",
"integrity": "sha512-RDYrhmpB7mTvmCKcpj+pc5k7POKszS4E2O9TYc+U+Y4iaCP+r910QdO43qmpOja8LRr1RJ0b3U+CqVsnPqzf4w==", "integrity": "sha512-Xb2irDqNcq+O8F0/k/NaDp7+t091p+acb51iA4bCKfIn+WFWd6HrNvcsSbMMxIR9NjcMZS6NReTKygqiQN+ntw==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/collection": "^2.1.1", "@discordjs/collection": "^2.1.1",
@ -82,10 +92,10 @@
"@sapphire/async-queue": "^1.5.3", "@sapphire/async-queue": "^1.5.3",
"@sapphire/snowflake": "^3.5.3", "@sapphire/snowflake": "^3.5.3",
"@vladfrangu/async_event_emitter": "^2.4.6", "@vladfrangu/async_event_emitter": "^2.4.6",
"discord-api-types": "^0.38.16", "discord-api-types": "0.37.97",
"magic-bytes.js": "^1.10.0", "magic-bytes.js": "^1.10.0",
"tslib": "^2.6.3", "tslib": "^2.6.3",
"undici": "6.21.3" "undici": "6.19.8"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@ -106,14 +116,11 @@
"url": "https://github.com/discordjs/discord.js?sponsor" "url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@discordjs/rest/node_modules/undici": { "node_modules/@discordjs/rest/node_modules/discord-api-types": {
"version": "6.21.3", "version": "0.37.97",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.21.3.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.97.tgz",
"integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==", "integrity": "sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==",
"license": "MIT", "license": "MIT"
"engines": {
"node": ">=18.17"
}
}, },
"node_modules/@discordjs/util": { "node_modules/@discordjs/util": {
"version": "1.1.1", "version": "1.1.1",
@ -128,19 +135,19 @@
} }
}, },
"node_modules/@discordjs/voice": { "node_modules/@discordjs/voice": {
"version": "0.19.0", "version": "0.17.0",
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.19.0.tgz", "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.17.0.tgz",
"integrity": "sha512-UyX6rGEXzVyPzb1yvjHtPfTlnLvB5jX/stAMdiytHhfoydX+98hfympdOwsnTktzr+IRvphxTbdErgYDJkEsvw==", "integrity": "sha512-hArn9FF5ZYi1IkxdJEVnJi+OxlwLV0NJYWpKXsmNOojtGtAZHxmsELA+MZlu2KW1F/K1/nt7lFOfcMXNYweq9w==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@types/ws": "^8.18.1", "@types/ws": "^8.5.10",
"discord-api-types": "^0.38.16", "discord-api-types": "0.37.83",
"prism-media": "^1.3.5", "prism-media": "^1.3.5",
"tslib": "^2.8.1", "tslib": "^2.6.2",
"ws": "^8.18.3" "ws": "^8.16.0"
}, },
"engines": { "engines": {
"node": ">=22.12.0" "node": ">=16.11.0"
}, },
"funding": { "funding": {
"url": "https://github.com/discordjs/discord.js?sponsor" "url": "https://github.com/discordjs/discord.js?sponsor"
@ -181,20 +188,20 @@
} }
}, },
"node_modules/@discordjs/ws": { "node_modules/@discordjs/ws": {
"version": "1.2.3", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.2.3.tgz", "resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.1.1.tgz",
"integrity": "sha512-wPlQDxEmlDg5IxhJPuxXr3Vy9AjYq5xCvFWGJyD7w7Np8ZGu+Mc+97LCoEc/+AYCo2IDpKioiH0/c/mj5ZR9Uw==", "integrity": "sha512-PZ+vLpxGCRtmr2RMkqh8Zp+BenUaJqlS6xhgWKEZcgC/vfHLEzpHtKkB0sl3nZWpwtcKk6YWy+pU3okL2I97FA==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/collection": "^2.1.0", "@discordjs/collection": "^2.1.0",
"@discordjs/rest": "^2.5.1", "@discordjs/rest": "^2.3.0",
"@discordjs/util": "^1.1.0", "@discordjs/util": "^1.1.0",
"@sapphire/async-queue": "^1.5.2", "@sapphire/async-queue": "^1.5.2",
"@types/ws": "^8.5.10", "@types/ws": "^8.5.10",
"@vladfrangu/async_event_emitter": "^2.2.4", "@vladfrangu/async_event_emitter": "^2.2.4",
"discord-api-types": "^0.38.1", "discord-api-types": "0.37.83",
"tslib": "^2.6.2", "tslib": "^2.6.2",
"ws": "^8.17.0" "ws": "^8.16.0"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=16.11.0"
@ -215,74 +222,10 @@
"url": "https://github.com/discordjs/discord.js?sponsor" "url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/@distube/ytdl-core": {
"version": "4.16.12",
"resolved": "https://registry.npmjs.org/@distube/ytdl-core/-/ytdl-core-4.16.12.tgz",
"integrity": "sha512-/NR8Jur1Q4E2oD+DJta7uwWu7SkqdEkhwERt7f4iune70zg7ZlLLTOHs1+jgg3uD2jQjpdk7RGC16FqstG4RsA==",
"license": "MIT",
"dependencies": {
"http-cookie-agent": "^7.0.1",
"https-proxy-agent": "^7.0.6",
"m3u8stream": "^0.8.6",
"miniget": "^4.2.3",
"sax": "^1.4.1",
"tough-cookie": "^5.1.2",
"undici": "^7.8.0"
},
"engines": {
"node": ">=20.18.1"
},
"funding": {
"url": "https://github.com/distubejs/ytdl-core?sponsor"
}
},
"node_modules/@emnapi/core": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.6.0.tgz",
"integrity": "sha512-zq/ay+9fNIJJtJiZxdTnXS20PllcYMX3OE23ESc4HK/bdYu3cOWYVhsOhVnXALfU/uqJIxn5NBPd9z4v+SfoSg==",
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.1.0",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.6.0.tgz",
"integrity": "sha512-obtUmAHTMjll499P+D9A3axeJFlhdjOWdKUNs/U6QIGT7V5RjcUW1xToAzjvmgTSQhDbYn/NwfTRoJcQ2rNBxA==",
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz",
"integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==",
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@napi-rs/wasm-runtime": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.0.7.tgz",
"integrity": "sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==",
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "^1.5.0",
"@emnapi/runtime": "^1.5.0",
"@tybys/wasm-util": "^0.10.1"
}
},
"node_modules/@sapphire/async-queue": { "node_modules/@sapphire/async-queue": {
"version": "1.5.5", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.5.tgz", "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.3.tgz",
"integrity": "sha512-cvGzxbba6sav2zZkH8GPf2oGk9yYoD5qrNWdu9fRehifgnFZJMV+nuy2nON2roRO4yQQ+v7MK/Pktl/HgfsUXg==", "integrity": "sha512-x7zadcfJGxFka1Q3f8gCts1F0xMwCKbZweM85xECGI0hBTeIZJGGCrHgLggihBoprlQ/hBmDR5LKfIPqnmHM3w==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=v14.0.0", "node": ">=v14.0.0",
@ -312,268 +255,6 @@
"npm": ">=7.0.0" "npm": ">=7.0.0"
} }
}, },
"node_modules/@snazzah/davey": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey/-/davey-0.1.7.tgz",
"integrity": "sha512-qBWp9sHf9vvKqDhg2AGOgWjB9q7MZat2CAPIcaXe+XFWl7nCmriRnDcdIRy7CwKWK+ECiuO29/RSxxKuulo28w==",
"license": "MIT",
"engines": {
"node": ">= 10"
},
"funding": {
"url": "https://github.com/sponsors/Snazzah"
},
"optionalDependencies": {
"@snazzah/davey-android-arm-eabi": "0.1.7",
"@snazzah/davey-android-arm64": "0.1.7",
"@snazzah/davey-darwin-arm64": "0.1.7",
"@snazzah/davey-darwin-x64": "0.1.7",
"@snazzah/davey-freebsd-x64": "0.1.7",
"@snazzah/davey-linux-arm-gnueabihf": "0.1.7",
"@snazzah/davey-linux-arm64-gnu": "0.1.7",
"@snazzah/davey-linux-arm64-musl": "0.1.7",
"@snazzah/davey-linux-x64-gnu": "0.1.7",
"@snazzah/davey-linux-x64-musl": "0.1.7",
"@snazzah/davey-wasm32-wasi": "0.1.7",
"@snazzah/davey-win32-arm64-msvc": "0.1.7",
"@snazzah/davey-win32-ia32-msvc": "0.1.7",
"@snazzah/davey-win32-x64-msvc": "0.1.7"
}
},
"node_modules/@snazzah/davey-android-arm-eabi": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-android-arm-eabi/-/davey-android-arm-eabi-0.1.7.tgz",
"integrity": "sha512-GxkEpfFtaS8xZHN42NkTQhLFdYCQ9qxJvmG+qwYDL+wdv3s7Dl44o2lg5gwGOtQU8EZw9/lZkYi9TenYkStbFg==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-android-arm64": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-android-arm64/-/davey-android-arm64-0.1.7.tgz",
"integrity": "sha512-EkC1Wz3IMBZfbaCE82+peV+vEFVCRL3HxTRKGIY5AXzkKGQSJJ7Est/6h9vTcQbBEbMj2RAXRbwcydukWJR2vg==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-darwin-arm64": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-darwin-arm64/-/davey-darwin-arm64-0.1.7.tgz",
"integrity": "sha512-Iov5NUjhl5Q9XZHIuGLzd9PgQPm8ELI9NPiNt3r6VtSVHLp9/ktOgzaeEji0WnvvirrSb9MdpfTuyHnJjEXuRQ==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-darwin-x64": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-darwin-x64/-/davey-darwin-x64-0.1.7.tgz",
"integrity": "sha512-P7WqV/9ttSW2kHlC1WME8ykMeo0LJBzqbC9lZ2aYH4IEdb5mp4lCzb82mcEc99Nxi8878c0k5Qaza6z4KeSdIA==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-freebsd-x64": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-freebsd-x64/-/davey-freebsd-x64-0.1.7.tgz",
"integrity": "sha512-O8QxS4jGPCvvHa5EJIvP0Dm2JkMqe1RnfDU0qnIcSwzJseqQqwpM5vXSMt9E2Mi58RiUGwTRefr0I9+ttCrDzg==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-linux-arm-gnueabihf": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-linux-arm-gnueabihf/-/davey-linux-arm-gnueabihf-0.1.7.tgz",
"integrity": "sha512-30Gzhbg7kBbbg/Vdb75c5DUvHrwRglIXtTK0L3paxo5TCNXNFdfnSX5oLGjV4s1pyoFL8nWyq3/IzCcUIcHx5Q==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-linux-arm64-gnu": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-linux-arm64-gnu/-/davey-linux-arm64-gnu-0.1.7.tgz",
"integrity": "sha512-kDpbZEb24bn84yDG7gG8KTLL1sTl+UHPEt83qD5G3Sm7L37DN+uABN4nw51wst1JzxWphq7tvSSjfqz9NES4Xg==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-linux-arm64-musl": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-linux-arm64-musl/-/davey-linux-arm64-musl-0.1.7.tgz",
"integrity": "sha512-J+6CnJ34OaoFYq9f8BQPSXWMF3HRjKg5UCEb0E64Q7wMz5+6o7hACd7kVjKnG3as7IjGMcgp6/SNtrht79ntjQ==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-linux-x64-gnu": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-linux-x64-gnu/-/davey-linux-x64-gnu-0.1.7.tgz",
"integrity": "sha512-7+I6LN43WkALjrQGm/pp1fQg84pSnwicsLPZKthlEi1L2UP2d9k8JEtnhHXJ4pymLuPsAZu5nC8QMDoIJy+exw==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-linux-x64-musl": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-linux-x64-musl/-/davey-linux-x64-musl-0.1.7.tgz",
"integrity": "sha512-N17vBRkU401w8EOvHVem2di/zAqv3CDgm7LAnONm8S/CNpAeLQWrhbHdN6RHZEyhQk2trnfPh4+wiZbAoXek0A==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-wasm32-wasi": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-wasm32-wasi/-/davey-wasm32-wasi-0.1.7.tgz",
"integrity": "sha512-BhtNJpqmP69sdSf5eyDqlIsZSjkHo6FebaXaYVH0qf3V9YYQdEbbjep3MrcIL2F0STfpceSi2v+vZTTwlZBbKw==",
"cpu": [
"wasm32"
],
"license": "MIT",
"optional": true,
"dependencies": {
"@napi-rs/wasm-runtime": "^1.0.5"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@snazzah/davey-win32-arm64-msvc": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-win32-arm64-msvc/-/davey-win32-arm64-msvc-0.1.7.tgz",
"integrity": "sha512-oj/F1eQRQggMwqXNq6CY4UTqcFcCi/Wug99jWH8LepLVsYUdFxQUNTqkp51qarT+lbuX4L/ZZqZX4y4dhz6Lvg==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-win32-ia32-msvc": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-win32-ia32-msvc/-/davey-win32-ia32-msvc-0.1.7.tgz",
"integrity": "sha512-T1qPP/pQm0qDaM7QGCYMzeXE1Xes0b3ckAQS2m27dt3FkD1Ki8FX2g77dcGOWqGkzDlNJj1drw/9QlgCt3Tcrw==",
"cpu": [
"ia32"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@snazzah/davey-win32-x64-msvc": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@snazzah/davey-win32-x64-msvc/-/davey-win32-x64-msvc-0.1.7.tgz",
"integrity": "sha512-Z2NhImUYeApi/lNn7MBcn14dPa2dtgnp5taz43JDaPpl+2cinDm9kYjpFzJE9SZMlfsa//p2dhE9B8TEVi9bHQ==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz",
"integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==",
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@types/js-levenshtein": { "node_modules/@types/js-levenshtein": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/@types/js-levenshtein/-/js-levenshtein-1.1.3.tgz", "resolved": "https://registry.npmjs.org/@types/js-levenshtein/-/js-levenshtein-1.1.3.tgz",
@ -582,9 +263,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/mysql": { "node_modules/@types/mysql": {
"version": "2.15.27", "version": "2.15.26",
"resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.27.tgz", "resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.26.tgz",
"integrity": "sha512-YfWiV16IY0OeBfBCk8+hXKmdTKrKlwKN1MNKAPBu5JYxLwBEZl7QzeEpGnlZb3VMGJrrGmB84gXiH+ofs/TezA==", "integrity": "sha512-DSLCOXhkvfS5WNNPbfn2KdICAmk8lLc+/PNvnPnF7gOdMZCxopXduqv0OQ13y/yA/zXTSikZZqVgybUxOEg6YQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -601,33 +282,24 @@
} }
}, },
"node_modules/@types/ws": { "node_modules/@types/ws": {
"version": "8.18.1", "version": "8.5.12",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz",
"integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@vladfrangu/async_event_emitter": { "node_modules/@vladfrangu/async_event_emitter": {
"version": "2.4.7", "version": "2.4.6",
"resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.7.tgz", "resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.6.tgz",
"integrity": "sha512-Xfe6rpCTxSxfbswi/W/Pz7zp1WWSNn4A0eW4mLkQUewCrXXtMj31lCg+iQyTkh/CkusZSq9eDflu7tjEDXUY6g==", "integrity": "sha512-RaI5qZo6D2CVS6sTHFKg1v5Ohq/+Bo2LZ5gzUEwZ/WkHhwtGTCB/sVLw8ijOkAUxasZ+WshN/Rzj4ywsABJ5ZA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=v14.0.0", "node": ">=v14.0.0",
"npm": ">=7.0.0" "npm": ">=7.0.0"
} }
}, },
"node_modules/agent-base": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",
"integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
"license": "MIT",
"engines": {
"node": ">= 14"
}
},
"node_modules/bignumber.js": { "node_modules/bignumber.js": {
"version": "9.0.0", "version": "9.0.0",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
@ -643,51 +315,30 @@
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/debug": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/discord-api-types": { "node_modules/discord-api-types": {
"version": "0.38.30", "version": "0.37.83",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.30.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.83.tgz",
"integrity": "sha512-KhAqlBrg+rVK+Ob7INMF5o63yW4/GUzRatG/AjyVsIO8lgcLyR8qCl2HokIVzWwmzkJYG0CEPXsKMOqau3E8NA==", "integrity": "sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==",
"license": "MIT", "license": "MIT"
"workspaces": [
"scripts/actions/documentation"
]
}, },
"node_modules/discord.js": { "node_modules/discord.js": {
"version": "14.23.2", "version": "14.16.3",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.23.2.tgz", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.16.3.tgz",
"integrity": "sha512-tU2NFr823X3TXEc8KyR/4m296KLxPai4nirN3q9kHCpY4TKj96n9lHZnyLzRNMui8EbL07jg9hgH2PWWfKMGIg==", "integrity": "sha512-EPCWE9OkA9DnFFNrO7Kl1WHHDYFXu3CNVFJg63bfU7hVtjZGyhShwZtSBImINQRWxWP2tgo2XI+QhdXx28r0aA==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@discordjs/builders": "^1.12.1", "@discordjs/builders": "^1.9.0",
"@discordjs/collection": "1.5.3", "@discordjs/collection": "1.5.3",
"@discordjs/formatters": "^0.6.1", "@discordjs/formatters": "^0.5.0",
"@discordjs/rest": "^2.6.0", "@discordjs/rest": "^2.4.0",
"@discordjs/util": "^1.1.1", "@discordjs/util": "^1.1.1",
"@discordjs/ws": "^1.2.3", "@discordjs/ws": "1.1.1",
"@sapphire/snowflake": "3.5.3", "@sapphire/snowflake": "3.5.3",
"discord-api-types": "^0.38.29", "discord-api-types": "0.37.100",
"fast-deep-equal": "3.1.3", "fast-deep-equal": "3.1.3",
"lodash.snakecase": "4.1.1", "lodash.snakecase": "4.1.1",
"magic-bytes.js": "^1.10.0",
"tslib": "^2.6.3", "tslib": "^2.6.3",
"undici": "6.21.3" "undici": "6.19.8"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@ -696,14 +347,11 @@
"url": "https://github.com/discordjs/discord.js?sponsor" "url": "https://github.com/discordjs/discord.js?sponsor"
} }
}, },
"node_modules/discord.js/node_modules/undici": { "node_modules/discord.js/node_modules/discord-api-types": {
"version": "6.21.3", "version": "0.37.100",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.21.3.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.100.tgz",
"integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==", "integrity": "sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA==",
"license": "MIT", "license": "MIT"
"engines": {
"node": ">=18.17"
}
}, },
"node_modules/fast-deep-equal": { "node_modules/fast-deep-equal": {
"version": "3.1.3", "version": "3.1.3",
@ -711,43 +359,6 @@
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/http-cookie-agent": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-7.0.1.tgz",
"integrity": "sha512-lZHFZUdPTw64PdksQac5xbUd4NWjUbyDYnvR//2sbLpcC4UqEUW0x/6O+rDntVzJzJ07QvhtL5XZSC+c5EK+IQ==",
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.3"
},
"engines": {
"node": ">=20.0.0"
},
"funding": {
"url": "https://github.com/sponsors/3846masa"
},
"peerDependencies": {
"tough-cookie": "^4.0.0 || ^5.0.0",
"undici": "^7.0.0"
},
"peerDependenciesMeta": {
"undici": {
"optional": true
}
}
},
"node_modules/https-proxy-agent": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
"integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.2",
"debug": "4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/inherits": { "node_modules/inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@ -781,38 +392,10 @@
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/m3u8stream": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.6.tgz",
"integrity": "sha512-LZj8kIVf9KCphiHmH7sbFQTVe4tOemb202fWwvJwR9W5ENW/1hxJN6ksAWGhQgSBSa3jyWhnjKU1Fw1GaOdbyA==",
"license": "MIT",
"dependencies": {
"miniget": "^4.2.2",
"sax": "^1.2.4"
},
"engines": {
"node": ">=12"
}
},
"node_modules/magic-bytes.js": { "node_modules/magic-bytes.js": {
"version": "1.12.1", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.12.1.tgz", "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.10.0.tgz",
"integrity": "sha512-ThQLOhN86ZkJ7qemtVRGYM+gRgR8GEXNli9H/PMvpnZsE44Xfh3wx9kGJaldg314v85m+bFW6WBMaVHJc/c3zA==", "integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==",
"license": "MIT"
},
"node_modules/miniget": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/miniget/-/miniget-4.2.3.tgz",
"integrity": "sha512-SjbDPDICJ1zT+ZvQwK0hUcRY4wxlhhNpHL9nJOB2MEAXRGagTljsO8MEDzQMTFf0Q8g4QNi8P9lEm/g7e+qgzA==",
"license": "MIT",
"engines": {
"node": ">=12"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/mysql": { "node_modules/mysql": {
@ -844,7 +427,8 @@
}, },
"node_modules/play-dl": { "node_modules/play-dl": {
"version": "1.9.7", "version": "1.9.7",
"resolved": "git+ssh://git@github.com/xuc323/play-dl.git#2e515a99b7f872b1670ad7d23455fd7a05a07b3e", "resolved": "https://gitea.deadfish.cz/Histmy/play-dl-fix/archive/main.tar.gz",
"integrity": "sha512-YK62RESrfcOXJAE7orKb+D+vs7lJvRur7hq1vPeT4pFH2aJSjI4sGgoefRYDPoM/BCp8VCsC5i11YDpWbW2dMA==",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"play-audio": "^0.5.2" "play-audio": "^0.5.2"
@ -880,12 +464,6 @@
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/sax": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz",
"integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==",
"license": "ISC"
},
"node_modules/sqlstring": { "node_modules/sqlstring": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
@ -910,36 +488,6 @@
"integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==", "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/tldts": {
"version": "6.1.86",
"resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
"integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==",
"license": "MIT",
"dependencies": {
"tldts-core": "^6.1.86"
},
"bin": {
"tldts": "bin/cli.js"
}
},
"node_modules/tldts-core": {
"version": "6.1.86",
"resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz",
"integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==",
"license": "MIT"
},
"node_modules/tough-cookie": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz",
"integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==",
"license": "BSD-3-Clause",
"dependencies": {
"tldts": "^6.1.32"
},
"engines": {
"node": ">=16"
}
},
"node_modules/ts-mixer": { "node_modules/ts-mixer": {
"version": "6.0.4", "version": "6.0.4",
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz", "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
@ -947,9 +495,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/tslib": { "node_modules/tslib": {
"version": "2.8.1", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/tweetnacl": { "node_modules/tweetnacl": {
@ -959,12 +507,12 @@
"license": "Unlicense" "license": "Unlicense"
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "7.9.0", "version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.9.0.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz",
"integrity": "sha512-e696y354tf5cFZPXsF26Yg+5M63+5H3oE6Vtkh2oqbvsE2Oe7s2nIbcQh5lmG7Lp/eS29vJtTpw9+p6PX0qNSg==", "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=20.18.1" "node": ">=18.17"
} }
}, },
"node_modules/undici-types": { "node_modules/undici-types": {
@ -980,9 +528,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/valibot": { "node_modules/valibot": {
"version": "1.1.0", "version": "0.42.1",
"resolved": "https://registry.npmjs.org/valibot/-/valibot-1.1.0.tgz", "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.42.1.tgz",
"integrity": "sha512-Nk8lX30Qhu+9txPYTwM0cFlWLdPFsFr6LblzqIySfbZph9+BFsAHsNvHOymEviUepeIW6KFHzpX8TKhbptBXXw==", "integrity": "sha512-3keXV29Ar5b//Hqi4MbSdV7lfVp6zuYLZuA9V1PvQUsXqogr+u5lvLPLk3A4f74VUXDnf/JfWMN6sB+koJ/FFw==",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"typescript": ">=5" "typescript": ">=5"
@ -994,9 +542,9 @@
} }
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "8.18.3", "version": "8.18.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"

View File

@ -1,6 +1,6 @@
{ {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.62.9", "version": "3001.61.0",
"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/"
@ -13,20 +13,18 @@
"author": "Histmy + det-fys", "author": "Histmy + det-fys",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@discordjs/voice": "^0.19.0", "@discordjs/voice": "^0.17.0",
"@distube/ytdl-core": "^4.16.12", "discord.js": "^14.16.3",
"@snazzah/davey": "^0.1.7",
"discord.js": "^14.23.2",
"js-levenshtein": "^1.1.6", "js-levenshtein": "^1.1.6",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"opusscript": "^0.1.1", "opusscript": "^0.1.1",
"play-dl": "github:xuc323/play-dl", "play-dl": "https://gitea.deadfish.cz/Histmy/play-dl-fix/archive/main.tar.gz",
"tiny-typed-emitter": "^2.1.0", "tiny-typed-emitter": "^2.1.0",
"tweetnacl": "^1.0.3", "tweetnacl": "^1.0.3",
"valibot": "^1.1.0" "valibot": "^0.42.1"
}, },
"devDependencies": { "devDependencies": {
"@types/js-levenshtein": "^1.1.3", "@types/js-levenshtein": "^1.1.3",
"@types/mysql": "^2.15.27" "@types/mysql": "^2.15.26"
} }
} }

View File

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hra - $domena</title>
<style>
table {
border-collapse: collapse;
}
td {
padding: 0;
}
img {
width: 2em;
height: 2em;
display: block;
}
.nic {
width: 2em;
}
</style>
</head>
<body>
<h1>Hra</h1>
<p>$pecko</p>
<table>
$hra
</table>
</body>
</html>

View File

@ -1,10 +1,11 @@
import { ButtonStyle, ChannelType, Client, ClientPresenceStatusData, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials, Presence } from "discord.js"; import { ButtonStyle, ChannelType, Client, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials } from "discord.js";
import { readdirSync } from "fs"; import { readdirSync } from "fs";
import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, SMessage, SRecord, SuperListenerFunkce } from "./utils/types"; import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, SMessage, SRecord, SuperListenerFunkce } from "./utils/types";
import { adminLog, areStatusesSame, formatCas, log, nabidni, oddiakritikovat, prefix, rand, messageReply } 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";
import { logOOoZS, logSZS, logPZS } from "./utils/statuslog";
const ints = GatewayIntentBits; const ints = GatewayIntentBits;
const client = new Client({ const client = new Client({
@ -20,7 +21,7 @@ const komandyNaPoslani: KomandNaExport[] = [];
const helpServer: HelpServer = require("./utils/helpServer"); const helpServer: HelpServer = require("./utils/helpServer");
client.on("error", err => { client.on("error", err => {
log("errorek", err); log(err);
adminLog(client, "nejaka chyba na klijentovi", err); adminLog(client, "nejaka chyba na klijentovi", err);
}); });
@ -29,39 +30,6 @@ client.on("shardError", err => {
adminLog(client, "šárd ejrr??", err); adminLog(client, "šárd ejrr??", err);
}); });
process.on("unhandledRejection", (reason, promise) => {
let message: string;
if (reason instanceof Error) {
message = `${reason.name}: ${reason.message}\n${reason.stack}`;
} else {
message = String(reason);
}
if (message.includes("Connect Timeout Error") && message.includes("10000ms")) {
// Klasika
log(new Error("Discord timeout..."));
return;
}
log(new Error("Unhandled Rejection in app:"), reason, promise);
adminLog(client, "Unhandled Rejection", message);
});
process.on("uncaughtException", (err) => {
log(new Error("Uncaught Exception in app:"), err);
let message: string;
if (err instanceof Error) {
message = `${err.name}: ${err.message}\n${err.stack}`;
} else {
message = String(err);
}
adminLog(client, "Uncaught Exception", message);
});
client.komandy = {}; client.komandy = {};
client.aliasy = {}; client.aliasy = {};
setClient(client); setClient(client);
@ -262,7 +230,7 @@ function handle(e: unknown, mesOrInt: SMessage | CommandInteraction) {
const admin = process.env.adminID; const admin = process.env.adminID;
const txt = `pri spousteni thohoto komandu nastala chyba ${admin ? `<@${admin}> uz?` : ""}`; const txt = `pri spousteni thohoto komandu nastala chyba ${admin ? `<@${admin}> uz?` : ""}`;
if (mesOrInt instanceof Message) return void messageReply(mesOrInt, txt); if (mesOrInt instanceof Message) return void send(mesOrInt, txt);
mesOrInt.reply(txt); mesOrInt.reply(txt);
} }
@ -274,23 +242,23 @@ async function runKomand(mesOrInt: SMessage | CommandInteraction, cmd: Komand, c
if (jeMes && cmd.slashRun) { if (jeMes && cmd.slashRun) {
const nazev = `${prefix}${cmdName}`; const nazev = `${prefix}${cmdName}`;
const id = client.slashCommandy[nazev]; const id = client.slashCommandy[nazev];
return void messageReply(mesOrInt, `tuto ejenom sleh komand </${nazev}:${id}>`); return void send(mesOrInt, `tuto ejenom sleh komand </${nazev}:${id}>`);
} }
if (cmd.cd && jeMes) { if (cmd.cd && jeMes) {
const zbyva = Math.round(maKuldan(mesOrInt.author.id, cmdName, cmd.cd)); const zbyva = Math.round(maKuldan(mesOrInt.author.id, cmdName, cmd.cd));
if (zbyva) return messageReply(mesOrInt, `si kkt vole maz kuldan jeste ${formatCas(zbyva)}`); if (zbyva) return send(mesOrInt, `si kkt vole maz kuldan jeste ${formatCas(zbyva)}`);
} }
if (cmd.premium && !lidiCoMajDenimPremium.includes(jeMes ? mesOrInt.author.id : mesOrInt.member?.user.id || "")) { if (cmd.premium && !lidiCoMajDenimPremium.includes(jeMes ? mesOrInt.author.id : mesOrInt.member?.user.id || "")) {
return messageReply(mesOrInt as SMessage, "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!; const akce = cmd.run ?? cmd.slashRun!;
if (typeof akce == "string") { if (typeof akce == "string") {
const res = renderMessage(akce, arg?.split(" ") || []); const res = renderMessage(akce, arg?.split(" ") || []);
if (jeMes) return messageReply(mesOrInt, res); if (jeMes) return send(mesOrInt, res);
return mesOrInt.reply(res); return mesOrInt.reply(res);
} }
@ -299,7 +267,7 @@ async function runKomand(mesOrInt: SMessage | CommandInteraction, cmd: Komand, c
const result = await akce(mesOrInt as never, arg || ""); const result = await akce(mesOrInt as never, arg || "");
if (!result) return; if (!result) return;
if (jeMes) return messageReply(mesOrInt, result) if (jeMes) return send(mesOrInt, result)
.catch(e => handle(e, mesOrInt)); .catch(e => handle(e, mesOrInt));
// další feklo // další feklo
mesOrInt.reply(result as InteractionReplyOptions); mesOrInt.reply(result as InteractionReplyOptions);
@ -315,12 +283,12 @@ client.on("messageCreate", async mes => {
const prefixDiff = levenshtein(oddiakritikovat(mesPrefix.toLowerCase()), prefix); const prefixDiff = levenshtein(oddiakritikovat(mesPrefix.toLowerCase()), prefix);
if (prefixDiff > 0) { if (prefixDiff > 0) {
if (!await runEvent("messageCreate", [mes]) && prefixDiff <= 1 && mes.author.id != client.user!.id) messageReply(mes, `${prefix}*`); if (!await runEvent("messageCreate", [mes]) && prefixDiff <= 1 && mes.author.id != client.user!.id) send(mes, `${prefix}*`);
return; return;
} }
if (!komandSDiakritikou) { if (!komandSDiakritikou) {
if (!await runEvent("messageCreate", [mes])) messageReply(mes, "coe voe"); if (!await runEvent("messageCreate", [mes])) send(mes, "coe voe");
return; return;
} }
@ -339,7 +307,7 @@ client.on("messageCreate", async mes => {
if (await runEvent("messageCreate", [mes, cmdName])) return; if (await runEvent("messageCreate", [mes, cmdName])) return;
const komand = client.komandy[cmdName]; const komand = client.komandy[cmdName];
if (mes.channel.type == ChannelType.DM && komand?.DMUnsafe) return void messageReply(mes, "tuten komand bohuzel v sz nefunkuje"); if (mes.channel.type == ChannelType.DM && komand?.DMUnsafe) return void send(mes, "tuten komand bohuzel v sz nefunkuje");
if (komand) return void runKomand(mes, komand, cmdName, celArgs); if (komand) return void runKomand(mes, komand, cmdName, celArgs);
@ -349,7 +317,7 @@ client.on("messageCreate", async mes => {
const distance = levenshtein(cmd, cmdName); const distance = levenshtein(cmd, cmdName);
if (distance <= Math.ceil(cmdName.length * 0.3)) slova.push(cmd); if (distance <= Math.ceil(cmdName.length * 0.3)) slova.push(cmd);
}); });
if (!slova.length) return void messageReply(mes, "co to znamena ti gadzovko"); if (!slova.length) return void send(mes, "co to znamena ti gadzovko");
const nabidka = slova.sort().slice(0, 5); const nabidka = slova.sort().slice(0, 5);
@ -365,9 +333,9 @@ client.on("messageCreate", async mes => {
radek.components.forEach((btn, i) => btn.setDisabled() && (i == lookupId && btn.setStyle(ButtonStyle.Success))); radek.components.forEach((btn, i) => btn.setDisabled() && (i == lookupId && btn.setStyle(ButtonStyle.Success)));
i.update({ content: `ok vole ${emouty.d3k}`, components: [radek] }); i.update({ content: `ok vole ${emouty.d3k}`, components: [radek] });
if (!cmd) return void messageReply(mes, "bohuzel negdo sy ze mi dela prel"); if (!cmd) return void send(mes, "bohuzel negdo sy ze mi dela prel");
if (mes.channel.type == ChannelType.DM && cmd?.DMUnsafe) return void messageReply(mes, "tuten komand bohuzel v sz nefunkuje"); if (mes.channel.type == ChannelType.DM && cmd?.DMUnsafe) return void send(mes, "tuten komand bohuzel v sz nefunkuje");
runKomand(mes, cmd, cmdName, celArgs); runKomand(mes, cmd, cmdName, celArgs);
}, },
@ -375,28 +343,17 @@ client.on("messageCreate", async mes => {
}); });
}); });
function alertPokudNestandardni(client: CClient, aft: Presence) {
const presence = aft.clientStatus;
for (const pres in presence) {
if (["web", "mobile", "desktop"].includes(pres)) {
continue;
}
// Máme jinej
adminLog(client, `zahlidnul jsem zvlastni status "${pres}".\n\`\`\`${JSON.stringify(presence)}\`\`\`\nod uzivatele ${aft.userId} ${aft.user}`);
}
}
// Simulation of userPresenceUpdate event // Simulation of userPresenceUpdate event
client.on("presenceUpdate", async (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 = {};
logOOoZS(user.id, aft.clientStatus);
if (areStatusesSame(aft.clientStatus, user.presence)) return; if (areStatusesSame(aft.clientStatus, user.presence)) return;
alertPokudNestandardni(client, aft); logSZS(user.id, aft.clientStatus);
const naCo = aft.clientStatus || {}; const naCo = aft.clientStatus || {};
user.presence = naCo; user.presence = naCo;
@ -404,6 +361,7 @@ client.on("presenceUpdate", async (bef, aft) => {
await new Promise(r => setTimeout(r, 1000)); await new Promise(r => setTimeout(r, 1000));
if (!areStatusesSame(naCo, user.presence)) { if (!areStatusesSame(naCo, user.presence)) {
logPZS(user.id, naCo, user.presence);
return; return;
} }
@ -411,7 +369,7 @@ client.on("presenceUpdate", async (bef, aft) => {
}); });
client.on("interactionCreate", async int => { client.on("interactionCreate", async int => {
if (process.env.ignoreMess || !int.isChatInputCommand()) return; if (process.env.ignoreMess || !int.isCommand()) return;
const cmdName = int.commandName.slice(prefix.length); const cmdName = int.commandName.slice(prefix.length);

View File

@ -1,10 +1,10 @@
// Modul na komand "anketa" // Modul na komand "anketa"
import { ActionRowBuilder, APIEmbed, APIEmbedField, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, ComponentType, Message, MessageComponentInteraction } from "discord.js"; import { ActionRowBuilder, APIEmbed, APIEmbedField, ButtonBuilder, ButtonStyle, CommandInteraction, ComponentType, Message, MessageComponentInteraction } from "discord.js";
import { Modul, SRecord } from "../utils/types"; import { Modul, SRecord } from "../utils/types";
import { formatter } from "../utils/utils"; import { formatter } from "../utils/utils";
function lookup<T>(opt: ChatInputCommandInteraction["options"], item: string) { function lookup<T>(opt: CommandInteraction["options"], item: string) {
return opt.get(item)?.value as T | undefined; return opt.get(item)?.value as T | undefined;
} }

View File

@ -1,8 +1,8 @@
import { CClient, HelpServer, Komand, KomandNaExport, Modul, SMessage, SRecord } from "../utils/types"; import { CClient, HelpServer, Komand, KomandNaExport, Modul, SMessage, SRecord } from "../utils/types";
import { join } from "path"; import { join } from "path";
import { existsSync, readFileSync, writeFileSync } from "fs"; import { existsSync, readFileSync, writeFileSync } from "fs";
import { oddiakritikovat, messageReply, strankovani } from "../utils/utils"; import { oddiakritikovat, send, strankovani } from "../utils/utils";
import { APIEmbed } from "discord.js"; import { APIEmbed, Message } from "discord.js";
let client: CClient; let client: CClient;
const cesta = `${join(__dirname, "../../res/")}custom`; const cesta = `${join(__dirname, "../../res/")}custom`;
@ -63,13 +63,13 @@ function zmrdovoAliasy(zacatek: string, owner: string, mes: SMessage) {
let text = ""; let text = "";
arr.forEach(element => { arr.forEach(element => {
if (text.length + element.length > 2000) { if (text.length + element.length > 2000) {
messageReply(mes, { content: text, allowedMentions: { users: [] } }); send(mes, { content: text, allowedMentions: { users: [] } });
text = ""; text = "";
} }
text += `${element}\n`; text += `${element}\n`;
}); });
messageReply(mes, { content: text, allowedMentions: { users: [] } }); send(mes, { content: text, allowedMentions: { users: [] } });
} }
const exp: Modul = { const exp: Modul = {
@ -310,7 +310,7 @@ const exp: Modul = {
} }
}, },
on_clientReady: () => { on_ready: () => {
client = module.exports.client; client = module.exports.client;
zakladniKomandy = client.komandy; zakladniKomandy = client.komandy;
zakladniAliasy = client.aliasy; zakladniAliasy = client.aliasy;

View File

@ -5,7 +5,7 @@ import { join } from "path";
import { Priority, novejPlay } from "../utils/voice"; import { Priority, novejPlay } from "../utils/voice";
import { lidiCoMajDenimPremium } from "../utils/denim-Spravce"; import { lidiCoMajDenimPremium } from "../utils/denim-Spravce";
import { exec } from "child_process"; import { exec } from "child_process";
import { betterFetch, log, messageReply } from "../utils/utils"; import { log, send } from "../utils/utils";
const kmenovaCesta = join(__dirname, `../../zvuky/priVstupu`); const kmenovaCesta = join(__dirname, `../../zvuky/priVstupu`);
const formaty = ["mp3", "wav", "ogg"]; const formaty = ["mp3", "wav", "ogg"];
@ -34,7 +34,7 @@ const exp: Modul = {
const typ = soubor.name.slice(-3); const typ = soubor.name.slice(-3);
const docasnaCesta = `${kmenovaCesta}/temp${Math.round(Math.random() * 1000)}.${typ}`; const docasnaCesta = `${kmenovaCesta}/temp${Math.round(Math.random() * 1000)}.${typ}`;
const odpoved = await betterFetch(soubor.url).then(r => r.arrayBuffer()); const odpoved = await fetch(soubor.url).then(r => r.arrayBuffer());
writeFileSync(docasnaCesta, new DataView(odpoved)); writeFileSync(docasnaCesta, new DataView(odpoved));
// Zjistit running-time // Zjistit running-time
@ -42,14 +42,14 @@ const exp: Modul = {
if (error) { if (error) {
log("chyba pri ffprobe", error); log("chyba pri ffprobe", error);
messageReply(mes, "bohuzel chiba"); send(mes, "bohuzel chiba");
vymaz(docasnaCesta); vymaz(docasnaCesta);
return; return;
} }
// Maximum // Maximum
if (Number(stdout) > 13) { if (Number(stdout) > 13) {
messageReply(mes, "13 se kund maks"); send(mes, "13 se kund maks");
vymaz(docasnaCesta); vymaz(docasnaCesta);
return; return;
} }
@ -62,7 +62,7 @@ const exp: Modul = {
renameSync(docasnaCesta, `${zaklad}.${typ}`); renameSync(docasnaCesta, `${zaklad}.${typ}`);
messageReply(mes, "ej tot am"); send(mes, "ej tot am");
}); });
} }
} }

View File

@ -3,7 +3,7 @@
import { ChannelType, Message, MessageReaction } from "discord.js"; import { ChannelType, Message, MessageReaction } from "discord.js";
import { emouty } from "../utils/emotes"; import { emouty } from "../utils/emotes";
import { Modul, SRecord } from "../utils/types"; import { Modul, SRecord } from "../utils/types";
import { formatter, ping, messageReply, sendDM, sendWithoutReply } from "../utils/utils"; import { formatter, ping, send, sendDM } from "../utils/utils";
const exp: Modul = { const exp: Modul = {
more_komandy: { more_komandy: {
@ -67,7 +67,7 @@ const exp: Modul = {
argument.splice(0, 1); argument.splice(0, 1);
if (argument.length) setTimeout(() => randomshit(mes, argument), 1000); if (argument.length) setTimeout(() => randomshit(mes, argument), 1000);
}; };
messageReply(mes, ":stop_button:").then(mes => randomshit(mes, [":five:", ":four:", ":three:", ":two:", ":one:", ":ok:"])); send(mes, ":stop_button:").then(mes => randomshit(mes, [":five:", ":four:", ":three:", ":two:", ":one:", ":ok:"]));
}, },
pocasi: () => { pocasi: () => {
@ -92,7 +92,7 @@ const exp: Modul = {
} }
try { try {
await sendWithoutReply(await mes.author.createDM(), `test ${emouty.d3k}`); await mes.author.send(`test ${emouty.d3k}`);
} catch { } catch {
return "ja ti ale napsat nemuzu ti kundo"; return "ja ti ale napsat nemuzu ti kundo";
} }

View File

@ -1,20 +1,20 @@
import { TextChannel } from "discord.js"; import { TextChannel } from "discord.js";
import { CClient, Modul } from "../utils/types"; import { CClient, Modul } from "../utils/types";
import { betterFetch, log, sendWithoutReply } from "../utils/utils"; import { log } from "../utils/utils";
let client: CClient; let client: CClient;
const najdiClanek = /href="(?<odkaz>.+?)">\n *<h2>(?<nazev>.+?)<\/h2>/; let najdiClanek = /href="(?<odkaz>.+?)">\n *<h2>(?<nazev>.+?)<\/h2>/;
let posledniNazev: string; let posledniNazev: string;
let posledniOdkaz: string; let posledniOdkaz: string;
async function zkontrolovatNovinky() { async function zkontrolovatNovinky() {
const stranka = await betterFetch("https://histmy.eu/BUM/clanky") const stranka = await fetch("https://histmy.eu/BUM/clanky")
.then(r => r.text()) .then(r => r.text())
.catch(e => log("chyba pri accessovani BUM stránky", e)); .catch(e => log("chyba pri accessovani BUM stránky", e));
const nazevAOdkaz = najdiClanek.exec(stranka || ""); let nazevAOdkaz = najdiClanek.exec(stranka || "");
if (!nazevAOdkaz || !nazevAOdkaz.groups) return false; if (!nazevAOdkaz || !nazevAOdkaz.groups) return false;
@ -63,13 +63,13 @@ async function urobit() {
const general = guilda.channels.cache.get("555779161067749448") as TextChannel; const general = guilda.channels.cache.get("555779161067749448") as TextChannel;
if (!general) return log(new Error("general nenalezen")); if (!general) return log(new Error("general nenalezen"));
sendWithoutReply(general, `<@&1313491870231564318>\n${zprava}`); general.send(`<@&1313491870231564318>\n${zprava}`);
naplanovat(); naplanovat();
} }
const exp: Modul = { const exp: Modul = {
on_clientReady: () => { on_ready: () => {
client = module.exports.client; client = module.exports.client;
urobit(); urobit();

View File

@ -2,11 +2,10 @@
import { AudioPlayerStatus, VoiceConnectionStatus } from "@discordjs/voice"; import { AudioPlayerStatus, VoiceConnectionStatus } from "@discordjs/voice";
import { Client } from "discord.js"; import { Client } from "discord.js";
import { search, validate, video_basic_info } from "play-dl"; import { search, stream, validate, video_basic_info } from "play-dl";
import ytdlko from "@distube/ytdl-core";
import { emouty } from "../utils/emotes"; import { emouty } from "../utils/emotes";
import { Modul } from "../utils/types"; import { Modul } from "../utils/types";
import { adminLog, betterFetch, log, messageReply } from "../utils/utils"; import { adminLog, log, send } from "../utils/utils";
import { getConn, Hratelny, novejJoin, novejPlay, Priority, stopPlayer } from "../utils/voice"; import { getConn, Hratelny, novejJoin, novejPlay, Priority, stopPlayer } from "../utils/voice";
import { array, record, safeParse, string } from "valibot"; import { array, record, safeParse, string } from "valibot";
@ -20,25 +19,6 @@ const guildy = new Map<string, { kju: QueueItem[]; loop: boolean; }>();
const searchScema = array(record(string(), string())); const searchScema = array(record(string(), string()));
async function createHratelny(url: string): Promise<Hratelny> {
/* Verze pro knihovnu play-dl */
/* const src = await stream(url);
return {
src: src.stream,
volume: 1,
type: src.type
};*/
/* Verze pro ytdl-core */
const src = ytdlko(url, { filter: "audioonly", highWaterMark: 1 << 25 });
return {
src: src,
volume: 1
};
}
async function playNext(guildId: string) { async function playNext(guildId: string) {
try { try {
const guilda = guildy.get(guildId)!; const guilda = guildy.get(guildId)!;
@ -47,7 +27,8 @@ async function playNext(guildId: string) {
let coZahrat: Hratelny; let coZahrat: Hratelny;
if (!item.special) { if (!item.special) {
coZahrat = await createHratelny(item.url); const src = await stream(item.url);
coZahrat = { src: src.stream, volume: 1, type: src.type };
} else { } else {
coZahrat = item.url; coZahrat = item.url;
} }
@ -62,7 +43,7 @@ async function playNext(guildId: string) {
return playNext(guildId); return playNext(guildId);
}) })
.catch(e => { .catch(e => {
log("chyba v hrani muziki", e); log("chyba v muziki", e);
}); });
} catch (e) { } catch (e) {
if (e instanceof Error && e.message.startsWith("Seeking beyond limit")) if (e instanceof Error && e.message.startsWith("Seeking beyond limit"))
@ -91,16 +72,16 @@ const exp: Modul = {
ajtem.name = soubor.name; ajtem.name = soubor.name;
ajtem.url = soubor.url; ajtem.url = soubor.url;
ajtem.special = true; ajtem.special = true;
messageReply(mes, `zahraju \`${soubor.name}\``); send(mes, `zahraju \`${soubor.name}\``);
} else if (txt == "") return "co mam zahrat??"; } else if (txt == "") return "co mam zahrat??";
else if (!druh) { else if (!druh) {
ajtem.name = `nejaka picovina ot ${mes.author}`; ajtem.name = `nejaka picovina ot ${mes.author}`;
ajtem.url = txt; ajtem.url = txt;
ajtem.special = true; ajtem.special = true;
messageReply(mes, `zkusim to zahrat`); send(mes, `zkusim to zahrat`);
} }
else if (druh == "search") { else if (druh == "search") {
const msg = messageReply(mes, "hledam"); const msg = send(mes, "hledam");
const hledani = await search(txt, { limit: 1 }); const hledani = await search(txt, { limit: 1 });
if (!hledani[0]) return "nic sem nenašel"; if (!hledani[0]) return "nic sem nenašel";
ajtem.url = hledani[0].url; ajtem.url = hledani[0].url;
@ -112,23 +93,13 @@ const exp: Modul = {
const video = await video_basic_info(txt); const video = await video_basic_info(txt);
ajtem.name = video.video_details.title!; ajtem.name = video.video_details.title!;
} catch (e) { } catch (e) {
if (!(e instanceof Error)) { return "sorka bracho ael tuto je ajdzreztrigtnuti";
log("chyba ale nechyba v mzike", e);
return "neco se fatk posralo";
}
if (e.message.includes("age"))
return "sorka bracho ael tuto je nesjpis ajdzreztrigtnuti";
log("chyba v hledani muziki", e);
return "doslo k random chybe";
} }
if (typeof ajtem.name == "undefined") { if (typeof ajtem.name == "undefined") {
const client: Client = module.exports.client; const client: Client = module.exports.client;
adminLog(client, "video nemá název"); adminLog(client, "video nemá název");
} }
messageReply(mes, `zahraju \`${ajtem.name}\``); send(mes, `zahraju \`${ajtem.name}\``);
} else return "tuto neumim zahrat"; } else return "tuto neumim zahrat";
if (!guildy.has(guildId)) { if (!guildy.has(guildId)) {
@ -213,10 +184,8 @@ const exp: Modul = {
const kju = guildy.get(mes.guildId!)?.kju; const kju = guildy.get(mes.guildId!)?.kju;
if (!kju?.length) return "nehraje nic"; if (!kju?.length) return "nehraje nic";
const nameSplited = kju[0].name.split("-"); const query = kju[0].name.split("-")[1] ?? kju[0].name;
const res = await fetch(`https://search.karaoketexty.cz/index.php?q=${query}`)
const query = nameSplited[1] ?? kju[0].name;
const res = await betterFetch(`https://search.karaoketexty.cz/index.php?q=${query}`)
.then(res => res.text()) .then(res => res.text())
.catch(log); .catch(log);
@ -226,19 +195,11 @@ const exp: Modul = {
if (!vyhledavani.success) return "KaraokeTexty se na mi visarly"; if (!vyhledavani.success) return "KaraokeTexty se na mi visarly";
let vysledek; const vysledek = vyhledavani.output[0];
const vyfiltrovano = vyhledavani.output.filter(result => nameSplited.length && result.label.includes(nameSplited[0]) && result.label.includes(nameSplited[1]));
if (vyfiltrovano.length) {
vysledek = vyfiltrovano[0];
} else {
vysledek = vyhledavani.output[0];
}
if (!vysledek) return "KaraokeTexty nic nenasli"; if (!vysledek) return "KaraokeTexty nic nenasli";
const res2 = await betterFetch(`https://www.karaoketexty.cz/texty-pisni/h/h-${vysledek.id}`) const res2 = await fetch(`https://www.karaoketexty.cz/texty-pisni/h/h-${vysledek.id}`)
.then(res => res.text()) .then(res => res.text())
.catch(log); .catch(log);

View File

@ -111,7 +111,7 @@ const komandy: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [
]; ];
const exp: Modul = { const exp: Modul = {
on_clientReady: async () => { on_ready: async () => {
const client = module.exports.client as CClient; const client = module.exports.client as CClient;
client.slashCommandy = {}; client.slashCommandy = {};

View File

@ -4,7 +4,7 @@ import { APIEmbed, Message } from "discord.js";
import { Modul } from "../utils/types"; import { Modul } from "../utils/types";
import { fokinLookupTable, klikance, pocetKeStrane } from "../utils/sachyEtc"; import { fokinLookupTable, klikance, pocetKeStrane } from "../utils/sachyEtc";
import { emiter, sachyDomena } from "../utils/sachyServer"; import { emiter, sachyDomena } from "../utils/sachyServer";
import { messageReply } from "../utils/utils"; import { send } from "../utils/utils";
const hry = new Map<number, Hra>(); // gameID -> Hra const hry = new Map<number, Hra>(); // gameID -> Hra
const hraci = new Map<string, number>(); // hrac -> gameID const hraci = new Map<string, number>(); // hrac -> gameID
@ -98,7 +98,7 @@ function jeCheck(barva: Hra["hraje"], deska: Deska) {
// od pawnů // od pawnů
[7, 9].forEach(i => { [7, 9].forEach(i => {
const pis = deska[index - i]; const pis = deska[index - i];
if (pis?.typ == "pawn" && pocetKeStrane[index][i == 7 ? 1 : 3] > 0 && pis.barva != barva) check = true; if (pis?.typ == "pawn" && pis.barva != barva) check = true;
}); });
// od králika // od králika
@ -173,13 +173,6 @@ function tahyProPawny(index: number, deska: Deska) {
if (index % 8 != 7 && deska[index - 7] && deska[index - 7]!.barva != barva) if (index % 8 != 7 && deska[index - 7] && deska[index - 7]!.barva != barva)
tahy.push(index - 7); tahy.push(index - 7);
// en croassant
if (pocetKeStrane[index][3] > 0 && deska[index - 1]?.enPassantovatelna)
tahy.push(index - 9);
if (pocetKeStrane[index][1] > 0 && deska[index + 1]?.enPassantovatelna)
tahy.push(index - 7);
// Blokáda // Blokáda
if (deska[index - 8]) if (deska[index - 8])
return tahy; return tahy;
@ -190,6 +183,13 @@ function tahyProPawny(index: number, deska: Deska) {
if (deska[index]?.netahnuta && !deska[index - 16]) if (deska[index]?.netahnuta && !deska[index - 16])
tahy.push(index - 16); tahy.push(index - 16);
// en croassant
if (deska[index - 1]?.enPassantovatelna)
tahy.push(index - 9);
if (deska[index + 1]?.enPassantovatelna)
tahy.push(index - 7);
return tahy; return tahy;
} }
@ -218,8 +218,6 @@ function tahyProKrale(index: number, deska: Deska) {
break; break;
} }
if (Math.abs(i) == 3) continue;
const novaDeska = [...deska]; const novaDeska = [...deska];
novaDeska[index + i] = deska[index]; novaDeska[index + i] = deska[index];
novaDeska[index] = undefined; novaDeska[index] = undefined;
@ -304,45 +302,6 @@ function renderHra(hra: Hra, konec?: true) {
const deska = [...hra.deska]; const deska = [...hra.deska];
const vybranejPis = hra.vybranejPis; const vybranejPis = hra.vybranejPis;
const policka: Policko[] = [];
hra.tahy = [];
if (typeof vybranejPis == "number") hra.tahy = legalniTahy(vybranejPis, deska);
for (let i = 0; i < 64; i++) {
const figurka = deska[i];
const jeTah = hra.tahy.includes(i);
const cernyPozadi = (Math.floor(i / 8) + (i % 8)) % 2;
if (!figurka) {
policka.push(jeTah
? { typ: "tahnutelne", emoutId: cernyPozadi ? "1066376051422404628" : "1066376343807336488" }
: { typ: "prazdne", barva: cernyPozadi ? "cerna" : "bila" }
);
} else {
let klic = (cernyPozadi ? "g" : "w") + (figurka.barva == "bila" ? "w" : "b") + figurka.typ;
if (jeTah) klic += "t";
else if (figurka.typ == "king" && figurka.barva == hra.hraje && jeCheck(figurka.barva, deska)) klic += "c";
const emoutId = fokinLookupTable[klic];
const tahnutelny = !konec && figurka.barva == hra.hraje || jeTah;
policka.push({ emoutId, typ: tahnutelny ? "tahnutelne" : "figurka" });
}
}
return policka;
}
function generateGameEmbed(hra: Hra, konec?: true) {
const embed: APIEmbed = { const embed: APIEmbed = {
fields: [ fields: [
{ {
@ -358,64 +317,51 @@ function generateGameEmbed(hra: Hra, konec?: true) {
] ]
}; };
const policka = renderHra(hra, konec); hra.tahy = [];
if (typeof vybranejPis == "number") hra.tahy = legalniTahy(vybranejPis, deska);
for (let i = 0; i < 64; i++) { for (let i = 0; i < 64; i++) {
const policko = policka[i]; const figurka = deska[i];
const field = embed.fields![(i % 8) < 4 ? 0 : 1]; const klikanec = klikance[i];
const prvniDuhy = (i % 8) < 4 ? 0 : 1;
const field = embed.fields![prvniDuhy];
const cernyPozadi = (Math.floor(i / 8) + (i % 8)) % 2;
if (!figurka) {
field.value += hra.tahy.includes(i)
? (cernyPozadi ? `[<:h:1066376051422404628>](http://${sachyDomena}/${klikanec})` : `[<:h:1066376343807336488>](http://${sachyDomena}/${klikanec})`)
: (cernyPozadi ? "🟩" : "⬜");
} else {
let klic = (cernyPozadi ? "g" : "w") + (figurka.barva == "bila" ? "w" : "b") + figurka.typ;
if (hra.tahy.includes(i)) klic += "t";
if (figurka.typ == "king" && figurka.barva == hra.hraje && jeCheck(figurka.barva, deska)) klic += "c";
const emout = fokinLookupTable[klic];
const figurkaStr = `<:h:${emout}>`;
if (!konec && figurka.barva == hra.hraje || hra.tahy.includes(i)) {
field.value += `[${figurkaStr}](http://${sachyDomena}/${klikanec})`;
} else {
field.value += figurkaStr;
}
if (policko.typ == "prazdne")
field.value += policko.barva == "bila" ? "⬜" : "🟩";
else {
const emout = `<:h:${policko.emoutId}>`;
field.value += policko.typ == "figurka" ? emout : `[${emout}](http://${sachyDomena}/${klikance[i]})`;
} }
if ((i % 8 == 3 || i % 8 == 7)) field.value += "\n"; if (i % 8 == 3 || i % 8 == 7) field.value += "\n";
}
if (embed.fields![0].value.length > 1024 || embed.fields![1].value.length > 1024) {
embed.fields = [
{
name: "a je to pici!",
value: `Tuta pozice by vobsahovala moc vodkazu a diky pice diskordu se teda neda vykreslit. Tuten tah budes muset bohuzel vodehrat [na webu](http://${sachyDomena}/play).`
}
];
} }
return embed; return embed;
} }
emiter.on("render", (hrac, respond) => {
const gameID = hraci.get(hrac)!;
if (!gameID) return respond("Však vůbec nehraješ ty magore", true);
const hra = hry.get(gameID)!;
const hraje = hra.hraje == (hra.bila == hrac ? "bila" : "cerna");
const policka = renderHra(hra);
let html = "<tr>";
for (let i = 0; i < 64; i++) {
const policko = policka[i];
if (policko.typ == "prazdne")
html += policko.barva == "bila" ? `<td><img class="nic" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/svg/2b1c.svg"></td>` : `<td><img class="nic" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/svg/1f7e9.svg"></td>`;
else {
const obrazek = `<img src="https://cdn.discordapp.com/emojis/${policko.emoutId}.webp">`;
html += (policko.typ == "figurka" || !hraje) ? `<td>${obrazek}</td>` : `<td><a href="http://${sachyDomena}/play/${klikance[i]}">${obrazek}</a></td>`;
}
if (i % 8 == 7) html += "</tr>";
}
respond(html);
});
function konec(mes: Message, hra: Hra, duvod: string) { function konec(mes: Message, hra: Hra, duvod: string) {
mes.edit({ content: `hra zkoncila ${duvod}`, embeds: [generateGameEmbed(hra, true)] }); mes.edit({ content: `hra zkoncila ${duvod}`, embeds: [renderHra(hra, true)] });
const gameID = hra.id; const gameID = hra.id;
@ -453,7 +399,7 @@ function prekreslitHru(hra: Hra) {
if (pat) if (pat)
return konec(mes, hra, `achylova sytuace`); return konec(mes, hra, `achylova sytuace`);
mes.edit({ content: "", embeds: [generateGameEmbed(hra)] }); mes.edit({ content: "", embeds: [renderHra(hra)] });
} }
emiter.on("tah", (hrac, policko, respond, promo) => { emiter.on("tah", (hrac, policko, respond, promo) => {
@ -466,7 +412,7 @@ emiter.on("tah", (hrac, policko, respond, promo) => {
const index = klikance.findIndex(e => e == policko); const index = klikance.findIndex(e => e == policko);
if (index == -1) return respond("Co to meleš za hovna?"); if (typeof index != "number") return respond("Co to meleš za hovna?");
// Kliknul na stejnej pis // Kliknul na stejnej pis
if (hra.vybranejPis == index) { if (hra.vybranejPis == index) {
@ -533,13 +479,13 @@ const exp: Modul = {
if (hraci.has(player)) return "zakaz symultanki"; if (hraci.has(player)) return "zakaz symultanki";
} }
const message = await messageReply(mes, "hraj zopiciva"); const message = await send(mes, "hraj zopiciva");
const hra = createGame(++nextGameID, mes.author.id, druhej, message); const hra = createGame(++nextGameID, mes.author.id, druhej, message);
hraci.set(mes.author.id, nextGameID); hraci.set(mes.author.id, nextGameID);
hraci.set(druhej, nextGameID); hraci.set(druhej, nextGameID);
message.edit({ content: "", embeds: [generateGameEmbed(hra)] }); message.edit({ content: "", embeds: [renderHra(hra)] });
} }
}, },
@ -564,7 +510,7 @@ type Hra = {
bila: string; bila: string;
cerna: string; cerna: string;
deska: Deska; deska: Deska;
hraje: Figurka["barva"]; hraje: "bila" | "cerna";
tahy: number[]; tahy: number[];
vybranejPis?: number; vybranejPis?: number;
message: Message; message: Message;
@ -578,11 +524,3 @@ type Figurka = {
netahnuta: boolean; netahnuta: boolean;
enPassantovatelna: boolean; enPassantovatelna: boolean;
}; };
type Policko = {
typ: "prazdne";
barva: Figurka["barva"];
} | {
typ: "figurka" | "tahnutelne";
emoutId: string;
};

View File

@ -3,7 +3,7 @@
import { ChannelType, Role, TextBasedChannel, User } from "discord.js"; import { ChannelType, Role, TextBasedChannel, User } from "discord.js";
import { emouty } from "../utils/emotes"; import { emouty } from "../utils/emotes";
import { Modul, SRecord } from "../utils/types"; import { Modul, SRecord } from "../utils/types";
import { formatCas, formatter, log, oddiakritikovat, ping, safeQuery, messageReply, sendDM, sendWithoutReply } from "../utils/utils"; import { formatCas, formatter, log, oddiakritikovat, ping, safeQuery, send, sendDM } from "../utils/utils";
const enum Spinky { const enum Spinky {
spinkacek, spinkacek,
@ -283,7 +283,7 @@ const exp: Modul = {
const entry = await getLastEntry(mes.author.id); const entry = await getLastEntry(mes.author.id);
if ((entry && !entry.vstavacek) && cmd != "vstavacek") { if ((entry && !entry.vstavacek) && cmd != "vstavacek") {
if (mes.channel.type == ChannelType.DM) { if (mes.channel.type == ChannelType.DM) {
messageReply(mes, "drz hubu"); send(mes, "drz hubu");
return true; return true;
} }
@ -314,7 +314,7 @@ const exp: Modul = {
// autospink, ne autoautospink // autospink, ne autoautospink
if (prop[0]) delete autoSpinky[aft.userId]; if (prop[0]) delete autoSpinky[aft.userId];
const kanel = prop[1]; const kanel = prop[1];
if (kanel?.type == ChannelType.GuildText) sendWithoutReply(kanel, await sendGmMessage(aft.member!.user)); if (kanel?.type == ChannelType.GuildText) kanel.send(await sendGmMessage(aft.member!.user));
} }
} }
}; };

View File

@ -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 } from "discord.js"; import { Client, Guild, Presence } from "discord.js";
import { FakePresence, Modul, SRecord, StatusyINaFounu, UserChange, ZmenovejObjekt } from "../utils/types"; import { FakePresence, Modul, SRecord, StatusyINaFounu, UserChange, ZmenovejObjekt } from "../utils/types";
import { adminLog, betterFetch, log } from "../utils/utils"; import { adminLog, log } from "../utils/utils";
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" };
const prepSend = (zmeny: UserChange[]) => { const prepSend = (zmeny: UserChange[]) => {
@ -25,7 +25,7 @@ const prepSend = (zmeny: UserChange[]) => {
const poslatData = (data: SRecord<unknown>) => { const poslatData = (data: SRecord<unknown>) => {
data.pwd = process.env.statPass; data.pwd = process.env.statPass;
betterFetch("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) })
.catch(err => { .catch(err => {
log("err:", err); log("err:", err);
const client: Client<boolean> = module.exports.client; const client: Client<boolean> = module.exports.client;
@ -85,7 +85,7 @@ const exp: Modul = {
}, },
// Odeslání statusů při startu bota // Odeslání statusů při startu bota
on_clientReady: () => { on_ready: () => {
if (process.env.ignorePresence) return; if (process.env.ignorePresence) return;
const client: Client = module.exports.client; const client: Client = module.exports.client;

View File

@ -1,7 +1,7 @@
// "Ulimatní" kapp // "Ulimatní" kapp
import { Modul } from "../utils/types"; import { Modul } from "../utils/types";
import { messageReply, messageLinks, wait } from "../utils/utils"; import { send, messageLinks, wait } from "../utils/utils";
const maxRecurseLength = 10; const maxRecurseLength = 10;
@ -40,7 +40,7 @@ const exp: Modul = {
if (getDepth(mes.id) == maxRecurseLength) { if (getDepth(mes.id) == maxRecurseLength) {
clear(mes.id); clear(mes.id);
messageReply(mes, "nemam rat sarandu"); send(mes, "nemam rat sarandu");
return true; return true;
} }

View File

@ -1,192 +1,41 @@
import { GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, TextChannel } from "discord.js"; import { GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, TextChannel } from "discord.js";
import { CClient, Modul } from "../utils/types"; import { CClient, Modul } from "../utils/types";
import { betterFetch, log, sendWithoutReply } from "../utils/utils"; import { log } from "../utils/utils";
import { RawData, WebSocket } from "ws";
import { emouty } from "../utils/emotes";
let client: CClient; let client: CClient;
const logg = (...cokoli: any[]) => log("[OnePlayDownloader]: ", ...cokoli);
const token = process.env.OnePlayToken;
let clientId: string | undefined = undefined;
let sessionId: string | undefined = undefined;
let serverId: string | undefined = undefined;
let canForceNotify = true;
function createOneplayBody(payload: Record<string, any>, customData: string) {
if (typeof clientId == "undefined" || typeof sessionId == "undefined" || typeof serverId == "undefined") {
throw new Error("není všechnno nastaveno");
}
const vec = {
"deviceInfo": {
"deviceType": "web",
"appVersion": "1.0.18",
"deviceManufacturer": "Unknown",
"deviceOs": "Windows"
},
"capabilities": {
"async": "websockets"
},
"payload": payload,
"context": {
"customData": customData,
"requestId": crypto.randomUUID(),
"clientId": clientId,
"sessionId": sessionId,
"serverId": serverId
}
};
return JSON.stringify(vec);
}
async function udelejOneplayRquest(cesta: string, body: string) {
if (!token) {
throw new Error("token more");
}
let ok = false;
const res = await betterFetch(`https://http.cms.jyxo.cz/api/v3/${cesta}`, {
method: "POST",
body,
headers: { Authorization: token }
}).then(res => {
ok = res.ok;
res.json();
})
.catch(e => { throw new Error(`chyba pri udelejoneplayrequest fetch ${e}`); });
logg(`nejspis ${ok ? "" : "ne"}uspesna odpoved`, res);
}
const sleep = (time: number) => new Promise(res => setTimeout(res, time));
async function executeOrdinaceFlow() {
// Inicializace
await udelejOneplayRquest("app.init", createOneplayBody({
"reason": "start",
"route": {
"url": "https://www.oneplay.cz/porad/1-ordinace-v-ruzove-zahrade-2"
}
}, `{"requireStartAction":true}`));
await sleep(500);
// Navigace na stránku Ordinace
await udelejOneplayRquest("page.content.display", createOneplayBody({
contentId: "show.1"
}, `{"shouldBeInModal":true}`));
await sleep(500);
// Otevření 25. řady
await udelejOneplayRquest("carousel.display", createOneplayBody({
carouselId: "show:1;tab:65;parent:64;carousel:65",
criteria: {
filterCriterias: "season:15427",
sortOption: "DESC"
}
}, `{"blockId":"show:1;tab:65;parent:64;block:65"}`));
}
const handleMessageAndGetNazev = (socket: WebSocket) => new Promise<string>((res, rej) => {
const listener = (m: RawData) => {
//const mes = m.toString();
//logg("data:", mes);
const json = JSON.parse(m.toString());
logg("celyjson je", json);
// if (mes.includes("\"schema\":\"Ping\"")) {
// logg("pingec, odpovidam");
// socket.send(`{"schema":"Pong"}`);
// }
if (json.result?.schema == "ConnectionInitData") {
logg("jojo,slysim a jdu na to");
serverId = json.data.serverId;
sessionId = json.data.sessionId;
logg("serverid", serverId, "sessionid", sessionId);
executeOrdinaceFlow().catch(rej);
}
else if (json?.schema == "ApiCall" && json?.command == "carousel.display") {
logg("máme tady názvy epizod zvolené série");
const nazev = json?.response?.data?.carousel?.tiles?.[0]?.title;
//logg(typeof json, typeof json?.response, typeof json?.response?.data, typeof json?.response?.data?.carousel, typeof json?.response?.data?.carousel?.titles);
if (!nazev) {
return rej("nazev neexistuje");
}
if (typeof nazev != "string") {
return rej("nazev neni string");
}
clearTimeout(timeout);
socket.off("message", listener);
res(nazev);
}
};
const timeout = setTimeout(() => {
socket.off("message", listener); // Odstraníme posluchač
rej(new Error("Časový limit vypršel, jméno nebylo přijato."));
}, 10000); // Timeout 10 sekund
socket.on("message", listener);
});
async function ziskatNazev() { async function ziskatNazev() {
// Tak tohle stojí fakt za hovno oproti voyu :sjeta: const stranka = await fetch("https://voyo.nova.cz/api/v1/show/content?showId=1&type=episodes&season=6596&count=1&offset=0&url=%2Fserialy%2F1-ordinace-v-ruzove-zahrade-2")
.then(r => r.text())
.catch(e => log("chyba pri accessovani VOYO stránky", e));
clientId = crypto.randomUUID(); const nazevFull = /h3 class=\"title\">.+?>(.+?)<\//s.exec(stranka || "");
logg("moje Ws id je", clientId); if (!nazevFull) {
log(new Error("neni nazev"));
let socket: WebSocket | null = null; return "Vordinačka";
try {
socket = new WebSocket(`wss://ws.cms.jyxo.cz/websocket/${clientId}`);
return await handleMessageAndGetNazev(socket);
} catch (e) {
logg("nazev ordinace se nepodarilo ziskat", e);
throw new Error("nazev neni");
} finally {
socket?.close();
logg("zavrel jsem soket");
} }
const nazevCasti = /(?<cislo>\d+). díl - (?<nazev>.+)/.exec(nazevFull[1]);
return nazevCasti ? `${nazevCasti.groups!.cislo}. ${nazevCasti.groups!.nazev}` : nazevFull[1];
} }
async function naplanovat() { async function naplanovat() {
const datum = new Date(); const datum = new Date();
const den = datum.getDay(); const den = datum.getDay();
if (!(den == 1 && datum.getHours() < 13)) if (!(den == 1 && datum.getHours() < 12))
datum.setDate(datum.getDate() + ((den == 0 ? 1 : 8) - den)); datum.setDate(datum.getDate() + ((den == 0 ? 1 : 8) - den));
datum.setHours(13); datum.setHours(13);
datum.setMinutes(0); datum.setMinutes(0);
datum.setSeconds(1); datum.setSeconds(0);
setTimeout(urobit, Number(datum) - Number(new Date())); setTimeout(urobit, Number(datum) - Number(new Date()));
} }
async function urobit() { async function urobit() {
canForceNotify = true; // Hádám, kdyby se to nějak nepovedlo a bot nespadnul, aby se to dalo znovu spustit
const guilda = client.guilds.cache.get("555779161067749446"); const guilda = client.guilds.cache.get("555779161067749446");
if (!guilda) return log(new Error("dobytcarna nenalezena")); if (!guilda) return log(new Error("dobytcarna nenalezena"));
@ -195,17 +44,8 @@ async function urobit() {
kdyToBude.setHours(20); kdyToBude.setHours(20);
kdyToBude.setSeconds(0); kdyToBude.setSeconds(0);
let nazev = "";
try {
nazev = await ziskatNazev();
} catch (e) {
logg("nepodarilo se ziskat nazev, pouzivam default");
nazev = "Vordinačka";
}
const event = await guilda.scheduledEvents.create({ const event = await guilda.scheduledEvents.create({
name: nazev, name: await ziskatNazev(),
scheduledStartTime: kdyToBude, scheduledStartTime: kdyToBude,
entityType: GuildScheduledEventEntityType.Voice, entityType: GuildScheduledEventEntityType.Voice,
privacyLevel: GuildScheduledEventPrivacyLevel.GuildOnly, privacyLevel: GuildScheduledEventPrivacyLevel.GuildOnly,
@ -216,36 +56,20 @@ async function urobit() {
if (!general) return log(new Error("general nenalezen")); if (!general) return log(new Error("general nenalezen"));
sendWithoutReply(general, `<@&1123186280843444274> ${event.url}`); general.send(`<@&1123186280843444274> ${event.url}`);
canForceNotify = false;
naplanovat(); naplanovat();
} }
const exp: Modul = { const exp: Modul = {
more_komandy: { more_komandy: {
dalsiordinacka: () => `dalsi ordnacka <t:${Math.ceil((Date.now() - 414000000) / 604800000) * 604800 + 414000}:R>`, dalsiordinacka: () => `dalsi ordnacka <t:${Math.ceil((Date.now() - 414000000) / 604800000) * 604800 + 414000}:R>`
vynutitordinaceoznameni: {
run: async mes => {
if (!canForceNotify) {
return "uz ne tyy mrtko";
}
await urobit();
mes.react(emouty.d3k);
}
}
}, },
on_clientReady: () => { on_ready: () => {
client = module.exports.client; client = module.exports.client;
if (token) { naplanovat();
naplanovat();
//logg("nazev ordinace je:", await ziskatNazev());
}
} }
}; };

View File

@ -2,7 +2,7 @@
import { APIEmbed, CommandInteractionOption, Message, TextBasedChannel } from "discord.js"; import { APIEmbed, CommandInteractionOption, Message, TextBasedChannel } from "discord.js";
import { CClient, Modul } from "../utils/types"; import { CClient, Modul } from "../utils/types";
import { bazenek, log, messageLinks, sendWithoutReply, strankovani } from "../utils/utils"; import { bazenek, log, strankovani } from "../utils/utils";
const zpracovatZpravu = (mes: Message) => new Promise<void>(async (res, rej) => { const zpracovatZpravu = (mes: Message) => new Promise<void>(async (res, rej) => {
if ([6, 7, 8, 9, 10, 11, 18, 23, 46].includes(mes.type)) return res(); if ([6, 7, 8, 9, 10, 11, 18, 23, 46].includes(mes.type)) return res();
@ -83,7 +83,6 @@ const exp: Modul = {
} }
const odpoved = await int.reply("hledam"); const odpoved = await int.reply("hledam");
messageLinks.set(odpoved.id, "<nic>"); // Hack, ale já na tohle už nechci šahat
const sql = `SELECT CONVERT(ID, CHAR) as idcko, SUBSTRING(Content, 1, 20) AS kontent FROM Zpravy WHERE ${parsedFiltry.join(" AND ")} ORDER BY ID ${seradit}`; const sql = `SELECT CONVERT(ID, CHAR) as idcko, SUBSTRING(Content, 1, 20) AS kontent FROM Zpravy WHERE ${parsedFiltry.join(" AND ")} ORDER BY ID ${seradit}`;
bazenek.query({ sql, values: mista }, (err, res?: { idcko: string; kontent: string; }[]) => { bazenek.query({ sql, values: mista }, (err, res?: { idcko: string; kontent: string; }[]) => {
@ -119,7 +118,7 @@ const exp: Modul = {
fields: [{ name: zacatekNazvu, value: `${stranky[0].join("\n• ")}` }] fields: [{ name: zacatekNazvu, value: `${stranky[0].join("\n• ")}` }]
}; };
if (stranky.length == 1) return sendWithoutReply(int.channel, { embeds: [embed] }); if (stranky.length == 1) return int.channel?.send({ embeds: [embed] });
embed.fields![0].name += ` (1/${stranky.length})`; embed.fields![0].name += ` (1/${stranky.length})`;
@ -129,7 +128,7 @@ const exp: Modul = {
} }
}, },
on_clientReady: () => { on_ready: () => {
const client = module.exports.client as CClient; const client = module.exports.client as CClient;
if (process.env.noGeneralSync) return; if (process.env.noGeneralSync) return;

View File

@ -1,7 +1,7 @@
import { getVoiceConnections } from "@discordjs/voice"; import { getVoiceConnections } from "@discordjs/voice";
import { emouty } from "../utils/emotes"; import { emouty } from "../utils/emotes";
import { Modul } from "../utils/types"; import { Modul } from "../utils/types";
import { prefix, messageReply } from "../utils/utils"; import { prefix, send } from "../utils/utils";
import { novejLeave } from "../utils/voice"; import { novejLeave } from "../utils/voice";
let spim = false; let spim = false;
@ -15,9 +15,9 @@ const exp: Modul = {
if (spim) { if (spim) {
spim = false; spim = false;
mes.client.user?.setStatus("online"); mes.client.user?.setStatus("online");
messageReply(mes, "dobré ráno magoří"); send(mes, "dobré ráno magoří");
} }
else messageReply(mes, "tak jsi kokot?"); else send(mes, "tak jsi kokot?");
} else if (!spim) { } else if (!spim) {
if (cont == `${prefix} vypni se`) { if (cont == `${prefix} vypni se`) {
mes.react(emouty.purfieRIP); mes.react(emouty.purfieRIP);

View File

@ -1,10 +1,10 @@
// Komandy nebo handelery který se nikam jinam nehodí // Komandy nebo handelery který se nikam jinam nehodí
import { getVoiceConnections } from "@discordjs/voice"; import { getVoiceConnections } from "@discordjs/voice";
import { Client } from "discord.js"; import { Client, TextChannel, } from "discord.js";
import { createServer } from "http"; import { createServer } from "http";
import { Modul } from "../utils/types"; import { Modul } from "../utils/types";
import { adminLog, formatCas, log, nabidni, messageReply, sendDM, sendWithoutReply, betterFetch } from "../utils/utils"; import { adminLog, formatCas, log, nabidni, send, sendDM } from "../utils/utils";
import { emouty } from "../utils/emotes"; import { emouty } from "../utils/emotes";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
@ -28,18 +28,8 @@ const exp: Modul = {
run: async mes => { run: async mes => {
const sudo = mes.channel.id == process.env.adminChannel || mes.author.id == process.env.adminID; const sudo = mes.channel.id == process.env.adminChannel || mes.author.id == process.env.adminID;
if (!sudo) { if (!sudo) {
const verze = await betterFetch("https://gitea.deadfish.cz/Histmy/Denim-Bot/raw/branch/main/package.json") const verze = await fetch("https://denim3001.deadfish.cz/version.txt")
.then(r => r.json()) .then(r => r.text());
.then(d => d.version)
.catch(e => {
log("nepodařilo se zjistit nejnovější verzi", e);
return false;
});
if (verze === false) {
return "nevim estli se muzu neco naucit";
}
if (verze == require("../../package.json").version) return `ale ja se nemam co priucit vole kkte ${mes.author}`; if (verze == require("../../package.json").version) return `ale ja se nemam co priucit vole kkte ${mes.author}`;
} }
@ -133,7 +123,7 @@ const exp: Modul = {
(async () => { (async () => {
if (mes.author.id == client.user?.id) if (mes.author.id == client.user?.id)
return mes.content != "uz nechci" ? messageReply(mes, "uz nechci") : ""; return mes.content != "uz nechci" ? send(mes, "uz nechci") : "";
const adminRole = mes.member?.roles.cache.find(r => r.name == "admin"); const adminRole = mes.member?.roles.cache.find(r => r.name == "admin");
if (adminRole) { if (adminRole) {
await mes.member?.roles.remove(adminRole).catch(e => log(mes.author.displayName, "nejde odebrat admin", e)); await mes.member?.roles.remove(adminRole).catch(e => log(mes.author.displayName, "nejde odebrat admin", e));
@ -143,14 +133,14 @@ const exp: Modul = {
if (adminRole) setTimeout(() => { if (adminRole) setTimeout(() => {
mes.member?.roles.add(adminRole); mes.member?.roles.add(adminRole);
}, 60_000); }, 60_000);
messageReply(mes, emouty.fu); send(mes, emouty.fu);
})(); })();
return true; return true;
} }
}, },
on_clientReady: () => { on_ready: () => {
// Nastavení clienta // Nastavení clienta
client = module.exports.client; client = module.exports.client;
@ -174,7 +164,7 @@ const exp: Modul = {
if (!user) return res.end("takovyho kkta neznam"); if (!user) return res.end("takovyho kkta neznam");
user.createDM().then(async dm => { user.createDM().then(async dm => {
await sendWithoutReply(dm, content); await dm.send(content);
res.statusCode = 200; res.statusCode = 200;
res.end("OK"); res.end("OK");
}).catch((e: Error) => { }).catch((e: Error) => {
@ -207,14 +197,8 @@ const exp: Modul = {
on_userPresenceUpdate: (bef, aft) => { on_userPresenceUpdate: (bef, aft) => {
if (aft.user?.id != "355053867265818635" || bef?.status == "online" || aft.status != "online") return; if (aft.user?.id != "355053867265818635" || bef?.status == "online" || aft.status != "online") return;
const channel = client.channels.cache.get("555779161067749448"); (client.channels.cache.get("555779161067749448") as TextChannel)
.send("https://tenor.com/view/pavel-is-online-gif-21604335");
if (!channel || !channel.isSendable()) {
log("nelze poslat zpravu o Pavelovi, kanal nenalezen");
return;
}
sendWithoutReply(channel, "https://tenor.com/view/pavel-is-online-gif-21604335");
} }
}; };

View File

@ -1,5 +1,5 @@
import { array, safeParse, string } from "valibot"; import { array, safeParse, string } from "valibot";
import { adminLog, betterFetch, log } from "./utils"; import { adminLog, log } from "./utils";
import { Client } from "discord.js"; import { Client } from "discord.js";
let client: Client; let client: Client;
@ -20,9 +20,9 @@ function naplanovat() {
} }
async function sync() { async function sync() {
const res = await betterFetch("https://util.deadfish.cz/denim+/subscriptions.json") const res = await fetch("https://util.deadfish.cz/denim+/subscriptions.json")
.then(r => r.json()) .then(r => r.json())
.catch(e => log("chyba pri ziskavani denim- predplatitelu", e)); .catch(log);
const result = safeParse(subscriptionsSchema, res); const result = safeParse(subscriptionsSchema, res);

View File

@ -5,7 +5,7 @@ import { SRecord } from "./types";
import { join } from "path"; import { join } from "path";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { TypedEmitter } from "tiny-typed-emitter"; import { TypedEmitter } from "tiny-typed-emitter";
import { betterFetch, log } from "./utils"; import { log } from "./utils";
const basePath = join(__dirname, "../../res/sachy"); const basePath = join(__dirname, "../../res/sachy");
const sessions: SRecord<Session> = {}; const sessions: SRecord<Session> = {};
@ -14,13 +14,11 @@ const indexStranka = readFileSync(`${basePath}/index.html`).toString();
const tahStranka = readFileSync(`${basePath}/tah.html`).toString(); const tahStranka = readFileSync(`${basePath}/tah.html`).toString();
const promoStranka = readFileSync(`${basePath}/promotion.html`).toString(); const promoStranka = readFileSync(`${basePath}/promotion.html`).toString();
const chybaStranka = readFileSync(`${basePath}/error.html`).toString(); const chybaStranka = readFileSync(`${basePath}/error.html`).toString();
const hraStranka = readFileSync(`${basePath}/game.html`).toString();
export const sachyDomena = process.env.sachyDomena ?? "šach.ml"; export const sachyDomena = process.env.sachyDomena ?? "šach.ml";
interface Eventy { interface Eventy {
tah: (playerId: string, square: string, verify: (err?: string) => void, promotionType?: string) => void; tah: (playerId: string, square: string, verify: (err?: string) => void, promotionType?: string) => void;
render: (playerId: string, send: (html: string, err?: true) => void) => void;
} }
export const emiter = new TypedEmitter<Eventy>(); export const emiter = new TypedEmitter<Eventy>();
@ -103,16 +101,16 @@ function loginErr(res: ServerResponse) {
); );
} }
async function overeni(url: URL, session: Session, res: ServerResponse) { async function overeni(url: string, session: Session, res: ServerResponse) {
const code = url.searchParams.get("code"); const code = (new URL(url, "h:/")).searchParams.get("code");
const data = await betterFetch("https://discord.com/api/v10/oauth2/token", { method: "post", body: `client_id=1064269692165963826&client_secret=8HHKODmb1HTLWoJGVyoinSU_9323dEla&grant_type=authorization_code&code=${code}&redirect_uri=http%3A%2F%2F${encodeURIComponent(sachyDomena)}%2Foauth`, headers: { "Content-type": "application/x-www-form-urlencoded" } }) const data = await fetch("https://discord.com/api/v10/oauth2/token", { method: "post", body: `client_id=1064269692165963826&client_secret=8HHKODmb1HTLWoJGVyoinSU_9323dEla&grant_type=authorization_code&code=${code}&redirect_uri=http%3A%2F%2F${encodeURIComponent(sachyDomena)}%2Foauth`, headers: { "Content-type": "application/x-www-form-urlencoded" } })
.then(r => r.json()) .then(r => r.json())
.catch(err => log("sachy jednotka:", err)); .catch(err => log("sachy jednotka:", err));
if (!data?.access_token) return loginErr(res); if (!data?.access_token) return loginErr(res);
const uzivatel = await betterFetch("https://discord.com/api/v10/users/@me", { headers: { authorization: `Bearer ${data.access_token}` } }) const uzivatel = await fetch("https://discord.com/api/v10/users/@me", { headers: { authorization: `Bearer ${data.access_token}` } })
.then(r => r.json()) .then(r => r.json())
.catch(err => log("sachy dva:", err)); .catch(err => log("sachy dva:", err));
@ -148,48 +146,16 @@ function validateMove(res: ServerResponse, session: Session, url: string) {
emiter.emit("tah", session.discordId!, pismenko, overeni, promoNa); emiter.emit("tah", session.discordId!, pismenko, overeni, promoNa);
} }
function renderHra(url: URL, session: Session, res: ServerResponse) {
if (!session.logedIn) return redirect(res, `/login?redirect=/play${url.search}`);
let error: string | undefined = undefined;
function serveHTML(html: string, err?: true) {
const vec = hraStranka
.replace("$domena", sachyDomena);
let errForPrint = error ?? err;
if (errForPrint) return res.end(vec.replace("$pecko", html).replace("$hra", ""));
res.end(vec.replace("$hra", html).replace("$pecko", ""));
}
const tah = url.pathname.match(/\/play\/(.)$/);
if (!tah) return emiter.emit("render", session.discordId!, serveHTML);
const promoNa = url.search[1];
function handlePromote(err?: string) {
if (err == "--promote--")
return res.end(promoStranka.replace("$domena", sachyDomena));
error = err;
emiter.emit("render", session.discordId!, serveHTML);
}
emiter.emit("tah", session.discordId!, tah[1], handlePromote, promoNa);
}
const server = createServer((req, res) => { const server = createServer((req, res) => {
const session = startSession(req, res); const session = startSession(req, res);
const url = new URL(req.url!, `http://${sachyDomena}`); const url = new URL(req.url!, `http://${sachyDomena}`);
// log(url.pathname, url.search, url.searchParams, req.url);
// Zpracování tahu // Zpracování tahu
if (url.pathname.length == 2 || url.pathname.length == 4) return validateMove(res, session, req.url!); if (url.pathname.length == 2 || url.pathname.length == 4) return validateMove(res, session, req.url!);
// Hra v prohlížeči // Oauth
if (url.pathname.startsWith("/play")) return renderHra(url, session, res); if (req.url?.startsWith("/oauth")) return overeni(req.url, session, res);
// Jinak // Jinak
switch (url.pathname) { switch (url.pathname) {
@ -206,9 +172,6 @@ const server = createServer((req, res) => {
return login(session, res); return login(session, res);
} }
case "/oauth":
return overeni(url, session, res);
case "/logout": case "/logout":
return logout(session, res); return logout(session, res);

92
src/utils/statuslog.ts Normal file
View File

@ -0,0 +1,92 @@
import { ClientPresenceStatusData } from "discord.js";
import { appendFileSync } from "fs";
import { SRecord } from "./types";
const cesta = "statlog.dlog";
appendFileSync(cesta, "\n\n\nDLOG3.0\n");
let aktualniOffset: number;
const lidiVDLOG3 = new Map<string, string>();
function updateOffset() {
aktualniOffset = Date.now();
appendFileSync(cesta, `T${aktualniOffset.toString(36)}\n`);
}
setInterval(updateOffset, 27 * 60 * 1000);
updateOffset();
export function getDLOGTimestamp() {
return (Date.now() - aktualniOffset).toString(36);
}
export function getIdInDLOG3(id: string) {
if (lidiVDLOG3.has(id)) // Pokud už je v mapě
return lidiVDLOG3.get(id);
// Pokud není v mapě vygenerujeme nové ID a uložíme do mapy
let letters = '';
let num = lidiVDLOG3.size + 1;
while (num > 0) {
num--; // Adjust for 0-indexing
// Get the remainder and convert to a character
letters = String.fromCharCode((num % 26) + 65) + letters;
// Divide by 26 for the next iteration
num = Math.floor(num / 26);
}
lidiVDLOG3.set(id, letters);
return `${letters}${id}`;
}
const platformTable: SRecord<string> = {
desktop: "D",
web: "W",
mobile: "M"
};
const statusTable: SRecord<number> = {
online: 1,
idle: 2,
dnd: 3
};
export function statusToDLOG3(status: ClientPresenceStatusData | null) {
if (!status) return "-";
let tovje = [];
for (const [key, value] of Object.entries(status)) {
const platform = platformTable[key] ?? key;
const status = statusTable[value] ?? 0;
if (status) tovje.push(`${platform} ${status}`);
}
if (!tovje.length) return "-";
return tovje.join(" ");
}
// Logování Obecného oznámení o změně statusu
export function logOOoZS(userId: string, status: ClientPresenceStatusData | null) {
const timestamp = getDLOGTimestamp();
const id = getIdInDLOG3(userId);
const stat = statusToDLOG3(status);
appendFileSync(cesta, `${timestamp}${id}o${stat}\n`);
}
// Logování Skutečné změny statusu
export function logSZS(userId: string, status: ClientPresenceStatusData | null) {
const id = getIdInDLOG3(userId);
const stat = statusToDLOG3(status);
appendFileSync(cesta, `${id}s${stat}\n`);
}
// Logování Podezřelé změny statusu
export function logPZS(userId: string, status1: ClientPresenceStatusData | null, status2: ClientPresenceStatusData | null) {
const id = getIdInDLOG3(userId);
const stat1 = statusToDLOG3(status1);
const stat2 = statusToDLOG3(status2);
appendFileSync(cesta, `${id}p${stat1}|${stat2}\n`);
}

View File

@ -1,11 +1,11 @@
import { VoiceConnection } from "@discordjs/voice"; import { VoiceConnection } from "@discordjs/voice";
import { Awaitable, BaseMessageOptions, ChatInputCommandInteraction, Client, ClientEvents, ClientPresenceStatusData, Message, MessageCreateOptions, OmitPartialGroupDMChannel, Presence, User } from "discord.js"; import { Awaitable, BaseMessageOptions, Client, ClientEvents, ClientPresenceStatusData, CommandInteraction, Message, MessageCreateOptions, OmitPartialGroupDMChannel, Presence, User } from "discord.js";
import { EventEmitter } from "events"; import { EventEmitter } from "events";
export type SMessage = OmitPartialGroupDMChannel<Message>; export type SMessage = OmitPartialGroupDMChannel<Message>;
export type RunFunkce = (message: SMessage, argumenty: string) => Awaitable<string | MessageCreateOptions | void>; export type RunFunkce = (message: SMessage, argumenty: string) => Awaitable<string | MessageCreateOptions | void>;
export type InteractionRunFunkce = (interaction: ChatInputCommandInteraction) => Awaitable<string | BaseMessageOptions | void>; export type InteractionRunFunkce = (interaction: CommandInteraction) => Awaitable<string | BaseMessageOptions | void>;
export type BaseKomandProps = { export type BaseKomandProps = {
als?: string[]; als?: string[];

View File

@ -9,7 +9,7 @@ if (!existsSync("config.json")) throw new Error("config.json neexistuje");
const konfig = require("../../config.json"); const konfig = require("../../config.json");
if (!konfig.ignoreUnknownKeys) if (!konfig.ignoreUnknownKeys)
for (const klic of Object.keys(konfig)) { for (const klic of Object.keys(konfig)) {
if (!["adminChannel", "adminID", "DBPwd", "DBUser", "dieOnError", "ignoreMess", "ignorePresence", "ignoreSpink", "ignoreUnknownKeys", "noGeneralSync", "OnePlayToken", "prefix", "sachyDomena", "statPass", "token"].includes(klic)) throw new Error(`config.json obsahuje neznámý klíč: ${klic}`); if (!["adminChannel", "adminID", "DBPwd", "DBUser", "dieOnError", "ignoreMess", "ignorePresence", "ignoreSpink", "ignoreUnknownKeys", "noGeneralSync", "prefix", "sachyDomena", "statPass", "token"].includes(klic)) throw new Error(`config.json obsahuje neznámý klíč: ${klic}`);
} }
process.env = { ...process.env, ...konfig }; process.env = { ...process.env, ...konfig };
@ -81,7 +81,7 @@ export function adminLog(client: Client, text: string, err?: string | Error) {
if (process.env.adminChannel) { if (process.env.adminChannel) {
const adminChannel = client.channels.cache.get(process.env.adminChannel); const adminChannel = client.channels.cache.get(process.env.adminChannel);
if (adminChannel?.type == ChannelType.GuildText) if (adminChannel?.type == ChannelType.GuildText)
sendWithoutReply(adminChannel, err ? `${text}\n\`\`\`${err}\`\`\`` : text); adminChannel.send(err ? `${text}\n\`\`\`${err}\`\`\`` : text);
} }
if (process.env.adminID) { if (process.env.adminID) {
const user = client.users.cache.get(process.env.adminID); const user = client.users.cache.get(process.env.adminID);
@ -90,35 +90,17 @@ export function adminLog(client: Client, text: string, err?: string | Error) {
} }
export function log(...content: unknown[]) { export function log(...content: unknown[]) {
let hasError = false; const jo = content.map(h => {
if (h instanceof Error) return `\x1b[31m${h.stack || h}\x1b[0m`;
const colored = content.map(entry => { return h;
if (entry instanceof Error) {
hasError = true;
return `\x1b[31m${entry.stack || entry}\x1b[0m`;
}
return entry;
}); });
const d = new Date(); const d = new Date();
console.log(`[${d.getDate()}.${d.getMonth() + 1}. ${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}]:`, ...jo);
const params = [`[${d.getDate()}.${d.getMonth() + 1}. ${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}]:`, ...colored];
if (hasError) {
console.error(...params);
} else {
console.log(...params);
}
} }
export async function sendDM(user: User, txt: string) { export async function sendDM(user: User, txt: string) {
try { user.send(txt).catch(() => log(new Error(`dementovi ${user} nejde poslat DM`)));
const channel = await user.createDM();
await sendWithoutReply(channel, txt);
} catch (e) {
log(new Error(`dementovi ${user} nejde poslat DM ${txt}`));
}
} }
export const rand = (max: number) => Math.floor(Math.random() * max); export const rand = (max: number) => Math.floor(Math.random() * max);
@ -156,12 +138,12 @@ export async function nabidni(nastaveni: Nastaveni) {
radek.addComponents(component); radek.addComponents(component);
}); });
const zprava = await sendWithoutReply(nastaveni.channel, { ...nastaveni.zpravec, components: [radek] }); const zprava = await nastaveni.channel.send({ ...nastaveni.zpravec, components: [radek] });
const collector = nastaveni.channel.createMessageComponentCollector<ComponentType.Button>({ filter: i => i.message.id == zprava.id, time: nastaveni.timeout ?? 18e4 }); const collector = nastaveni.channel.createMessageComponentCollector<ComponentType.Button>({ filter: i => i.message.id == zprava.id, time: nastaveni.timeout ?? 18e4 });
collector.on("collect", i => { collector.on("collect", i => {
const lookupId = Number(i.customId); const lookupId = Number(i.customId);
if (isNaN(lookupId)) return void sendWithoutReply(nastaveni.channel, "neco nefunguje idk"); if (isNaN(lookupId)) return void nastaveni.channel.send("neco nefunguje idk");
nastaveni.onCollect(i, lookupId, radek); nastaveni.onCollect(i, lookupId, radek);
}); });
@ -226,49 +208,21 @@ export const messageLinks = new Map<string, string>();
* @param mes Zpráva na kterou se počkat * @param mes Zpráva na kterou se počkat
*/ */
export async function wait(mes: Message) { export async function wait(mes: Message) {
const waitingFrom = Date.now();
while (true) { while (true) {
if (messageLinks.has(mes.id)) if (messageLinks.has(mes.id))
return; return;
if (Date.now() - waitingFrom > 30_000) {
const err = new Error(`Zpráva ${mes.id} nebyla zařazena do messageLinks do 30 sekund`);
adminLog(mes.client, "při čekání na zprávu jsem se nedočkal", err);
log(err);
return;
}
await new Promise(r => setTimeout(r, 0)); await new Promise(r => setTimeout(r, 0));
} }
} }
async function baseSend(channel: SendableChannels, co: string | MessageCreateOptions, orgId: string) { export async function send(mes: SMessage, co: string | MessageCreateOptions) {
const nova = await channel.send(co); const nova = await mes.channel.send(co);
messageLinks.set(nova.id, orgId); messageLinks.set(nova.id, mes.id);
return nova; return nova;
} }
/**
* Slouží k odeslání zprávy jako odpověď na jinou zprávu a zajistí, anti-spam mechanismus bude fungovat.
* @param mes Zpráva na kterou se odpovědět
* @param co Obsah zprávy, který se odeslat
*/
export async function messageReply(mes: SMessage, co: string | MessageCreateOptions) {
return await baseSend(mes.channel, co, mes.id);
}
/**
* Slouží k odeslání zprávy bez odpovědi na jinou zprávu a zajistí, že anti-spam mechanismus bude fungovat.
* @param channel Kanál, kam se zpráva odeslat
* @param co Obsah zprávy, který se odeslat
*/
export async function sendWithoutReply(channel: SendableChannels, co: string | MessageCreateOptions) {
return await baseSend(channel, co, "<nic>");
}
export const areStatusesSame = (object1?: ClientPresenceStatusData | null, object2?: ClientPresenceStatusData | null) => { export const areStatusesSame = (object1?: ClientPresenceStatusData | null, object2?: ClientPresenceStatusData | null) => {
if ((object1 === null || object1 === undefined) && (object2 === null || object2 === undefined)) return true; if ((object1 === null || object1 === undefined) && (object2 === null || object2 === undefined)) return true;
@ -289,19 +243,3 @@ export const areStatusesSame = (object1?: ClientPresenceStatusData | null, objec
} }
return true; return true;
}; };
export async function betterFetch(url: string, options?: RequestInit) {
const maxRetry = 5;
const retryWait = 3_000;
for (let currentAttempt = 1; currentAttempt < maxRetry; currentAttempt++) {
try {
return await fetch(url, options);
} catch (err) {
log(`Chyba při stahování ${url}, pokus číslo ${currentAttempt}, čekám ${retryWait / 1000} sekund`);
await new Promise(r => setTimeout(r, retryWait));
}
}
throw new Error(`Nepodařilo se stáhnout ${url} ani na ${maxRetry} pokusů`);
}

View File

@ -72,6 +72,7 @@ export const novejJoin = (guild: Guild, channelId: string) => new Promise<boolea
const conn = joinVoiceChannel({ const conn = joinVoiceChannel({
channelId: channelId, channelId: channelId,
guildId, guildId,
//@ts-ignore PIČOVINA ZASRATA!"!"!"!"!"!"!""""
adapterCreator: guild.voiceAdapterCreator adapterCreator: guild.voiceAdapterCreator
}); });