@kaikybrofc/omnizap-system 2.1.8

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.
Files changed (166) hide show
  1. package/.env.example +534 -0
  2. package/LICENSE +21 -0
  3. package/README.md +431 -0
  4. package/RELEASE-v2.1.2.md +83 -0
  5. package/app/config/adminIdentity.js +87 -0
  6. package/app/config/baileysConfig.js +693 -0
  7. package/app/config/groupUtils.js +388 -0
  8. package/app/connection/socketController.js +992 -0
  9. package/app/controllers/messageController.js +354 -0
  10. package/app/modules/adminModule/groupCommandHandlers.js +1294 -0
  11. package/app/modules/adminModule/groupEventHandlers.js +355 -0
  12. package/app/modules/aiModule/catCommand.js +1006 -0
  13. package/app/modules/broadcastModule/noticeCommand.js +416 -0
  14. package/app/modules/gameModule/diceCommand.js +67 -0
  15. package/app/modules/menuModule/common.js +311 -0
  16. package/app/modules/menuModule/menus.js +59 -0
  17. package/app/modules/playModule/playCommand.js +1615 -0
  18. package/app/modules/quoteModule/quoteCommand.js +851 -0
  19. package/app/modules/rpgPokemonModule/rpgBattleCanvasRenderer.js +786 -0
  20. package/app/modules/rpgPokemonModule/rpgBattleService.js +2082 -0
  21. package/app/modules/rpgPokemonModule/rpgBattleService.test.js +760 -0
  22. package/app/modules/rpgPokemonModule/rpgEvolutionUtils.js +22 -0
  23. package/app/modules/rpgPokemonModule/rpgPokemonCommand.js +172 -0
  24. package/app/modules/rpgPokemonModule/rpgPokemonDomain.js +192 -0
  25. package/app/modules/rpgPokemonModule/rpgPokemonDomain.test.js +93 -0
  26. package/app/modules/rpgPokemonModule/rpgPokemonEvolution.test.js +46 -0
  27. package/app/modules/rpgPokemonModule/rpgPokemonMessages.js +746 -0
  28. package/app/modules/rpgPokemonModule/rpgPokemonRepository.js +1859 -0
  29. package/app/modules/rpgPokemonModule/rpgPokemonService.js +6738 -0
  30. package/app/modules/rpgPokemonModule/rpgProfileCanvasRenderer.js +354 -0
  31. package/app/modules/statsModule/globalRankingCommand.js +65 -0
  32. package/app/modules/statsModule/noMessageCommand.js +288 -0
  33. package/app/modules/statsModule/rankingCommand.js +60 -0
  34. package/app/modules/statsModule/rankingCommon.js +889 -0
  35. package/app/modules/stickerModule/addStickerMetadata.js +239 -0
  36. package/app/modules/stickerModule/convertToWebp.js +390 -0
  37. package/app/modules/stickerModule/stickerCommand.js +454 -0
  38. package/app/modules/stickerModule/stickerConvertCommand.js +156 -0
  39. package/app/modules/stickerModule/stickerTextCommand.js +657 -0
  40. package/app/modules/stickerPackModule/autoPackCollectorRuntime.js +20 -0
  41. package/app/modules/stickerPackModule/autoPackCollectorService.js +284 -0
  42. package/app/modules/stickerPackModule/semanticReclassificationEngine.js +466 -0
  43. package/app/modules/stickerPackModule/semanticReclassificationEngine.test.js +88 -0
  44. package/app/modules/stickerPackModule/semanticThemeClusterService.js +571 -0
  45. package/app/modules/stickerPackModule/stickerAssetClassificationRepository.js +449 -0
  46. package/app/modules/stickerPackModule/stickerAssetRepository.js +400 -0
  47. package/app/modules/stickerPackModule/stickerAssetReprocessQueueRepository.js +180 -0
  48. package/app/modules/stickerPackModule/stickerAutoPackByTagsRuntime.js +4078 -0
  49. package/app/modules/stickerPackModule/stickerClassificationBackgroundRuntime.js +598 -0
  50. package/app/modules/stickerPackModule/stickerClassificationService.js +588 -0
  51. package/app/modules/stickerPackModule/stickerMarketplaceDriftService.js +102 -0
  52. package/app/modules/stickerPackModule/stickerPackCatalogHttp.js +7506 -0
  53. package/app/modules/stickerPackModule/stickerPackCommandHandlers.js +1095 -0
  54. package/app/modules/stickerPackModule/stickerPackEngagementRepository.js +108 -0
  55. package/app/modules/stickerPackModule/stickerPackErrors.js +30 -0
  56. package/app/modules/stickerPackModule/stickerPackInteractionEventRepository.js +110 -0
  57. package/app/modules/stickerPackModule/stickerPackItemRepository.js +440 -0
  58. package/app/modules/stickerPackModule/stickerPackMarketplaceService.js +337 -0
  59. package/app/modules/stickerPackModule/stickerPackMessageService.js +296 -0
  60. package/app/modules/stickerPackModule/stickerPackRepository.js +442 -0
  61. package/app/modules/stickerPackModule/stickerPackService.js +788 -0
  62. package/app/modules/stickerPackModule/stickerPackServiceRuntime.js +51 -0
  63. package/app/modules/stickerPackModule/stickerPackUtils.js +97 -0
  64. package/app/modules/stickerPackModule/stickerStorageService.js +507 -0
  65. package/app/modules/stickerPackModule/stickerWorkerPipelineRuntime.js +233 -0
  66. package/app/modules/stickerPackModule/stickerWorkerTaskQueueRepository.js +205 -0
  67. package/app/modules/systemMetricsModule/pingCommand.js +421 -0
  68. package/app/modules/tiktokModule/tiktokCommand.js +798 -0
  69. package/app/modules/userModule/userCommand.js +1217 -0
  70. package/app/modules/waifuPicsModule/waifuPicsCommand.js +177 -0
  71. package/app/observability/metrics.js +734 -0
  72. package/app/services/captchaService.js +492 -0
  73. package/app/services/dbWriteQueue.js +572 -0
  74. package/app/services/groupMetadataService.js +279 -0
  75. package/app/services/lidMapService.js +663 -0
  76. package/app/services/messagePersistenceService.js +56 -0
  77. package/app/services/newsBroadcastService.js +351 -0
  78. package/app/services/pokeApiService.js +398 -0
  79. package/app/services/queueUtils.js +57 -0
  80. package/app/services/socketState.js +7 -0
  81. package/app/store/aiPromptStore.js +38 -0
  82. package/app/store/groupConfigStore.js +58 -0
  83. package/app/store/premiumUserStore.js +36 -0
  84. package/app/utils/antiLink/antiLinkModule.js +804 -0
  85. package/app/utils/http/getImageBufferModule.js +18 -0
  86. package/app/utils/json/jsonSanitizer.js +113 -0
  87. package/app/utils/json/jsonSanitizer.test.js +40 -0
  88. package/app/utils/logger/loggerModule.js +262 -0
  89. package/app/utils/systemMetrics/systemMetricsModule.js +91 -0
  90. package/database/index.js +2052 -0
  91. package/database/init.js +516 -0
  92. package/database/migrations/20260203_0001_sticker_packs.sql +54 -0
  93. package/database/migrations/20260210_0003_rpg_pokemon.sql +58 -0
  94. package/database/migrations/20260210_0004_rpg_shiny_biome.sql +9 -0
  95. package/database/migrations/20260210_0005_rpg_missions.sql +14 -0
  96. package/database/migrations/20260210_0006_rpg_world_pokedex_traits.sql +27 -0
  97. package/database/migrations/20260210_0007_rpg_raid_pvp.sql +56 -0
  98. package/database/migrations/20260210_0008_rpg_social_system.sql +195 -0
  99. package/database/migrations/20260211_0009_rpg_social_xp.sql +36 -0
  100. package/database/migrations/20260222_0010_remove_message_xp.sql +2 -0
  101. package/database/migrations/20260226_0011_sticker_asset_classification.sql +17 -0
  102. package/database/migrations/20260226_0012_sticker_pack_engagement.sql +16 -0
  103. package/database/migrations/20260226_0013_sticker_marketplace_intelligence.sql +19 -0
  104. package/database/migrations/20260226_0014_sticker_pack_publish_flow.sql +30 -0
  105. package/database/migrations/20260226_0014_sticker_worker_queues.sql +42 -0
  106. package/database/migrations/20260226_0015_sticker_auto_pack_curation_integrity.sql +18 -0
  107. package/database/migrations/20260226_0016_sticker_web_google_auth_persistence.sql +34 -0
  108. package/database/migrations/20260226_0017_sticker_web_admin_ban.sql +22 -0
  109. package/database/migrations/20260226_0018_sticker_web_admin_moderator.sql +18 -0
  110. package/database/migrations/20260227_0019_sticker_classification_v2_signals.sql +12 -0
  111. package/database/migrations/20260227_0020_semantic_theme_clusters.sql +35 -0
  112. package/docker-compose.yml +103 -0
  113. package/ecosystem.prod.config.cjs +35 -0
  114. package/eslint.config.js +61 -0
  115. package/index.js +437 -0
  116. package/ml/clip_classifier/Dockerfile +16 -0
  117. package/ml/clip_classifier/README.md +120 -0
  118. package/ml/clip_classifier/adaptive_scoring.py +40 -0
  119. package/ml/clip_classifier/classifier.py +654 -0
  120. package/ml/clip_classifier/embedding_store.py +481 -0
  121. package/ml/clip_classifier/env_loader.py +15 -0
  122. package/ml/clip_classifier/llm_label_expander.py +144 -0
  123. package/ml/clip_classifier/main.py +213 -0
  124. package/ml/clip_classifier/requirements.txt +10 -0
  125. package/ml/clip_classifier/similarity_engine.py +74 -0
  126. package/observability/alert-rules.yml +60 -0
  127. package/observability/grafana/dashboards/omnizap-mysql.json +136 -0
  128. package/observability/grafana/dashboards/omnizap-overview.json +170 -0
  129. package/observability/grafana/provisioning/dashboards/dashboards.yml +11 -0
  130. package/observability/grafana/provisioning/datasources/datasources.yml +15 -0
  131. package/observability/loki-config.yml +38 -0
  132. package/observability/mysql-exporter.cnf +5 -0
  133. package/observability/mysql-setup.sql +46 -0
  134. package/observability/prometheus.yml +32 -0
  135. package/observability/promtail-config.yml +84 -0
  136. package/package.json +109 -0
  137. package/public/api-docs/index.html +144 -0
  138. package/public/css/github-project-panel.css +297 -0
  139. package/public/css/stickers-admin.css +1272 -0
  140. package/public/css/styles.css +671 -0
  141. package/public/index.html +1311 -0
  142. package/public/js/apps/apiDocsApp.js +310 -0
  143. package/public/js/apps/createPackApp.js +2069 -0
  144. package/public/js/apps/homeApp.js +396 -0
  145. package/public/js/apps/stickersAdminApp.js +1744 -0
  146. package/public/js/apps/stickersApp.js +4830 -0
  147. package/public/js/catalog.js +1019 -0
  148. package/public/js/github-panel/components/CommitList.js +34 -0
  149. package/public/js/github-panel/components/ErrorState.js +16 -0
  150. package/public/js/github-panel/components/GithubProjectPanel.js +106 -0
  151. package/public/js/github-panel/components/ReleaseList.js +38 -0
  152. package/public/js/github-panel/components/SkeletonPanel.js +22 -0
  153. package/public/js/github-panel/components/StatCard.js +15 -0
  154. package/public/js/github-panel/index.js +15 -0
  155. package/public/js/github-panel/useGithubRepoData.js +154 -0
  156. package/public/js/github-panel/vendor/react.js +11 -0
  157. package/public/js/runtime/react-runtime.js +19 -0
  158. package/public/licenca/index.html +106 -0
  159. package/public/stickers/admin/index.html +23 -0
  160. package/public/stickers/create/index.html +47 -0
  161. package/public/stickers/index.html +48 -0
  162. package/public/termos-de-uso/index.html +125 -0
  163. package/scripts/cache-bust.mjs +107 -0
  164. package/scripts/deploy.sh +458 -0
  165. package/scripts/github-deploy-notify.mjs +174 -0
  166. package/scripts/release.sh +129 -0
