Skip to content

Commit

Permalink
Merge fec5de9 into 223b270
Browse files Browse the repository at this point in the history
  • Loading branch information
nonumpa committed Oct 31, 2020
2 parents 223b270 + fec5de9 commit c646795
Show file tree
Hide file tree
Showing 22 changed files with 2,106 additions and 125 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ Sent event format: `Event category` / `Event action` / `Event label`
10. User opens settings list
- Page view for page `/setting` is sent
- If opened after sending reply requests: `utm_source=rumors-line-bot&utm_medium=reply-request`
- If opened in tutorial: `&utm_source=rumors-line-bot&utm_medium=tutorial`

11. Other LIFF operations
- `LIFF` / `page_redirect` / `App` is sent on LIFF redirect, with value being redirect count.

12. Tutorial
- If it's triggered by follow event
- `Tutorial` / `Step` / `ON_BOARDING`
- If it's triggered by rich menu
- `Tutorial` / `Step` / `RICH_MENU`
- Others
- `Tutorial` / `Step` / `<TUTORIAL_STEPS>`
154 changes: 138 additions & 16 deletions i18n/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgstr ""
"mime-version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/webhook/index.js:81
#: src/webhook/index.js:78
#. Set default result
#.
msgid "I cannot understand messages other than text."
Expand Down Expand Up @@ -79,40 +79,40 @@ msgstr ""
"不實訊息常常會被人修改重發。\n"
"請選擇比較接近的版本"

#: src/webhook/handlers/choosingReply.js:57
#: src/webhook/handlers/utils.js:579
msgid "Someone on the internet replies to the message:"
msgstr "網路上有人這樣回應這則訊息:"

#: src/webhook/handlers/choosingReply.js:70
#: src/webhook/handlers/utils.js:592
#, javascript-format
msgid "Therefore, the author think the message ${ typeStr }."
msgstr "綜合以上,回應者認為它${typeStr}。"

#: src/webhook/handlers/choosingReply.js:71
#: src/webhook/handlers/utils.js:593
msgid ""
"These messages are provided by some nice volunteers. Please refer to their "
"references and make judgements on your own."
msgstr "以上資訊由好心人提供。請斟酌出處與理由思考判斷。"

#: src/webhook/handlers/choosingReply.js:73
#: src/webhook/handlers/utils.js:595
msgid ""
"There are different replies for the message. Read them all here before "
"making judgements:"
msgstr "這則訊息有很多不同回應,建議到這裡一次讀完再下判斷:"

#: src/webhook/handlers/choosingReply.js:75
#: src/webhook/handlers/utils.js:597
msgid "If you have different thoughts, you may have your say here:"
msgstr "如果你對這則訊息有不同看法,歡迎到下面這裡寫入新的回應:"

#: src/webhook/handlers/choosingReply.js:49
#: src/webhook/handlers/choosingReply.js:19
msgid "Is the reply helpful?"
msgstr "請問上面回應是否有幫助?"

#: src/webhook/handlers/choosingReply.js:108
#: src/webhook/handlers/choosingReply.js:55
msgid "Yes"
msgstr "是"

#: src/webhook/handlers/choosingReply.js:118
#: src/webhook/handlers/choosingReply.js:65
msgid "No"
msgstr "否"

Expand Down Expand Up @@ -149,23 +149,23 @@ msgstr "有人認為它${typeWords}"
msgid "Looks ${ similarityPercentage }% similar"
msgstr "看起來 ${similarityPercentage}% 像"

#: src/webhook/index.js:36
#: src/webhook/index.js:40
msgid ""
"Line bot is busy, or we cannot handle this message. Maybe you can try again "
"a few minutes later."
msgstr "不好意思!系統可能在忙線中,無法及時處理您傳的訊息。請稍等幾分鐘再試試看唷。"

#: src/webhook/handleInput.js:152
#: src/webhook/handleInput.js:159
msgid "Wrong usage"
msgstr "這不是這樣用的"

