Commit 780eaefc authored by Melroy van den Berg's avatar Melroy van den Berg
Browse files

Add lbrynet version

parent 7fe3052c
Pipeline #1386 passed with stage
in 1 minute and 37 seconds
......@@ -55,6 +55,21 @@ class LBRY {
})
}
/**
* Retrieve LBRYnet version
*
* @return {Promise} Axios promise
*/
getLbryNetVersion () {
return this.lbrynet.post('/', {
method: 'version',
params: {}
})
.then(response => {
return Promise.resolve(response.data.result.lbrynet_version)
})
}
/**
* Get content information by providing the uri
*
......
......@@ -115,60 +115,72 @@ Lbrynet connection: ${result.connection_status.code}`
})
.catch(error => {
console.error(error)
text += 'Error: Could not LBRYnet (SDK) info!\n'
text += 'Error: Could not retrieve LBRYnet (SDK) status!\n'
})
.then(function () {
// always executed
lbry.getNetworkInfo()
.then(networkResult => {
lbry.getLbryNetVersion()
.then(lbryNetVersion => {
text += `
Lbrycrd version: ${networkResult.subversion}
Protocol version: ${networkResult.protocolversion}
\n*Peer info*
Peers connected: ${networkResult.connections}`
Lbrynet version: ${lbryNetVersion}`
})
.catch(error => {
console.error(error)
text += 'Error: Could not fetch network info!\n'
text += 'Error: Could not retrieve LBRYnet version!\n'
})
.then(function () {
// always executed
lbry.getPeerInfo()
.then(peerResult => {
text += '\nFirst peer details:'
if (peerResult.length > 0) {
const sendTime = Misc.printDate(new Date(peerResult[0].lastsend * 1000))
const recieveTime = Misc.printDate(new Date(peerResult[0].lastrecv * 1000))
const ping = parseFloat(peerResult[0].pingtime * 1000).toFixed(2)
text += `
Ping: ${ping} ms
Last send: ${sendTime}
Last receive: ${recieveTime}`
} else {
text += 'Warning: No peers connected...'
}
lbry.getNetworkInfo()
.then(networkResult => {
text += `
Lbrycrd version: ${networkResult.subversion}
Protocol version: ${networkResult.protocolversion}
\n*Peer info*
Peers connected: ${networkResult.connections}`
})
.catch(error => {
console.error(error)
text += 'Error: Could not fetch peer info!\n'
text += 'Error: Could not fetch network info!\n'
})
.then(function () {
// always executed
lbry.getWalletInfo()
.then(walletResult => {
const oldestKeyTime = Misc.printDate(new Date(walletResult.keypoololdest * 1000))
text += `
\n*Wallet info* 👛
Oldest address in keypool: ${oldestKeyTime}
# of reserved addresses: ${walletResult.keypoolsize}`
lbry.getPeerInfo()
.then(peerResult => {
text += '\nFirst peer details:'
if (peerResult.length > 0) {
const sendTime = Misc.printDate(new Date(peerResult[0].lastsend * 1000))
const recieveTime = Misc.printDate(new Date(peerResult[0].lastrecv * 1000))
const ping = parseFloat(peerResult[0].pingtime * 1000).toFixed(2)
text += `
Ping: ${ping} ms
Last send: ${sendTime}
Last receive: ${recieveTime}`
} else {
text += 'Warning: No peers connected...'
}
})
.catch(error => {
console.error(error)
text += 'Error: Could not fetch wallet info!\n'
text += 'Error: Could not fetch peer info!\n'
})
.then(function () {
// always executed, finally we send the info back!
bot.sendMessage(chatId, text, { parse_mode: 'markdown' })
// always executed
lbry.getWalletInfo()
.then(walletResult => {
const oldestKeyTime = Misc.printDate(new Date(walletResult.keypoololdest * 1000))
text += `
\n*Wallet info* 👛
Oldest address in keypool: ${oldestKeyTime}
# of reserved addresses: ${walletResult.keypoolsize}`
})
.catch(error => {
console.error(error)
text += 'Error: Could not fetch wallet info!\n'
})
.then(function () {
// always executed, finally we send the info back!
bot.sendMessage(chatId, text, { parse_mode: 'markdown' })
})
})
})
})
......@@ -654,6 +666,11 @@ Last 7 days: ${quote.percent_change_7d}% ${days7ChangeIcon}`
})
// TODO: Last channel tips?
this.bot.onText(/^[/|!]contenttips\S*$/, msg => {
const chatId = msg.chat.id
this.bot.sendMessage(chatId, 'Error: Provide atleast the LBRY URI as argument: /contenttips <URI>')
})
// contenttips command
this.bot.onText(/[/|!]contenttips@?\S* (.+)/, (msg, match) => {
const contentName = match[1].trim()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment