@jikey/fcazero
Version:
Facebook Messenger bot, and is one of the most advanced next-generation Facebook Chat API (FCA)
2 lines (1 loc) • 1.86 kB
JavaScript
;var y=Object.create;var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var C=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},n=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of w(e))!g.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(a=h(e,s))||a.enumerable});return r};var I=(r,e,t)=>(t=r!=null?y(_(r)):{},n(e||!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>n(u({},"__esModule",{value:!0}),r);var N={};C(N,{default:()=>d});module.exports=D(N);var f=require("../utils/clients.js"),m=require("../utils/constants.js"),l=I(require("../utils/logger.js"),1);class d{constructor(e,t,a){this.defaultFuncs=e;this.ctx=a}call(e,t){return new Promise(async(a,s)=>{try{if(m.Constants.getType(e.userIDs)!=="Array")throw new Error("userIDs must be an array of strings");if(e.userIDs.length<2)throw new Error("userIDs must contain at least 2 user IDs");const o=[];for(const i in e.userIDs)o.push({fbid:e.userIDs[i]});o.push({fbid:this.ctx.userID});const c={fb_api_caller_class:"RelayModern",fb_api_req_friendly_name:"MessengerGroupCreateMutation",doc_id:"577041672419534",variables:JSON.stringify({input:{entry_point:"jewel_new_group",actor_id:this.ctx.userID,participants:o,client_mutation_id:Math.round(Math.random()*1024).toString(),thread_settings:{name:e.groupName||"",joinable_mode:"PRIVATE",thread_image_fbid:null}}})},p=await this.defaultFuncs.post("https://www.facebook.com/api/graphql/",this.ctx.jar,c).then(f.Clients.parseAndCheckLogin(this.ctx,this.defaultFuncs));if(p&&p.errors)throw p;{const i=p&&p.data.messenger_group_thread_create.thread;t&&typeof t=="function"&&t(null,i),a(i)}}catch(o){l.default.error({error:o},"Error in CreateNewGroup"),t&&typeof t=="function"&&t(o),s(o)}})}}