#: src/webhook/index.js:112
#: src/webhook/index.js:126
msgid ""
"You are currently searching for another message, buttons from previous "
"search sessions do not work now."
msgstr "您已經在搜尋新的訊息了,過去查過的訊息的按鈕已經失效囉。"

#: src/webhook/index.js:254
#: src/webhook/index.js:268
msgid ""
"Oops, something is not working. We have cleared your search data, hopefully "
"the error will go away. Would you please send us the message from the start?"
Expand Down Expand Up @@ -230,7 +230,7 @@ msgid "We've received feedback from you and ${ _otherFeedbackCount } other users
msgstr "感謝您與其他 ${_otherFeedbackCount} 人的評價。"

#: src/webhook/handlers/choosingArticle.js:44
#: src/webhook/handlers/choosingReply.js:20
#: src/webhook/handlers/choosingReply.js:86
msgid "Please choose from provided options."
msgstr "請從上面的選項中做選擇。"

Expand Down Expand Up @@ -278,7 +278,7 @@ msgstr "抱歉這篇訊息還沒有人回應過唷!請闢謠編輯查證,"
msgid "provide more information using “${ btnText }” button. "
msgstr "使用「${btnText}」按鈕來提供更多資訊。"

#: src/webhook/handlers/choosingReply.js:41
#: src/webhook/handlers/choosingReply.js:107
msgid ""
"We have problem retrieving message and reply data, please forward the "
"message again"
Expand Down Expand Up @@ -665,4 +665,126 @@ msgstr "開啟小鈴鐺"

#: src/liff/pages/UserSetting.svelte:69
msgid "Fetching settings"
msgstr "載入設定中"
msgstr "載入設定中"

#: src/webhook/handlers/tutorial.js:15
#. From rich menu
msgid "tutorial"
msgstr "教學"

#: src/webhook/handlers/tutorial.js:17
#. From flex message button
msgid "Simulates forwarding a message"
msgstr "模擬傳訊息進 Cofacts"

#: src/webhook/handlers/tutorial.js:19
#. From quick reply, Note: it should be less than 20 charactors
msgid "Cool, I got it!"
msgstr "酷,我懂了!"

#: src/webhook/handlers/tutorial.js:20
msgid "What happened?"
msgstr "發生什麼事?"

#: src/webhook/handlers/tutorial.js:21
msgid "Why"
msgstr "為什麼要設這個"

#: src/webhook/handlers/tutorial.js:22
msgid "Done!"
msgstr "我設好了!"

#: src/webhook/handlers/tutorial.js:23
msgid "Later"
msgstr "之後再設吧"

#: src/webhook/handlers/tutorial.js:90
msgid ""
"This is a chatbot that looks up suspicious forwarded messages for you. Here "
"is how to use me:"
msgstr "我是幫你查轉傳訊息的機器人。用法像這樣"

#: src/webhook/handlers/tutorial.js:126
msgid "Wanna try it out? Just forward a message to me!"
msgstr "是不是躍躍欲試呢?試試把訊息傳進來吧!"

#: src/webhook/handlers/tutorial.js:190
msgid ""
"This is the end of the tutorial. Next time when you receive a suspicious "
"message, don't hesitate to forward it to me!"
msgstr ""
"耶咿~教學結束囉!!\n"
"下次收到可疑的訊息時,就轉傳分享給我幫你查吧!"

#: src/webhook/handlers/tutorial.js:244
msgid "Setup permission"
msgstr "權限設定"

#: src/webhook/handlers/tutorial.js:297
msgid "You are smart"
msgstr "你很聰明"

#: src/webhook/handlers/tutorial.js:298
msgid ""
"OK. When we ask for feedback from you, the permission dialog will pop-up "
"again."
msgstr "好的,如果之後 真的假的 機器人需要請求你的幫忙,再來問你喔!"

