wiki-plugin-mech 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/mech.js +18 -1
- package/package.json +1 -1
package/client/mech.js
CHANGED
|
@@ -584,6 +584,22 @@
|
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
+
function roster_emit({elem,command,state}) {
|
|
588
|
+
if(!state.neighborhood) return trouble(elem,`ROSTER expected a neighborhood, like from NEIGHBORS.`)
|
|
589
|
+
inspect(elem,'neighborhood',state)
|
|
590
|
+
const infos = state.neighborhood
|
|
591
|
+
const sites = infos
|
|
592
|
+
.map(info => info.domain)
|
|
593
|
+
.filter(uniq)
|
|
594
|
+
const any = array => array[Math.floor(Math.random()*array.length)]
|
|
595
|
+
console.log(infos)
|
|
596
|
+
const items = [
|
|
597
|
+
{type:'roster', text:"Mech\n"+sites.join("\n")},
|
|
598
|
+
{type:'activity', text:`ROSTER Mech\nSINCE 30 days`}]
|
|
599
|
+
elem.innerHTML = command + ` ⇒ ${sites.length} sites`
|
|
600
|
+
state.items = items
|
|
601
|
+
}
|
|
602
|
+
|
|
587
603
|
|
|
588
604
|
// C A T A L O G
|
|
589
605
|
|
|
@@ -608,7 +624,8 @@
|
|
|
608
624
|
SLEEP: {emit:sleep_emit},
|
|
609
625
|
TOGETHER:{emit:together_emit},
|
|
610
626
|
GET: {emit:get_emit},
|
|
611
|
-
DELTA: {emit:delta_emit}
|
|
627
|
+
DELTA: {emit:delta_emit},
|
|
628
|
+
ROSTER: {emit:roster_emit}
|
|
612
629
|
}
|
|
613
630
|
|
|
614
631
|
|