Toggle navigation
Toggle navigation
This project
Loading...
Sign in
kykint
/
TELEGRAMBOT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
kykint
2019-05-30 22:32:16 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
042b61079b7b468cc4a701b2c7e3465cee839878
042b6107
1 parent
3c355795
Print source message to log as well
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
app.js
app.js
View file @
042b610
...
...
@@ -75,8 +75,8 @@ bot.onText(/(?!\/)(.+)/, (msg, match) => {
var
translate_options
=
{
url
:
translate_api_url
,
form
:
{
'source'
:
source
,
//
Translate from source
'target'
:
target
,
//
to target
'source'
:
source
,
//
Before translation
'target'
:
target
,
//
After translation
'text'
:
received_msg
// Message to translate
},
headers
:
{
...
...
@@ -93,7 +93,8 @@ bot.onText(/(?!\/)(.+)/, (msg, match) => {
result
.
text
=
objBody
.
message
.
result
.
translatedText
;
// Send translated message
console
.
log
(
result
.
text
);
console
.
log
(
'Before: '
+
received_msg
);
console
.
log
(
'After: '
+
result
.
text
);
bot
.
sendMessage
(
chatId
,
result
.
text
);
}
});
...
...
Please
register
or
login
to post a comment