mqad21 / pepesan

Simple automatic WhatsApp message responder
MIT License
153 stars 16 forks source link

Keyword contain with character is not working. #3

Open wahyurp opened 4 months ago

wahyurp commented 4 months ago

Thank you for sharing your code. But i have some problem here.

I'm trying to use router.keyword("hello*", ...). But it doesn't work.

router.js

const { Router, Response } = require("pepesan");
const BotController = require("./controller/BotController");
const f = require("./utils/Formatter");

const router = new Router();
// another code
router.keyword("hello*", [BotController, "resend"]);

BotController.js

const { Controller, Response } = require("pepesan");
const f = require("../utils/Formatter");

module.exports = class BotController extends Controller {
// another code

    async resend(request) {
      return this.reply("Hello i know it")
    }
}

index,js

require('dotenv').config()
const Pepesan = require("pepesan");
const router = require("./router");
const { ALLOWED_NUMBERS } = process.env;

(async () => {
    const config = {
        allowedNumbers: ALLOWED_NUMBERS ? ALLOWED_NUMBERS.split(',') : null,
        browserName: 'Bot App'
    }
    const pepesan = Pepesan.init(router, config)
    await pepesan.connect()
})()

Can you help me, please? Thank you.