#: src/webhook/handlers/tutorial.js:300
msgid ""
"To wrap up, please finish your permission settings so that I can provide a "
"smoother experience."
msgstr "現在請你完成設定,讓機器人的事實查核順利進行喔!"

#: src/webhook/handlers/tutorial.js:301
msgid ""
"When I provide hoax-busting replies to you, I would like to ask you for any "
"feedback on the crowd-sourced reply.\n"
"In order to achieve that, I need to ask for your permission to \"send your "
"message to our chatroom\".\n"
"The permission will be used to send only this one message of yours back to "
"this particular chatroom.\n"
"You can still use Cofacts without granting me this permission. When we ask "
"for feedback from you, the permission dialog will pop-up again."
msgstr ""
"當我把查到的闢謠回給你的時候,我會需要跟你對話確認才不會誤會你的意思,所以請幫我選擇許可「傳送訊息至聊天室」。\n"
"一樣只會在 真的假的 的好友帳號裡面,讓你可以查新的謠言。\n\n"
"如果不同意的話,還是可以使用其他功能喔!如果我們需要你幫忙,這個「請求同意」的對話會再次出現。"

#: src/webhook/handlers/tutorial.js:108
msgid "When receiving a message from elsewhere"
msgstr "在他處收到訊息"

#: src/webhook/handlers/tutorial.js:109
msgid "Long press and share"
msgstr "長按後分享"

#: src/webhook/handlers/tutorial.js:110
msgid "Select Cofacts to share"
msgstr "指名 Cofacts"

#: src/webhook/handlers/tutorial.js:111
msgid "Cofacts replies with a crowd-sourced fact-check or chatbot replies"
msgstr "Cofacts 回傳網撰寫的的查證或回應"

#: src/webhook/handlers/tutorial.js:306
msgid ""
"What you see above is a simulation of what you may see after you forward a "
"message to Cofacts."
msgstr "上面在模擬你傳訊息給我時,會得到的回應。"

#: src/webhook/handlers/tutorial.js:307
msgid "Cofacts has a database of hoax messages and replies."
msgstr "Cofacts 有一個謠言與回應的資料庫。"

#: src/webhook/handlers/tutorial.js:308
msgid ""
"When you send a message to me, I look up the message in our database and "
"return the results I found."
msgstr "當你傳訊息給我的時候,我會搜尋資料庫然後回傳找到的結果。"

#: src/webhook/handlers/tutorial.js:309
msgid ""
"If I can't find anything, I will ask you about sending your message to that "
"database."
msgstr "如果我找不到的話,會徵求你的同意,看看要不要把這個訊息送進資料庫唷。"
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,26 @@ if (process.env.NODE_ENV === 'production') {
maxage: 31536000 * 1000, // https://stackoverflow.com/a/7071880/1582110
})
);
app.use(
serve({
rootDir: path.join(__dirname, '../static'),
rootPath: '/static',
maxage: 31536000 * 1000, // https://stackoverflow.com/a/7071880/1582110
})
);
} else {
app.use(
require('koa-proxies')('/liff', {
target: `http://localhost:${process.env.LIFF_DEV_PORT}`,
logs: true,
})
);
app.use(
require('koa-proxies')('/static', {
target: `http://localhost:${process.env.LIFF_DEV_PORT}`,
logs: true,
})
);
}

app.use(router.routes());
Expand Down
14 changes: 7 additions & 7 deletions src/lib/__mocks__/ga.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const eventMock = jest.fn();
const sendMock = jest.fn();
const ga = jest.fn();

function ga() {
return {
event: eventMock,
send: sendMock,
screenview: () => {},
};
}
ga.mockImplementation(() => ({
event: eventMock,
send: sendMock,
screenview: () => {},
}));

ga.clearAllMocks = () => {
eventMock.mockClear();
sendMock.mockClear();
ga.mockClear();
};

ga.eventMock = eventMock;
Expand Down

0 comments on commit c646795

Please sign in to comment.