Giter VIP home page Giter VIP logo

activitybot's People

Contributors

bbandydd avatar chnbohwr avatar jimmyhou024 avatar jimmyhouwistron avatar yang-025 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

chnbohwr

activitybot's Issues

LUIS.AI 開始收費了............

如題,要註冊 azure 帳號才能夠申請 endpoint key

目前來看我們可能要拋棄 luis.ai了

A key is your passport to the server allowing you to publish your app to be used by end users. LUIS requires these types of keys:

Programmatic API Key: Created automatically per LUIS account and you don't have to buy it. It enables you to author and edit your application using LUIS programmatic APIs.
Endpoint Key(s): You need to buy it from Microsoft Azure portal. It is essential for publishing your app and accessing its HTTP endpoint. This key reflects your quota of endpoint hits based on the usage plan you specified for creating the key.
External Key(s): You need to buy an external key only if you want to use any external services with LUIS (e.g. Bing Spell Check service).

建立活動功能實做

收到 LUIS 的意圖之後會在 db.activities 建立一筆活動

包含的資訊有

日期
地點
活動開始時間
活動結束時間
使用者的 id 列表

取得上一個意圖

這部份要等 database 串接上去以後根據 userid 取得上一個動作

如果紀錄在globals 同時多人聊天會錯亂

使用者資訊只有ID,是否增加其他資訊?

在列參加名單時,使用者的資訊只有line user ID,資訊太少,目前想到以下方法:

  • 使用line user id取得最新個人資訊。
  • 用增加使用者的時候存使用者當前的名稱。

想跟大家討論,要存多少使用者資訊在資料庫呢?

heroku 不允許 nedb 新增檔案

Ephemeral filesystem

Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted. For example, this occurs any time a dyno is replaced due to application deployment and approximately once a day as part of normal dyno management.****

我們可能真的要串個 database 了,請大家提供一下意見好了,看看我們要哪種 database ...然後把錢準備好

結巴在部署到 heroku 的時候會有問題

如題,話說 我昨天想在 aws lambda 放入結巴的 function 但是也是會出現這個問題,估計是heroku 可能不能夠支援結巴中文斷詞 .....

可能要考慮把結巴拆掉.........傷心 😢

2017-02-18T08:48:29.305197+00:00 app[web.1]: 
2017-02-18T08:48:29.305218+00:00 app[web.1]: > [email protected] start /app
2017-02-18T08:48:29.305225+00:00 app[web.1]: > babel-node ./src/serverIndex.js --watch
2017-02-18T08:48:29.305225+00:00 app[web.1]: 
2017-02-18T08:48:34.421812+00:00 app[web.1]: module.js:471
2017-02-18T08:48:34.421825+00:00 app[web.1]:     throw err;
2017-02-18T08:48:34.421826+00:00 app[web.1]:     ^
2017-02-18T08:48:34.421827+00:00 app[web.1]: 
2017-02-18T08:48:34.421828+00:00 app[web.1]: Error: Cannot find module './build/Release/nodejieba.node'
2017-02-18T08:48:34.421829+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:469:15)
2017-02-18T08:48:34.421830+00:00 app[web.1]:     at Function.Module._load (module.js:417:25)
2017-02-18T08:48:34.421830+00:00 app[web.1]:     at Module.require (module.js:497:17)
2017-02-18T08:48:34.421831+00:00 app[web.1]:     at require (internal/module.js:20:19)
2017-02-18T08:48:34.421832+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/nodejieba/index.js:1:17)
2017-02-18T08:48:34.421832+00:00 app[web.1]:     at Module._compile (module.js:570:32)
2017-02-18T08:48:34.421833+00:00 app[web.1]:     at Module._extensions..js (module.js:579:10)
2017-02-18T08:48:34.421834+00:00 app[web.1]:     at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:152:7)
2017-02-18T08:48:34.421834+00:00 app[web.1]:     at Module.load (module.js:487:32)
2017-02-18T08:48:34.421835+00:00 app[web.1]:     at tryModuleLoad (module.js:446:12)
2017-02-18T08:48:34.421836+00:00 app[web.1]:     at Function.Module._load (module.js:438:3)
2017-02-18T08:48:34.421836+00:00 app[web.1]:     at Module.require (module.js:497:17)
2017-02-18T08:48:34.421837+00:00 app[web.1]:     at require (internal/module.js:20:19)
2017-02-18T08:48:34.421837+00:00 app[web.1]:     at Object.<anonymous> (/app/src/modules/None.js:1:15)
2017-02-18T08:48:34.421838+00:00 app[web.1]:     at Module._compile (module.js:570:32)
2017-02-18T08:48:34.421839+00:00 app[web.1]:     at loader (/app/node_modules/babel-register/lib/node.js:144:5)
2017-02-18T08:48:34.421839+00:00 app[web.1]:     at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7)
2017-02-18T08:48:34.421840+00:00 app[web.1]:     at Module.load (module.js:487:32)
2017-02-18T08:48:34.421841+00:00 app[web.1]:     at tryModuleLoad (module.js:446:12)
2017-02-18T08:48:34.421841+00:00 app[web.1]:     at Function.Module._load (module.js:438:3)
2017-02-18T08:48:34.421842+00:00 app[web.1]:     at Module.require (module.js:497:17)
2017-02-18T08:48:34.421842+00:00 app[web.1]:     at require (internal/module.js:20:19)
2017-02-18T08:48:34.490392+00:00 app[web.1]: 
2017-02-18T08:48:34.502756+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2017-02-18T08:48:34.503082+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-02-18T08:48:34.503353+00:00 app[web.1]: npm ERR! node v6.9.5
2017-02-18T08:48:34.503575+00:00 app[web.1]: npm ERR! npm  v3.10.10
2017-02-18T08:48:34.503823+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-02-18T08:48:34.508047+00:00 app[web.1]: npm ERR! [email protected] start: `babel-node ./src/serverIndex.js --watch`
2017-02-18T08:48:34.508222+00:00 app[web.1]: npm ERR! Exit status 1
2017-02-18T08:48:34.508409+00:00 app[web.1]: npm ERR! 
2017-02-18T08:48:34.508577+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script 'babel-node ./src/serverIndex.js --watch'.
2017-02-18T08:48:34.508740+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-02-18T08:48:34.508899+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the ActivityBot package,
2017-02-18T08:48:34.509062+00:00 app[web.1]: npm ERR! not with npm itself.
2017-02-18T08:48:34.509238+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-02-18T08:48:34.509398+00:00 app[web.1]: npm ERR!     babel-node ./src/serverIndex.js --watch
2017-02-18T08:48:34.509565+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-02-18T08:48:34.509732+00:00 app[web.1]: npm ERR!     npm bugs ActivityBot
2017-02-18T08:48:34.509888+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-02-18T08:48:34.510058+00:00 app[web.1]: npm ERR!     npm owner ls ActivityBot
2017-02-18T08:48:34.510249+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-02-18T08:48:34.558354+00:00 app[web.1]: 
2017-02-18T08:48:34.558681+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-02-18T08:48:34.558817+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2017-02-18T08:48:34.702061+00:00 heroku[web.1]: State changed from starting to crashed
2017-02-18T08:48:34.684053+00:00 heroku[web.1]: Process exited with status 1
2017-02-18T08:48:34.509398+00:00 app[web.1]: npm ERR!     babel-node ./src/serverIndex.js --watch
2017-02-18T08:48:34.509565+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-02-18T08:48:34.509732+00:00 app[web.1]: npm ERR!     npm bugs ActivityBot
2017-02-18T08:48:34.509888+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-02-18T08:48:34.510058+00:00 app[web.1]: npm ERR!     npm owner ls ActivityBot
2017-02-18T08:48:34.510249+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-02-18T08:48:34.558354+00:00 app[web.1]: 
2017-02-18T08:48:34.558681+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-02-18T08:48:34.558817+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2017-02-18T08:48:34.702061+00:00 heroku[web.1]: State changed from starting to crashed
2017-02-18T08:48:34.684053+00:00 heroku[web.1]: Process exited with status 1

