@indra.ai/deva.veda 0.0.32 → 0.0.34
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/{LICENSE → LICENSE.md} +1 -1
- package/README.md +74 -4
- package/data/atharvaveda/books/01.json +325 -0
- package/data/atharvaveda/books/02.json +298 -0
- package/data/atharvaveda/books/03.json +289 -0
- package/data/atharvaveda/books/04.json +370 -0
- package/data/atharvaveda/books/05.json +289 -0
- package/data/atharvaveda/books/06.json +1288 -0
- package/data/atharvaveda/books/07.json +1072 -0
- package/data/atharvaveda/books/08.json +100 -0
- package/data/atharvaveda/books/09.json +100 -0
- package/data/atharvaveda/books/10.json +100 -0
- package/data/atharvaveda/books/11.json +100 -0
- package/data/atharvaveda/books/12.json +55 -0
- package/data/atharvaveda/books/13.json +46 -0
- package/data/atharvaveda/books/14.json +28 -0
- package/data/atharvaveda/books/15.json +172 -0
- package/data/atharvaveda/books/16.json +91 -0
- package/data/atharvaveda/books/17.json +19 -0
- package/data/atharvaveda/books/18.json +46 -0
- package/data/atharvaveda/books/19.json +658 -0
- package/data/atharvaveda/books/20.json +1297 -0
- package/data/atharvaveda/index.js +102 -0
- package/data/atharvaveda/index.json +191 -0
- package/data/index.js +0 -4
- package/data/{laws → manu}/index.js +9 -8
- package/data/menu.json +38 -0
- package/data/rigveda/01.json +1038 -878
- package/data/rigveda/02.json +240 -213
- package/data/rigveda/03.json +327 -274
- package/data/rigveda/04.json +319 -277
- package/data/rigveda/05.json +486 -444
- package/data/rigveda/06.json +406 -349
- package/data/rigveda/07.json +582 -527
- package/data/rigveda/08.json +555 -480
- package/data/rigveda/09.json +690 -581
- package/data/rigveda/10.json +1021 -851
- package/data/rigveda/books/01.json +1729 -0
- package/data/rigveda/books/02.json +397 -0
- package/data/rigveda/books/03.json +568 -0
- package/data/rigveda/books/04.json +532 -0
- package/data/rigveda/books/05.json +793 -0
- package/data/rigveda/books/06.json +685 -0
- package/data/rigveda/books/07.json +946 -0
- package/data/rigveda/books/08.json +937 -0
- package/data/rigveda/books/09.json +1036 -0
- package/data/rigveda/books/10.json +1729 -0
- package/data/rigveda/index.js +61 -26
- package/data/rigveda/index.json +47 -35
- package/data/samaveda/books/01.json +130 -0
- package/data/samaveda/books/02.json +130 -0
- package/data/samaveda/books/03.json +118 -0
- package/data/samaveda/books/04.json +130 -0
- package/data/samaveda/books/05.json +130 -0
- package/data/samaveda/books/06.json +118 -0
- package/data/samaveda/books/07.json +538 -0
- package/data/samaveda/books/08.json +466 -0
- package/data/samaveda/books/09.json +550 -0
- package/data/samaveda/books/10.json +466 -0
- package/data/samaveda/books/11.json +526 -0
- package/data/samaveda/books/12.json +598 -0
- package/data/samaveda/books/13.json +598 -0
- package/data/samaveda/books/14.json +610 -0
- package/data/samaveda/books/15.json +478 -0
- package/data/samaveda/index.js +140 -0
- package/data/samaveda/index.json +146 -0
- package/func/index.js +247 -0
- package/help/corpus.feecting +2 -4
- package/help/main.feecting +23 -5
- package/index.js +8 -303
- package/methods/index.js +199 -0
- package/package.json +110 -2
- package/data/agent.json +0 -46
- package/data/html/manu/01.html +0 -149
- package/data/html/manu/02.html +0 -281
- package/data/html/manu/03.html +0 -319
- package/data/html/manu/04.html +0 -291
- package/data/html/manu/05.html +0 -200
- package/data/html/manu/06.html +0 -127
- package/data/html/manu/07.html +0 -257
- package/data/html/manu/08.html +0 -452
- package/data/html/manu/09.html +0 -367
- package/data/html/manu/10.html +0 -162
- package/data/html/manu/11.html +0 -297
- package/data/html/manu/12.html +0 -156
- package/data/rigveda/links.json +0 -19
- package/data/vars.json +0 -90
- /package/data/{laws/manu → manu}/01.json +0 -0
- /package/data/{laws/manu → manu}/02.json +0 -0
- /package/data/{laws/manu → manu}/03.json +0 -0
- /package/data/{laws/manu → manu}/04.json +0 -0
- /package/data/{laws/manu → manu}/05.json +0 -0
- /package/data/{laws/manu → manu}/06.json +0 -0
- /package/data/{laws/manu → manu}/07.json +0 -0
- /package/data/{laws/manu → manu}/08.json +0 -0
- /package/data/{laws/manu → manu}/09.json +0 -0
- /package/data/{laws/manu → manu}/10.json +0 -0
- /package/data/{laws/manu → manu}/11.json +0 -0
- /package/data/{laws/manu → manu}/12.json +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// set the __dirname
|
|
3
|
+
import he from 'he';
|
|
4
|
+
import * as cheerio from 'cheerio';
|
|
5
|
+
import {dirname} from 'node:path';
|
|
6
|
+
import {fileURLToPath} from 'node:url';
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
export const data = {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// function to import the atharvaveda books from the html files.
|
|
14
|
+
export async function avbooks(packet) {
|
|
15
|
+
this.context('import', `avbooks:${packet.id}`);
|
|
16
|
+
this.action('method', `avbooks:${packet.id}`);
|
|
17
|
+
try {
|
|
18
|
+
// const baseurl = "https://sacred-texts.com/hin/av/"
|
|
19
|
+
|
|
20
|
+
const indexpath = this.lib.path.join(__dirname, 'index.json');
|
|
21
|
+
const indexdata = {
|
|
22
|
+
id: this.lib.uid(),
|
|
23
|
+
title: "The Atharvaveda Books",
|
|
24
|
+
describe: " The Atharvaveda is one of the four Vedas, a collection of ancient texts that includes hymns, spells, and incantations for healing and rituals. It focuses on practical aspects of daily life, such as health, longevity, and protection from evil forces.",
|
|
25
|
+
data: [],
|
|
26
|
+
created: Date.now(),
|
|
27
|
+
}
|
|
28
|
+
for (let x = 1; x <= 20; x++) {
|
|
29
|
+
const key = x < 10 ? `0${x}` : `${x}`;
|
|
30
|
+
const htmlpath = this.lib.path.join(__dirname, 'html', key);
|
|
31
|
+
const jsonpath = this.lib.path.join(__dirname, 'json', `${key}.json`);
|
|
32
|
+
const htmlindex = this.lib.path.join(htmlpath, 'index.htm');
|
|
33
|
+
const htmldata = he.decode(this.lib.fs.readFileSync(htmlindex).toString());
|
|
34
|
+
const dataitem = {
|
|
35
|
+
id: this.lib.uid(),
|
|
36
|
+
title: htmldata.split('<H1 ALIGN="CENTER">')[1].split('</H1>')[0],
|
|
37
|
+
book: htmldata.split('<H1 ALIGN="CENTER">')[2].split('</A>')[0],
|
|
38
|
+
author: htmldata.split('<H3 ALIGN="CENTER">tr. by ')[1].split('</H3>')[0],
|
|
39
|
+
created: Date.now(),
|
|
40
|
+
data: htmldata.match(/<A\sHREF=\"av.+.htm\">.+<\/A><BR>/g).map(item => {
|
|
41
|
+
const hymn = {
|
|
42
|
+
id: this.lib.uid(),
|
|
43
|
+
hymn: item.split('.htm">')[1].split(':')[0].trim(),
|
|
44
|
+
title: item.split(': ')[1].split('</A>')[0].trim(),
|
|
45
|
+
file: item.split('<A HREF="')[1].split('">')[0].trim(),
|
|
46
|
+
created: Date.now(),
|
|
47
|
+
}
|
|
48
|
+
hymn.hash = this.lib.hash(hymn);
|
|
49
|
+
return hymn;
|
|
50
|
+
}),
|
|
51
|
+
} // end of data packet.
|
|
52
|
+
const indexitem = {
|
|
53
|
+
id: dataitem.id,
|
|
54
|
+
key,
|
|
55
|
+
title: dataitem.book,
|
|
56
|
+
json: `json/${key}.json`,
|
|
57
|
+
created: Date.now(),
|
|
58
|
+
}
|
|
59
|
+
indexitem.hash = this.lib.hash(indexitem);
|
|
60
|
+
indexdata.data.push(indexitem);
|
|
61
|
+
|
|
62
|
+
// loop over the books and get the files from the site and save them to the directory
|
|
63
|
+
for (let x = 0; x < dataitem.data.length; x++) {
|
|
64
|
+
const item = dataitem.data[x];
|
|
65
|
+
const hymnpath = this.lib.path.join(htmlpath, item.file);
|
|
66
|
+
const book = this.lib.fs.readFileSync(hymnpath).toString();
|
|
67
|
+
const $ = cheerio.load(book);
|
|
68
|
+
const step1 = book.split('<P ALIGN="CENTER"><FONT SIZE="-1" COLOR="GREEN">')[1];
|
|
69
|
+
const step2 = step1.split('<p><HR>')[0];
|
|
70
|
+
const step3 = step2.replace(/<h1 align=\"center\">.+?<\/h1>/gi, '')
|
|
71
|
+
.replace(/\s?<I>Hymns of the Atharva\s?.+<HR><\/p>/gi, '')
|
|
72
|
+
.replace(/\s?<h3 align="center" align="center">.+<\/h3>/gi, '')
|
|
73
|
+
.replace(/\s?<h4 align="center">(.+)<\/h4>/gi, '')
|
|
74
|
+
.replace(/\s?<span class="margnote"><FONT COLOR="GREEN" SIZE="-1"><A NAME=".+?">\d+?<\/A><\/FONT><\/span>/gi, '\n\n')
|
|
75
|
+
.replace(/\s?<a name=".+?"><font size="1" color="green">.+?<\/font><\/A>/gi, '')
|
|
76
|
+
.replace(/ |<br>|<p>|<\/p>/gi, '')
|
|
77
|
+
.trim()
|
|
78
|
+
// .replace(/<span class="margnote"><FONT COLOR="GREEN" SIZE="-1"><A NAME=".+">\d+\.?<\/A><\/FONT><\/span>/gi, '\n\n')
|
|
79
|
+
// .replace(/<p>|<\/p>/gi, '').trim()
|
|
80
|
+
const content = he.decode(step3);
|
|
81
|
+
|
|
82
|
+
dataitem.data[x].content = content;
|
|
83
|
+
dataitem.data[x].created = Date.now();
|
|
84
|
+
dataitem.data[x].hash = this.lib.hash(dataitem.data[x]);
|
|
85
|
+
}
|
|
86
|
+
dataitem.hash = this.lib.hash(dataitem);
|
|
87
|
+
this.prompt(`write ${jsonpath}`);
|
|
88
|
+
this.lib.fs.writeFileSync(jsonpath, JSON.stringify(dataitem, null, 2), {encoding:'utf8',flag:'w'});
|
|
89
|
+
} // end of for x loop of books
|
|
90
|
+
indexdata.hash = this.lib.hash(indexdata);
|
|
91
|
+
this.prompt(`write ${indexpath}`);
|
|
92
|
+
this.lib.fs.writeFileSync(indexpath, JSON.stringify(indexdata, null, 2), {encoding:'utf8',flag:'w'});
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
catch(err) {
|
|
96
|
+
throw err
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
this.state('return', `avbooks:${packet.id}`);
|
|
100
|
+
return 'atharvaveda books';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": 6214075822720,
|
|
3
|
+
"title": "The Atharvaveda Books",
|
|
4
|
+
"describe": "This is the Ralph T.H. Griffith translation of the Atharvaveda. The Atharvaveda is a Vedic-era collection of spells, prayers, charms, and hymns. There are prayers to protect crops from lightning and drought, charms against venomous serpents, love spells, healing spells, hundreds of verses.",
|
|
5
|
+
"orig": "https://www.sacred-texts.com/hin/av/index.htm",
|
|
6
|
+
"api": "data/atharvaveda/index.json",
|
|
7
|
+
"data": [
|
|
8
|
+
{
|
|
9
|
+
"id": 4874275083388,
|
|
10
|
+
"key": "01",
|
|
11
|
+
"title": "Book I",
|
|
12
|
+
"api": "data/atharvaveda/books/01.json",
|
|
13
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook01.htm",
|
|
14
|
+
"created": 1747590782230,
|
|
15
|
+
"hash": "md5-MjbYvrnPz4MqlRb56czLOQ=="
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": 7220005585976,
|
|
19
|
+
"key": "02",
|
|
20
|
+
"title": "Book II",
|
|
21
|
+
"api": "data/atharvaveda/books/02.json",
|
|
22
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook02.htm",
|
|
23
|
+
"created": 1747590782230,
|
|
24
|
+
"hash": "md5-MN/G7JKw4wNQs8ZvQ0c4BA=="
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": 4124268649265,
|
|
28
|
+
"key": "03",
|
|
29
|
+
"title": "Book III",
|
|
30
|
+
"api": "data/atharvaveda/books/03.json",
|
|
31
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook03.htm",
|
|
32
|
+
"created": 1747590782230,
|
|
33
|
+
"hash": "md5-aZyjsM7H4MFPgP0pCt1/uQ=="
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": 6533355290307,
|
|
37
|
+
"key": "04",
|
|
38
|
+
"title": "Book IV",
|
|
39
|
+
"api": "data/atharvaveda/books/04.json",
|
|
40
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook04.htm",
|
|
41
|
+
"created": 1747590782230,
|
|
42
|
+
"hash": "md5-M5owcAYhlPa27OqjCU9dGA=="
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": 6020169975514,
|
|
46
|
+
"key": "05",
|
|
47
|
+
"title": "Book V",
|
|
48
|
+
"api": "data/atharvaveda/books/05.json",
|
|
49
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook05.htm",
|
|
50
|
+
"created": 1747590782230,
|
|
51
|
+
"hash": "md5-gPilHs08VZSIrhXiGN3mAQ=="
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": 4740700787855,
|
|
55
|
+
"key": "06",
|
|
56
|
+
"title": "Book VI",
|
|
57
|
+
"api": "data/atharvaveda/books/06.json",
|
|
58
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook06.htm",
|
|
59
|
+
"created": 1747590782230,
|
|
60
|
+
"hash": "md5-kk5c9szffa/hJQa45AZWDA=="
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": 5263760451276,
|
|
64
|
+
"key": "07",
|
|
65
|
+
"title": "Book VII",
|
|
66
|
+
"api": "data/atharvaveda/books/07.json",
|
|
67
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook07.htm",
|
|
68
|
+
"created": 1747590782230,
|
|
69
|
+
"hash": "md5-JGH7VQxrxZUTSXHxkAfpHw=="
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": 6987750407326,
|
|
73
|
+
"key": "08",
|
|
74
|
+
"title": "Book VIII",
|
|
75
|
+
"api": "data/atharvaveda/books/08.json",
|
|
76
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook08.htm",
|
|
77
|
+
"created": 1747590782230,
|
|
78
|
+
"hash": "md5-4OZ3AqnfYe9Y6l5LGRCC+g=="
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": 3860721072937,
|
|
82
|
+
"key": "09",
|
|
83
|
+
"title": "Book IX",
|
|
84
|
+
"api": "data/atharvaveda/books/09.json",
|
|
85
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook09.htm",
|
|
86
|
+
"created": 1747590782230,
|
|
87
|
+
"hash": "md5-NKWyP44B9ZD3tsaoaVSILg=="
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": 6705804137407,
|
|
91
|
+
"key": "10",
|
|
92
|
+
"title": "Book X",
|
|
93
|
+
"api": "data/atharvaveda/books/10.json",
|
|
94
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook10.htm",
|
|
95
|
+
"created": 1747590782230,
|
|
96
|
+
"hash": "md5-HnLTX3nR1WdAo62GSLiDBg=="
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": 4785944054357,
|
|
100
|
+
"key": "11",
|
|
101
|
+
"title": "Book XI",
|
|
102
|
+
"api": "data/atharvaveda/books/11.json",
|
|
103
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook11.htm",
|
|
104
|
+
"created": 1747590782230,
|
|
105
|
+
"hash": "md5-yfctCbYKGmXZVkeDwgMi9A=="
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": 7172437466087,
|
|
109
|
+
"key": "12",
|
|
110
|
+
"title": "Book XII",
|
|
111
|
+
"api": "data/atharvaveda/books/12.json",
|
|
112
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook12.htm",
|
|
113
|
+
"created": 1747590782230,
|
|
114
|
+
"hash": "md5-62J4gQ96xpR0kWi8sW4ZZQ=="
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": 2716000496093,
|
|
118
|
+
"key": "13",
|
|
119
|
+
"title": "Book XIII",
|
|
120
|
+
"api": "data/atharvaveda/books/13.json",
|
|
121
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook13.htm",
|
|
122
|
+
"created": 1747590782230,
|
|
123
|
+
"hash": "md5-u/oIXDc4ETw/TSoR9lNKYg=="
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": 1644824796841,
|
|
127
|
+
"key": "14",
|
|
128
|
+
"title": "Book XIV",
|
|
129
|
+
"api": "data/atharvaveda/books/14.json",
|
|
130
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook14.htm",
|
|
131
|
+
"created": 1747590782230,
|
|
132
|
+
"hash": "md5-MzlM5pUFn+N62ShR8giIgg=="
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"id": 1268843203063,
|
|
136
|
+
"key": "15",
|
|
137
|
+
"title": "Book XV",
|
|
138
|
+
"api": "data/atharvaveda/books/15.json",
|
|
139
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook15.htm",
|
|
140
|
+
"created": 1747590782230,
|
|
141
|
+
"hash": "md5-JrZYx7VB95W3LfVwSLvu5Q=="
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": 3354033896873,
|
|
145
|
+
"key": "16",
|
|
146
|
+
"title": "Book XVI",
|
|
147
|
+
"api": "data/atharvaveda/books/16.json",
|
|
148
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook16.htm",
|
|
149
|
+
"created": 1747590782230,
|
|
150
|
+
"hash": "md5-zrFp21oK8zj07DuR356nSg=="
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": 2869737371825,
|
|
154
|
+
"key": "17",
|
|
155
|
+
"title": "Book XVII",
|
|
156
|
+
"api": "data/atharvaveda/books/17.json",
|
|
157
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook17.htm",
|
|
158
|
+
"created": 1747590782230,
|
|
159
|
+
"hash": "md5-asqoKo+sxZKappgSNL/DZA=="
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": 2307581123412,
|
|
163
|
+
"key": "18",
|
|
164
|
+
"title": "Book XVIII",
|
|
165
|
+
"api": "data/atharvaveda/books/18.json",
|
|
166
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook18.htm",
|
|
167
|
+
"created": 1747590782230,
|
|
168
|
+
"hash": "md5-oWu6hxw02bHMchTYgZEdWw=="
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"id": 1514762318663,
|
|
172
|
+
"key": "19",
|
|
173
|
+
"title": "Book XIX",
|
|
174
|
+
"api": "data/atharvaveda/books/19.json",
|
|
175
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook19.htm",
|
|
176
|
+
"created": 1747590782230,
|
|
177
|
+
"hash": "md5-khoa8px8hQAPEobla/WqUw=="
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"id": 5727818945495,
|
|
181
|
+
"key": "20",
|
|
182
|
+
"title": "Book XX",
|
|
183
|
+
"api": "data/atharvaveda/books/20.json",
|
|
184
|
+
"orig": "https://www.sacred-texts.com/hin/av/avbook20.htm",
|
|
185
|
+
"created": 1747590782230,
|
|
186
|
+
"hash": "md5-ZkSBOc+yVBMIo7x2pErInA=="
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"created": 1747590782230,
|
|
190
|
+
"hash": "md5-T2jvNrbtNjhPfGE5NWadcQ=="
|
|
191
|
+
}
|
package/data/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// set the __dirname
|
|
2
3
|
import {dirname} from 'node:path';
|
|
3
4
|
import {fileURLToPath} from 'node:url';
|
|
4
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
6
|
|
|
6
|
-
"use strict";
|
|
7
7
|
// (c)2025 Quinn Michaels; All rights reserved.
|
|
8
8
|
export function manu(packet) {
|
|
9
9
|
this.context('manu', packet.id);
|
|
@@ -16,12 +16,10 @@ export function manu(packet) {
|
|
|
16
16
|
data.manu = personal.manu;
|
|
17
17
|
data.files = [];
|
|
18
18
|
for (let x = 0; x < data.manu.length; x++) {
|
|
19
|
-
const file = data.manu[x];
|
|
20
|
-
|
|
19
|
+
const file = data.manu[x];
|
|
21
20
|
const filePath = this.lib.path.join(__dirname, file);
|
|
22
21
|
const html = this.lib.fs.readFileSync(filePath);
|
|
23
22
|
const title = html.toString().split('<CENTER><H1>')[1].split('</H1></CENTER>')[0];
|
|
24
|
-
|
|
25
23
|
const formatHTML = html.toString().split('</H1></CENTER>')[1].split('</BODY>')[0];
|
|
26
24
|
const htmlData = formatHTML.replace(/\<\/P\>\n?\s?/gi, '').replace(/\'\d+\.\s?/g, '').split(/\<P\>\d+\.\s?/);
|
|
27
25
|
const laws = htmlData.map(item => {
|
|
@@ -47,10 +45,11 @@ export function manu(packet) {
|
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
catch(e) {
|
|
48
|
+
this.state('catch', `manu:${packet.id}`);
|
|
50
49
|
return this.error(e, packet, reject);
|
|
51
50
|
}
|
|
52
51
|
finally {
|
|
53
|
-
|
|
52
|
+
this.state('retrun', `manu:${packet.id}`);
|
|
54
53
|
return resolve({
|
|
55
54
|
text: this.vars.messages.manu,
|
|
56
55
|
html: this.vars.messages.manu,
|
|
@@ -82,11 +81,11 @@ export async function manuhash(packet) {
|
|
|
82
81
|
law: item.law,
|
|
83
82
|
created: this.lib.formatDate(Date.now(), 'long', true),
|
|
84
83
|
};
|
|
85
|
-
newitem.hash = this.lib.hash(
|
|
84
|
+
newitem.hash = this.lib.hash(newitem);
|
|
86
85
|
newdata.data.push(newitem);
|
|
87
86
|
}
|
|
88
87
|
newdata.hash = this.lib.hash(newdata);
|
|
89
|
-
this.prompt(`filepath: ${filepath}`)
|
|
88
|
+
this.prompt(`filepath: ${filepath}`);
|
|
90
89
|
this.lib.fs.writeFileSync(filepath, JSON.stringify(newdata, null, 2), {encoding:'utf8',flag:'w'});
|
|
91
90
|
return Promise.resolve({
|
|
92
91
|
text: 'rehash data',
|
|
@@ -99,8 +98,8 @@ export async function manuhash(packet) {
|
|
|
99
98
|
export function laws(packet) {
|
|
100
99
|
this.action('func', `laws:${packet.id}`);
|
|
101
100
|
return new Promise((resolve, reject) => {
|
|
101
|
+
if (!packet.q.text) return resolve(this._messages.notext);
|
|
102
102
|
try {
|
|
103
|
-
// #veda laws:manu 01
|
|
104
103
|
const {params} = packet.q.meta;
|
|
105
104
|
const lookup = params[1] || 'manu';
|
|
106
105
|
|
|
@@ -129,12 +128,14 @@ export function laws(packet) {
|
|
|
129
128
|
`::end:hidden`,
|
|
130
129
|
`::END:LAWS:${filejson.hash}`,
|
|
131
130
|
].join('\n');
|
|
131
|
+
this.state('return', `laws:${packet.id}`);
|
|
132
132
|
return resolve({
|
|
133
133
|
text,
|
|
134
134
|
data: filejson
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
catch(e) {
|
|
138
|
+
this.state('catch', `laws:${packet.id}`);
|
|
138
139
|
return this.error(e, packet, reject);
|
|
139
140
|
}
|
|
140
141
|
});
|
package/data/menu.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": 5439950010622,
|
|
3
|
+
"key": "menu",
|
|
4
|
+
"title": "Veda Menu",
|
|
5
|
+
"describe": "The Veda Knowledge Menu",
|
|
6
|
+
"data": [
|
|
7
|
+
{
|
|
8
|
+
"id": 1283031073193,
|
|
9
|
+
"title": "🛟 Help",
|
|
10
|
+
"cmd": "#veda help"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": 1783384154168,
|
|
14
|
+
"title": "🪷 Rig Veda",
|
|
15
|
+
"cmd": "#veda books:rigveda"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": 5927006658592,
|
|
19
|
+
"title": "🌈 Sama Veda",
|
|
20
|
+
"cmd": "#veda books:samaveda"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": 1783384154168,
|
|
24
|
+
"title": "🧘 Atharva Veda",
|
|
25
|
+
"cmd": "#veda books:atharvaveda"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": 2858650626992,
|
|
29
|
+
"title": "✨ Yajur Veda",
|
|
30
|
+
"cmd": "#veda books:yajurveda"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": 1783384154168,
|
|
34
|
+
"title": "👨⚖️ Laws of Manu",
|
|
35
|
+
"cmd": "#veda books:manu"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|