瀏覽代碼

only bot nexilis.io

yayan 11 月之前
父節點
當前提交
b697bcb877
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      whatsapp-client.js

+ 4 - 1
whatsapp-client.js

@@ -75,11 +75,14 @@ class WhasAppClient {
 
         let that = this.client;
         this.client.on('message', async (msg) => {
-            // console.log(`be:${this.clientId}:message:${JSON.stringify(msg)}`);
+            console.log(`be:${this.clientId}:message:${JSON.stringify(msg)}`);
             if (msg.body.startsWith('!bot ')) {
                 let message = msg.body.slice(5, msg.body.length);
                 let chat = await msg.getChat();
                 chat.sendSeen();
+                if (msg.to.indexOf("8119607282") === -1) { // nexilis.io official number
+                    return;
+                }
                 console.log(`message:${message}`);
                 axios.post('https://nexilis.io/chatgpt/gptnexilis', [{
                     role: 'user',