@@ -0,0 +1,354 @@
1
+ import 'dotenv/config';
2
+
3
+ import { handleMenuCommand } from '../modules/menuModule/menus.js';
4
+ import { handleAdminCommand, isAdminCommand } from '../modules/adminModule/groupCommandHandlers.js';
5
+ import { extractSupportedStickerMediaDetails, processSticker } from '../modules/stickerModule/stickerCommand.js';
6
+ import { processBlinkingTextSticker, processTextSticker } from '../modules/stickerModule/stickerTextCommand.js';
7
+ import { handlePlayCommand, handlePlayVidCommand } from '../modules/playModule/playCommand.js';
8
+ import { handleRankingCommand } from '../modules/statsModule/rankingCommand.js';
9
+ import { handleGlobalRankingCommand } from '../modules/statsModule/globalRankingCommand.js';
10
+ import { handleNoMessageCommand } from '../modules/statsModule/noMessageCommand.js';
11
+ import { handlePingCommand } from '../modules/systemMetricsModule/pingCommand.js';
12
+ import { extractMessageContent, getExpiration, isGroupJid, isSameJidUser, resolveBotJid } from '../config/baileysConfig.js';
13
+ import logger from '../utils/logger/loggerModule.js';
14
+ import { handleAntiLink } from '../utils/antiLink/antiLinkModule.js';
15
+ import { handleCatCommand, handleCatImageCommand, handleCatPromptCommand } from '../modules/aiModule/catCommand.js';
16
+ import { handleNoticeCommand } from '../modules/broadcastModule/noticeCommand.js';
17
+ import { handleQuoteCommand } from '../modules/quoteModule/quoteCommand.js';
18
+ import { handleStickerConvertCommand } from '../modules/stickerModule/stickerConvertCommand.js';
19
+ import { handleWaifuPicsCommand, getWaifuPicsUsageText } from '../modules/waifuPicsModule/waifuPicsCommand.js';
20
+ import { handlePackCommand, maybeCaptureIncomingSticker } from '../modules/stickerPackModule/stickerPackCommandHandlers.js';
21
+ import { handleUserCommand } from '../modules/userModule/userCommand.js';
22
+ import { handleDiceCommand } from '../modules/gameModule/diceCommand.js';
23
+ import { handleTikTokCommand } from '../modules/tiktokModule/tiktokCommand.js';
24
+ import { handleRpgPokemonCommand } from '../modules/rpgPokemonModule/rpgPokemonCommand.js';
25
+ import groupConfigStore from '../store/groupConfigStore.js';
26
+ import { sendAndStore } from '../services/messagePersistenceService.js';
27
+ import { resolveCaptchaByMessage } from '../services/captchaService.js';
28
+
29
+ const DEFAULT_COMMAND_PREFIX = process.env.COMMAND_PREFIX || '/';
30
+ const COMMAND_REACT_EMOJI = process.env.COMMAND_REACT_EMOJI || '🤖';
31
+
32
+ /**
33
+ * Resolve o prefixo de comandos.
34
+ * Usa o prefixo do grupo quando existir, senão usa o padrão.
35
+ */
36
+ const resolveCommandPrefix = async (isGroupMessage, remoteJid) => {
37
+ if (!isGroupMessage) return DEFAULT_COMMAND_PREFIX;
38
+ const config = await groupConfigStore.getGroupConfig(remoteJid);
39
+ if (!config || typeof config.commandPrefix !== 'string') {
40
+ return DEFAULT_COMMAND_PREFIX;
41
+ }
42
+ const prefix = config.commandPrefix.trim();
43
+ return prefix || DEFAULT_COMMAND_PREFIX;
44
+ };
45
+
46
+ /**
47
+ * Executa um comando com tratamento de erro.
48
+ * Captura erros síncronos e promessas rejeitadas.
49
+ */
50
+ const runCommand = (label, handler) => {
51
+ try {
52
+ const result = handler();
53
+ if (result && typeof result.catch === 'function') {
54
+ result.catch((error) => {
55
+ logger.error(`Erro ao executar comando ${label}:`, error.message);
56
+ });
57
+ }
58
+ } catch (error) {
59
+ logger.error(`Erro ao executar comando ${label}:`, error.message);
60
+ }
61
+ };
62
+
63
+ /**
64
+ * Lida com atualizações do WhatsApp, sejam mensagens ou eventos genéricos.
65
+ *
66
+ * @param {Object} update - Objeto contendo a atualização do WhatsApp.
67
+ */
68
+ export const handleMessages = async (update, sock) => {
69
+ if (update.messages && Array.isArray(update.messages)) {
70
+ try {
71
+ for (const messageInfo of update.messages) {
72
+ const extractedText = extractMessageContent(messageInfo);
73
+ const remoteJid = messageInfo.key.remoteJid;
74
+ const isGroupMessage = isGroupJid(remoteJid);
75
+ const senderJid = isGroupMessage ? messageInfo.key.participant : remoteJid;
76
+ const senderIdentity = isGroupMessage
77
+ ? {
78
+ participant: messageInfo.key?.participant || null,
79
+ participantAlt: messageInfo.key?.participantAlt || null,
80
+ jid: senderJid || null,
81
+ }
82
+ : senderJid;
83
+ const senderName = messageInfo.pushName;
84
+ const expirationMessage = getExpiration(messageInfo);
85
+ const botJid = resolveBotJid(sock?.user?.id);
86
+ const isMessageFromBot = Boolean(messageInfo?.key?.fromMe) || (botJid ? isSameJidUser(senderJid, botJid) : false);
87
+ let commandPrefix = DEFAULT_COMMAND_PREFIX;
88
+
89
+ /**
90
+ * Executa validações de grupo.
91
+ * Aplica o Anti-Link e resolve o prefixo do grupo.
92
+ * Se a mensagem for bloqueada, interrompe o processamento.
93
+ */
94
+ if (isGroupMessage) {
95
+ const shouldSkip = await handleAntiLink({ sock, messageInfo, extractedText, remoteJid, senderJid, botJid });
96
+
97
+ if (shouldSkip) {
98
+ continue;
99
+ }
100
+ commandPrefix = await resolveCommandPrefix(true, remoteJid);
101
+ }
102
+
103
+ if (isGroupMessage && !isMessageFromBot) {
104
+ await resolveCaptchaByMessage({
105
+ groupId: remoteJid,
106
+ senderJid,
107
+ senderIdentity,
108
+ messageKey: messageInfo.key,
109
+ messageInfo,
110
+ extractedText,
111
+ });
112
+ }
113
+
114
+ /**
115
+ * Envia uma reação automática quando a mensagem começa com o prefixo de comando.
116
+ * A falha no envio da reação não interrompe o processamento do comando.
117
+ */
118
+ const isCommandMessage = extractedText.startsWith(commandPrefix);
119
+
120
+ if (isCommandMessage) {
121
+ if (COMMAND_REACT_EMOJI) {
122
+ try {
123
+ await sendAndStore(sock, remoteJid, {
124
+ react: {
125
+ text: COMMAND_REACT_EMOJI,
126
+ key: messageInfo.key,
127
+ },
128
+ });
129
+ } catch (error) {
130
+ logger.warn('Falha ao enviar reação de comando:', error.message);
131
+ }
132
+ }
133
+
134
+ const commandBody = extractedText.substring(commandPrefix.length);
135
+ const match = commandBody.match(/^(\S+)([\s\S]*)$/);
136
+ const command = match ? match[1].toLowerCase() : '';
137
+ const rawArgs = match && match[2] !== undefined ? match[2].trim() : '';
138
+ const args = rawArgs ? rawArgs.split(/\s+/) : [];
139
+ const text = match && match[2] !== undefined ? match[2] : '';
140
+
141
+ switch (command) {
142
+ case 'menu':
143
+ runCommand('menu', () => handleMenuCommand(sock, remoteJid, messageInfo, expirationMessage, senderName, commandPrefix, args));
144
+ break;
145
+
146
+ case 'sticker':
147
+ case 's':
148
+ runCommand('sticker', () => processSticker(sock, messageInfo, senderJid, remoteJid, expirationMessage, senderName, args.join(' '), { commandPrefix }));
149
+ break;
150
+
151
+ case 'pack':
152
+ case 'packs':
153
+ runCommand('pack', () => handlePackCommand({ sock, remoteJid, messageInfo, expirationMessage, senderJid, senderName, text, commandPrefix }));
154
+ break;
155
+
156
+ case 'toimg':
157
+ case 'tovideo':
158
+ case 'tovid':
159
+ runCommand('toimg', () => handleStickerConvertCommand({ sock, remoteJid, messageInfo, expirationMessage, senderJid }));
160
+ break;
161
+
162
+ case 'play':
163
+ runCommand('play', () => handlePlayCommand(sock, remoteJid, messageInfo, expirationMessage, text, commandPrefix));
164
+ break;
165
+
166
+ case 'playvid':
167
+ runCommand('playvid', () => handlePlayVidCommand(sock, remoteJid, messageInfo, expirationMessage, text, commandPrefix));
168
+ break;
169
+
170
+ case 'tiktok':
171
+ case 'tt':
172
+ runCommand('tiktok', () => handleTikTokCommand({ sock, remoteJid, messageInfo, expirationMessage, text, commandPrefix }));
173
+ break;
174
+
175
+ case 'cat':
176
+ runCommand('cat', () => handleCatCommand({ sock, remoteJid, messageInfo, expirationMessage, senderJid, text, commandPrefix }));
177
+ break;
178
+
179
+ case 'catimg':
180
+ case 'catimage':
181
+ runCommand('catimg', () => handleCatImageCommand({ sock, remoteJid, messageInfo, expirationMessage, senderJid, text, commandPrefix }));
182
+ break;
183
+
184
+ case 'catprompt':
185
+ case 'iaprompt':
186
+ case 'promptia':
187
+ runCommand('catprompt', () => handleCatPromptCommand({ sock, remoteJid, messageInfo, expirationMessage, senderJid, text, commandPrefix }));
188
+ break;
189
+
190
+ case 'quote':
191
+ case 'qc':
192
+ runCommand('quote', () => handleQuoteCommand({ sock, remoteJid, messageInfo, expirationMessage, senderJid, senderName, text, commandPrefix }));
193
+ break;
194
+
195
+ case 'wp':
196
+ case 'waifupics':
197
+ runCommand('waifupics', () => handleWaifuPicsCommand({ sock, remoteJid, messageInfo, expirationMessage, text, type: 'sfw', commandPrefix }));
198
+ break;
199
+
200
+ case 'wpnsfw':
201
+ case 'waifupicsnsfw':
202
+ runCommand('waifupicsnsfw', () => handleWaifuPicsCommand({ sock, remoteJid, messageInfo, expirationMessage, text, type: 'nsfw', commandPrefix }));
203
+ break;
204
+
205
+ case 'wppicshelp':
206
+ runCommand('wppicshelp', () => sendAndStore(sock, remoteJid, { text: getWaifuPicsUsageText(commandPrefix) }, { quoted: messageInfo, ephemeralExpiration: expirationMessage }));
207
+ break;
208
+
209
+ case 'stickertext':
210
+ case 'st':
211
+ runCommand('stickertext', () => processTextSticker({ sock, messageInfo, remoteJid, senderJid, senderName, text, extraText: 'PackZoeira', expirationMessage, color: 'black', commandPrefix }));
212
+ break;
213
+
214
+ case 'stickertextwhite':
215
+ case 'stw':
216
+ runCommand('stickertextwhite', () => processTextSticker({ sock, messageInfo, remoteJid, senderJid, senderName, text, extraText: 'PackZoeira', expirationMessage, color: 'white', commandPrefix }));
217
+ break;
218
+
219
+ case 'stickertextblink':
220
+ case 'stb':
221
+ runCommand('stickertextblink', () => processBlinkingTextSticker({ sock, messageInfo, remoteJid, senderJid, senderName, text, extraText: 'PackZoeira', expirationMessage, color: 'white', commandPrefix }));
222
+ break;
223
+
224
+ case 'ranking':
225
+ case 'rank':
226
+ case 'top5':
227
+ runCommand('ranking', () => handleRankingCommand({ sock, remoteJid, messageInfo, expirationMessage, isGroupMessage }));
228
+ break;
229
+
230
+ case 'rankingglobal':
231
+ case 'rankglobal':
232
+ case 'globalrank':
233
+ case 'globalranking':
234
+ runCommand('rankingglobal', () => handleGlobalRankingCommand({ sock, remoteJid, messageInfo, expirationMessage, isGroupMessage }));
235
+ break;
236
+
237
+ case 'semmsg':
238
+ case 'zeromsg':
239
+ case 'nomsg':
240
+ case 'inativos':
241
+ runCommand('semmsg', () => handleNoMessageCommand({ sock, remoteJid, messageInfo, expirationMessage, isGroupMessage, senderJid, text }));
242
+ break;
243
+
244
+ case 'ping':
245
+ runCommand('ping', () => handlePingCommand({ sock, remoteJid, messageInfo, expirationMessage }));
246
+ break;
247
+
248
+ case 'dado':
249
+ case 'dice':
250
+ runCommand('dado', () => handleDiceCommand({ sock, remoteJid, messageInfo, expirationMessage, args, commandPrefix }));
251
+ break;
252
+
253
+ case 'user':
254
+ case 'usuario':
255
+ runCommand('user', () =>
256
+ handleUserCommand({
257
+ sock,
258
+ remoteJid,
259
+ messageInfo,
260
+ expirationMessage,
261
+ senderJid,
262
+ args,
263
+ isGroupMessage,
264
+ commandPrefix,
265
+ }),
266
+ );
267
+ break;
268
+
269
+ case 'rpg':
270
+ runCommand('rpg', () =>
271
+ handleRpgPokemonCommand({
272
+ sock,
273
+ remoteJid,
274
+ messageInfo,
275
+ expirationMessage,
276
+ senderJid,
277
+ senderIdentity,
278
+ args,
279
+ commandPrefix,
280
+ }),
281
+ );
282
+ break;
283
+
284
+ case 'aviso':
285
+ case 'notice':
286
+ runCommand('aviso', () => handleNoticeCommand({ sock, remoteJid, messageInfo, expirationMessage, senderJid, text, commandPrefix }));
287
+ break;
288
+
289
+ default:
290
+ if (isAdminCommand(command)) {
291
+ runCommand('admin', () => handleAdminCommand({ command, args, text, sock, messageInfo, remoteJid, senderJid, botJid, isGroupMessage, expirationMessage, commandPrefix }));
292
+ break;
293
+ }
294
+
295
+ logger.info(`Comando desconhecido recebido: ${command}`);
296
+ runCommand('unknown', () =>
297
+ sendAndStore(
298
+ sock,
299
+ remoteJid,
300
+ {
301
+ text: `❌ *Comando não reconhecido*
302
+
303
+ O comando *${command}* não está configurado ou ainda não existe.
304
+
305
+ ℹ️ *Dica:*
306
+ Digite *${commandPrefix}menu* para ver a lista de comandos disponíveis.
307
+
308
+ 🚧 *Fase Beta*
309
+ O omnizap-system ainda está em desenvolvimento e novos comandos estão sendo adicionados constantemente.`,
310
+ },
311
+ { quoted: messageInfo, ephemeralExpiration: expirationMessage },
312
+ ),
313
+ );
314
+ break;
315
+ }
316
+ }
317
+
318
+ if (!isMessageFromBot) {
319
+ runCommand('pack-capture', () =>
320
+ maybeCaptureIncomingSticker({
321
+ messageInfo,
322
+ senderJid,
323
+ isMessageFromBot,
324
+ }),
325
+ );
326
+ }
327
+
328
+ if (isGroupMessage && !isCommandMessage && !isMessageFromBot) {
329
+ const autoStickerMedia = extractSupportedStickerMediaDetails(messageInfo, { includeQuoted: false });
330
+
331
+ if (autoStickerMedia && autoStickerMedia.mediaType !== 'sticker') {
332
+ const groupConfig = await groupConfigStore.getGroupConfig(remoteJid);
333
+ if (groupConfig.autoStickerEnabled) {
334
+ runCommand('autosticker', () =>
335
+ processSticker(sock, messageInfo, senderJid, remoteJid, expirationMessage, senderName, '', {
336
+ includeQuotedMedia: false,
337
+ showAutoPackNotice: false,
338
+ commandPrefix,
339
+ }),
340
+ );
341
+ }
342
+ }
343
+ }
344
+ }
345
+ } catch (error) {
346
+ logger.error('Erro ao processar mensagens:', error.message);
347
+ }
348
+ } else {
349
+ logger.info('🔄 Processando evento recebido:', {
350
+ eventType: update?.type || 'unknown',
351
+ eventData: update,
352
+ });
353
+ }
354
+ };