Download src/automations/event-delete-msg.js from vanducdev/botzalo: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/vanducdev/botzalo/resolve/main/src/automations/event-delete-msg.js
- Command line
-
hf download hf://spaces/vanducdev/botzalo/src/automations/event-delete-msg.js
-
curl -L -o event-delete-msg.js https://huggingface.co/spaces/vanducdev/botzalo/resolve/main/src/automations/event-delete-msg.js
1.1 kB
| import { initGroupSettings } from "../commands/command.js"; | |
| import { getBotId, isAdmin } from "../index.js"; | |
| import { antiUndoGroup } from "../service-dqt/anti-service/anti-undo.js"; | |
| import { getGroupAdmins, getGroupInfoData } from "../service-dqt/info-service/group-info.js"; | |
| import { readGroupSettings } from "../utils/io-json.js"; | |
| export async function undoMessageEvents(api, undo) { | |
| const threadId = undo.data.idTo; | |
| const senderId = undo.data.uidFrom; | |
| const isAdminLevelHighest = isAdmin(senderId); | |
| const isAdminBot = isAdmin(senderId, threadId); | |
| const idBot = getBotId(); | |
| let isSelf = idBot === senderId; | |
| const isGroup = undo.isGroup; | |
| if (isGroup) { | |
| const groupInfo = await getGroupInfoData(api, threadId); | |
| const groupAdmins = await getGroupAdmins(groupInfo); | |
| const botIsAdminBox = groupAdmins.includes(idBot.toString()); | |
| const groupSettings = readGroupSettings(); | |
| initGroupSettings(groupSettings, threadId, groupInfo.name); | |
| await antiUndoGroup(api, undo, isAdminLevelHighest, groupSettings, botIsAdminBox, isSelf); | |
| } | |
| } | |