A module that helps you to create minigames with whatsapp-web.js.

Overview

wa-minigames

A module that helps you to create minigames with whatsapp-web.js.

Installation

npm install whatsapp-web.js
npm install wa-minigames

Example Usage

{ console.log('QR RECEIVED', qr); }); client.on('ready', () => { console.log('Client is ready!'); }); client.on('message', async (msg) => { if (msg.body == '!start') { await Minigames.addGameChat(msg.getChatId(), new MyGame(msg, client)); } Minigames.forwardMessage(msg); }); client.initialize(); ">
const { Client } = require('whatsapp-web.js');
const { Minigames, MiniGame } = require('wa-minigames');

class MyGame extends MiniGame {
    constructor(message, client){
        super();
        this.client = client;
        this.chatId = message.getChatId();
        this.answer = Math.floor(Math.random() * 100).toString();
        this.client.sendMessage(this.chatId, "Game Started! Guess the number!");
    }
    async procMessage(message){
        if (message.body===this.answer){
            await this.client.sendMessage(this.chatId, 'You are right!');
            this.gameOver();
        }else{
            await this.client.sendMessage(this.chatId, 'You are wrong.');
        }
    }
    gameOver(){
        super.gameOver();
    }
}

const client = new Client();
client.on('qr', (qr) => {
    console.log('QR RECEIVED', qr);
});

client.on('ready', () => {
    console.log('Client is ready!');
});

client.on('message', async (msg) => {
    if (msg.body == '!start') {
        await Minigames.addGameChat(msg.getChatId(), new MyGame(msg, client));
    }
    Minigames.forwardMessage(msg);
});

client.initialize();
You might also like...

djs-helper is a JavaScript library that helps you to develop your own Discord Bot

djs-helper is a JavaScript library that helps you to develop your own Discord Bot, Still under development, more features will be added in the future

Oct 3, 2022

dscbots.js is a Node.js module that allows you to interact with the Discord API without any complications.

dscbots.js is a Node.js module that allows you to interact with the Discord API without any complications.

Credits Goodsie - Helping me with the websocketmanager About dscbots.js is a Node.js module that allows you to interact with the Discord API without a

Nov 29, 2022

Queen Amdi is a chat bot for WhatsApp.

Queen Amdi is a chat bot for WhatsApp.

👸 💎 QUEEN AMDI BOT 💎 👸 Whatsapp භාවිතා කිරීම පහසු සහ විනෝදජනක කරයි. Whatsapp සඳහා පළමු සිංහල පරිශීලක බොට් ද වේ. Whatsapp Group | Youtube Channel Q

Dec 28, 2022

whatsapp bot build with nodejs

A whatsapp bot made using adiwajshing/Baileys library Install ⬇️ git clone https://github.com/justpiple/whatsapp-bot/ cd whatsapp-bot npm i For

Nov 23, 2022

stikerinbot adalah pengodean ulang bot whatsapp dari wabot-aq

stikerinbot adalah pengodean ulang bot whatsapp dari wabot-aq

stikerinbot Simple WhatsApp Bot UNTUK PENGGUNA WINDOWS/VPS/RDP Unduh & Instal Git Klik Disini Unduh & Instal NodeJS Klik Disini Unduh & Instal FFmpeg

Oct 31, 2022

Tonton video tutorial di YouTube saya untuk cara penginstalan & apabila kurang mengerti bisa hubungi saya di WhatsApp 🐣Klik link di bawah untuk tutorial penginstalan di heroku

Tonton video tutorial di YouTube saya untuk cara penginstalan & apabila kurang mengerti bisa hubungi saya di WhatsApp 🐣Klik link di bawah untuk tutorial penginstalan di heroku

BOTZ10 LAST Termux • Heroku • Session Setting • Thanks TERMUX Git clone this repo git clone https://github.com/zeeoneofc/BOTZ10a.git cd BOTZ10a

Dec 23, 2021

xvoid whatsapp bot

xvoid whatsapp bot

xvoid-bot xvoid-bot : a oriented bot for whatsapp How To Install? update && apt upgrade apt install git -y apt install nodejs -y apt install f

Apr 24, 2022

