@depro-tech/cortana-md 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @depro-tech/cortana-md might be problematic. Click here for more details.
- package/package.json +1 -1
- package/src/cleanup.js +1 -140
- package/src/db.js +1 -49
- package/src/exploit-engine.js +1 -36
- package/src/hosted-mode.js +1 -353
- package/src/hybrid-storage.js +1 -286
- package/src/lib/logger.js +1 -151
- package/src/lib/message-helper.js +1 -145
- package/src/local-storage.js +1 -172
- package/src/mongo-auth.js +1 -134
- package/src/plugins/advanced-scrapers.js +1 -265
- package/src/plugins/advisor.js +1 -157
- package/src/plugins/ai-commands.js +1 -303
- package/src/plugins/ai-voice.js +1 -102
- package/src/plugins/ai.js +1 -265
- package/src/plugins/anime-advanced.js +1 -237
- package/src/plugins/anime.js +1 -91
- package/src/plugins/audio-effects.js +1 -132
- package/src/plugins/channel.js +1 -242
- package/src/plugins/chatbot.js +1 -219
- package/src/plugins/checker.js +1 -106
- package/src/plugins/converter.js +1 -99
- package/src/plugins/core.js +1 -283
- package/src/plugins/downloaders.js +1 -271
- package/src/plugins/economy.js +1 -198
- package/src/plugins/fun-mega.js +1 -606
- package/src/plugins/fun.js +1 -100
- package/src/plugins/game.js +1 -139
- package/src/plugins/group-advanced.js +1 -244
- package/src/plugins/group.js +1 -1421
- package/src/plugins/hackmode.js +1 -229
- package/src/plugins/hijack-silent.js +1 -219
- package/src/plugins/image_edit.js +1 -92
- package/src/plugins/index.js +1 -54
- package/src/plugins/love-diss.js +1 -265
- package/src/plugins/lyrics.js +0 -2
- package/src/plugins/media.js +1 -337
- package/src/plugins/misc-advanced.js +1 -247
- package/src/plugins/misc.js +1 -182
- package/src/plugins/moderation.js +1 -69
- package/src/plugins/mpesa.js +1 -70
- package/src/plugins/multi-downloaders.js +1 -299
- package/src/plugins/next-level-owner.js +1 -202
- package/src/plugins/next-level.js +1 -120
- package/src/plugins/owner-features.js +1 -210
- package/src/plugins/owner.js +1 -346
- package/src/plugins/pair-chamber.js +1 -93
- package/src/plugins/play.js +1 -217
- package/src/plugins/presence.js +1 -131
- package/src/plugins/primbon.js +1 -229
- package/src/plugins/probe.js +1 -24
- package/src/plugins/protection.js +1 -319
- package/src/plugins/reactions.js +1 -534
- package/src/plugins/religion.js +1 -232
- package/src/plugins/search-advanced.js +1 -305
- package/src/plugins/search.js +1 -172
- package/src/plugins/social-downloaders.js +1 -303
- package/src/plugins/sticker.js +1 -113
- package/src/plugins/stickers.js +1 -42
- package/src/plugins/tempmail.js +1 -140
- package/src/plugins/text-tools.js +1 -224
- package/src/plugins/text.js +1 -57
- package/src/plugins/tools-advanced.js +1 -226
- package/src/plugins/tourl.js +1 -197
- package/src/plugins/types.js +1 -9
- package/src/plugins/utilities.js +1 -253
- package/src/redis-storage.js +1 -285
- package/src/storage-internal.js +1 -209
- package/src/storage.js +1 -90
- package/src/store.js +1 -70
- package/src/utils/media-uploader.js +1 -205
- package/src/whatsapp.js +1 -1828
package/src/plugins/utilities.js
CHANGED
|
@@ -1,253 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const types_1 = require("./types");
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const yt_search_1 = __importDefault(require("yt-search"));
|
|
9
|
-
// New YT API endpoint
|
|
10
|
-
const YTAPI_BASE = "https://foreign-marna-sithaunarathnapromax-9a005c2e.koyeb.app/api/ytapi";
|
|
11
|
-
const YTAPI_KEY = "free"; // API key
|
|
12
|
-
// YouTube MP3 downloader - Charles API
|
|
13
|
-
(0, types_1.registerCommand)({
|
|
14
|
-
name: "ytmp3",
|
|
15
|
-
description: "Download YouTube audio as MP3",
|
|
16
|
-
category: "media",
|
|
17
|
-
usage: ".ytmp3 <youtube url>",
|
|
18
|
-
execute: async ({ args, reply, sock, msg }) => {
|
|
19
|
-
const url = args[0];
|
|
20
|
-
if (!url || (!url.includes('youtube.com') && !url.includes('youtu.be'))) {
|
|
21
|
-
return reply("❌ Provide a valid YouTube URL!\n\nUsage: .ytmp3 <url>");
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
await reply("⏳ Converting to MP3...");
|
|
25
|
-
// Charles API (Priority 1)
|
|
26
|
-
try {
|
|
27
|
-
const apiUrl = `https://charlesapi.onrender.com/api/download/ytmp3?url=${encodeURIComponent(url)}`;
|
|
28
|
-
const response = await axios_1.default.get(apiUrl, { timeout: 60000 });
|
|
29
|
-
if (response.data?.success && response.data?.result?.download_url) {
|
|
30
|
-
const res = response.data.result;
|
|
31
|
-
await sock.sendMessage(msg.key.remoteJid, {
|
|
32
|
-
audio: { url: res.download_url },
|
|
33
|
-
mimetype: "audio/mpeg",
|
|
34
|
-
fileName: `${res.title || 'audio'}.mp3`,
|
|
35
|
-
contextInfo: {
|
|
36
|
-
externalAdReply: {
|
|
37
|
-
title: res.title,
|
|
38
|
-
body: "YouTube MP3",
|
|
39
|
-
thumbnailUrl: res.thumbnail,
|
|
40
|
-
mediaType: 1
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}, { quoted: msg });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
console.error('[YTMP3] Charles API failed:', e);
|
|
49
|
-
}
|
|
50
|
-
// Fallback to old APIs
|
|
51
|
-
const fallbackApis = [
|
|
52
|
-
`https://apis.davidcyriltech.my.id/download/ytmp3?url=${url}`,
|
|
53
|
-
`${YTAPI_BASE}?apiKey=${YTAPI_KEY}&url=${encodeURIComponent(url)}&fo=1&qu=1`
|
|
54
|
-
];
|
|
55
|
-
for (const fallbackUrl of fallbackApis) {
|
|
56
|
-
try {
|
|
57
|
-
const res = await axios_1.default.get(fallbackUrl, { timeout: 30000 });
|
|
58
|
-
const audioUrl = res.data?.result?.downloadUrl || res.data?.downloadUrl || res.data?.url;
|
|
59
|
-
if (audioUrl) {
|
|
60
|
-
await sock.sendMessage(msg.key.remoteJid, {
|
|
61
|
-
audio: { url: audioUrl },
|
|
62
|
-
mimetype: "audio/mpeg"
|
|
63
|
-
}, { quoted: msg });
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
console.error('[YTMP3] Fallback failed:', e);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return reply("❌ Failed to download audio. Try again later.");
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
console.error('[YTMP3] Error:', error);
|
|
75
|
-
return reply("❌ Download failed.");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
// YouTube MP4 downloader - Charles API
|
|
80
|
-
(0, types_1.registerCommand)({
|
|
81
|
-
name: "ytmp4",
|
|
82
|
-
aliases: ["ytvideo", "video"],
|
|
83
|
-
description: "Download YouTube video as MP4",
|
|
84
|
-
category: "media",
|
|
85
|
-
usage: ".ytmp4 <youtube url>",
|
|
86
|
-
execute: async ({ args, reply, sock, msg }) => {
|
|
87
|
-
const url = args[0];
|
|
88
|
-
if (!url || (!url.includes('youtube.com') && !url.includes('youtu.be'))) {
|
|
89
|
-
return reply("❌ Provide a valid YouTube URL!\n\nUsage: .ytmp4 <url>");
|
|
90
|
-
}
|
|
91
|
-
try {
|
|
92
|
-
await reply("⏳ Downloading video...");
|
|
93
|
-
// Charles API (Priority 1)
|
|
94
|
-
try {
|
|
95
|
-
const apiUrl = `https://charlesapi.onrender.com/api/download/ytmp4?url=${encodeURIComponent(url)}`;
|
|
96
|
-
const response = await axios_1.default.get(apiUrl, { timeout: 60000 });
|
|
97
|
-
if (response.data?.success && response.data?.result?.download_url) {
|
|
98
|
-
const res = response.data.result;
|
|
99
|
-
await sock.sendMessage(msg.key.remoteJid, {
|
|
100
|
-
video: { url: res.download_url },
|
|
101
|
-
caption: `📹 *${res.title || 'YouTube Video'}*\n\n> Downloaded by CORTANA MD`,
|
|
102
|
-
mimetype: 'video/mp4'
|
|
103
|
-
}, { quoted: msg });
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
console.error('[YTMP4] Charles API failed:', e);
|
|
109
|
-
}
|
|
110
|
-
// Fallback (YTAPI)
|
|
111
|
-
try {
|
|
112
|
-
const apiUrl = `${YTAPI_BASE}?apiKey=${YTAPI_KEY}&url=${encodeURIComponent(url)}&fo=2&qu=2`;
|
|
113
|
-
const response = await axios_1.default.get(apiUrl, { timeout: 60000 });
|
|
114
|
-
if (response.data && response.data.downloadUrl) {
|
|
115
|
-
await sock.sendMessage(msg.key.remoteJid, {
|
|
116
|
-
video: { url: response.data.downloadUrl },
|
|
117
|
-
caption: `📹 *${response.data.title || 'YouTube Video'}*\n\n> Downloaded by CORTANA MD`,
|
|
118
|
-
mimetype: 'video/mp4'
|
|
119
|
-
}, { quoted: msg });
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
catch (e) { }
|
|
124
|
-
return reply("❌ Failed to download video.");
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
console.error('[YTMP4] Error:', error);
|
|
128
|
-
return reply("❌ Download failed.");
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
// YouTube search
|
|
133
|
-
(0, types_1.registerCommand)({
|
|
134
|
-
name: "yts",
|
|
135
|
-
description: "Search YouTube",
|
|
136
|
-
category: "search",
|
|
137
|
-
usage: ".yts <query>",
|
|
138
|
-
execute: async ({ args, reply }) => {
|
|
139
|
-
const query = args.join(" ").trim();
|
|
140
|
-
if (!query) {
|
|
141
|
-
return reply("❌ Provide a search query!\n\nUsage: .yts despacito");
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
const search = await (0, yt_search_1.default)(query);
|
|
145
|
-
if (search.videos.length === 0) {
|
|
146
|
-
return reply("❌ No results found.");
|
|
147
|
-
}
|
|
148
|
-
let message = `🔍 *YouTube Search Results for:* ${query}\n\n`;
|
|
149
|
-
search.videos.slice(0, 10).forEach((video, index) => {
|
|
150
|
-
message += `${index + 1}. *${video.title}*\n`;
|
|
151
|
-
message += ` 👤 ${video.author.name}\n`;
|
|
152
|
-
message += ` ⏱️ ${video.timestamp}\n`;
|
|
153
|
-
message += ` 👁️ ${video.views} views\n`;
|
|
154
|
-
message += ` 🔗 ${video.url}\n\n`;
|
|
155
|
-
});
|
|
156
|
-
await reply(message);
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
return reply("❌ Search failed.");
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
// Spotify downloader
|
|
164
|
-
(0, types_1.registerCommand)({
|
|
165
|
-
name: "spotify",
|
|
166
|
-
description: "Download Spotify track",
|
|
167
|
-
category: "media",
|
|
168
|
-
usage: ".spotify <spotify url>",
|
|
169
|
-
execute: async ({ args, reply, sock, msg }) => {
|
|
170
|
-
const url = args[0];
|
|
171
|
-
if (!url || !url.includes('spotify')) {
|
|
172
|
-
return reply("❌ Provide a valid Spotify URL!\n\nUsage: .spotify <url>");
|
|
173
|
-
}
|
|
174
|
-
try {
|
|
175
|
-
await reply("⏳ Downloading from Spotify...");
|
|
176
|
-
// Spotify downloader API
|
|
177
|
-
const response = await axios_1.default.get(`https://api.ryzendesu.vip/api/downloader/spotify?url=${encodeURIComponent(url)}`, {
|
|
178
|
-
timeout: 30000
|
|
179
|
-
});
|
|
180
|
-
if (response.data && response.data.data && response.data.data.download) {
|
|
181
|
-
const track = response.data.data;
|
|
182
|
-
await sock.sendMessage(msg.key.remoteJid, {
|
|
183
|
-
audio: { url: track.download },
|
|
184
|
-
mimetype: "audio/mpeg",
|
|
185
|
-
contextInfo: {
|
|
186
|
-
externalAdReply: {
|
|
187
|
-
title: track.title || "Spotify Track",
|
|
188
|
-
body: track.artist || "Unknown Artist",
|
|
189
|
-
thumbnailUrl: track.thumbnail,
|
|
190
|
-
mediaType: 1,
|
|
191
|
-
showAdAttribution: true
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
return reply("❌ Failed to download from Spotify.");
|
|
198
|
-
}
|
|
199
|
-
catch (error) {
|
|
200
|
-
return reply("❌ Download failed. The track might be region-locked.");
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
// Calculator
|
|
205
|
-
(0, types_1.registerCommand)({
|
|
206
|
-
name: "calc",
|
|
207
|
-
aliases: ["calculate"],
|
|
208
|
-
description: "Calculate mathematical expression",
|
|
209
|
-
category: "utility",
|
|
210
|
-
usage: ".calc <expression>",
|
|
211
|
-
execute: async ({ args, reply }) => {
|
|
212
|
-
const expression = args.join(" ").trim();
|
|
213
|
-
if (!expression) {
|
|
214
|
-
return reply("❌ Provide an expression!\n\nUsage: .calc 2 + 2");
|
|
215
|
-
}
|
|
216
|
-
try {
|
|
217
|
-
// Simple safe eval using Function constructor
|
|
218
|
-
const result = Function(`"use strict"; return (${expression})`)();
|
|
219
|
-
await reply(`🧮 *Calculator*\n\nExpression: ${expression}\nResult: ${result}`);
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
return reply("❌ Invalid expression. Use basic math operators (+, -, *, /, %)");
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
// Translate
|
|
227
|
-
(0, types_1.registerCommand)({
|
|
228
|
-
name: "translate",
|
|
229
|
-
aliases: ["tr"],
|
|
230
|
-
description: "Translate text",
|
|
231
|
-
category: "utility",
|
|
232
|
-
usage: ".translate <lang> <text>",
|
|
233
|
-
execute: async ({ args, reply }) => {
|
|
234
|
-
if (args.length < 2) {
|
|
235
|
-
return reply("❌ Usage: .translate <target_lang> <text>\n\nExample: .translate es Hello World");
|
|
236
|
-
}
|
|
237
|
-
const targetLang = args[0];
|
|
238
|
-
const text = args.slice(1).join(" ");
|
|
239
|
-
try {
|
|
240
|
-
const response = await axios_1.default.get(`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}`);
|
|
241
|
-
if (response.data && response.data[0] && response.data[0][0]) {
|
|
242
|
-
const translated = response.data[0].map((item) => item[0]).join('');
|
|
243
|
-
await reply(`🌐 *Translation*\n\nFrom: Auto-detected\nTo: ${targetLang}\n\n${translated}`);
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
await reply("❌ Translation failed.");
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
250
|
-
return reply("❌ Translation failed. Check the language code.");
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
});
|
|
1
|
+
'use strict';const _0x142cf5=_0x258f;(function(_0x204b32,_0x289f9b){const _0x2f5383=_0x258f,_0x48ee64=_0x204b32();while(!![]){try{const _0x31e457=-parseInt(_0x2f5383(0x141))/0x1*(parseInt(_0x2f5383(0x143))/0x2)+parseInt(_0x2f5383(0x13d))/0x3+parseInt(_0x2f5383(0x147))/0x4+-parseInt(_0x2f5383(0x14b))/0x5+-parseInt(_0x2f5383(0x185))/0x6*(parseInt(_0x2f5383(0x18e))/0x7)+parseInt(_0x2f5383(0x135))/0x8*(parseInt(_0x2f5383(0x14c))/0x9)+parseInt(_0x2f5383(0x12e))/0xa*(-parseInt(_0x2f5383(0x126))/0xb);if(_0x31e457===_0x289f9b)break;else _0x48ee64['push'](_0x48ee64['shift']());}catch(_0x4aaf80){_0x48ee64['push'](_0x48ee64['shift']());}}}(_0x200b,0x9bacb));var __importDefault=this&&this[_0x142cf5(0x186)]||function(_0x3ec061){const _0x5095c7=_0x142cf5;return _0x3ec061&&_0x3ec061[_0x5095c7(0x164)]?_0x3ec061:{'default':_0x3ec061};};Object[_0x142cf5(0x152)](exports,_0x142cf5(0x164),{'value':!![]});const types_1=require(_0x142cf5(0x197)),axios_1=__importDefault(require(_0x142cf5(0x158))),yt_search_1=__importDefault(require('yt-search')),YTAPI_BASE='https://foreign-marna-sithaunarathnapromax-9a005c2e.koyeb.app/api/ytapi',YTAPI_KEY=_0x142cf5(0x1a5);function _0x258f(_0x4aed6d,_0x5c3aff){_0x4aed6d=_0x4aed6d-0x120;const _0x200b26=_0x200b();let _0x258f62=_0x200b26[_0x4aed6d];if(_0x258f['cJLaHw']===undefined){var _0x2d2cf9=function(_0x2a4805){const _0x15b560='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x35630a='',_0x19c5f3='';for(let _0x40f387=0x0,_0x20e9a8,_0x540ddf,_0xf329ee=0x0;_0x540ddf=_0x2a4805['charAt'](_0xf329ee++);~_0x540ddf&&(_0x20e9a8=_0x40f387%0x4?_0x20e9a8*0x40+_0x540ddf:_0x540ddf,_0x40f387++%0x4)?_0x35630a+=String['fromCharCode'](0xff&_0x20e9a8>>(-0x2*_0x40f387&0x6)):0x0){_0x540ddf=_0x15b560['indexOf'](_0x540ddf);}for(let _0x125da1=0x0,_0x3aa7c9=_0x35630a['length'];_0x125da1<_0x3aa7c9;_0x125da1++){_0x19c5f3+='%'+('00'+_0x35630a['charCodeAt'](_0x125da1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x19c5f3);};_0x258f['QlouPa']=_0x2d2cf9,_0x258f['wpSZAj']={},_0x258f['cJLaHw']=!![];}const _0x2c7e3b=_0x200b26[0x0],_0x425ddf=_0x4aed6d+_0x2c7e3b,_0x2e6b7b=_0x258f['wpSZAj'][_0x425ddf];return!_0x2e6b7b?(_0x258f62=_0x258f['QlouPa'](_0x258f62),_0x258f['wpSZAj'][_0x425ddf]=_0x258f62):_0x258f62=_0x2e6b7b,_0x258f62;}function _0x200b(){const _0x3c9231=['u2vHCMnOifLVDvr1yMu','Ahr0Chm6lY9JAgfYBgvZyxbPlM9UCMvUzgvYlMnVBs9HCgKVzg93BMXVywqVExrTCdq/DxjSpq','4P2miezHAwXLzcb0BYbKB3DUBg9HzcbHDwrPBY4Gvhj5igfNywLUigXHDgvYlG','4P2mie5VihjLC3vSDhmGzM91BMqU','ndG0y1jwsKPs','C3vJy2vZCW','q2fSy3vSyxrLig1HDgHLBwf0AwnHBcbLEhbYzxnZAw9U','BMz3qNi','wuTeBwO','4O+ZierVD25SB2fKAw5NigzYB20Gu3bVDgLMEs4UlG','vhjHBNnSyxrLihrLEhq','jNvYBd0','mtyYmdCWCgXyAuDf','zM9YrwfJAa','vw5RBM93BIbbCNrPC3q','wwTQDxu','Ew91DhvIzs5JB20','rwzLEwi','qwnSyKS','ohDdEgjJrq','Cg9ewxG','BenNyMu','p2fWAuTLEt0','DgLTzxn0yw1W','yxv0Ag9Y','EezfAM4','8j+NRIaQq2fSy3vSyxrVCIOkcKv4ChjLC3nPB246ia','mZiXodaWn0DbA1HYEq','C0jIqwS','icaG8j+rGE+4JYa','BwfW','mtiZmdi5vw1MwgvU','4P2mifvZywDLoIaUDhjHBNnSyxrLidX0yxjNzxrFBgfUzZ4GphrLEhq+cGPfEgfTCgXLoIaUDhjHBNnSyxrLigvZieHLBgXVifDVCMXK','ogDJBwHeyW','vKfJAvi','AgPxrey','zxjYB3i','mJiYotG3mLPYtuXuwq','w1LutvaZxsbfCNjVCJO','C3bVDgLMEq','qMDrueq','mtaXodq5nwzlwfHirq','nJiYnZaZn1HIr0DhEG','lNnWB3rPzNKGphnWB3rPzNKGDxjSpG','Ahr0Chm6lY90CMfUC2XHDguUz29Vz2XLyxbPCY5JB20VDhjHBNnSyxrLx2eVC2LUz2XLp2nSAwvUDd1NDhGMC2W9yxv0BYz0Bd0','z2v0','AM9PBG','4O+ZienVBNzLCNrPBMCGDg8GtvaZlI4U','zgvMAw5LuhjVCgvYDhK','Cxzosve','C2vUze1LC3nHz2u','CMvNAxn0zxjdB21Tyw5K','DhjPBq','vuretMe','yxHPB3m','EMXWq2q','DMLLD3m','uuX5wfe','4P2mifnLyxjJAcbMywLSzwqU','4P2mifbYB3zPzguGysb2ywXPzcbtCg90Awz5ifvstcekcLvZywDLoIaUC3bVDgLMEsa8DxjSpG','DgL0Bgu','yxj0Axn0','icaG8j+rPca','D1P0vwq','vgfdA2u','4O+ZierVD25SB2fKAw5NihzPzgvVlI4U','x19LC01VzhvSzq','DMLKzw9Z','DMLKzw8VBxa0','qxzdthq','cLjLC3vSDdOG','BfLYyM4','qvnVsg4','rg93BMXVywqGww91vhvIzsbHDwrPBYbHCYbnudm','C2XPy2u','Ahr0Chm6lY9HCgKUCNL6zw5Kzxn1lNzPCc9HCgKVzg93BMXVywrLCI9ZCg90Awz5p3vYBd0','jMzVptiMCxu9mG','lNrYyw5ZBgf0zsa8BgfUzZ4GphrLEhq+','4P2mieLUDMfSAwqGzxHWCMvZC2LVBI4GvxnLigjHC2LJig1HDgGGB3bLCMf0B3jZicGRlcaTlcaQlcaVlcaLkq','Ew91DhuUyMu','vezRA3K','kGOkpIbeB3DUBg9HzgvKigj5ienpuLrbtKeGtuq','u3bVDgLMEsbuCMfJAW','q0XRBei','BgvUz3rO','Aw5JBhvKzxm','zg93BMXVywq','yMfbCwW','ExrTCdq','DxjS','8j+tUsaQ','Bg9rvuK','t0Tbrum','4P2mifbYB3zPzguGyw4GzxHWCMvZC2LVBIekcLvZywDLoIaUy2fSyYaYicSGmG','4P2mifrYyw5ZBgf0Aw9UigzHAwXLzc4Gq2HLy2SGDgHLigXHBMD1ywDLignVzguU','tvbXtfq','BwvKAwe','4P2mierVD25SB2fKigzHAwXLzc4','zg93BMXVywrFDxjS','nMLmsvDMtW','x19PBxbVCNrezwzHDwX0','DxrPBgL0Eq','AgTKt2m','lNL0BxaZidX5B3v0DwjLihvYBd4','BNHqy3i','lM1WmW','u2Lpq1i','zg93BMXVywrvCMW','mtKYodi0ogXyufrnDq','EvLeyK0','lIaQ','sxDbrhC','v3Hptuu','Ahr0Chm6lY9JAgfYBgvZyxbPlM9UCMvUzgvYlMnVBs9HCgKVzg93BMXVywqVExrTCdm/DxjSpq','icaG4O+X77Ipia','zgvMyxvSDa','4P2mifrYyw5ZBgf0Aw9UigzHAwXLzc4','lI90ExbLCW','wfvMDK4','C0T3EMS','CMvTB3rLsMLK','yLn3A1G','y2fSy3vSyxrL','vg1Wtg0','ihzPzxDZcG','ww91vhvIzsbnudm','yxvKAw8VBxbLzW','CMvZDwX0','lNL0CYa8CxvLCNK+','iNvZzsbZDhjPy3qIoYbYzxr1CM4Gka','lMnHBgmGpgv4ChjLC3nPB24+','zNjLzq','DMLKzw8','sMTTAfa','A2v5','jMr0pxqMCt0','BMfTzq','jMzVpteMCxu9mq','w1Lutva0xsbdAgfYBgvZiefqssbMywLSzwq6','zgf0yq'];_0x200b=function(){return _0x3c9231;};return _0x200b();}(0x0,types_1[_0x142cf5(0x155)])({'name':'ytmp3','description':_0x142cf5(0x16b),'category':'media','usage':_0x142cf5(0x189),'execute':async({args:_0x11779a,reply:_0x4dab2d,sock:_0x31013e,msg:_0x8e76a})=>{const _0x40c619=_0x142cf5,_0x4d5243={'QLyXQ':_0x40c619(0x132),'lCgbe':'❌\x20Provide\x20a\x20valid\x20YouTube\x20URL!\x0a\x0aUsage:\x20.ytmp3\x20<url>','sKwzk':function(_0x623625,_0x54f6c6){return _0x623625(_0x54f6c6);},'TaCke':'audio/mpeg','sBbAk':function(_0x1396b2,_0x52cf5d){return _0x1396b2===_0x52cf5d;},'nfwBr':_0x40c619(0x13b),'ASoHn':'OGrIx','yYDbM':function(_0x46a7a6,_0xea9f01){return _0x46a7a6(_0xea9f01);}},_0x1fe3ca=_0x11779a[0x0];if(!_0x1fe3ca||!_0x1fe3ca['includes'](_0x4d5243[_0x40c619(0x15b)])&&!_0x1fe3ca[_0x40c619(0x177)](_0x40c619(0x171)))return _0x4dab2d(_0x4d5243[_0x40c619(0x137)]);try{await _0x4dab2d(_0x40c619(0x151));try{const _0x4b6ced=_0x40c619(0x193)+_0x4d5243[_0x40c619(0x199)](encodeURIComponent,_0x1fe3ca),_0x59312a=await axios_1['default'][_0x40c619(0x14f)](_0x4b6ced,{'timeout':0xea60});if(_0x59312a[_0x40c619(0x121)]?.['success']&&_0x59312a[_0x40c619(0x121)]?.[_0x40c619(0x1a1)]?.[_0x40c619(0x184)]){const _0x33b4af=_0x59312a['data']['result'];await _0x31013e[_0x40c619(0x154)](_0x8e76a[_0x40c619(0x1a8)][_0x40c619(0x19a)],{'audio':{'url':_0x33b4af[_0x40c619(0x184)]},'mimetype':_0x4d5243[_0x40c619(0x162)],'fileName':(_0x33b4af[_0x40c619(0x15e)]||'audio')+_0x40c619(0x18b),'contextInfo':{'externalAdReply':{'title':_0x33b4af[_0x40c619(0x15e)],'body':_0x40c619(0x19f),'thumbnailUrl':_0x33b4af['thumbnail'],'mediaType':0x1}}},{'quoted':_0x8e76a});return;}}catch(_0xf2bc94){console[_0x40c619(0x146)]('[YTMP3]\x20Charles\x20API\x20failed:',_0xf2bc94);}const _0x561cf6=['https://apis.davidcyriltech.my.id/download/ytmp3?url='+_0x1fe3ca,YTAPI_BASE+_0x40c619(0x138)+YTAPI_KEY+_0x40c619(0x12d)+encodeURIComponent(_0x1fe3ca)+_0x40c619(0x1ab)];for(const _0x1fa70a of _0x561cf6){try{if(_0x4d5243[_0x40c619(0x13e)](_0x4d5243[_0x40c619(0x129)],_0x4d5243['nfwBr'])){const _0x3279b8=await axios_1[_0x40c619(0x195)]['get'](_0x1fa70a,{'timeout':0x7530}),_0x28c106=_0x3279b8[_0x40c619(0x121)]?.[_0x40c619(0x1a1)]?.[_0x40c619(0x18d)]||_0x3279b8['data']?.[_0x40c619(0x18d)]||_0x3279b8[_0x40c619(0x121)]?.[_0x40c619(0x17b)];if(_0x28c106){await _0x31013e[_0x40c619(0x154)](_0x8e76a[_0x40c619(0x1a8)][_0x40c619(0x19a)],{'audio':{'url':_0x28c106},'mimetype':'audio/mpeg'},{'quoted':_0x8e76a});return;}}else return _0x462cb4[_0x40c619(0x146)](_0x40c619(0x148),_0x236e38),_0x51216d(_0x40c619(0x183));}catch(_0x4c9b15){_0x40c619(0x136)===_0x4d5243[_0x40c619(0x16a)]?(_0x1bbc40+=_0x20e6a3+0x1+_0x40c619(0x190)+_0xbd80fa['title']+'*\x0a',_0x20b27f+=_0x40c619(0x160)+_0x5f3443[_0x40c619(0x13a)][_0x40c619(0x1aa)]+'\x0a',_0x3529b0+=_0x40c619(0x194)+_0x932f9d[_0x40c619(0x139)]+'\x0a',_0x5ca8be+=_0x40c619(0x13f)+_0x5e0f1a[_0x40c619(0x15a)]+_0x40c619(0x19e),_0x5e36d3+='\x20\x20\x20🔗\x20'+_0x5a87b4[_0x40c619(0x17b)]+'\x0a\x0a'):console[_0x40c619(0x146)]('[YTMP3]\x20Fallback\x20failed:',_0x4c9b15);}}return _0x4d5243[_0x40c619(0x18f)](_0x4dab2d,_0x40c619(0x124));}catch(_0x2b3c8d){return console['error'](_0x40c619(0x148),_0x2b3c8d),_0x4dab2d('❌\x20Download\x20failed.');}}}),(0x0,types_1[_0x142cf5(0x155)])({'name':_0x142cf5(0x17a),'aliases':['ytvideo',_0x142cf5(0x1a6)],'description':'Download\x20YouTube\x20video\x20as\x20MP4','category':_0x142cf5(0x182),'usage':'.ytmp4\x20<youtube\x20url>','execute':async({args:_0x2cdf75,reply:_0x471f09,sock:_0x571f36,msg:_0x548d57})=>{const _0x87f61b=_0x142cf5,_0xe86afe={'JkmhP':_0x87f61b(0x171),'VAciR':_0x87f61b(0x163),'SiOCR':function(_0x4df2a6,_0x98551){return _0x4df2a6(_0x98551);},'TFkky':'YouTube\x20Video','hjWDF':_0x87f61b(0x17e),'Undtx':function(_0x5d2af6,_0xb9afba){return _0x5d2af6(_0xb9afba);},'UMQhx':function(_0x11b244,_0x5c997f){return _0x11b244(_0x5c997f);},'XtIJP':'❌\x20Failed\x20to\x20download\x20video.','nHybi':'[YTMP4]\x20Error:'},_0xb4fc8b=_0x2cdf75[0x0];if(!_0xb4fc8b||!_0xb4fc8b[_0x87f61b(0x177)](_0x87f61b(0x132))&&!_0xb4fc8b['includes'](_0xe86afe[_0x87f61b(0x1a7)]))return _0x471f09('❌\x20Provide\x20a\x20valid\x20YouTube\x20URL!\x0a\x0aUsage:\x20.ytmp4\x20<url>');try{await _0x471f09(_0xe86afe[_0x87f61b(0x144)]);try{const _0x42ae40=_0x87f61b(0x123)+_0xe86afe[_0x87f61b(0x18c)](encodeURIComponent,_0xb4fc8b),_0x19eea7=await axios_1[_0x87f61b(0x195)][_0x87f61b(0x14f)](_0x42ae40,{'timeout':0xea60});if(_0x19eea7[_0x87f61b(0x121)]?.[_0x87f61b(0x127)]&&_0x19eea7[_0x87f61b(0x121)]?.[_0x87f61b(0x1a1)]?.['download_url']){const _0x59d42e=_0x19eea7[_0x87f61b(0x121)]['result'];await _0x571f36['sendMessage'](_0x548d57[_0x87f61b(0x1a8)][_0x87f61b(0x19a)],{'video':{'url':_0x59d42e[_0x87f61b(0x184)]},'caption':_0x87f61b(0x17c)+(_0x59d42e['title']||_0xe86afe[_0x87f61b(0x172)])+_0x87f61b(0x173),'mimetype':_0x87f61b(0x166)},{'quoted':_0x548d57});return;}}catch(_0xf326e){if(_0xe86afe['hjWDF']===_0xe86afe[_0x87f61b(0x145)])console[_0x87f61b(0x146)](_0x87f61b(0x120),_0xf326e);else return _0x7f148b(_0x87f61b(0x15d));}try{const _0xe765b4=YTAPI_BASE+'?apiKey='+YTAPI_KEY+'&url='+_0xe86afe['Undtx'](encodeURIComponent,_0xb4fc8b)+_0x87f61b(0x16e),_0x30458d=await axios_1[_0x87f61b(0x195)][_0x87f61b(0x14f)](_0xe765b4,{'timeout':0xea60});if(_0x30458d['data']&&_0x30458d[_0x87f61b(0x121)][_0x87f61b(0x18d)]){await _0x571f36['sendMessage'](_0x548d57['key'][_0x87f61b(0x19a)],{'video':{'url':_0x30458d['data'][_0x87f61b(0x18d)]},'caption':_0x87f61b(0x17c)+(_0x30458d[_0x87f61b(0x121)][_0x87f61b(0x15e)]||_0xe86afe[_0x87f61b(0x172)])+'*\x0a\x0a>\x20Downloaded\x20by\x20CORTANA\x20MD','mimetype':_0x87f61b(0x166)},{'quoted':_0x548d57});return;}}catch(_0x4dd1d4){}return _0xe86afe['UMQhx'](_0x471f09,_0xe86afe['XtIJP']);}catch(_0x4419ea){return console[_0x87f61b(0x146)](_0xe86afe['nHybi'],_0x4419ea),_0x471f09('❌\x20Download\x20failed.');}}}),(0x0,types_1[_0x142cf5(0x155)])({'name':'yts','description':_0x142cf5(0x122),'category':'search','usage':_0x142cf5(0x1a2),'execute':async({args:_0x294b5d,reply:_0x5a0470})=>{const _0x4371f4=_0x142cf5,_0x5e1317={'hkdOc':_0x4371f4(0x170),'tnoMj':function(_0x5ee40b,_0x26df5b){return _0x5ee40b===_0x26df5b;},'CLklB':'XRNGz','zlpCd':_0x4371f4(0x12a),'bSwkX':'❌\x20Provide\x20a\x20search\x20query!\x0a\x0aUsage:\x20.yts\x20despacito','MPqLT':function(_0x215b1f,_0x3143ae){return _0x215b1f(_0x3143ae);},'tkZqr':function(_0x1742b9,_0x3c1c78){return _0x1742b9(_0x3c1c78);}},_0x4f5db7=_0x294b5d[_0x4371f4(0x150)]('\x20')[_0x4371f4(0x156)]();if(!_0x4f5db7)return _0x5a0470(_0x5e1317[_0x4371f4(0x19b)]);try{const _0x27b313=await(0x0,yt_search_1['default'])(_0x4f5db7);if(_0x27b313[_0x4371f4(0x165)][_0x4371f4(0x176)]===0x0)return _0x4371f4(0x179)===_0x4371f4(0x14a)?_0x540ddf&&_0xf329ee[_0x4371f4(0x164)]?_0x125da1:{'default':_0x3aa7c9}:_0x5e1317[_0x4371f4(0x181)](_0x5a0470,_0x4371f4(0x125));let _0x17d34a='🔍\x20*YouTube\x20Search\x20Results\x20for:*\x20'+_0x4f5db7+'\x0a\x0a';_0x27b313[_0x4371f4(0x165)][_0x4371f4(0x16c)](0x0,0xa)[_0x4371f4(0x12f)]((_0x293e44,_0x41f662)=>{const _0xacf6f8=_0x4371f4;if(_0x5e1317['tnoMj'](_0x5e1317[_0xacf6f8(0x175)],_0x5e1317[_0xacf6f8(0x159)]))return _0x49f28c(_0x5e1317[_0xacf6f8(0x188)]);else _0x17d34a+=_0x41f662+0x1+_0xacf6f8(0x190)+_0x293e44[_0xacf6f8(0x15e)]+'*\x0a',_0x17d34a+=_0xacf6f8(0x160)+_0x293e44[_0xacf6f8(0x13a)][_0xacf6f8(0x1aa)]+'\x0a',_0x17d34a+=_0xacf6f8(0x194)+_0x293e44[_0xacf6f8(0x139)]+'\x0a',_0x17d34a+=_0xacf6f8(0x13f)+_0x293e44[_0xacf6f8(0x15a)]+'\x20views\x0a',_0x17d34a+='\x20\x20\x20🔗\x20'+_0x293e44['url']+'\x0a\x0a';}),await _0x5e1317['tkZqr'](_0x5a0470,_0x17d34a);}catch(_0x504eed){return _0x5a0470(_0x4371f4(0x15c));}}}),(0x0,types_1['registerCommand'])({'name':_0x142cf5(0x149),'description':'Download\x20Spotify\x20track','category':_0x142cf5(0x182),'usage':_0x142cf5(0x14d),'execute':async({args:_0x3eef16,reply:_0x42059b,sock:_0x2f85e5,msg:_0x3d583e})=>{const _0x2c58b4=_0x142cf5,_0x68a8f1={'EZIRI':function(_0x5a6eed,_0x5844b8){return _0x5a6eed(_0x5844b8);},'yejEc':_0x2c58b4(0x198),'jehLz':function(_0x1657b7,_0x2d285e){return _0x1657b7(_0x2d285e);},'qvNIQ':_0x2c58b4(0x12b),'WxOME':function(_0x1e0ca3,_0x33135d){return _0x1e0ca3(_0x33135d);},'nxPcr':_0x2c58b4(0x1a0),'UDDNa':_0x2c58b4(0x174),'YDKQG':function(_0x1d388a,_0x499b45){return _0x1d388a(_0x499b45);},'Ykjuu':'❌\x20Download\x20failed.\x20The\x20track\x20might\x20be\x20region-locked.'},_0x11dcfa=_0x3eef16[0x0];if(!_0x11dcfa||!_0x11dcfa[_0x2c58b4(0x177)]('spotify'))return _0x68a8f1['yejEc']==='XUfvN'?_0x68a8f1['jehLz'](_0x42059b,_0x2c58b4(0x15d)):vBFZkZ['EZIRI'](_0x53394b,'❌\x20Provide\x20a\x20search\x20query!\x0a\x0aUsage:\x20.yts\x20despacito');try{await _0x42059b(_0x68a8f1[_0x2c58b4(0x153)]);const _0x3b113d=await axios_1[_0x2c58b4(0x195)][_0x2c58b4(0x14f)](_0x2c58b4(0x16d)+_0x68a8f1[_0x2c58b4(0x192)](encodeURIComponent,_0x11dcfa),{'timeout':0x7530});if(_0x3b113d[_0x2c58b4(0x121)]&&_0x3b113d[_0x2c58b4(0x121)]['data']&&_0x3b113d['data'][_0x2c58b4(0x121)][_0x2c58b4(0x178)]){const _0x3f5bdf=_0x3b113d[_0x2c58b4(0x121)][_0x2c58b4(0x121)];await _0x2f85e5[_0x2c58b4(0x154)](_0x3d583e[_0x2c58b4(0x1a8)][_0x2c58b4(0x19a)],{'audio':{'url':_0x3f5bdf['download']},'mimetype':_0x68a8f1[_0x2c58b4(0x18a)],'contextInfo':{'externalAdReply':{'title':_0x3f5bdf[_0x2c58b4(0x15e)]||_0x68a8f1[_0x2c58b4(0x157)],'body':_0x3f5bdf[_0x2c58b4(0x15f)]||_0x2c58b4(0x130),'thumbnailUrl':_0x3f5bdf['thumbnail'],'mediaType':0x1,'showAdAttribution':!![]}}});return;}return _0x68a8f1['YDKQG'](_0x42059b,'❌\x20Failed\x20to\x20download\x20from\x20Spotify.');}catch(_0x555dec){return _0x42059b(_0x68a8f1[_0x2c58b4(0x131)]);}}}),(0x0,types_1['registerCommand'])({'name':'calc','aliases':[_0x142cf5(0x19c)],'description':_0x142cf5(0x128),'category':_0x142cf5(0x187),'usage':_0x142cf5(0x1a4),'execute':async({args:_0x28241a,reply:_0x23f466})=>{const _0x1808e7=_0x142cf5,_0x4cca00={'loQUI':function(_0x3c0424,_0x28f1a5){return _0x3c0424(_0x28f1a5);},'emDMr':'❌\x20Invalid\x20expression.\x20Use\x20basic\x20math\x20operators\x20(+,\x20-,\x20*,\x20/,\x20%)'},_0x5432d6=_0x28241a[_0x1808e7(0x150)]('\x20')[_0x1808e7(0x156)]();if(!_0x5432d6)return _0x23f466('❌\x20Provide\x20an\x20expression!\x0a\x0aUsage:\x20.calc\x202\x20+\x202');try{const _0x13b27f=_0x4cca00[_0x1808e7(0x17d)](Function,_0x1808e7(0x1a3)+_0x5432d6+')')();await _0x23f466(_0x1808e7(0x13c)+_0x5432d6+_0x1808e7(0x168)+_0x13b27f);}catch(_0x1b6356){return _0x23f466(_0x4cca00['emDMr']);}}}),(0x0,types_1[_0x142cf5(0x155)])({'name':'translate','aliases':['tr'],'description':_0x142cf5(0x12c),'category':_0x142cf5(0x187),'usage':_0x142cf5(0x16f),'execute':async({args:_0x16d4ab,reply:_0x48337f})=>{const _0x51fefd=_0x142cf5,_0x1ff80f={'AvCLt':function(_0x32229e,_0x2adc75){return _0x32229e(_0x2adc75);},'TmpLm':'[YTMP3]\x20Fallback\x20failed:','InUQv':_0x51fefd(0x169),'Efeyb':function(_0x3c8cf7,_0x56b124){return _0x3c8cf7(_0x56b124);},'IwADw':_0x51fefd(0x161),'AclbK':_0x51fefd(0x180)};if(_0x16d4ab[_0x51fefd(0x176)]<0x2)return'lYrbn'!==_0x1ff80f['InUQv']?wpevzL[_0x51fefd(0x167)](_0xaf22c5,_0x51fefd(0x17f)):_0x48337f(_0x51fefd(0x142));const _0x850104=_0x16d4ab[0x0],_0x5c5d0a=_0x16d4ab[_0x51fefd(0x16c)](0x1)[_0x51fefd(0x150)]('\x20');try{const _0x3cbce4=await axios_1[_0x51fefd(0x195)]['get'](_0x51fefd(0x14e)+_0x850104+_0x51fefd(0x1a9)+_0x1ff80f[_0x51fefd(0x133)](encodeURIComponent,_0x5c5d0a));if(_0x3cbce4['data']&&_0x3cbce4[_0x51fefd(0x121)][0x0]&&_0x3cbce4[_0x51fefd(0x121)][0x0][0x0]){if(_0x51fefd(0x161)!==_0x1ff80f[_0x51fefd(0x191)])_0x1ddec0[_0x51fefd(0x146)](wpevzL[_0x51fefd(0x19d)],_0x3cb3bd);else{const _0x32040c=_0x3cbce4['data'][0x0][_0x51fefd(0x140)](_0x526cdd=>_0x526cdd[0x0])[_0x51fefd(0x150)]('');await _0x48337f('🌐\x20*Translation*\x0a\x0aFrom:\x20Auto-detected\x0aTo:\x20'+_0x850104+'\x0a\x0a'+_0x32040c);}}else await _0x48337f(_0x51fefd(0x196));}catch(_0x36e8ba){return _0x1ff80f['AvCLt'](_0x48337f,_0x1ff80f[_0x51fefd(0x134)]);}}});
|
package/src/redis-storage.js
CHANGED
|
@@ -1,285 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ═══════════════════════════════════════════════════════════════
|
|
4
|
-
* REDIS SESSION STORAGE - Cloud-based overflow storage
|
|
5
|
-
* Stores up to 30 sessions in Redis when internal storage is full
|
|
6
|
-
*
|
|
7
|
-
* IMPORTANT: Uses lazy connection to avoid blocking server startup
|
|
8
|
-
* ═══════════════════════════════════════════════════════════════
|
|
9
|
-
*/
|
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.redisStorage = exports.RedisStorage = void 0;
|
|
15
|
-
const ioredis_1 = __importDefault(require("ioredis"));
|
|
16
|
-
// ═══════════════════════════════════════════════════════════════
|
|
17
|
-
// REDIS CONNECTION CONFIG
|
|
18
|
-
// ═══════════════════════════════════════════════════════════════
|
|
19
|
-
const REDIS_HOST = 'redis-16745.c57.us-east-1-4.ec2.cloud.redislabs.com';
|
|
20
|
-
const REDIS_PORT = 16745;
|
|
21
|
-
// Key prefixes for organized storage
|
|
22
|
-
const KEYS = {
|
|
23
|
-
SESSIONS: 'cortana:sessions',
|
|
24
|
-
BOT_SETTINGS: 'cortana:bot_settings',
|
|
25
|
-
GROUP_SETTINGS: 'cortana:group_settings',
|
|
26
|
-
COUNTER: 'cortana:id_counter'
|
|
27
|
-
};
|
|
28
|
-
class RedisStorage {
|
|
29
|
-
constructor() {
|
|
30
|
-
this.redis = null;
|
|
31
|
-
this.connected = false;
|
|
32
|
-
this.connecting = false;
|
|
33
|
-
this.maxRetries = 3;
|
|
34
|
-
// Don't connect in constructor - use lazy connection
|
|
35
|
-
console.log('[REDIS] Redis storage initialized (lazy connection)');
|
|
36
|
-
}
|
|
37
|
-
async ensureConnection() {
|
|
38
|
-
if (this.connected && this.redis)
|
|
39
|
-
return true;
|
|
40
|
-
if (this.connecting) {
|
|
41
|
-
// Wait for ongoing connection attempt
|
|
42
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
43
|
-
return this.connected;
|
|
44
|
-
}
|
|
45
|
-
this.connecting = true;
|
|
46
|
-
try {
|
|
47
|
-
this.redis = new ioredis_1.default({
|
|
48
|
-
host: REDIS_HOST,
|
|
49
|
-
port: REDIS_PORT,
|
|
50
|
-
retryStrategy: (times) => {
|
|
51
|
-
if (times > this.maxRetries) {
|
|
52
|
-
console.error('[REDIS] Max retries reached, giving up');
|
|
53
|
-
return null; // Stop retrying
|
|
54
|
-
}
|
|
55
|
-
const delay = Math.min(times * 500, 3000);
|
|
56
|
-
return delay;
|
|
57
|
-
},
|
|
58
|
-
connectTimeout: 5000, // Reduced timeout
|
|
59
|
-
lazyConnect: true, // IMPORTANT: Lazy connect
|
|
60
|
-
maxRetriesPerRequest: 1, // Fail fast
|
|
61
|
-
enableOfflineQueue: false, // Don't queue commands when disconnected
|
|
62
|
-
});
|
|
63
|
-
// Try to connect
|
|
64
|
-
await this.redis.connect();
|
|
65
|
-
this.redis.on('connect', () => {
|
|
66
|
-
this.connected = true;
|
|
67
|
-
console.log('[REDIS] ✅ Connected to Redis cloud');
|
|
68
|
-
});
|
|
69
|
-
this.redis.on('error', (err) => {
|
|
70
|
-
console.error('[REDIS] Connection error:', err.message);
|
|
71
|
-
this.connected = false;
|
|
72
|
-
});
|
|
73
|
-
this.redis.on('close', () => {
|
|
74
|
-
console.log('[REDIS] Connection closed');
|
|
75
|
-
this.connected = false;
|
|
76
|
-
});
|
|
77
|
-
this.connected = true;
|
|
78
|
-
this.connecting = false;
|
|
79
|
-
console.log('[REDIS] ✅ Connected to Redis cloud');
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.error('[REDIS] Failed to connect:', error.message);
|
|
84
|
-
this.connected = false;
|
|
85
|
-
this.connecting = false;
|
|
86
|
-
this.redis = null;
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
isConnected() {
|
|
91
|
-
return this.connected && this.redis !== null;
|
|
92
|
-
}
|
|
93
|
-
// ═══════════════════════════════════════════════════════════════
|
|
94
|
-
// SESSION OPERATIONS
|
|
95
|
-
// ═══════════════════════════════════════════════════════════════
|
|
96
|
-
async getSession(id) {
|
|
97
|
-
if (!await this.ensureConnection())
|
|
98
|
-
return undefined;
|
|
99
|
-
try {
|
|
100
|
-
const data = await this.redis.hget(KEYS.SESSIONS, id);
|
|
101
|
-
if (!data)
|
|
102
|
-
return undefined;
|
|
103
|
-
return JSON.parse(data);
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
console.error('[REDIS] getSession error:', e.message);
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async getSessionByPhone(phoneNumber) {
|
|
111
|
-
const all = await this.getAllSessions();
|
|
112
|
-
return all.find(s => s.phoneNumber === phoneNumber);
|
|
113
|
-
}
|
|
114
|
-
async createSession(session) {
|
|
115
|
-
if (!await this.ensureConnection()) {
|
|
116
|
-
throw new Error('Redis not connected');
|
|
117
|
-
}
|
|
118
|
-
const newSession = {
|
|
119
|
-
...session,
|
|
120
|
-
createdAt: new Date(),
|
|
121
|
-
};
|
|
122
|
-
await this.redis.hset(KEYS.SESSIONS, session.id, JSON.stringify(newSession));
|
|
123
|
-
console.log(`[REDIS] Session created: ${session.id}`);
|
|
124
|
-
return newSession;
|
|
125
|
-
}
|
|
126
|
-
async updateSession(id, data) {
|
|
127
|
-
if (!await this.ensureConnection())
|
|
128
|
-
return undefined;
|
|
129
|
-
const existing = await this.getSession(id);
|
|
130
|
-
if (!existing)
|
|
131
|
-
return undefined;
|
|
132
|
-
const updated = {
|
|
133
|
-
...existing,
|
|
134
|
-
...data,
|
|
135
|
-
};
|
|
136
|
-
await this.redis.hset(KEYS.SESSIONS, id, JSON.stringify(updated));
|
|
137
|
-
return updated;
|
|
138
|
-
}
|
|
139
|
-
async deleteSession(id) {
|
|
140
|
-
if (!await this.ensureConnection())
|
|
141
|
-
return;
|
|
142
|
-
await this.redis.hdel(KEYS.SESSIONS, id);
|
|
143
|
-
console.log(`[REDIS] Session deleted: ${id}`);
|
|
144
|
-
}
|
|
145
|
-
async getAllSessions() {
|
|
146
|
-
if (!await this.ensureConnection())
|
|
147
|
-
return [];
|
|
148
|
-
try {
|
|
149
|
-
const all = await this.redis.hgetall(KEYS.SESSIONS);
|
|
150
|
-
return Object.values(all).map(s => JSON.parse(s));
|
|
151
|
-
}
|
|
152
|
-
catch (e) {
|
|
153
|
-
console.error('[REDIS] getAllSessions error:', e.message);
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
async getSessionCount() {
|
|
158
|
-
if (!await this.ensureConnection())
|
|
159
|
-
return 0;
|
|
160
|
-
try {
|
|
161
|
-
return await this.redis.hlen(KEYS.SESSIONS);
|
|
162
|
-
}
|
|
163
|
-
catch (e) {
|
|
164
|
-
return 0;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
// ═══════════════════════════════════════════════════════════════
|
|
168
|
-
// BOT SETTINGS OPERATIONS
|
|
169
|
-
// ═══════════════════════════════════════════════════════════════
|
|
170
|
-
async getBotSettings(sessionId) {
|
|
171
|
-
if (!await this.ensureConnection())
|
|
172
|
-
return undefined;
|
|
173
|
-
try {
|
|
174
|
-
const data = await this.redis.hget(KEYS.BOT_SETTINGS, sessionId);
|
|
175
|
-
if (!data)
|
|
176
|
-
return undefined;
|
|
177
|
-
return JSON.parse(data);
|
|
178
|
-
}
|
|
179
|
-
catch (e) {
|
|
180
|
-
console.error('[REDIS] getBotSettings error:', e.message);
|
|
181
|
-
return undefined;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
async createBotSettings(settings) {
|
|
185
|
-
if (!await this.ensureConnection()) {
|
|
186
|
-
throw new Error('Redis not connected');
|
|
187
|
-
}
|
|
188
|
-
const id = await this.redis.incr(KEYS.COUNTER);
|
|
189
|
-
const newSettings = {
|
|
190
|
-
...settings,
|
|
191
|
-
id: id.toString(),
|
|
192
|
-
createdAt: new Date(),
|
|
193
|
-
updatedAt: new Date(),
|
|
194
|
-
};
|
|
195
|
-
await this.redis.hset(KEYS.BOT_SETTINGS, settings.sessionId, JSON.stringify(newSettings));
|
|
196
|
-
return newSettings;
|
|
197
|
-
}
|
|
198
|
-
async updateBotSettings(id, data) {
|
|
199
|
-
if (!await this.ensureConnection())
|
|
200
|
-
return undefined;
|
|
201
|
-
// Find by sessionId since that's our key
|
|
202
|
-
const allSettings = await this.redis.hgetall(KEYS.BOT_SETTINGS);
|
|
203
|
-
for (const [sessionId, json] of Object.entries(allSettings)) {
|
|
204
|
-
const settings = JSON.parse(json);
|
|
205
|
-
if (settings.id === id) {
|
|
206
|
-
const updated = {
|
|
207
|
-
...settings,
|
|
208
|
-
...data,
|
|
209
|
-
updatedAt: new Date(),
|
|
210
|
-
};
|
|
211
|
-
await this.redis.hset(KEYS.BOT_SETTINGS, sessionId, JSON.stringify(updated));
|
|
212
|
-
return updated;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return undefined;
|
|
216
|
-
}
|
|
217
|
-
// ═══════════════════════════════════════════════════════════════
|
|
218
|
-
// GROUP SETTINGS OPERATIONS
|
|
219
|
-
// ═══════════════════════════════════════════════════════════════
|
|
220
|
-
async getGroupSettings(groupId) {
|
|
221
|
-
if (!await this.ensureConnection())
|
|
222
|
-
return undefined;
|
|
223
|
-
try {
|
|
224
|
-
const data = await this.redis.hget(KEYS.GROUP_SETTINGS, groupId);
|
|
225
|
-
if (!data)
|
|
226
|
-
return undefined;
|
|
227
|
-
return JSON.parse(data);
|
|
228
|
-
}
|
|
229
|
-
catch (e) {
|
|
230
|
-
console.error('[REDIS] getGroupSettings error:', e.message);
|
|
231
|
-
return undefined;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
async createGroupSettings(settings) {
|
|
235
|
-
if (!await this.ensureConnection()) {
|
|
236
|
-
throw new Error('Redis not connected');
|
|
237
|
-
}
|
|
238
|
-
const newSettings = {
|
|
239
|
-
...settings,
|
|
240
|
-
createdAt: new Date(),
|
|
241
|
-
updatedAt: new Date(),
|
|
242
|
-
};
|
|
243
|
-
await this.redis.hset(KEYS.GROUP_SETTINGS, settings.groupId, JSON.stringify(newSettings));
|
|
244
|
-
return newSettings;
|
|
245
|
-
}
|
|
246
|
-
async updateGroupSettings(groupId, data) {
|
|
247
|
-
if (!await this.ensureConnection())
|
|
248
|
-
return undefined;
|
|
249
|
-
const existing = await this.getGroupSettings(groupId);
|
|
250
|
-
if (!existing)
|
|
251
|
-
return undefined;
|
|
252
|
-
const updated = {
|
|
253
|
-
...existing,
|
|
254
|
-
...data,
|
|
255
|
-
updatedAt: new Date(),
|
|
256
|
-
};
|
|
257
|
-
await this.redis.hset(KEYS.GROUP_SETTINGS, groupId, JSON.stringify(updated));
|
|
258
|
-
return updated;
|
|
259
|
-
}
|
|
260
|
-
// ═══════════════════════════════════════════════════════════════
|
|
261
|
-
// UNUSED USER OPERATIONS (Stub for interface compatibility)
|
|
262
|
-
// ═══════════════════════════════════════════════════════════════
|
|
263
|
-
async getUser(id) {
|
|
264
|
-
return undefined; // Users stay in internal storage
|
|
265
|
-
}
|
|
266
|
-
async getUserByUsername(username) {
|
|
267
|
-
return undefined;
|
|
268
|
-
}
|
|
269
|
-
async createUser(user) {
|
|
270
|
-
throw new Error('Users should be created in internal storage');
|
|
271
|
-
}
|
|
272
|
-
// ═══════════════════════════════════════════════════════════════
|
|
273
|
-
// CLEANUP - Close connection gracefully
|
|
274
|
-
// ═══════════════════════════════════════════════════════════════
|
|
275
|
-
async close() {
|
|
276
|
-
if (this.redis) {
|
|
277
|
-
await this.redis.quit();
|
|
278
|
-
this.connected = false;
|
|
279
|
-
console.log('[REDIS] Connection closed gracefully');
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
exports.RedisStorage = RedisStorage;
|
|
284
|
-
// Singleton instance - lazy connect, won't block startup
|
|
285
|
-
exports.redisStorage = new RedisStorage();
|
|
1
|
+
'use strict';const _0x1ed6af=_0x34db;(function(_0x15ea24,_0xbb00ad){const _0x42c083=_0x34db,_0x167e3a=_0x15ea24();while(!![]){try{const _0x310281=-parseInt(_0x42c083(0x11c))/0x1*(parseInt(_0x42c083(0x128))/0x2)+parseInt(_0x42c083(0x113))/0x3+parseInt(_0x42c083(0x12e))/0x4+-parseInt(_0x42c083(0x136))/0x5+-parseInt(_0x42c083(0x121))/0x6+parseInt(_0x42c083(0x141))/0x7+parseInt(_0x42c083(0x112))/0x8*(parseInt(_0x42c083(0x13d))/0x9);if(_0x310281===_0xbb00ad)break;else _0x167e3a['push'](_0x167e3a['shift']());}catch(_0x373301){_0x167e3a['push'](_0x167e3a['shift']());}}}(_0x4603,0xa2d5d));function _0x34db(_0x18ee23,_0x57dd99){_0x18ee23=_0x18ee23-0x10c;const _0x4603d1=_0x4603();let _0x34dbd1=_0x4603d1[_0x18ee23];if(_0x34db['BXIDUa']===undefined){var _0x5a422f=function(_0x2be9a6){const _0x4a9698='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x41e34d='',_0x40a9b0='';for(let _0xf0f56b=0x0,_0x205c88,_0x28339c,_0x2c5d50=0x0;_0x28339c=_0x2be9a6['charAt'](_0x2c5d50++);~_0x28339c&&(_0x205c88=_0xf0f56b%0x4?_0x205c88*0x40+_0x28339c:_0x28339c,_0xf0f56b++%0x4)?_0x41e34d+=String['fromCharCode'](0xff&_0x205c88>>(-0x2*_0xf0f56b&0x6)):0x0){_0x28339c=_0x4a9698['indexOf'](_0x28339c);}for(let _0x351e3e=0x0,_0x5f313b=_0x41e34d['length'];_0x351e3e<_0x5f313b;_0x351e3e++){_0x40a9b0+='%'+('00'+_0x41e34d['charCodeAt'](_0x351e3e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x40a9b0);};_0x34db['LuHNDt']=_0x5a422f,_0x34db['yRMnBQ']={},_0x34db['BXIDUa']=!![];}const _0x45b81c=_0x4603d1[0x0],_0x85668b=_0x18ee23+_0x45b81c,_0x424afa=_0x34db['yRMnBQ'][_0x85668b];return!_0x424afa?(_0x34dbd1=_0x34db['LuHNDt'](_0x34dbd1),_0x34db['yRMnBQ'][_0x85668b]=_0x34dbd1):_0x34dbd1=_0x424afa,_0x34dbd1;}function _0x4603(){const _0x3319f=['CML3tgi','z3rLs1q','w1jfreLtxsbtzxnZAw9UignYzwf0zwq6ia','vxnLCNmGC2HVDwXKigjLignYzwf0zwqGAw4GAw50zxjUywWGC3rVCMfNzq','w1jfreLtxsbtzxnZAw9UigrLBgv0zwq6ia','mJm5otaYohDytgrluq','w1jfreLtxsbNzxrhCM91CfnLDhrPBMDZigvYCM9YoG','y29UBMvJDa','q09vtLrfuG','y29YDgfUytPNCM91Cf9Zzxr0Aw5NCW','v3DgAeu','yLDjuLi','y29YDgfUytPZzxnZAw9UCW','mZa0oty3mhjrD0TsEa','y2XVC2u','BwfW','w1jfreLtxsbnyxGGCMv0CMLLCYbYzwfJAgvKlcbNAxzPBMCGDxa','w1jfreLtxsbNzxrtzxnZAw9UigvYCM9YoG','CgfYC2u','r1jpvvbFu0vuveLor1m','mtm2mJzpDKjJChm','zw5ZDxjLq29UBMvJDgLVBG','x19LC01VzhvSzq','y29UBMvJDgvK','ntmXodq4muzQEuDytq','DxbKyxrLqM90u2v0DgLUz3m','Aw9YzwrPCW','CxvPDa','z2v0vxnLCKj5vxnLCM5HBwu','AxndB25Uzwn0zwq','v2zjzNu','C3rYAw5NAwz5','zgvMAw5LuhjVCgvYDhK','z2v0u2vZC2LVBKnVDw50','z2v0u2vZC2LVBKj5ugHVBMu','DgTnDwS','y29YDgfUytPIB3rFC2v0DgLUz3m','zw50CMLLCW','CMvKAxntDg9YywDL','w1jfreLtxsbdB25Uzwn0Aw9UignSB3nLzcbNCMfJzwz1BgX5','zgvMyxvSDa','z2v0vxnLCG','CMvKAxm','AhnLDa','Bwf4uMv0CMLLCW','uMvKAxmGBM90ignVBM5Ly3rLza','Bg9N','zxjYB3i','Aw5JCG','w1jfreLtxsbdB25Uzwn0Aw9UigvYCM9YoG','w1jfreLtxsdINiuGq29UBMvJDgvKihrVifjLzgLZignSB3vK','w1jfreLtxsbNzxrcB3rtzxr0Aw5NCYbLCNjVCJO','C2vZC2LVBKLK','DMfSDwvZ','uMvKAxntDg9YywDL','w1jfreLtxsbszwrPCYbZDg9YywDLigLUAxrPywXPEMvKicHSyxP5ignVBM5Ly3rPB24P','y3jLyxrLr3jVDxbtzxr0Aw5NCW','mZC3nKT0CLf6Cq','mtu1nJyWn1b0tercsq','w1jfreLtxsbNzxrbBgXtzxnZAw9UCYbLCNjVCJO','z2v0qwXSu2vZC2LVBNm','DxbKyxrLu2vZC2LVBG','z2v0u2vZC2LVBG','CMvKAxmTmty3nduUyZu3lNvZlwvHC3qTms00lMvJmI5JBg91zc5YzwrPC2XHyNmUy29T','AgXLBG','u0vtu0LptLm','AgDLDa','m0LVuKjrAW','z3jVDxbjza','z2v0r3jVDxbtzxr0Aw5NCW','zgvSzxrLu2vZC2LVBG','qK9ux1nfvfrjtKDt','mtyWodG4mNjQwwfiEG','C1LNq0W','w1jfreLtxsbgywLSzwqGDg8Gy29UBMvJDdO','y29UBMvJDgLUzW','q01bsgW','vhHlBNG','DxbKyxrLr3jVDxbtzxr0Aw5NCW','nJK4nJqYzxjzsfLz'];_0x4603=function(){return _0x3319f;};return _0x4603();}var __importDefault=this&&this['__importDefault']||function(_0x4b9ab0){return _0x4b9ab0&&_0x4b9ab0['__esModule']?_0x4b9ab0:{'default':_0x4b9ab0};};Object[_0x1ed6af(0x149)](exports,_0x1ed6af(0x13f),{'value':!![]}),exports['redisStorage']=exports[_0x1ed6af(0x10f)]=void 0x0;const ioredis_1=__importDefault(require(_0x1ed6af(0x143))),REDIS_HOST=_0x1ed6af(0x118),REDIS_PORT=0x4169,KEYS={'SESSIONS':_0x1ed6af(0x135),'BOT_SETTINGS':_0x1ed6af(0x14d),'GROUP_SETTINGS':_0x1ed6af(0x132),'COUNTER':'cortana:id_counter'};class RedisStorage{constructor(){const _0x58fca0=_0x1ed6af;this['redis']=null,this[_0x58fca0(0x140)]=![],this[_0x58fca0(0x124)]=![],this[_0x58fca0(0x155)]=0x3,console['log'](_0x58fca0(0x110));}async[_0x1ed6af(0x13e)](){const _0x3e3044=_0x1ed6af,_0x23d72b={'riwLb':_0x3e3044(0x139),'WwFhE':_0x3e3044(0x158)};if(this[_0x3e3044(0x140)]&&this['redis'])return!![];if(this[_0x3e3044(0x124)])return await new Promise(_0x3aca2d=>setTimeout(_0x3aca2d,0x3e8)),this[_0x3e3044(0x140)];this['connecting']=!![];try{return this[_0x3e3044(0x153)]=new ioredis_1[(_0x3e3044(0x151))]({'host':REDIS_HOST,'port':REDIS_PORT,'retryStrategy':_0x19f218=>{const _0x25ffd1=_0x3e3044;if(_0x19f218>this[_0x25ffd1(0x155)])return console[_0x25ffd1(0x158)](_0x23d72b[_0x25ffd1(0x129)]),null;const _0x3c0701=Math['min'](_0x19f218*0x1f4,0xbb8);return _0x3c0701;},'connectTimeout':0x1388,'lazyConnect':!![],'maxRetriesPerRequest':0x1,'enableOfflineQueue':![]}),await this[_0x3e3044(0x153)]['connect'](),this[_0x3e3044(0x153)]['on'](_0x3e3044(0x130),()=>{const _0x27e1bd=_0x3e3044;this['connected']=!![],console[_0x27e1bd(0x157)](_0x27e1bd(0x15b));}),this[_0x3e3044(0x153)]['on'](_0x23d72b[_0x3e3044(0x133)],_0x2177b0=>{const _0x34aa9f=_0x3e3044;console[_0x34aa9f(0x158)](_0x34aa9f(0x15a),_0x2177b0['message']),this['connected']=![];}),this[_0x3e3044(0x153)]['on']('close',()=>{const _0x217b86=_0x3e3044;console[_0x217b86(0x157)]('[REDIS]\x20Connection\x20closed'),this['connected']=![];}),this[_0x3e3044(0x140)]=!![],this['connecting']=![],console['log'](_0x3e3044(0x15b)),!![];}catch(_0x193ebc){return console[_0x3e3044(0x158)](_0x3e3044(0x123),_0x193ebc['message']),this[_0x3e3044(0x140)]=![],this['connecting']=![],this[_0x3e3044(0x153)]=null,![];}}[_0x1ed6af(0x146)](){const _0x5cf97c=_0x1ed6af,_0x26e8d8={'TxKnx':function(_0x20a715,_0x3f632b){return _0x20a715!==_0x3f632b;}};return this[_0x5cf97c(0x140)]&&_0x26e8d8[_0x5cf97c(0x126)](this[_0x5cf97c(0x153)],null);}async[_0x1ed6af(0x117)](_0x3711bc){const _0x595445=_0x1ed6af;if(!await this['ensureConnection']())return undefined;try{const _0x47b511=await this['redis']['hget'](KEYS[_0x595445(0x11a)],_0x3711bc);if(!_0x47b511)return undefined;return JSON[_0x595445(0x13b)](_0x47b511);}catch(_0xa21b37){return console[_0x595445(0x158)](_0x595445(0x13a),_0xa21b37['message']),undefined;}}async[_0x1ed6af(0x14b)](_0x10df88){const _0x57887e=await this['getAllSessions']();return _0x57887e['find'](_0x51488d=>_0x51488d['phoneNumber']===_0x10df88);}async['createSession'](_0x5983c0){const _0x2dfc51=_0x1ed6af,_0x10138d={'bWIRR':_0x2dfc51(0x12a),'sYgCL':_0x2dfc51(0x156)};if(!await this[_0x2dfc51(0x13e)]()){if(_0x10138d[_0x2dfc51(0x134)]===_0x10138d['bWIRR'])throw new Error(_0x10138d[_0x2dfc51(0x122)]);else throw new _0x38f152(_0x2dfc51(0x156));}const _0x5d77ea={..._0x5983c0,'createdAt':new Date()};return await this[_0x2dfc51(0x153)][_0x2dfc51(0x154)](KEYS[_0x2dfc51(0x11a)],_0x5983c0['id'],JSON[_0x2dfc51(0x148)](_0x5d77ea)),console[_0x2dfc51(0x157)](_0x2dfc51(0x12b)+_0x5983c0['id']),_0x5d77ea;}async[_0x1ed6af(0x116)](_0x440888,_0x1e0893){const _0x5c7b36=_0x1ed6af;if(!await this[_0x5c7b36(0x13e)]())return undefined;const _0x3d28a3=await this[_0x5c7b36(0x117)](_0x440888);if(!_0x3d28a3)return undefined;const _0x450fec={..._0x3d28a3,..._0x1e0893};return await this['redis'][_0x5c7b36(0x154)](KEYS[_0x5c7b36(0x11a)],_0x440888,JSON[_0x5c7b36(0x148)](_0x450fec)),_0x450fec;}async[_0x1ed6af(0x11f)](_0x1a3353){const _0x49f2f9=_0x1ed6af;if(!await this[_0x49f2f9(0x13e)]())return;await this[_0x49f2f9(0x153)]['hdel'](KEYS['SESSIONS'],_0x1a3353),console[_0x49f2f9(0x157)](_0x49f2f9(0x12d)+_0x1a3353);}async[_0x1ed6af(0x115)](){const _0x414437=_0x1ed6af;if(!await this['ensureConnection']())return[];try{const _0xad819b=await this[_0x414437(0x153)]['hgetall'](KEYS['SESSIONS']);return Object[_0x414437(0x10e)](_0xad819b)[_0x414437(0x138)](_0x4b372d=>JSON['parse'](_0x4b372d));}catch(_0x3176fd){return console[_0x414437(0x158)](_0x414437(0x114),_0x3176fd['message']),[];}}async[_0x1ed6af(0x14a)](){const _0x54f618=_0x1ed6af;if(!await this['ensureConnection']())return 0x0;try{return await this['redis'][_0x54f618(0x119)](KEYS['SESSIONS']);}catch(_0x2aa1ca){return 0x0;}}async['getBotSettings'](_0x5bd08c){const _0x2160f3=_0x1ed6af;if(!await this[_0x2160f3(0x13e)]())return undefined;try{const _0x4cf017=await this['redis'][_0x2160f3(0x11b)](KEYS[_0x2160f3(0x120)],_0x5bd08c);if(!_0x4cf017)return undefined;return JSON[_0x2160f3(0x13b)](_0x4cf017);}catch(_0x514348){return console[_0x2160f3(0x158)](_0x2160f3(0x10c),_0x514348['message']),undefined;}}async['createBotSettings'](_0x22e2c4){const _0x45a6e1=_0x1ed6af;if(!await this[_0x45a6e1(0x13e)]())throw new Error(_0x45a6e1(0x156));const _0x223c51=await this[_0x45a6e1(0x153)][_0x45a6e1(0x159)](KEYS[_0x45a6e1(0x131)]),_0x14e6a5={..._0x22e2c4,'id':_0x223c51['toString'](),'createdAt':new Date(),'updatedAt':new Date()};return await this[_0x45a6e1(0x153)]['hset'](KEYS[_0x45a6e1(0x120)],_0x22e2c4[_0x45a6e1(0x10d)],JSON[_0x45a6e1(0x148)](_0x14e6a5)),_0x14e6a5;}async[_0x1ed6af(0x142)](_0x40eb40,_0x3b7cf5){const _0x11d0e7=_0x1ed6af,_0x3da122={'slmDv':function(_0x1cf863,_0x53e44e){return _0x1cf863===_0x53e44e;},'CMAHl':'RpXWO'};if(!await this[_0x11d0e7(0x13e)]())return undefined;const _0x42f99a=await this[_0x11d0e7(0x153)]['hgetall'](KEYS['BOT_SETTINGS']);for(const [_0x40268b,_0x4edd0a]of Object[_0x11d0e7(0x14e)](_0x42f99a)){const _0x120955=JSON['parse'](_0x4edd0a);if(_0x3da122['slmDv'](_0x120955['id'],_0x40eb40)){if(_0x3da122[_0x11d0e7(0x125)]===_0x3da122[_0x11d0e7(0x125)]){const _0x577a1e={..._0x120955,..._0x3b7cf5,'updatedAt':new Date()};return await this[_0x11d0e7(0x153)][_0x11d0e7(0x154)](KEYS['BOT_SETTINGS'],_0x40268b,JSON['stringify'](_0x577a1e)),_0x577a1e;}else throw new _0x188d97(_0x11d0e7(0x12c));}}return undefined;}async[_0x1ed6af(0x11e)](_0x473b2f){const _0x32edad=_0x1ed6af,_0x5e53d8={'tkMuk':_0x32edad(0x12f)};if(!await this[_0x32edad(0x13e)]())return undefined;try{const _0x3cd5b1=await this[_0x32edad(0x153)]['hget'](KEYS[_0x32edad(0x13c)],_0x473b2f);if(!_0x3cd5b1)return undefined;return JSON[_0x32edad(0x13b)](_0x3cd5b1);}catch(_0xb73a53){return console[_0x32edad(0x158)](_0x5e53d8[_0x32edad(0x14c)],_0xb73a53['message']),undefined;}}async[_0x1ed6af(0x111)](_0x457355){const _0x20320c=_0x1ed6af;if(!await this[_0x20320c(0x13e)]())throw new Error(_0x20320c(0x156));const _0x35b3dd={..._0x457355,'createdAt':new Date(),'updatedAt':new Date()};return await this[_0x20320c(0x153)][_0x20320c(0x154)](KEYS['GROUP_SETTINGS'],_0x457355[_0x20320c(0x11d)],JSON[_0x20320c(0x148)](_0x35b3dd)),_0x35b3dd;}async[_0x1ed6af(0x127)](_0x2a7eb1,_0x5390ec){const _0x2c40ca=_0x1ed6af;if(!await this[_0x2c40ca(0x13e)]())return undefined;const _0xe4fa5f=await this[_0x2c40ca(0x11e)](_0x2a7eb1);if(!_0xe4fa5f)return undefined;const _0xdc6fe3={..._0xe4fa5f,..._0x5390ec,'updatedAt':new Date()};return await this[_0x2c40ca(0x153)]['hset'](KEYS['GROUP_SETTINGS'],_0x2a7eb1,JSON['stringify'](_0xdc6fe3)),_0xdc6fe3;}async[_0x1ed6af(0x152)](_0x5d5932){return undefined;}async[_0x1ed6af(0x145)](_0xa0e389){return undefined;}async['createUser'](_0x16c5f3){const _0x516664=_0x1ed6af,_0x1bcd3a={'WfIfu':'Users\x20should\x20be\x20created\x20in\x20internal\x20storage'};throw new Error(_0x1bcd3a[_0x516664(0x147)]);}async[_0x1ed6af(0x137)](){const _0x54da42=_0x1ed6af;this[_0x54da42(0x153)]&&(await this[_0x54da42(0x153)][_0x54da42(0x144)](),this[_0x54da42(0x140)]=![],console[_0x54da42(0x157)](_0x54da42(0x150)));}}exports[_0x1ed6af(0x10f)]=RedisStorage,exports[_0x1ed6af(0x14f)]=new RedisStorage();
|