trompot 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +560 -0
- package/lib/bot/BotBase.d.ts +82 -0
- package/lib/bot/BotBase.js +144 -0
- package/lib/bot/BotBase.js.map +1 -0
- package/lib/bot/BotEvents.d.ts +87 -0
- package/lib/bot/BotEvents.js +51 -0
- package/lib/bot/BotEvents.js.map +1 -0
- package/lib/bot/BotServer.d.ts +34 -0
- package/lib/bot/BotServer.js +118 -0
- package/lib/bot/BotServer.js.map +1 -0
- package/lib/bot/BotStatus.d.ts +4 -0
- package/lib/bot/BotStatus.js +9 -0
- package/lib/bot/BotStatus.js.map +1 -0
- package/lib/bot/IBot.d.ts +292 -0
- package/lib/bot/IBot.js +3 -0
- package/lib/bot/IBot.js.map +1 -0
- package/lib/bot/index.d.ts +5 -0
- package/lib/bot/index.js +13 -0
- package/lib/bot/index.js.map +1 -0
- package/lib/client/Client.d.ts +120 -0
- package/lib/client/Client.js +687 -0
- package/lib/client/Client.js.map +1 -0
- package/lib/client/ClientEvents.d.ts +147 -0
- package/lib/client/ClientEvents.js +93 -0
- package/lib/client/ClientEvents.js.map +1 -0
- package/lib/client/ClientFunctionHandler.d.ts +15 -0
- package/lib/client/ClientFunctionHandler.js +70 -0
- package/lib/client/ClientFunctionHandler.js.map +1 -0
- package/lib/client/ConnectionType.d.ts +4 -0
- package/lib/client/ConnectionType.js +3 -0
- package/lib/client/ConnectionType.js.map +1 -0
- package/lib/client/IAuth.d.ts +9 -0
- package/lib/client/IAuth.js +3 -0
- package/lib/client/IAuth.js.map +1 -0
- package/lib/client/IClient.d.ts +358 -0
- package/lib/client/IClient.js +3 -0
- package/lib/client/IClient.js.map +1 -0
- package/lib/client/index.d.ts +7 -0
- package/lib/client/index.js +13 -0
- package/lib/client/index.js.map +1 -0
- package/lib/cluster/ClientCluster.d.ts +428 -0
- package/lib/cluster/ClientCluster.js +1746 -0
- package/lib/cluster/ClientCluster.js.map +1 -0
- package/lib/cluster/WorkerMessage.d.ts +99 -0
- package/lib/cluster/WorkerMessage.js +84 -0
- package/lib/cluster/WorkerMessage.js.map +1 -0
- package/lib/cluster/index.d.ts +5 -0
- package/lib/cluster/index.js +27 -0
- package/lib/cluster/index.js.map +1 -0
- package/lib/configs/ConnectionConfig.d.ts +22 -0
- package/lib/configs/ConnectionConfig.js +3 -0
- package/lib/configs/ConnectionConfig.js.map +1 -0
- package/lib/configs/Defaults.d.ts +2 -0
- package/lib/configs/Defaults.js +16 -0
- package/lib/configs/Defaults.js.map +1 -0
- package/lib/configs/WAConfigs.d.ts +1 -0
- package/lib/configs/WAConfigs.js +5 -0
- package/lib/configs/WAConfigs.js.map +1 -0
- package/lib/configs/index.d.ts +3 -0
- package/lib/configs/index.js +18 -0
- package/lib/configs/index.js.map +1 -0
- package/lib/errors/ChatNotDefinedError.d.ts +4 -0
- package/lib/errors/ChatNotDefinedError.js +9 -0
- package/lib/errors/ChatNotDefinedError.js.map +1 -0
- package/lib/errors/ClientNotDefinedError.d.ts +4 -0
- package/lib/errors/ClientNotDefinedError.js +9 -0
- package/lib/errors/ClientNotDefinedError.js.map +1 -0
- package/lib/errors/UserNotDefinedError.d.ts +4 -0
- package/lib/errors/UserNotDefinedError.js +9 -0
- package/lib/errors/UserNotDefinedError.js.map +1 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +60 -0
- package/lib/index.js.map +1 -0
- package/lib/messages/AudioMessage.d.ts +42 -0
- package/lib/messages/AudioMessage.js +66 -0
- package/lib/messages/AudioMessage.js.map +1 -0
- package/lib/messages/ButtonMessage.d.ts +88 -0
- package/lib/messages/ButtonMessage.js +137 -0
- package/lib/messages/ButtonMessage.js.map +1 -0
- package/lib/messages/ContactMessage.d.ts +37 -0
- package/lib/messages/ContactMessage.js +93 -0
- package/lib/messages/ContactMessage.js.map +1 -0
- package/lib/messages/CustomMessage.d.ts +35 -0
- package/lib/messages/CustomMessage.js +88 -0
- package/lib/messages/CustomMessage.js.map +1 -0
- package/lib/messages/EmptyMessage.d.ts +25 -0
- package/lib/messages/EmptyMessage.js +78 -0
- package/lib/messages/EmptyMessage.js.map +1 -0
- package/lib/messages/ErrorMessage.d.ts +35 -0
- package/lib/messages/ErrorMessage.js +86 -0
- package/lib/messages/ErrorMessage.js.map +1 -0
- package/lib/messages/FileMessage.d.ts +36 -0
- package/lib/messages/FileMessage.js +60 -0
- package/lib/messages/FileMessage.js.map +1 -0
- package/lib/messages/ImageMessage.d.ts +41 -0
- package/lib/messages/ImageMessage.js +65 -0
- package/lib/messages/ImageMessage.js.map +1 -0
- package/lib/messages/ListMessage.d.ts +91 -0
- package/lib/messages/ListMessage.js +126 -0
- package/lib/messages/ListMessage.js.map +1 -0
- package/lib/messages/LocationMessage.d.ts +48 -0
- package/lib/messages/LocationMessage.js +107 -0
- package/lib/messages/LocationMessage.js.map +1 -0
- package/lib/messages/MediaMessage.d.ts +54 -0
- package/lib/messages/MediaMessage.js +113 -0
- package/lib/messages/MediaMessage.js.map +1 -0
- package/lib/messages/Message.d.ts +144 -0
- package/lib/messages/Message.js +223 -0
- package/lib/messages/Message.js.map +1 -0
- package/lib/messages/PollMessage.d.ts +87 -0
- package/lib/messages/PollMessage.js +145 -0
- package/lib/messages/PollMessage.js.map +1 -0
- package/lib/messages/PollUpdateMessage.d.ts +40 -0
- package/lib/messages/PollUpdateMessage.js +98 -0
- package/lib/messages/PollUpdateMessage.js.map +1 -0
- package/lib/messages/ReactionMessage.d.ts +36 -0
- package/lib/messages/ReactionMessage.js +91 -0
- package/lib/messages/ReactionMessage.js.map +1 -0
- package/lib/messages/StickerMessage.d.ts +49 -0
- package/lib/messages/StickerMessage.js +73 -0
- package/lib/messages/StickerMessage.js.map +1 -0
- package/lib/messages/TextMessage.d.ts +33 -0
- package/lib/messages/TextMessage.js +84 -0
- package/lib/messages/TextMessage.js.map +1 -0
- package/lib/messages/VideoMessage.d.ts +42 -0
- package/lib/messages/VideoMessage.js +66 -0
- package/lib/messages/VideoMessage.js.map +1 -0
- package/lib/messages/index.d.ts +19 -0
- package/lib/messages/index.js +81 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/models/Address.d.ts +11 -0
- package/lib/models/Address.js +18 -0
- package/lib/models/Address.js.map +1 -0
- package/lib/models/Call.d.ts +68 -0
- package/lib/models/Call.js +127 -0
- package/lib/models/Call.js.map +1 -0
- package/lib/modules/chat/Chat.d.ts +142 -0
- package/lib/modules/chat/Chat.js +246 -0
- package/lib/modules/chat/Chat.js.map +1 -0
- package/lib/modules/chat/ChatAction.d.ts +3 -0
- package/lib/modules/chat/ChatAction.js +3 -0
- package/lib/modules/chat/ChatAction.js.map +1 -0
- package/lib/modules/chat/ChatStatus.d.ts +9 -0
- package/lib/modules/chat/ChatStatus.js +13 -0
- package/lib/modules/chat/ChatStatus.js.map +1 -0
- package/lib/modules/chat/ChatType.d.ts +7 -0
- package/lib/modules/chat/ChatType.js +11 -0
- package/lib/modules/chat/ChatType.js.map +1 -0
- package/lib/modules/chat/index.d.ts +5 -0
- package/lib/modules/chat/index.js +13 -0
- package/lib/modules/chat/index.js.map +1 -0
- package/lib/modules/command/Command.d.ts +67 -0
- package/lib/modules/command/Command.js +139 -0
- package/lib/modules/command/Command.js.map +1 -0
- package/lib/modules/command/CommandController.d.ts +50 -0
- package/lib/modules/command/CommandController.js +119 -0
- package/lib/modules/command/CommandController.js.map +1 -0
- package/lib/modules/command/CommandControllerEvent.d.ts +9 -0
- package/lib/modules/command/CommandControllerEvent.js +25 -0
- package/lib/modules/command/CommandControllerEvent.js.map +1 -0
- package/lib/modules/command/CommandEnums.d.ts +14 -0
- package/lib/modules/command/CommandEnums.js +20 -0
- package/lib/modules/command/CommandEnums.js.map +1 -0
- package/lib/modules/command/CommandKey.d.ts +17 -0
- package/lib/modules/command/CommandKey.js +67 -0
- package/lib/modules/command/CommandKey.js.map +1 -0
- package/lib/modules/command/CommandPermission.d.ts +9 -0
- package/lib/modules/command/CommandPermission.js +35 -0
- package/lib/modules/command/CommandPermission.js.map +1 -0
- package/lib/modules/command/ICommandControllerConfig.d.ts +7 -0
- package/lib/modules/command/ICommandControllerConfig.js +3 -0
- package/lib/modules/command/ICommandControllerConfig.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommand.d.ts +23 -0
- package/lib/modules/command/advanced/AdvancedCommand.js +131 -0
- package/lib/modules/command/advanced/AdvancedCommand.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandContext.d.ts +10 -0
- package/lib/modules/command/advanced/AdvancedCommandContext.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandContext.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandController.d.ts +29 -0
- package/lib/modules/command/advanced/AdvancedCommandController.js +118 -0
- package/lib/modules/command/advanced/AdvancedCommandController.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandData.d.ts +6 -0
- package/lib/modules/command/advanced/AdvancedCommandData.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandData.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandJob.d.ts +12 -0
- package/lib/modules/command/advanced/AdvancedCommandJob.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandJob.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandNext.d.ts +4 -0
- package/lib/modules/command/advanced/AdvancedCommandNext.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandNext.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandOptions.d.ts +8 -0
- package/lib/modules/command/advanced/AdvancedCommandOptions.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandOptions.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandStart.d.ts +11 -0
- package/lib/modules/command/advanced/AdvancedCommandStart.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandStart.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandStop.d.ts +3 -0
- package/lib/modules/command/advanced/AdvancedCommandStop.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandStop.js.map +1 -0
- package/lib/modules/command/advanced/AdvancedCommandTask.d.ts +2 -0
- package/lib/modules/command/advanced/AdvancedCommandTask.js +3 -0
- package/lib/modules/command/advanced/AdvancedCommandTask.js.map +1 -0
- package/lib/modules/command/defaults.d.ts +2 -0
- package/lib/modules/command/defaults.js +8 -0
- package/lib/modules/command/defaults.js.map +1 -0
- package/lib/modules/command/index.d.ts +12 -0
- package/lib/modules/command/index.js +36 -0
- package/lib/modules/command/index.js.map +1 -0
- package/lib/modules/command/keys.d.ts +9 -0
- package/lib/modules/command/keys.js +27 -0
- package/lib/modules/command/keys.js.map +1 -0
- package/lib/modules/command/perms.d.ts +2 -0
- package/lib/modules/command/perms.js +11 -0
- package/lib/modules/command/perms.js.map +1 -0
- package/lib/modules/quickResponse/QuickResponse.d.ts +49 -0
- package/lib/modules/quickResponse/QuickResponse.js +64 -0
- package/lib/modules/quickResponse/QuickResponse.js.map +1 -0
- package/lib/modules/quickResponse/QuickResponseController.d.ts +55 -0
- package/lib/modules/quickResponse/QuickResponseController.js +125 -0
- package/lib/modules/quickResponse/QuickResponseController.js.map +1 -0
- package/lib/modules/quickResponse/QuickResponseOptions.d.ts +56 -0
- package/lib/modules/quickResponse/QuickResponseOptions.js +76 -0
- package/lib/modules/quickResponse/QuickResponseOptions.js.map +1 -0
- package/lib/modules/quickResponse/QuickResponsePattern.d.ts +28 -0
- package/lib/modules/quickResponse/QuickResponsePattern.js +3 -0
- package/lib/modules/quickResponse/QuickResponsePattern.js.map +1 -0
- package/lib/modules/quickResponse/QuickResponseReply.d.ts +6 -0
- package/lib/modules/quickResponse/QuickResponseReply.js +3 -0
- package/lib/modules/quickResponse/QuickResponseReply.js.map +1 -0
- package/lib/modules/quickResponse/index.d.ts +6 -0
- package/lib/modules/quickResponse/index.js +13 -0
- package/lib/modules/quickResponse/index.js.map +1 -0
- package/lib/modules/user/User.d.ts +91 -0
- package/lib/modules/user/User.js +173 -0
- package/lib/modules/user/User.js.map +1 -0
- package/lib/modules/user/UserAction.d.ts +4 -0
- package/lib/modules/user/UserAction.js +3 -0
- package/lib/modules/user/UserAction.js.map +1 -0
- package/lib/modules/user/UserEvent.d.ts +3 -0
- package/lib/modules/user/UserEvent.js +3 -0
- package/lib/modules/user/UserEvent.js.map +1 -0
- package/lib/modules/user/index.d.ts +4 -0
- package/lib/modules/user/index.js +9 -0
- package/lib/modules/user/index.js.map +1 -0
- package/lib/routes/botServer/api/v1/emitEvent.d.ts +3 -0
- package/lib/routes/botServer/api/v1/emitEvent.js +17 -0
- package/lib/routes/botServer/api/v1/emitEvent.js.map +1 -0
- package/lib/routes/botServer/api/v1/function.d.ts +3 -0
- package/lib/routes/botServer/api/v1/function.js +22 -0
- package/lib/routes/botServer/api/v1/function.js.map +1 -0
- package/lib/routes/botServer/api/v1/ping.d.ts +3 -0
- package/lib/routes/botServer/api/v1/ping.js +12 -0
- package/lib/routes/botServer/api/v1/ping.js.map +1 -0
- package/lib/routes/botServer/api/v1/register.d.ts +3 -0
- package/lib/routes/botServer/api/v1/register.js +23 -0
- package/lib/routes/botServer/api/v1/register.js.map +1 -0
- package/lib/routes/botServer/api/v1/setValue.d.ts +3 -0
- package/lib/routes/botServer/api/v1/setValue.js +18 -0
- package/lib/routes/botServer/api/v1/setValue.js.map +1 -0
- package/lib/routes/botServer/api/v1/unregister.d.ts +3 -0
- package/lib/routes/botServer/api/v1/unregister.js +22 -0
- package/lib/routes/botServer/api/v1/unregister.js.map +1 -0
- package/lib/routes/botServer/middlewares/setBotServer.d.ts +4 -0
- package/lib/routes/botServer/middlewares/setBotServer.js +16 -0
- package/lib/routes/botServer/middlewares/setBotServer.js.map +1 -0
- package/lib/routes/botServer/routes.d.ts +8 -0
- package/lib/routes/botServer/routes.js +33 -0
- package/lib/routes/botServer/routes.js.map +1 -0
- package/lib/services/AddressService.d.ts +12 -0
- package/lib/services/AddressService.js +51 -0
- package/lib/services/AddressService.js.map +1 -0
- package/lib/services/BaseService.d.ts +5 -0
- package/lib/services/BaseService.js +19 -0
- package/lib/services/BaseService.js.map +1 -0
- package/lib/services/index.d.ts +3 -0
- package/lib/services/index.js +11 -0
- package/lib/services/index.js.map +1 -0
- package/lib/telegram/TelegramAuth.d.ts +17 -0
- package/lib/telegram/TelegramAuth.js +96 -0
- package/lib/telegram/TelegramAuth.js.map +1 -0
- package/lib/telegram/TelegramBot.d.ts +88 -0
- package/lib/telegram/TelegramBot.js +345 -0
- package/lib/telegram/TelegramBot.js.map +1 -0
- package/lib/telegram/TelegramEvents.d.ts +13 -0
- package/lib/telegram/TelegramEvents.js +131 -0
- package/lib/telegram/TelegramEvents.js.map +1 -0
- package/lib/telegram/TelegramSendingController.d.ts +36 -0
- package/lib/telegram/TelegramSendingController.js +213 -0
- package/lib/telegram/TelegramSendingController.js.map +1 -0
- package/lib/telegram/TelegramToRompotConverter.d.ts +22 -0
- package/lib/telegram/TelegramToRompotConverter.js +226 -0
- package/lib/telegram/TelegramToRompotConverter.js.map +1 -0
- package/lib/telegram/TelegramUtils.d.ts +14 -0
- package/lib/telegram/TelegramUtils.js +98 -0
- package/lib/telegram/TelegramUtils.js.map +1 -0
- package/lib/telegram/index.d.ts +7 -0
- package/lib/telegram/index.js +19 -0
- package/lib/telegram/index.js.map +1 -0
- package/lib/utils/ClientUtils.d.ts +27 -0
- package/lib/utils/ClientUtils.js +62 -0
- package/lib/utils/ClientUtils.js.map +1 -0
- package/lib/utils/Generic.d.ts +47 -0
- package/lib/utils/Generic.js +173 -0
- package/lib/utils/Generic.js.map +1 -0
- package/lib/utils/Libs.d.ts +10 -0
- package/lib/utils/Libs.js +55 -0
- package/lib/utils/Libs.js.map +1 -0
- package/lib/utils/MessageHandler.d.ts +54 -0
- package/lib/utils/MessageHandler.js +81 -0
- package/lib/utils/MessageHandler.js.map +1 -0
- package/lib/utils/MessageUtils.d.ts +3 -0
- package/lib/utils/MessageUtils.js +114 -0
- package/lib/utils/MessageUtils.js.map +1 -0
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.js +27 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/nonce.d.ts +1 -0
- package/lib/utils/nonce.js +16 -0
- package/lib/utils/nonce.js.map +1 -0
- package/lib/utils/server.d.ts +33 -0
- package/lib/utils/server.js +75 -0
- package/lib/utils/server.js.map +1 -0
- package/lib/wa/Auth.d.ts +19 -0
- package/lib/wa/Auth.js +123 -0
- package/lib/wa/Auth.js.map +1 -0
- package/lib/wa/ConfigWAEvents.d.ts +22 -0
- package/lib/wa/ConfigWAEvents.js +526 -0
- package/lib/wa/ConfigWAEvents.js.map +1 -0
- package/lib/wa/ConvertToWAMessage.d.ts +67 -0
- package/lib/wa/ConvertToWAMessage.js +403 -0
- package/lib/wa/ConvertToWAMessage.js.map +1 -0
- package/lib/wa/ConvertWAMessage.d.ts +108 -0
- package/lib/wa/ConvertWAMessage.js +527 -0
- package/lib/wa/ConvertWAMessage.js.map +1 -0
- package/lib/wa/ID.d.ts +4 -0
- package/lib/wa/ID.js +19 -0
- package/lib/wa/ID.js.map +1 -0
- package/lib/wa/WAMessage.d.ts +3 -0
- package/lib/wa/WAMessage.js +8 -0
- package/lib/wa/WAMessage.js.map +1 -0
- package/lib/wa/WAModule.d.ts +3 -0
- package/lib/wa/WAModule.js +3 -0
- package/lib/wa/WAModule.js.map +1 -0
- package/lib/wa/WAStatus.d.ts +3 -0
- package/lib/wa/WAStatus.js +15 -0
- package/lib/wa/WAStatus.js.map +1 -0
- package/lib/wa/WhatsAppBot.d.ts +188 -0
- package/lib/wa/WhatsAppBot.js +980 -0
- package/lib/wa/WhatsAppBot.js.map +1 -0
- package/lib/wa/index.d.ts +12 -0
- package/lib/wa/index.js +37 -0
- package/lib/wa/index.js.map +1 -0
- package/lib/wa/makeInMemoryStore.d.ts +43 -0
- package/lib/wa/makeInMemoryStore.js +430 -0
- package/lib/wa/makeInMemoryStore.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import { Cluster, Worker } from 'cluster';
|
|
2
|
+
import ConnectionConfig from '../configs/ConnectionConfig';
|
|
3
|
+
import Message from '../messages/Message';
|
|
4
|
+
import MediaMessage from '../messages/MediaMessage';
|
|
5
|
+
import ChatStatus from '../modules/chat/ChatStatus';
|
|
6
|
+
import Chat from '../modules/chat/Chat';
|
|
7
|
+
import User from '../modules/user/User';
|
|
8
|
+
import Command from '../modules/command/Command';
|
|
9
|
+
import CommandController from '../modules/command/CommandController';
|
|
10
|
+
import AdvancedCommand from '../modules/command/advanced/AdvancedCommand';
|
|
11
|
+
import AdvancedCommandController from '../modules/command/advanced/AdvancedCommandController';
|
|
12
|
+
import QuickResponseController from '../modules/quickResponse/QuickResponseController';
|
|
13
|
+
import { QuickResponsePattern } from '../modules/quickResponse/QuickResponsePattern';
|
|
14
|
+
import { QuickResponseReply } from '../modules/quickResponse/QuickResponseReply';
|
|
15
|
+
import QuickResponseOptions from '../modules/quickResponse/QuickResponseOptions';
|
|
16
|
+
import QuickResponse from '../modules/quickResponse/QuickResponse';
|
|
17
|
+
import ClientEvents, { ClientEventsMap } from '../client/ClientEvents';
|
|
18
|
+
import WorkerMessage, { WorkerMessageTag } from './WorkerMessage';
|
|
19
|
+
import IClient from '../client/IClient';
|
|
20
|
+
import IAuth from '../client/IAuth';
|
|
21
|
+
import IBot from '../bot/IBot';
|
|
22
|
+
import MessageHandler, { MessageHandlerConfig } from '../utils/MessageHandler';
|
|
23
|
+
import Call from '../models/Call';
|
|
24
|
+
/** ID dos dados globais do cluster gerenciado pelo Rompot */
|
|
25
|
+
export declare const GlobalRompotCluster = "rompot-client-cluster";
|
|
26
|
+
/** Configuração do cliente */
|
|
27
|
+
export type ClientClusterConfig = {
|
|
28
|
+
maxTimeout: number;
|
|
29
|
+
} & ConnectionConfig;
|
|
30
|
+
export default class ClientCluster extends ClientEvents implements IClient {
|
|
31
|
+
/** Tratador de mensagens */
|
|
32
|
+
messageHandler: MessageHandler;
|
|
33
|
+
/** Controlador de comandos */
|
|
34
|
+
commandController: CommandController;
|
|
35
|
+
quickResponseController: QuickResponseController;
|
|
36
|
+
advancedCommandController: AdvancedCommandController;
|
|
37
|
+
/** Configuração */
|
|
38
|
+
config: ClientClusterConfig;
|
|
39
|
+
/** Bot */
|
|
40
|
+
bot: IBot;
|
|
41
|
+
/** Vezes que o bot reconectou */
|
|
42
|
+
reconnectTimes: number;
|
|
43
|
+
/** Id do cliente */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Autenticação do bot */
|
|
46
|
+
auth: IAuth | string;
|
|
47
|
+
/** Processo do cliente */
|
|
48
|
+
worker: Worker;
|
|
49
|
+
/** É o cliente principal */
|
|
50
|
+
isMain: boolean;
|
|
51
|
+
/** Requisições */
|
|
52
|
+
requests: Record<string, (message: WorkerMessage) => any>;
|
|
53
|
+
/** Tratador de funções */
|
|
54
|
+
funcHandler: any;
|
|
55
|
+
constructor(id: string, worker: Worker, config?: Partial<ClientClusterConfig>, isMain?: boolean);
|
|
56
|
+
setWorker(worker: Worker): void;
|
|
57
|
+
/**
|
|
58
|
+
* * Gera um ID combase uma tag.
|
|
59
|
+
* @param tag - Tag que será usada.
|
|
60
|
+
* @returns ID gerado.
|
|
61
|
+
*/
|
|
62
|
+
generateIdByTag(tag: WorkerMessageTag): string;
|
|
63
|
+
/**
|
|
64
|
+
* * Envia uma mensagem no worker.
|
|
65
|
+
* @param tag - Tag da mensagem.
|
|
66
|
+
* @param data - Data da mensagem.
|
|
67
|
+
* @returns Mensagem de resposta do worker.
|
|
68
|
+
*/
|
|
69
|
+
sendWorkerMessage(workerMessage: WorkerMessage): Promise<WorkerMessage>;
|
|
70
|
+
/** Configura os eventos do cliente */
|
|
71
|
+
configEvents(): void;
|
|
72
|
+
/** Conectar bot
|
|
73
|
+
* @param auth Autenticação do bot
|
|
74
|
+
*/
|
|
75
|
+
connect(auth?: IAuth | string): Promise<void>;
|
|
76
|
+
/** Reconectar bot
|
|
77
|
+
* @param alert Alerta que está reconectando
|
|
78
|
+
*/
|
|
79
|
+
reconnect(alert?: boolean): Promise<void>;
|
|
80
|
+
/** Parar bot
|
|
81
|
+
* @param reason Razão por parar bot
|
|
82
|
+
*/
|
|
83
|
+
stop(reason?: any): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Desconecta o bot
|
|
86
|
+
*/
|
|
87
|
+
logout(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* * Aguarda um evento ser chamado.
|
|
90
|
+
* @param eventName - Nome do evento que será aguardado.
|
|
91
|
+
* @returns {Promise<ClientEventsMap[T]>} Argumento retornado do evento esperado.
|
|
92
|
+
*/
|
|
93
|
+
awaitEvent<T extends keyof ClientEventsMap>(eventName: T, maxTimeout?: number): Promise<ClientEventsMap[T]>;
|
|
94
|
+
/**
|
|
95
|
+
* * Aguarda a conexão for aberta.
|
|
96
|
+
*/
|
|
97
|
+
awaitConnectionOpen(): Promise<void>;
|
|
98
|
+
/** @returns Controlador de comando do cliente */
|
|
99
|
+
getCommandController(): CommandController;
|
|
100
|
+
/** Define o controlador de comando do cliente */
|
|
101
|
+
setCommandController(controller: CommandController): void;
|
|
102
|
+
/** Define os comandos do bot
|
|
103
|
+
* @param commands Comandos que será injetado
|
|
104
|
+
*/
|
|
105
|
+
setCommands(commands: Command[]): void;
|
|
106
|
+
/** @returns Retorna os comandos do bot */
|
|
107
|
+
getCommands(): Command[];
|
|
108
|
+
/** Adiciona um comando na lista de comandos
|
|
109
|
+
* @param command Comando que será adicionado
|
|
110
|
+
*/
|
|
111
|
+
addCommand(command: Command): void;
|
|
112
|
+
/** Remove um comando na lista de comandos
|
|
113
|
+
* @param command Comando que será removido
|
|
114
|
+
*/
|
|
115
|
+
removeCommand(command: Command): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Procura um comando no texto.
|
|
118
|
+
* @param text - Texto que contem o comando.
|
|
119
|
+
* */
|
|
120
|
+
searchCommand(text: string): Command | null;
|
|
121
|
+
/**
|
|
122
|
+
* Execução do comando.
|
|
123
|
+
* @param command - Comando que será executado.
|
|
124
|
+
* @param message - Mensagem associada ao comando.
|
|
125
|
+
*/
|
|
126
|
+
runCommand(command: Command, message: Message, type?: string): Promise<any>;
|
|
127
|
+
setAdvancedCommandController(advancedCommandController: AdvancedCommandController): void;
|
|
128
|
+
getAdvancedCommandController(): AdvancedCommandController;
|
|
129
|
+
setAdvancedCommands(commands: AdvancedCommand[]): void;
|
|
130
|
+
createAdvancedCommand<T extends object>(id: string, context: T): AdvancedCommand<T>;
|
|
131
|
+
getAdvancedCommands(): AdvancedCommand<object>[];
|
|
132
|
+
addAdvancedCommand(command: AdvancedCommand): void;
|
|
133
|
+
removeAdvancedCommand(command: AdvancedCommand): boolean;
|
|
134
|
+
execAdvancedCommand(command: AdvancedCommand | string, message: Message): Promise<void>;
|
|
135
|
+
addQuickResponse(pattern: QuickResponse): QuickResponse;
|
|
136
|
+
addQuickResponse(pattern: QuickResponsePattern, reply: QuickResponseReply, options?: Partial<QuickResponseOptions>): QuickResponse;
|
|
137
|
+
addQuickResponse(pattern: QuickResponsePattern[], reply: QuickResponseReply, options?: Partial<QuickResponseOptions>): QuickResponse;
|
|
138
|
+
removeQuickResponse(quickResponse: QuickResponse | string): void;
|
|
139
|
+
/**
|
|
140
|
+
* Deletar mensagem
|
|
141
|
+
* @param message Mensagem que será deletada da sala de bate-papos
|
|
142
|
+
*/
|
|
143
|
+
deleteMessage(message: Message): Promise<void>;
|
|
144
|
+
/** Remover mensagem
|
|
145
|
+
* @param message Mensagem que será removida da sala de bate-papo
|
|
146
|
+
*/
|
|
147
|
+
removeMessage(message: Message): Promise<void>;
|
|
148
|
+
/** Marca uma mensagem como visualizada
|
|
149
|
+
* @param message Mensagem que será visualizada
|
|
150
|
+
*/
|
|
151
|
+
readMessage(message: Message): Promise<void>;
|
|
152
|
+
/** Edita o texto de uma mensagem enviada
|
|
153
|
+
* @param message Mensagem que será editada
|
|
154
|
+
* @param text Novo texto da mensagem
|
|
155
|
+
*/
|
|
156
|
+
editMessage(message: Message, text: string): Promise<void>;
|
|
157
|
+
/** Adiciona uma reação na mensagem
|
|
158
|
+
* @param message Mensagem
|
|
159
|
+
* @param reaction Reação
|
|
160
|
+
*/
|
|
161
|
+
addReaction(message: Message, reaction: string): Promise<void>;
|
|
162
|
+
/** Remove a reação da mensagem
|
|
163
|
+
* @param message Mensagem que terá sua reação removida
|
|
164
|
+
*/
|
|
165
|
+
removeReaction(message: Message): Promise<void>;
|
|
166
|
+
/** Adiciona animações na reação da mensagem
|
|
167
|
+
* @param message Mensagem que receberá a animação
|
|
168
|
+
* @param reactions Reações em sequência
|
|
169
|
+
* @param interval Intervalo entre cada reação
|
|
170
|
+
* @param maxTimeout Maximo de tempo reagindo
|
|
171
|
+
*/
|
|
172
|
+
addAnimatedReaction(message: Message, reactions: string[], interval?: number, maxTimeout?: number): (reactionStop?: string) => Promise<void>;
|
|
173
|
+
/** Envia uma mensagem
|
|
174
|
+
* @param message Menssagem que será enviada
|
|
175
|
+
* @returns Retorna o conteudo enviado
|
|
176
|
+
*/
|
|
177
|
+
send(message: Message): Promise<Message>;
|
|
178
|
+
/** Envia uma mensagem
|
|
179
|
+
* @param chat Sala de bate-papo onde irá ser enviado a mensagem
|
|
180
|
+
* @param message Mensagem que será enviada
|
|
181
|
+
* @param mention Mensagem que será mencionada
|
|
182
|
+
*/
|
|
183
|
+
sendMessage(chat: Chat | string, message: string | Message, mention?: Message): Promise<Message>;
|
|
184
|
+
/** Aguarda uma mensagem ser recebida em uma sala de bate-papo
|
|
185
|
+
* @param chat Sala de bate-papo que irá receber a mensagem
|
|
186
|
+
* @param config Configuração do aguardo da mensagem
|
|
187
|
+
*/
|
|
188
|
+
awaitMessage(chat: Chat | string, config?: Partial<MessageHandlerConfig>): Promise<Message>;
|
|
189
|
+
/**
|
|
190
|
+
* Retorna a stream da mídia
|
|
191
|
+
* @param message Mídia que será baixada
|
|
192
|
+
* @returns Stream da mídia
|
|
193
|
+
*/
|
|
194
|
+
downloadStreamMessage(message: MediaMessage): Promise<Buffer>;
|
|
195
|
+
/** @returns Retorna o nome do bot */
|
|
196
|
+
getBotName(): Promise<string>;
|
|
197
|
+
/** Define o nome do bot
|
|
198
|
+
* @param name Nome do bot
|
|
199
|
+
*/
|
|
200
|
+
setBotName(name: string): Promise<void>;
|
|
201
|
+
/** @returns Retorna a descrição do bot */
|
|
202
|
+
getBotDescription(): Promise<string>;
|
|
203
|
+
/** Define a descrição do bot
|
|
204
|
+
* @param description Descrição do bot
|
|
205
|
+
*/
|
|
206
|
+
setBotDescription(description: string): Promise<void>;
|
|
207
|
+
/** @returns Retorna foto de perfil do bot */
|
|
208
|
+
getBotProfile(lowQuality?: boolean): Promise<Buffer>;
|
|
209
|
+
/** Define a imagem de perfil do bot
|
|
210
|
+
* @param image Imagem de perfil do bot
|
|
211
|
+
*/
|
|
212
|
+
setBotProfile(profile: Buffer): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* @param chat Sala de bate-papo
|
|
215
|
+
* @returns Retorna uma sala de bate-papo
|
|
216
|
+
*/
|
|
217
|
+
getChat(chat: Chat | string): Promise<Chat | null>;
|
|
218
|
+
/**
|
|
219
|
+
* Atualiza os dados de um chat.
|
|
220
|
+
* @param id - Id do chat que será atualizado.
|
|
221
|
+
* @param chat - Dados do chat que será atualizado.
|
|
222
|
+
*/
|
|
223
|
+
updateChat(id: string, chat: Partial<Chat>): Promise<void>;
|
|
224
|
+
/** @returns Retorna as sala de bate-papo que o bot está */
|
|
225
|
+
getChats(): Promise<Chat[]>;
|
|
226
|
+
/** Define as salas de bate-papo que o bot está
|
|
227
|
+
* @param chats Salas de bate-papo
|
|
228
|
+
*/
|
|
229
|
+
setChats(chats: Chat[]): Promise<void>;
|
|
230
|
+
/** Remove uma sala de bate-papo
|
|
231
|
+
* @param chat Sala de bate-papo
|
|
232
|
+
*/
|
|
233
|
+
removeChat(chat: string | Chat): Promise<void>;
|
|
234
|
+
/** Cria uma sala de bate-papo
|
|
235
|
+
* @param chat Sala de bate-papo
|
|
236
|
+
*/
|
|
237
|
+
createChat(chat: Chat): Promise<void>;
|
|
238
|
+
/** Sai de uma sala de bate-papo
|
|
239
|
+
* @param chat Sala de bate-papo
|
|
240
|
+
*/
|
|
241
|
+
leaveChat(chat: Chat | string): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* @param chat Sala de bate-papo
|
|
244
|
+
* @returns Retorna o nome da sala de bate-papo
|
|
245
|
+
*/
|
|
246
|
+
getChatName(chat: Chat | string): Promise<string>;
|
|
247
|
+
/** Define o nome da sala de bate-papo
|
|
248
|
+
* @param chat Sala de bate-papo
|
|
249
|
+
* @param name Nome da sala de bate-papo
|
|
250
|
+
*/
|
|
251
|
+
setChatName(chat: Chat | string, name: string): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* @param chat Sala de bate-papo
|
|
254
|
+
* @returns Retorna a descrição da sala de bate-papo
|
|
255
|
+
*/
|
|
256
|
+
getChatDescription(chat: Chat | string): Promise<string>;
|
|
257
|
+
/** Define a descrição da sala de bate-papo
|
|
258
|
+
* @param chat Sala de bate-papo
|
|
259
|
+
* @param description Descrição da sala de bate-papo
|
|
260
|
+
*/
|
|
261
|
+
setChatDescription(chat: Chat | string, description: string): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* @param chat Sala de bate-papo
|
|
264
|
+
* @returns Retorna a imagem de perfil da sala de bate-papo
|
|
265
|
+
*/
|
|
266
|
+
getChatProfile(chat: Chat | string, lowQuality?: boolean): Promise<Buffer>;
|
|
267
|
+
/** Define a imagem de perfil da sala de bate-papo
|
|
268
|
+
* @param chat Sala de bate-papo
|
|
269
|
+
* @param profile Imagem de perfil da sala de bate-papo
|
|
270
|
+
*/
|
|
271
|
+
setChatProfile(chat: Chat | string, profile: Buffer): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* @param chat Sala de bate-papo
|
|
274
|
+
* @returns Retorna o lider da sala de bate-papo
|
|
275
|
+
*/
|
|
276
|
+
getChatLeader(chat: Chat | string): Promise<User>;
|
|
277
|
+
/**
|
|
278
|
+
* @param chat Sala de bate-papo
|
|
279
|
+
* @returns Retorna os usuários de uma sala de bate-papo
|
|
280
|
+
*/
|
|
281
|
+
getChatUsers(chat: Chat | string): Promise<string[]>;
|
|
282
|
+
/**
|
|
283
|
+
* @param chat Sala de bate-papo
|
|
284
|
+
* @returns Retorna os administradores de uma sala de bate-papo
|
|
285
|
+
*/
|
|
286
|
+
getChatAdmins(chat: Chat | string): Promise<string[]>;
|
|
287
|
+
/** Adiciona um novo usuário a uma sala de bate-papo
|
|
288
|
+
* @param chat Sala de bate-papo
|
|
289
|
+
* @param user Usuário
|
|
290
|
+
*/
|
|
291
|
+
addUserInChat(chat: Chat | string, user: User | string): Promise<void>;
|
|
292
|
+
/** Adiciona um novo usuário a uma sala de bate-papo
|
|
293
|
+
* @param chat Sala de bate-papo
|
|
294
|
+
* @param user Usuário
|
|
295
|
+
*/
|
|
296
|
+
removeUserInChat(chat: Chat | string, user: User | string): Promise<void>;
|
|
297
|
+
/** Promove há administrador um usuário da sala de bate-papo
|
|
298
|
+
* @param chat Sala de bate-papo
|
|
299
|
+
* @param user Usuário
|
|
300
|
+
*/
|
|
301
|
+
promoteUserInChat(chat: Chat | string, user: User | string): Promise<void>;
|
|
302
|
+
/** Remove a administração um usuário da sala de bate-papo
|
|
303
|
+
* @param chat Sala de bate-papo
|
|
304
|
+
* @param user Usuário
|
|
305
|
+
*/
|
|
306
|
+
demoteUserInChat(chat: Chat | string, user: User | string): Promise<void>;
|
|
307
|
+
/** Altera o status da sala de bate-papo
|
|
308
|
+
* @param chat Sala de bate-papo
|
|
309
|
+
* @param status Status da sala de bate-papo
|
|
310
|
+
*/
|
|
311
|
+
changeChatStatus(chat: Chat | string, status: ChatStatus): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Entra no chat pelo código de convite.
|
|
314
|
+
* @param code - Código de convite do chat.
|
|
315
|
+
*/
|
|
316
|
+
joinChat(code: string): Promise<void>;
|
|
317
|
+
/**
|
|
318
|
+
* Obtem o código de convite do chat.
|
|
319
|
+
* @param chat - Chat que será obtido o código de convite.
|
|
320
|
+
* @returns O código de convite do chat.
|
|
321
|
+
*/
|
|
322
|
+
getChatInvite(chat: Chat | string): Promise<string>;
|
|
323
|
+
/**
|
|
324
|
+
* Revoga o código de convite do chat.
|
|
325
|
+
* @param chat - Chat que terá seu código de convite revogado.
|
|
326
|
+
* @returns O novo código de convite do chat.
|
|
327
|
+
*/
|
|
328
|
+
revokeChatInvite(chat: Chat | string): Promise<string>;
|
|
329
|
+
rejectCall(call: Call | string): Promise<void>;
|
|
330
|
+
/** @returns Retorna a lista de usuários do bot */
|
|
331
|
+
getUsers(): Promise<User[]>;
|
|
332
|
+
/**
|
|
333
|
+
* Obter lista de usuários salvos.
|
|
334
|
+
* @returns Lista de usuários salvos.
|
|
335
|
+
*/
|
|
336
|
+
getSavedUsers(): Promise<User[]>;
|
|
337
|
+
/** Define a lista de usuários do bot
|
|
338
|
+
* @param users Usuários
|
|
339
|
+
*/
|
|
340
|
+
setUsers(users: User[]): Promise<void>;
|
|
341
|
+
/**
|
|
342
|
+
* @param user Usuário
|
|
343
|
+
* @returns Retorna um usuário
|
|
344
|
+
*/
|
|
345
|
+
getUser(user: User | string): Promise<User | null>;
|
|
346
|
+
/**
|
|
347
|
+
* Atualiza os dados de um usuário.
|
|
348
|
+
* @param id - Id do usuário que será atualizado.
|
|
349
|
+
* @param user - Dados do usuário que será atualizado.
|
|
350
|
+
*/
|
|
351
|
+
updateUser(id: string, user: Partial<User>): Promise<void>;
|
|
352
|
+
/** Remove um usuário
|
|
353
|
+
* @param user Usuário
|
|
354
|
+
*/
|
|
355
|
+
removeUser(user: User | string): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* @param user Usuário
|
|
358
|
+
* @returns Retorna o nome do usuário
|
|
359
|
+
*/
|
|
360
|
+
getUserName(user: User | string): Promise<string>;
|
|
361
|
+
/** Define o nome do usuário
|
|
362
|
+
* @param user Usuário
|
|
363
|
+
* @param name Nome do usuário
|
|
364
|
+
*/
|
|
365
|
+
setUserName(user: User | string, name: string): Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* @param user Usuário
|
|
368
|
+
* @returns Retorna a descrição do usuário
|
|
369
|
+
*/
|
|
370
|
+
getUserDescription(user: User | string): Promise<string>;
|
|
371
|
+
/** Define a descrição do usuário
|
|
372
|
+
* @param user Usuário
|
|
373
|
+
* @param description Descrição do usuário
|
|
374
|
+
*/
|
|
375
|
+
setUserDescription(user: User | string, description: string): Promise<void>;
|
|
376
|
+
/**
|
|
377
|
+
* @param user Usuário
|
|
378
|
+
* @returns Retorna a foto de perfil do usuário
|
|
379
|
+
*/
|
|
380
|
+
getUserProfile(user: User | string, lowQuality?: boolean): Promise<Buffer>;
|
|
381
|
+
/** Define a imagem de perfil do usuário
|
|
382
|
+
* @param user Usuário
|
|
383
|
+
* @param profile Imagem de perfil do usuário
|
|
384
|
+
*/
|
|
385
|
+
setUserProfile(user: User | string, profile: Buffer): Promise<void>;
|
|
386
|
+
/** Desbloqueia um usuário
|
|
387
|
+
* @param user Usuário
|
|
388
|
+
*/
|
|
389
|
+
unblockUser(user: User | string): Promise<void>;
|
|
390
|
+
/** Bloqueia um usuário
|
|
391
|
+
* @param user Usuário
|
|
392
|
+
*/
|
|
393
|
+
blockUser(user: User | string): Promise<void>;
|
|
394
|
+
/**
|
|
395
|
+
* Retorna a lista de clientes diponíveis.
|
|
396
|
+
* @returns Clientes ordenados pelo ID.
|
|
397
|
+
*/
|
|
398
|
+
static getClients(): Record<string, ClientCluster>;
|
|
399
|
+
/**
|
|
400
|
+
* Define todos os clientes diponíveis.
|
|
401
|
+
* @param clients - Clientes que serão definidios.
|
|
402
|
+
*/
|
|
403
|
+
static saveClients(clients: Record<string, ClientCluster>): void;
|
|
404
|
+
/**
|
|
405
|
+
* Retorna o cliente pelo seu respectivo ID.
|
|
406
|
+
* @param id - ID do cliente.
|
|
407
|
+
* @returns O cliente associado ao ID.
|
|
408
|
+
*/
|
|
409
|
+
static getClient(id: string): ClientCluster;
|
|
410
|
+
/**
|
|
411
|
+
* Define um cliente disponível
|
|
412
|
+
* @param client - Cliente que será definido
|
|
413
|
+
*/
|
|
414
|
+
static saveClient(client: ClientCluster): void;
|
|
415
|
+
/** Gera um id único */
|
|
416
|
+
static generateId(): string;
|
|
417
|
+
/**
|
|
418
|
+
* * Cria um cliente principal para o bot.
|
|
419
|
+
* @param id - ID do cliente.
|
|
420
|
+
* @param worker - Worker do cliente.
|
|
421
|
+
* @param bot - Bot do cliente.
|
|
422
|
+
* @param auth - Autenticação do bot.
|
|
423
|
+
* @returns Instância principal do cliente.
|
|
424
|
+
*/
|
|
425
|
+
static createMain(id: string, worker: Worker, bot: IBot, auth: IAuth | string, config: Partial<ClientClusterConfig>): ClientCluster;
|
|
426
|
+
/** Configura o cluster para o cliente */
|
|
427
|
+
static configCluster(cluster: Cluster): void;
|
|
428
|
+
}
|