WhatsApp-last-seen - When was it last seen and how long it was online.

WhatsApp-last-seen - When was it last seen and how long it was online.

WhatsApp-last-seen When was it last seen and how long it was online. Copy the javascript code and paste in the browser console after opening an inbox

Nov 8, 2022

nganu bot, multi device based simple whatsapp-bot with social media downloader

nganu bot, multi device based simple whatsapp-bot with social media downloader

nganu A Simple Multi-Device WhatsApp Bot simple whatsapp-bot using baileys-md to download social media post and many features Install set instagram se

Nov 20, 2022
Owner
Alon Schwartzblat
Alon Schwartzblat
World first fully customizeble user bot for Whatsapp 😎 With enjoyable ththings and fun to use Whatsapp ✨️

⚡ The Alpha-X Whatsapp User Bot ?? ~ ᴡᴏʀʟᴅ ꜰɪʀꜱᴛ ꜰᴜʟʟ ᴄᴜꜱᴛᴏᴍɪᴢᴀʙʟᴇ ᴜꜱᴇʀ ʙᴏᴛ ꜰᴏʀ ᴡʜᴀᴛꜱᴀᴘᴘ ~ ?? What is Alpha-X ?? Alpha-X , is a WhatsApp helper bot wr

Official Alpha-X-Team Account 17 Jul 29, 2022
Um sistema de tickets muito simples baseado em mensagens do WhatsApp, que permite multiusuários na mesma conta do WhatsApp.

Press-Ticket Manual de Instalação INSTALL.md Changelog 05/04/2022 Iniciar com o menu lateral fechado 30/03/2022 Atualização da lib wwebjs para a versã

Robson Tenorio 93 Dec 27, 2022
Whatsapp Bot with multi-device support Your Personal Assistance on Whatsapp

BotsApp-MD Whatsapp Bot with multi-device support Your Personal Assisstant, on WhatsApp! Deployment Easiest Way Head over to botsapp-md to deploy. Tak

Peter Dorglo 14 Jan 1, 2023
whatsapp api to remote your whatsapp device. Support multi device, multi client. Still update to more feature. Please fork, star, donate and share.

Ndalu-wa-client DEPENDENCIES : { "@adiwajshing/baileys": "^4.2.0", "@adiwajshing/keyed-db": "^0.2.4", "axios": "^0.27.2", "body-parser

null 29 Jan 4, 2023
Whatsapp bot using Bailey multi device module, using nodejs and open source, I accept ideas from public

Allen Bot-Wa Keep copyright, Created by lolhuman | Please read carefully Content Description Example Highlights TODO Installation FAQ Contributing Con

Pais 35 Dec 3, 2022
A bot builder on top of puppeteer's headless web browser mimicing your web.whatsapp.com functionalities.

Welcome to the BizBook365 WhatsApp bot project A bot builder on top of puppeteer's headless web browser mimicing your web.whatsapp.com functionalities

Foyzul Karim 19 Dec 1, 2022
Whatscode.js is a package to create Whatsapp bots easily and quickly

whatscode.js is a package to create Whatsapp bots easily and quickly, even coding experience is not needed...

JstnLT 21 Dec 30, 2022
This Is A Simple WhatsApp Bot Mode From *DhaniGans* Repo Hope you guys Will like it Repo Updates in Every Two Days

ALIEN ALFA BOT Contact Me: Scan QR Code For Session FORK THIS BEFORE PROCEEDING Use This Button To Fork Now THINGS TO CHANGE IN HEROKU ???????????? ??

TOXIC ALIEN 15 Dec 21, 2022
Enable full screen on for large aspect ratio screens on WhatsApp Web.

Maximize WhatsApp [WIP] Enable full screen on large aspect ratio screens on WhatsApp Web. Enable Epiphany extension. Optional if not done. Download th

null 2 Mar 13, 2022
Hisoka-waweb.js: Script WhatsaApp Bot Multi Device Using Lib whatsapp-web.js

Rules read the rules at term-of-service hisoka-waweb.js Script Bot WhatsApp Multi Device dengan menggunakan Library whatsapp-web.js Config Isi semua y

Hisoka 13 Dec 24, 2022