建立活動要改成 web form

今天試了 wit.ai 以後發現有些entity不太好去做到,所以比較複雜的建立活動想要改成用 web page 的方式去製作,以下是整個流程

  1. 社長在 line 內對 wiwi 聲明要註冊成為社長,並且核對暗號成功,wiwi會把社長的 userId 寫入資料庫內
  2. 社長在網頁上面 line-login 之後會有 form 讓社長填寫資訊
  3. 填寫完畢以後送出, wiwi 發送給所有已知的使用者

每次對話需要把紀錄留在資料庫內

如題 可以討論看看要使用哪種方法

  1. refactor intentHandler 讓它每次收到訊息都寫進資料庫
  2. 在express 收到訊息的時候做 middlware 讓它寫入資料庫內

請假功能實做

在活動還沒關閉以前如果收到請假的意圖要把資料庫的該名 id 取消參加

註冊成為社長功能

如題 要當社長就要輸入通關密語

通關密語就寫在環境變數裡面

收到意圖之後判斷有沒有通關密語

如果有就寫入資料庫

列出活動使用者功能實做

LUIS 意圖為 listUsers 的時候從 database 裡面撈出該活動的使用者資訊回傳給 bot

要注意的地方大概就是資料庫儲存的為 id 列表 所以要呼叫 LineBot.getUserProfile(event.source.userId) 去取得所有的 user 名稱回傳

有人叫 bot 的時候才會回應

因為怕放到群組裡面以後會一直亂回大家的話

所以想做一個機制就是如果在群組內 event.source.type === 'group' 那就要叫名字才會回應

如果是私訊的就直接回應

bot 的名字放在環境變數裡面

參考資訊

在 createActivity 存了錯誤的userId

在建立活動時所產生的物件如下:

 const entity = {
      location: luisResult.entityObject.location,
      startTime: luisResult.entityObject['activityTime::activityStartTime'],
      endTime: luisResult.entityObject['activityTime::activityEndTime'],
      date: luisResult.entityObject['builtin.datetime.date'],
      user: event.message.id,
    };

其中的 user 所存的id 是否應存為:even.source.userId (U5bxxxxxxxxx5943debef9e8exxxxxdcf),
而不是存 :event.message.id (5664435528000)。

垃圾話回覆功能

新增垃圾話json

intent為None時,隨機回覆對應的垃圾話

可使用jieba中文斷句後比對

邀請 linebot 到開發群組裡面

我要把 line bot 邀請到正在開發的群組之中,看看他有沒有辦法接收到訊息

因為之前測試都是私下跟 line bot 聊天,不知道有沒有支援群組聊天

nedb 更新資料的方式

今天發現 nedb 的更新方式還是會有問題,不會更新該筆資料而是在寫入一筆新的進去,我要來調查一下有沒有參數可以設定成更新而不是新增

加入活動功能實做

收到意圖為 joinActivity 的時候把該使用者的 id 存入活動資料庫當中,這邊比較要注意到使用者可能報名人數會超過一人,所以除了紀錄 id 以會還要紀錄參加的人數

[
  {
      userId: 0001231561651,  // LINE ID
      number: 1,    //人數
      isLeave: true    // 是否請假
  }
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.