Created
November 1, 2019 10:55
-
-
Save tandevmode/8ff9ccfa40a43810c239f89fef888784 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.LineBotPush = functions.region(REGION).runWith(runtimeOpts).firestore.document('translations/inputText').onWrite(async (change, context) => { | |
let latest = change.after.data(); | |
let input = latest.input; | |
let containsJapanese = input.match(/[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/); | |
if (containsJapanese) { | |
push(GROUP_ID, latest.translated.th); | |
} else { | |
push(GROUP_ID, latest.translated.ja); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment