UNPKG

ggclient

Version:
51 lines (36 loc) 1.08 kB
## GGClient - API for gg.pl - [GGClient - API for gg.pl](#ggclient---api-for-ggpl) - [Usage](#usage) - [Setup](#setup) - [Send message](#send-message) - [Listen to messages](#listen-to-messages) GGClient is created and (possibly) maintained for the purposes of the GGBot project. ## Usage #### Setup ```js const ggclient = require('ggclient').GGClient; const puppeteer = require('puppeteer'); // OR import {GGClient} from "ggclient"; import puppeteer from "puppeteer"; (async () => { const browser = await puppeteer.launch({ headless: true, // show the browser for debug purposes args: ["--mute-audio"] // mute chromium on startup }); const client = await ggclient.launch(browser, userNumber, userPassword); }) ``` #### Send message ```js client.sendMessage(66666666, "Hello!"); ``` #### Listen to messages message.time is UNIX epoch in **seconds** ``` client.onMessageReceived = (message) => { console.log(message.sender, message.time, message.message); } ``` --- By Vlop