Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정홍주
/
Coin-trade-assistant
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
정홍주
2021-06-16 14:13:24 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2120e9bb1df3413c843b8fa4314c49ed3791f48b
2120e9bb
1 parent
40e639df
whale, 도움말 Tokenrror fix
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
app.js
app.js
View file @
2120e9b
...
...
@@ -41,7 +41,6 @@ app.post('/hook', function (req, res) {
console
.
log
(
'[request]'
,
req
.
body
);
console
.
log
(
'[request source] '
,
source
);
console
.
log
(
'[request message]'
,
message
);
if
(
message
.
text
===
'김프'
){
command
=
'김프'
;
USER_ID
=
source
.
userId
;
...
...
@@ -51,12 +50,14 @@ app.post('/hook', function (req, res) {
USER_ID
=
source
.
userId
;
}
else
if
(
message
.
text
==
'고래알람'
){
PushTimeId
=
SetWhaleAlert
()
PushTimeId
=
SetWhaleAlert
(
source
.
userId
)
USER_ID
=
source
.
userId
;
}
else
if
(
message
.
text
==
'도움말'
){
explain_message
();
explain_message
(
source
.
userId
);
USER_ID
=
source
.
userId
;
}
else
if
(
message
.
text
==
'고래알람해제'
){
clearTimeout
(
PushTimeId
)
...
...
@@ -69,7 +70,7 @@ app.post('/hook', function (req, res) {
res
.
sendStatus
(
200
);
});
function
explain_message
(){
function
explain_message
(
userId
){
request
.
post
(
{
url
:
TARGET_URL_PUSH
,
...
...
@@ -77,7 +78,7 @@ function explain_message(){
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"to"
:
`
${
USER_ID
}
`
,
"to"
:
`
${
userId
}
`
,
"messages"
:[
{
"type"
:
"text"
,
...
...
@@ -368,7 +369,7 @@ function data_collector(data, limit){
}
return
ret
;
}
function
SetWhaleAlert
(){
function
SetWhaleAlert
(
userId
){
url2
=
'https://api.whale-alert.io/v1/transactions?api_key='
+
api_key
+
'&cursor='
+
cursor
;
const
options
=
{
method
:
'GET'
,
headers
:
{
Accept
:
'application/json'
}};
...
...
@@ -421,7 +422,7 @@ function SetWhaleAlert(){
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"to"
:
`
${
USER_ID
}
`
,
"to"
:
`
${
userId
}
`
,
"messages"
:[
msg2user
[
i
]]
}
},(
error
,
response
,
body
)
=>
{
...
...
Please
register
or
login
to post a comment