@indra.ai/deva.veda 0.0.31 → 0.0.32
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/data/laws/index.js +46 -1
- package/data/laws/manu/01.json +1 -1
- package/data/vars.json +2 -1
- package/index.js +23 -2
- package/package.json +1 -1
package/data/laws/index.js
CHANGED
|
@@ -93,4 +93,49 @@ export async function manuhash(packet) {
|
|
|
93
93
|
html: 'rehash data',
|
|
94
94
|
data: false,
|
|
95
95
|
});
|
|
96
|
-
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// laws func to get json data
|
|
99
|
+
export function laws(packet) {
|
|
100
|
+
this.action('func', `laws:${packet.id}`);
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
try {
|
|
103
|
+
// #veda laws:manu 01
|
|
104
|
+
const {params} = packet.q.meta;
|
|
105
|
+
const lookup = params[1] || 'manu';
|
|
106
|
+
|
|
107
|
+
const filepath = this.lib.path.join(__dirname, lookup, `${packet.q.text}.json`);
|
|
108
|
+
const filedata = this.lib.fs.readFileSync(filepath);
|
|
109
|
+
const filejson = JSON.parse(filedata);
|
|
110
|
+
const _laws = filejson.data.map(item => {
|
|
111
|
+
return [
|
|
112
|
+
`::begin:law:${item.id}`,
|
|
113
|
+
`id: ${item.id}`,
|
|
114
|
+
`law: ${item.law}`,
|
|
115
|
+
`dbid: ${item.dbid}`,
|
|
116
|
+
`hash: ${item.hash}`,
|
|
117
|
+
`created: ${item.created}`,
|
|
118
|
+
`::end:law:${item.hash}`,
|
|
119
|
+
].join('\n');
|
|
120
|
+
}).join('\n');
|
|
121
|
+
const text = [
|
|
122
|
+
`::BEGIN:LAWS:${filejson.id}`,
|
|
123
|
+
`# ${filejson.title}`,
|
|
124
|
+
_laws,
|
|
125
|
+
`::begin:hidden`,
|
|
126
|
+
`#color = {{profile.color}}`,
|
|
127
|
+
`#bgcolor = {{profile.bgcolor}}`,
|
|
128
|
+
`#bg = {{profile.background}}`,
|
|
129
|
+
`::end:hidden`,
|
|
130
|
+
`::END:LAWS:${filejson.hash}`,
|
|
131
|
+
].join('\n');
|
|
132
|
+
return resolve({
|
|
133
|
+
text,
|
|
134
|
+
data: filejson
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
catch(e) {
|
|
138
|
+
return this.error(e, packet, reject);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
package/data/laws/manu/01.json
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
{
|
|
106
106
|
"id": 2996327316919,
|
|
107
107
|
"dbid": "67f589ae4da742404f3f12ab",
|
|
108
|
-
"law": "They created seven other Manus possessing great brilliancy, gods and classes of gods and great sages of measureless power, Yakshas the servants of Kubera, the demons called Rakshasas and Pisakas, Gandharvas or musicians of the gods, Apsarases the dancers of the gods, Asuras, the snake-deities called Nagas and Sarpas, the bird-deities called Suparnas and the several classes of the manes, Lightnings, thunderbolts and clouds, imperfect (rohita) and perfect rainbows, falling meteors, supernatural noises, comets, and heavenly lights of many kinds
|
|
108
|
+
"law": "They created seven other Manus possessing great brilliancy, gods and classes of gods and great sages of measureless power, Yakshas the servants of Kubera, the demons called Rakshasas and Pisakas, Gandharvas or musicians of the gods, Apsarases the dancers of the gods, Asuras, the snake-deities called Nagas and Sarpas, the bird-deities called Suparnas and the several classes of the manes, Lightnings, thunderbolts and clouds, imperfect (rohita) and perfect rainbows, falling meteors, supernatural noises, comets, and heavenly lights of many kinds, 39 (Horse-faced) Kinnaras, monkeys, fishes, birds of many kinds, cattle, deer, men, and carnivorous beasts with two rows of teeth, small and large worms and beetles, moths, lice, flies, bugs, all stinging and biting insects and the several kinds of immovable things.",
|
|
109
109
|
"created": "Saturday, April 12, 2025 - 2:30:09 PM",
|
|
110
110
|
"hash": "md5-qcx4fytxpUilCgSF9rSmfg=="
|
|
111
111
|
},
|
package/data/vars.json
CHANGED
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import utils from './utils.js';
|
|
|
7
7
|
import data from './data/index.js';
|
|
8
8
|
const {agent,vars,rigveda} = data;
|
|
9
9
|
|
|
10
|
-
import {manu, manuhash} from './data/laws/index.js';
|
|
10
|
+
import {manu, manuhash, laws} from './data/laws/index.js';
|
|
11
11
|
import {bookimport} from './data/rigveda/index.js';
|
|
12
12
|
|
|
13
13
|
// set the __dirname
|
|
@@ -207,7 +207,7 @@ const VEDA = new Deva({
|
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
209
|
},
|
|
210
|
-
|
|
210
|
+
laws,
|
|
211
211
|
},
|
|
212
212
|
methods: {
|
|
213
213
|
/**************
|
|
@@ -310,6 +310,27 @@ const VEDA = new Deva({
|
|
|
310
310
|
// Manu function for important laws
|
|
311
311
|
manu,
|
|
312
312
|
manuhash,
|
|
313
|
+
laws(packet) {
|
|
314
|
+
this.context('laws', packet.id);
|
|
315
|
+
this.action('method', `laws:${packet.id}`);
|
|
316
|
+
const data = {};
|
|
317
|
+
return new Promise((resolve, reject) => {
|
|
318
|
+
this.func.laws(packet).then(laws => {
|
|
319
|
+
data.laws = laws.data;
|
|
320
|
+
return this.question(`${this.askChr}feecting parse ${laws.text}`);
|
|
321
|
+
}).then(parsed => {
|
|
322
|
+
data.feecting = parsed.a.data;
|
|
323
|
+
this.state('return', `laws:${packet.id}`);
|
|
324
|
+
return resolve({
|
|
325
|
+
text: parsed.a.text,
|
|
326
|
+
html: parsed.a.html,
|
|
327
|
+
data,
|
|
328
|
+
});
|
|
329
|
+
}).catch(err => {
|
|
330
|
+
return this.error(err, packet. reject);
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
}
|
|
313
334
|
},
|
|
314
335
|
onReady(data, resolve) {
|
|
315
336
|
this.prompt(this.vars.messages.ready);
|