Update 'session-bot.js'

master
who am i 3 years ago
parent 4607e26c71
commit 15129cb4e7

@ -1,4 +1,5 @@
onst fs = require('fs')
const fs = require('fs')
const fetch = require('node-fetch')
const SessionClient = require('./session-client.js')
const client = new SessionClient()
@ -11,6 +12,7 @@ if (fs.existsSync('lastHash.txt')) {
client.loadIdentity({
seed: fs.existsSync('seed.txt') && fs.readFileSync('seed.txt').toString(),
displayName: 'Session Bot',
// avatarFile: '/home/botadmin/Pictures/SessionBot.gif',
}).then(async () => {
// output recovery phrase if making an identity
console.log(client.identityOutput)
@ -20,8 +22,18 @@ client.loadIdentity({
fs.writeFileSync('lastHash.txt', hash)
})
const openGroupV2URL = 'http://202.61.245.158/test?public_key=f3ea00d5a2f8ec3fbc6db632a66a7e489aeb37f18690e320f180ca3de9b25e42'
const ogv2Handle = await client.joinOpenGroupV2(openGroupV2URL)
/* const openGroupV2URL = {
"http://116.203.70.33/session?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238","http://116.203.70.33/oxen?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238","http://116.203.70.33/lokinet?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238","http://116.203.70.33/crypto?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238","http://open2.hesiod.network/build_a_bot?public_key=58dc124cc38e4d03449037e9a4a86a2e5c2a648938eb824a5cdf3b6a80fab07d", "http://202.61.245.158/test?public_key=f3ea00d5a2f8ec3fbc6db632a66a7e489aeb37f18690e320f180ca3de9b25e42"
};
const ogv2Handle = await client.joinOpenGroupV2(openGroupV2URL)
*/
// one group login (works)
const openGroupV2URL = ["http://202.61.245.158/test?public_key=f3ea00d5a2f8ec3fbc6db632a66a7e489aeb37f18690e320f180ca3de9b25e42"];
//const openGroupV2URL = ["http://116.203.70.33/session?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238"];
const ogv2Handle = await client.joinOpenGroupV2(openGroupV2URL)
// handle incoming messages
client.on('messages', msgs => {
@ -37,39 +49,45 @@ client.loadIdentity({
let response;
let options = { displayName: "Session Bot" };
if (msg.body === "/help")
response = " /news\n /session.faq\n /session.groups\n /session.issues\n /lokinet\n /lokinet.faq\n /lokinet.exit\n /oxen\n /oxen.wallet\n /oxen.price\n /oxen.observer\n /sn (currently inactive)\n /sn.deb\n /optf\n /donate\n"
response = " /news\n /whitepaper\n /roadmap\n /session.faq\n /session.groups\n /session.issues\n /lokinet\n /lokinet.faq\n /lokinet.exit\n /oxen\n /oxen.wallet\n /oxen.price\n /oxen.observer\n /sn (inactive)\n /sn.deb\n /sn.rancher\n /optf\n /donate\n"
else if (msg.body === "/session.faq")
response = "Session's FAQ:\nhttps://getsession.org/faq"
else if (msg.body === "/session.groups")
response = "sessiongroups.com\nThis is NOT maintained and moderated by the Session team"
response = "List of Session groups:\nhttp://lokilocker.com/Mods/Session-Groups/wiki/_pages\n(clearnet link)\nhttp://8bb19w1gugu7yq3cyck63gbo18udodab1b6zr1uykdphm37ushco.loki/Mods/Session-Groups/wiki/_pages\n(lokinet link)\nNote: This group list contains groups which are not maintained and moderated by the Session team\n\nHow to make a new Session Open Group?\nhttps://youtube.com/watch?v=D83gKXn6iTI\n(YouTube movie)\nhttps://github.com/oxen-io/session-open-group-server\n(Installation instructions)"
else if (msg.body === "/session.issues")
response = "Report a Session development issue:\nAndroid:\nhttps://github.com/oxen-io/session-android/issues\nDesktop:\nhttps://github.com/oxen-io/session-desktop/issues\niOS:\nhttps://github.com/oxen-io/session-ios/issues"
response = "Report a Session development issue:\n\nAndroid:\nhttps://github.com/oxen-io/session-android/issues\n\nDesktop:\nhttps://github.com/oxen-io/session-desktop/issues\n\niOS:\nhttps://github.com/oxen-io/session-ios/issues"
else if (msg.body === "/news")
response = "Session's blog:\nhttps://getsession.org/blog/\n\nOPTF blog:\nhttps://optf.ngo/blog\n\nOxen (weekly) dev updates:\nhttps://oxen.io/blog\n\nYouTube Channel:\nhttps://www.youtube.com/channel/UCN7LL0dEffQ7FSjbY5wwlnw"
else if (msg.body === "/whitepaper")
response = "The official Loki whitepaper, July 13th 2018 (V3): Private transactions, decentralised communication.\nauthors: Kee Jefferys, Simon Harman, Johnathan Ross and Paul McLean\nhttps://loki.network/readingmaterial\n\navailable in: Chinese, French, German, Japanese, Korean, Spanish and Russian\nRemark: loki was rebranded to Oxen in Jan. 2021"
else if (msg.body === "/roadmap")
response = "The roadmaps for Oxen, Session and Lokinet:\nhttps://oxen.io/roadmap"
else if (msg.body === "/lokinet")
response = "What, why, how to install, how to use lokinet?\nhttps://docs.oxen.io/products-built-on-oxen/lokinet\n\nHow to browse the clearnet with lokinet?\nhttps://docs.oxen.io/products-built-on-oxen/lokinet/exit-nodes\n\nLooking for a simple RPi (router) implementation of lokinet?\nhttps://github.com/necro-nemesis/LabyrinthAP"
else if (msg.body === "/lokinet.faq")
response = "https://lokinet.org/faqdark"
else if (msg.body === "/lokinet.exit")
response = "exit.loki (Germany)\ntixe.loki (France)\nexit-gondor.loki (Netherlands)\nexit-arda.loki (Norway)"
response = "exit.loki (Germany)\ntixe.loki (France)\nexit-gondor.loki (Netherlands)\nexit-arda.loki (Norway)\n\nHow to make your own exit node?\nhttp://8bb19w1gugu7yq3cyck63gbo18udodab1b6zr1uykdphm37ushco.loki/Cafe_Loki/Guides_and_Tutorials/src/branch/master/Guides/How_to_setup_an_Exit_Node_for_normies.md\n(lokinet link)\n\nhttp://lokilocker.com/Cafe_Loki/Guides_and_Tutorials/src/branch/master/Guides/How_to_setup_an_Exit_Node_for_normies.md\n(clearnet link)"
else if (msg.body === "/oxen")
response = "Overview, how to stack and economics:\nhttps://docs.oxen.io\nhttps://imaginary.stream/sn\n\nHow to setup your own Oxen Service Node?\nhttps://docs.oxen.io/using-the-oxen-blockchain/oxen-service-node-guides/setting-up-an-oxen-service-node\n\nHow to stack without running your own Oxen Service Node?\nhttps://docs.oxen.io/using-the-oxen-blockchain/oxen-service-node-guides/staking-to-shared-service-node\nWhere to buy OXEN?\nhttps://www.kucoin.com\nhttps://tradeogre.com\nhttps://global.bittrex.com\n\nHow to buy?\n\n1.Fiat (€, $, ...) > ETH or BTC\n2.ETH or BTC > OXEN\n3.Transfer to your private OXEN wallet."
response = "Overview, how to stake and economics:\nhttps://docs.oxen.io\nhttps://imaginary.stream/sn\n\nHow to setup your own Oxen Service Node?\nhttps://docs.oxen.io/using-the-oxen-blockchain/oxen-service-node-guides/setting-up-an-oxen-service-node\n\nHow to stake without running your own Oxen Service Node?\nhttps://docs.oxen.io/using-the-oxen-blockchain/oxen-service-node-guides/staking-to-shared-service-node\n\nWhere to buy OXEN?\nhttps://www.kucoin.com\nhttps://tradeogre.com\nhttps://global.bittrex.com\n\nHow to buy?\n1.Fiat (€, $, ...) > ETH or BTC\n2.ETH or BTC > OXEN\n3.Transfer to your private OXEN wallet."
else if (msg.body.startsWith("/oxen.price")){
const currentPriceUSD = await askPrice("oxen", "usd");
const currentPriceEUR = await askPrice("oxen", "eur");
response = "OXEN = " + currentPriceUSD.toString() + " USD\n" + "OXEN = " + currentPriceEUR.toString() + " EUR\n" + "base tx fee ~0.005 OXEN (~3s)\nblink tx fee ~0.015 OXEN (~20min)";
const currentPriceUSD = await askPrice("oxen", "usd")
const currentPriceEUR = await askPrice("oxen", "eur")
response = "OXEN = " + currentPriceUSD.toString() + " USD\n" + "OXEN = " + currentPriceEUR.toString() + " EUR\n" + "base tx fee ~0.01 OXEN ~20min\nblink tx fee ~0.03 OXEN ~3s"}
else if (msg.body === "/oxen.wallet")
response = "Download your Oxen wallet:\nhttps://docs.oxen.io/downloads\n\nAlways verify the download before using\nhttps://github.com/oxen-io/oxen-electron-gui-wallet/releases\n(Tip: https://www.youtube.com/watch?v=Lefnp-063go)\n\n Always BACKUP your wallet seed!\n\n NEVER share your wallet seed!"
response = "Download your Oxen wallet:\nhttps://docs.oxen.io/downloads\n\nAlways verify the download before using\nhttps://github.com/oxen-io/oxen-electron-gui-wallet/releases\n(Tip: https://www.youtube.com/watch?v=Lefnp-063go)\n\n Always BACKUP your wallet seed!\n NEVER share your wallet seed!"
else if (msg.body === "/oxen.observer")
response = "Monitor the OXEN and Service Node network:\nhttps://www.oxensn.com\nhttps://lokiblocks.com\nhttps://oxendashboard.com"
response = "Monitor the OXEN and Service Node network:\nhttps://www.oxensn.com\nhttps://lokiblocks.com\nhttps://oxendashboard.com\n(clearnet links)\n\nhttp://kcpyawm9se7trdbzncimdi5t7st4p5mh9i1mg7gkpuubi4k4ku1y.loki\n(lokinet link)"
else if (msg.body === "/sn")
response = "Active SN: XX.XXX\nVersions: X.X.X\nSN stake req.: 15,000 OXEN\nSN reward: 16.5 OXEN\nDaily reward: ~ X.XX OXEN\nRewards time: \nOpen for contribution:\nDecomissioned SN:"
else if (msg.body === "/sn.deb")
response = "Commands to check and control your service (Debian package)\n\nShow general status of the process:\nsudo systemctl status oxen-node\nsudo systemctl status oxen-storage-server\nsudo systemctl status lokinet-router\n\nStart/stop/restart a service:\nsudo systemctl start oxen-node\nsudo systemctl restart oxen-node\nsudo systemctl stop oxen-node\n\nQuery oxend for status (does not need sudo)\noxend status"
response = "Commands to check and control your Oxen Service Node (Debian package)\n\nShow general status of the process:\nsudo systemctl status oxen-node\nsudo systemctl status oxen-storage-server\nsudo systemctl status lokinet-router\n\nStart/stop/restart a service:\nsudo systemctl start oxen-node\nsudo systemctl restart oxen-node\nsudo systemctl stop oxen-node\n\nQuery oxend for status (does not need sudo):\noxend status"
else if (msg.body === "/sn.rancher")
response = "Check and control your Oxen Service Node (non-Debian package)\n\noxen-rancher help"
else if (msg.body === "/optf")
response = "Accessibility\nA free and open internet is essential to upholding democratic principles, including freedom of expression and freedom of the press.\n\nDemocratic freedoms\nA free and open internet is essential to upholding democratic principles, including freedom of expression and freedom of the press.\n\nEducation\nPeople need education and resources to help them understand and exercise their right to privacy.\n\nPrivacy\nDigital technology must be designed to protect user privacy by default.\n\nCommunity\nOnline communities are strongest when they are open and welcoming, and promote human dignity.\n\nThe Oxen Privacy Tech Foundation\nhttps://optf.ngo"
else if (msg.body === "/donate")
response = "Support Session Bot development:\n\nBot developer:\nLT2mP2DrmGD82gFnH16ty8ZtP6f33czpA6XgQdnuTVeT5bNGyy3vnaUezzKq1rEYyq3cvb2GBZ5LjCC6uqDyKnbvFki9aAX\n\nBot Dev Supporter:\nLUYB9Mq6RgnBssy5FHYziWdH6oY1z4dfdewp8c4fftiAfjbJ6JSNEsUWSmqiM16LQNeUo43rmKWPMYJb4MkQh4MiRb6w6Xt"
response = "Support Session Bot development:\nLT2mP2DrmGD82gFnH16ty8ZtP6f33czpA6XgQdnuTVeT5bNGyy3vnaUezzKq1rEYyq3cvb2GBZ5LjCC6uqDyKnbvFki9aAX"
else return;
if(ogv2Handle){
@ -105,5 +123,3 @@ async function askPrice(cryptoId, fiatSymbol) {
}

Loading…
Cancel
Save