From 08851d3a6b53ece50d27dd413dd2474f7344765f Mon Sep 17 00:00:00 2001 From: stephen Date: Tue, 7 Dec 2021 16:17:31 -0500 Subject: [PATCH] Prepping for 0.1.2 --- .vs/VSWorkspaceState.json | 6 ++++ .vs/nodejs/v16/.suo | Bin 0 -> 13824 bytes .vs/slnx.sqlite | Bin 0 -> 90112 bytes README.md | 4 +-- config.ini.dist | 68 ++++++++++++++++++++------------------ index.js | 32 +++++++++--------- 6 files changed, 59 insertions(+), 51 deletions(-) create mode 100755 .vs/VSWorkspaceState.json create mode 100755 .vs/nodejs/v16/.suo create mode 100755 .vs/slnx.sqlite mode change 100644 => 100755 index.js diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100755 index 0000000..9568b22 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/nodejs/v16/.suo b/.vs/nodejs/v16/.suo new file mode 100755 index 0000000000000000000000000000000000000000..54a1b459a575aa781db4242d77d085475be282b6 GIT binary patch literal 13824 zcmeHNU2GiH6~60)LQ>k4Bu�S_9$Vvzedu?yL#M-oJo^alpYu>PqQ)X6=l#-gUie zk~V7H5JJ2_#0xK=#C+e~8D~7+UC*wS z#EJH-&)hrr&b{Bg=l-2@kN@}SU7ufgZ{HUpK*M5-xU#%W{LGggLA=j<|CJD15og+! z<>h52Zvi9Pqnk(q&x;CvHPJ7!qKt4s{Fy@;n)Zm>R>u6cbxOVb`44}6<-*0tHhlN; z&c??_fLIZ;;%T5yBbF7X*QsT7_8!bgzqnWDHh+5>$(X*9JbdELixOI}Ad27#$f5u) zy5F@54v4-;r})1?WpBC_j*CU0l!Sx+lV^O$8Kf+<0(R4h&vnRk$#$&sxy(-D`JMaW zT?jAxJK)B5A>B*fj`+{PcY=Qb{v~(^nEl||-|dDRQtlTl$Mn63?{VLm)}zfQf$O>c z)lc64TW|e0*3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};Gx%YVg zJ3~i5JXiYHwpVL2k9_=1-}y`T&f$i3Yw0Xcgf%T*H4~bQKM#ZaW3L_D@AqG|b~kzE zXxQ;znP)8|*GLZHxBa-6xkds#|8H~Ob8rFqJ&bFFh=gwaw;T2UQjgt;|91oXzg+*} b-Obl#{rC3&rvEw-oW8yNzuBVgrHP*a=5Ok@ literal 0 HcmV?d00001 diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100755 index 0000000000000000000000000000000000000000..27c7855eddd9407840e5889305e1cc0d63c15701 GIT binary patch literal 90112 zcmeI5U2Gd$UchHEjvYI3Cf&3(B~+c>4;qtBVvoP#URAC-p~qtE^>>J;$lH zj-6{ydT+!fWyajVOYM(E$`W@t%gr71%06`R`ZU#ng!_qxhpq6 zMmaO*7?p@%mCJ7D^Q5hX?QEtbhQEA!&KKf&`m4Mm)!WF~bmw_cSEiiV$crv54+fSs zE<+G=auxF}i+98#w^PjB&lDeV_rynBrc&O{6>zcl#X=ctg?}sg{7t=-onH58OGZ6w zZbL>BA)QbZx5T1Y$ciOy&&VNml$LT_T^?M(MTE^PxZf%}n*;>Lkj-q0wxmrlFPce) zG8(|bZl;*Mn<*{}i9~pyu!F0SW$UQjK7Mc{wOh>=lHCfh_lJ@19<~ybm(gM)HPdLI ze!o?3wMi2PSe;@H8yu1|n`{M09Hn&JSJ1%#q4N?!$(gxN!!qA(NW?#j-48}Lz!1uI z+eZhTVYy%+e6lv{3)Qe+)l|PyHEl?p4(es4#$!|)R$cQlr{J93%bdw0%dz;JGY_`C z;o7U==aqo!aWAT>$2oI3&u8r(=S;@+8y@FOvii&f9;bJxo6bX)WAiw*-th+WYW8Bd zwY5=(z1y@g1P8`zTp03ycPB3&AL1x!L@J{S!}H3m1JqZfgTpFEf=4-bA4gIguZSh` zeqU%UOh02)OEjt_<<-cGaY0iopm%Gfkb6)W+<6R{K_-iN8EJaM@IA)3qN(f%B!kpl z)azqM8;bnTs2N`<9HyVYquQZSm{z>~%x||rd!oex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ig(%l1%ePaIi>>us78M*^)`hJm>n{@D+|pblVve#LQ*CYj6(g^-N?JhK8r6$|$DComUa*&CGZ~?D6#B8e$>hQ3Lng|Dj2C5C- z5qmHe9!=XABwrlmECUJmqFmi&kO%kH;Ju~*o-hatB{C+1I7?HK(`ceX#kF zBYQfQ(Bj;*7&%je%@5f8IMqtWD-OYoeT^T!%@6qe|CujxK!rd62mk>f00e*l5C8%| z00;m9AOHl;oB+)K&m1{a2n2ut5C8%|00;m9AOHk_01yBIK;X;?!1w>1IdZ5F2mk>f z00e*l5C8%|00;m9AOHk_z?l<({r@vZ4iy3cAOHk_01yBIKmZ5;0U!VbfB+CUa{~VZ Dh)#Ty literal 0 HcmV?d00001 diff --git a/README.md b/README.md index f055d15..c945d05 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,7 @@ Vanderwarker Family XMPP Bot. [![Known Vulnerabilities](https://snyk.io/test/npm/vxmppb/badge.svg)](https://snyk.io/test/npm/vxmppb) -![npm](https://img.shields.io/npm/dt/vxmppb) - -[![Build Status](https://build.vanderwarker.dev/buildStatus/icon?job=vxmppb)](https://build.vanderwarker.dev/job/vxmppb/) +![npm](https://img.shields.io/npm/dt/vxmppb) ### :book: How To Install You can install using: diff --git a/config.ini.dist b/config.ini.dist index b274dc7..f1e127e 100644 --- a/config.ini.dist +++ b/config.ini.dist @@ -1,34 +1,36 @@ -api_pass = -api_url = -api_user = -app_port = -asterisk_callfrom = -asterisk_callerID = -asterisk_context = -asterisk_host = -asterisk_password = +api_pass = +api_url = +api_user = +app_port = +asterisk_callfrom = +asterisk_callto = +asterisk_callerID = +asterisk_context = +asterisk_host = +asterisk_password = asterisk_port = -asterisk_user = -bot_hostname = -bot_jid = -bot_password = -city_code = -city_name = -gotify_api_key = -gotify_message = -gotify_priority = -gotify_title = -gotify_url = -mastodon_key = -mastodon_toot = -mastodon_url = -mqtt_message = -mqtt_password = -mqtt_server = -mqtt_topic = -mqtt_user = -rss_url = -user_jid = -user_name = -weather_api_key = -weather_units = +asterisk_user = +bot_hostname = +bot_jid = +bot_password = +city_code = +city_name = +gotify_api_key = +gotify_message = +gotify_priority = +gotify_title = +gotify_url = +mastodon_token = +mastodon_toot = +mastodon_url = +mqtt_message = +mqtt_password = +mqtt_server = +mqtt_topic = +mqtt_user = +rss_url = +user_jid = +user_name = +vfc_url = +weather_api_key = +weather_units = \ No newline at end of file diff --git a/index.js b/index.js old mode 100644 new mode 100755 index 6a1efee..6dd9b55 --- a/index.js +++ b/index.js @@ -17,6 +17,7 @@ const api_url = config.api_url; const api_user = config.api_user; const app_port = config.app_port; const asterisk_callfrom = config.asterisk_callfrom; +const asterisk_callto = config.asterisk_callerto; const asterisk_callerID = config.asterisk_callerID; const asterisk_context = config.asterisk_context; const asterisk_host = config.asterisk_host; @@ -26,6 +27,7 @@ const asterisk_user = config.asterisk_user; const bot_hostname = config.bot_hostname; const bot_jid = config.bot_jid; const bot_password = config.bot_password; +const bot_port = config.bot_port; const city_code = config.city_code; const city_name = config.city_name; const gotify_api_key = config.gotify_api_key; @@ -42,6 +44,7 @@ const mqtt_server = config.mqtt_server; const mqtt_topic = config.mqtt_topic; const mqtt_user = config.mqtt_user; const rpc_url = config.rpc_url; +const rss_url = config.rss_url; const user_jid = config.user_jid; const user_name = config.user_name; const vfc_url = config.vfc_url; @@ -70,7 +73,7 @@ xmpp.on('chat', function(from, message) { // HELP if (message === 'help' || message === 'Help') { - xmpp.send(from, 'https://vanderwarker.family/help/xmpp#chatbot'); + xmpp.send(from, 'https://wiki.vanderwarker.family/doku.php?id=code:vxmppb:commands'); console.log(chalk.blue('help')); } @@ -115,14 +118,14 @@ xmpp.on('chat', function(from, message) { console.log(chalk.blue('unlocks')); } - // Send VFC from coinbase to Pixel2 (Metamask) + // Check VFC balance else if (message === "vfc" || message === "Vfc") { ami.action({ 'action':'originate', 'channel':'SIP/' + asterisk_callfrom, 'context': asterisk_context, 'callerID' : asterisk_callerID, - 'exten' : '832', + 'exten' : asterisk_callto, 'priority' : '1', }); request(vfc_url, (error, res, body) => { @@ -139,7 +142,7 @@ xmpp.on('chat', function(from, message) { console.log(chalk.blue('vfc')); } - // Get latest toots (RSS) + // Get latest RSS item from feed else if (message === "rss" || message === "Rss") { (async () => { let feed = await parser.parseURL(rss_url); @@ -148,10 +151,11 @@ xmpp.on('chat', function(from, message) { console.log(item.title + ':' + item.link) xmpp.send(from, item.title) }); + xmpp.send(from, 'See https://vanderwarker.social/@stephen for full entries.') })(); } - // PING + // Ping a user to let them know you would like to communitcate else if (message === "ping" || message === 'Ping') { xmpp.send(from, "Pinging " + user_name + "! Please stand by."); xmpp.send(user_jid, from + " has pinged you!"); @@ -174,7 +178,7 @@ xmpp.on('chat', function(from, message) { }); } - // WEATHER + // Check the weather using weatherunderground API else if (message === "weather" || message === 'Weather') { xmpp.send(from, "Checking weather. Please hold...\r\n \r\n"); request(weather_url, function (err, response, body) { @@ -219,7 +223,7 @@ xmpp.on('chat', function(from, message) { console.log(chalk.blue('bye')); } - // VCARD (WIP) + // Get users vCard (WIP) else if (message === 'vcard' && from === user_jid){ xmpp.getVCard(from, function (vcard) { xmpp.send(from, vcard); @@ -227,19 +231,17 @@ xmpp.on('chat', function(from, message) { }) } - // AUTO REPLY (ALL OTHER MESSAGES) - else { - xmpp.send(from, "This is an auto replying bot. Reply \"help\" for more info."); + // If the user sends something we don't have logic for, send them info about the project + else { xmpp.send(from, "This is an auto replying bot. Reply \"help\" for more info, or https://wiki.vanderwarker.family/doku.php?id=code:vxmppb:start"); console.log(chalk.blue('autoreply')); } }); -// CATCH XMPP ERRORS +// Catch and log XMPP errors xmpp.on('error', function(err) { console.error(err); }); - // EXTENDING XEPS (WIP) /* xmpp.on('chatstate', function(from, state) { @@ -251,13 +253,13 @@ console.log(chalk.yellow(state + statusText + resource)); }); */ -// CONNECT TO XMPP! +// Alas, we connect to XMPP! xmpp.connect({ jid: bot_jid, password: bot_password, host: bot_hostname, - port: 5222 + port: bot_port }); -// CHECK FOR NEW INCOMING REQUESTS +// Checks the XMPP server for new 'friend' requests console.log(chalk.yellow(xmpp.getRoster()));