Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
LBRY Bot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Melroy van den Berg
LBRY Bot
Commits
f01e7089
Commit
f01e7089
authored
Sep 12, 2019
by
Melroy van den Berg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix lint
parent
1bf066b1
Pipeline
#1302
passed with stage
in 1 minute and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
app.js
app.js
+1
-1
src/miscellaneous.js
src/miscellaneous.js
+7
-7
No files found.
app.js
View file @
f01e7089
...
...
@@ -35,7 +35,7 @@ const lbry = new LBRY(LBRYNET_HOST, LBRYNET_PORT,
const
exchange
=
new
Exchange
(
COINMARKETCAP_API_TOKEN
)
// TODO: Only create a TelegramBot object, when bot server is enabled for serving Telegram requests
// Currently only Telegram is supported until futher notice.
const
telegramBot
=
new
TelegramBot
(
TELEGRAM_TOKEN
)
// This informs the Telegram servers of the new webhook.
telegramBot
.
setWebHook
(
`
${
botUrl
}
/telegram/bot
${
TelegramSecretHash
}
`
)
...
...
src/miscellaneous.js
View file @
f01e7089
class
Misc
{
/**
* Convert Date object to string
* @param {Date} - date
* @param {Date} - date
* @return {string} formatted date string
*/
static
printDate
(
date
)
{
static
printDate
(
date
)
{
const
options
=
{
year
:
'
numeric
'
,
month
:
'
long
'
,
day
:
'
numeric
'
}
return
date
.
toLocaleDateString
(
'
en-US
'
,
options
)
+
'
'
+
date
.
toLocaleTimeString
(
'
en-US
'
)
}
...
...
@@ -14,16 +14,16 @@ class Misc {
* @param {string} - hash string
* @return {Boolean} True if SHA256 otherwise false
*/
static
isSha256
(
hash
)
{
static
isSha256
(
hash
)
{
return
hash
.
match
(
/^
([
a-f0-9
]{64})
$/
)
!=
null
}
/**
* Convert timestamp to date (approximately)
* @param {Date} timestamp
* @param {Date} timestamp
* @turn {Dict} structure of year, month, day, hour, minute, second
*/
static
timestampToDate
(
timestamp
)
{
static
timestampToDate
(
timestamp
)
{
let
seconds
=
Math
.
floor
(
timestamp
/
1000
)
let
minutes
=
Math
.
floor
(
seconds
/
60
)
seconds
=
seconds
%
60
...
...
@@ -35,8 +35,8 @@ class Misc {
days
=
days
%
30
const
years
=
Math
.
floor
(
months
/
12
)
months
=
months
%
12
return
{
year
:
years
,
month
:
months
,
day
:
days
,
hour
:
hours
,
minute
:
minutes
,
second
:
seconds
}
return
{
year
:
years
,
month
:
months
,
day
:
days
,
hour
:
hours
,
minute
:
minutes
,
second
:
seconds
}
}
}
module
.
exports
=
Misc
\ No newline at end of file
module
.
exports
=
Misc
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment