@kamuridesu/whatframework
Version:
A simple WhatsApp Bot Framework on top of Baileys
12 lines (11 loc) • 576 B
JavaScript
import { Bot } from "../src/modules/bot.js";
export function botFactory(entryPointClass) {
return new Bot(entryPointClass.botName, entryPointClass.prefix, entryPointClass.ownerNumber, entryPointClass.language ? entryPointClass.language : "en-us");
}
export async function getTotalVideoBufferLengthInSeconds(buffer) {
const start = buffer.indexOf(Buffer.from("mvhd")) + 16;
const timeScale = buffer.readUInt32BE(start);
const duration = buffer.readUInt32BE(start + 4);
const lengthInSeconds = Math.floor(duration / timeScale);
return lengthInSeconds;
}