Download bot/handler/handlerAction.js from bot512/5121512: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/bot512/5121512/resolve/main/bot/handler/handlerAction.js
- Command line
-
hf download hf://spaces/bot512/5121512/bot/handler/handlerAction.js
-
curl -L -o handlerAction.js https://huggingface.co/spaces/bot512/5121512/resolve/main/bot/handler/handlerAction.js
1.78 kB
| const createFuncMessage = global.utils.message; | |
| const handlerCheckDB = require("./handlerCheckData.js"); | |
| module.exports = (api, threadModel, userModel, dashBoardModel, globalModel, usersData, threadsData, dashBoardData, globalData) => { | |
| const handlerEvents = require(process.env.NODE_ENV == 'development' ? "./handlerEvents.dev.js" : "./handlerEvents.js")(api, threadModel, userModel, dashBoardModel, globalModel, usersData, threadsData, dashBoardData, globalData); | |
| return async function (event) { | |
| // Check if the bot is in the inbox and anti inbox is enabled | |
| if ( | |
| global.GoatBot.config.antiInbox == true && | |
| (event.senderID == event.threadID || event.userID == event.senderID || event.isGroup == false) && | |
| (event.senderID || event.userID || event.isGroup == false) | |
| ) | |
| return; | |
| const message = createFuncMessage(api, event); | |
| await handlerCheckDB(usersData, threadsData, event); | |
| const handlerChat = await handlerEvents(event, message); | |
| if (!handlerChat) | |
| return; | |
| const { | |
| onAnyEvent, onFirstChat, onStart, onChat, | |
| onReply, onEvent, handlerEvent, onReaction, | |
| typ, presence, read_receipt | |
| } = handlerChat; | |
| onAnyEvent(); | |
| switch (event.type) { | |
| case "message": | |
| case "message_reply": | |
| case "message_unsend": | |
| onFirstChat(); | |
| onChat(); | |
| onStart(); | |
| onReply(); | |
| break; | |
| case "event": | |
| handlerEvent(); | |
| onEvent(); | |
| break; | |
| case "message_reaction": | |
| onReaction(); | |
| break; | |
| case "typ": | |
| typ(); | |
| break; | |
| case "presence": | |
| presence(); | |
| break; | |
| case "read_receipt": | |
| read_receipt(); | |
| break; | |
| // case "friend_request_received": | |
| // { /* code block */ } | |
| // break; | |
| // case "friend_request_cancel" | |
| // { /* code block */ } | |
| // break; | |
| default: | |
| break; | |
| } | |
| }; | |
| }; |