queenamdi-functions-beta 0.0.29 → 0.1.2

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/lib/settingsDB.js CHANGED
@@ -21,178 +21,100 @@
21
21
  Licensed under the GPL-3.0 License;
22
22
  you may not use this file except in compliance with the License.*/
23
23
 
24
- /**@settingtype CHAT_UPDATES, PREFIX, READ_CMD, REMOVE_BG_API, ALIVEPIC, ALIVETXT*/
24
+ /**@settingtype CHAT_UPDATES, READ_CMD, REMOVE_BG_API, ALIVEPIC, ALIVETXT*/
25
25
 
26
- (function (_0x1867aa, _0x21b032) {
27
- function _0x25aa9f(_0xc5795a, _0x2ddf5e) {
28
- return _0x5cd0(_0xc5795a - 0x27e, _0x2ddf5e);
29
- }
30
- const _0x164c44 = _0x1867aa();
31
- function _0x4aab41(_0x133155, _0x4f7fa0) {
32
- return _0x5cd0(_0x4f7fa0 - -0x158, _0x133155);
33
- }
34
- while (!![]) {
35
- try {
36
- const _0xcce124 = -parseInt(_0x4aab41(-0x9d, -0x96)) / 0x1 * (parseInt(_0x25aa9f(0x32c, 0x336)) / 0x2) + parseInt(_0x4aab41(-0x7e, -0x90)) / 0x3 * (parseInt(_0x4aab41(-0x91, -0x99)) / 0x4) + -parseInt(_0x4aab41(-0xb0, -0xa5)) / 0x5 + -parseInt(_0x25aa9f(0x334, 0x33e)) / 0x6 + parseInt(_0x4aab41(-0xc0, -0xa8)) / 0x7 * (parseInt(_0x4aab41(-0xb5, -0xb6)) / 0x8) + -parseInt(_0x4aab41(-0xaa, -0xbf)) / 0x9 * (-parseInt(_0x4aab41(-0xc3, -0xad)) / 0xa) + parseInt(_0x4aab41(-0x96, -0x9f)) / 0xb;
37
- if (_0xcce124 === _0x21b032)
38
- break;
39
- else
40
- _0x164c44['push'](_0x164c44['shift']());
41
- } catch (_0x46d023) {
42
- _0x164c44['push'](_0x164c44['shift']());
43
- }
44
- }
45
- }(_0x51ac, 0xee813), require('\x64\x6f\x74\x65\x6e\x76')[_0x4adb12(0x3a4, 0x3af)]());
46
- const {Pool} = require('\x70\x67'), _0x11c5fe = {};
47
- _0x11c5fe[_0x571c39(0x2aa, 0x29c) + _0x4adb12(0x3be, 0x3be)] = ![];
48
- const _0x483d02 = {};
49
- _0x483d02[_0x571c39(0x29e, 0x29b) + _0x4adb12(0x38c, 0x38e)] = process[_0x4adb12(0x387, 0x39e)][_0x571c39(0x2ba, 0x2ae) + '\x52\x4c'], _0x483d02[_0x4adb12(0x3b1, 0x3b0)] = _0x11c5fe;
50
- function _0x5cd0(_0xae741d, _0x313a51) {
51
- const _0x51ac70 = _0x51ac();
52
- return _0x5cd0 = function (_0x5cd08f, _0x350939) {
53
- _0x5cd08f = _0x5cd08f - 0x95;
54
- let _0x2779c0 = _0x51ac70[_0x5cd08f];
55
- return _0x2779c0;
56
- }, _0x5cd0(_0xae741d, _0x313a51);
57
- }
58
- function _0x571c39(_0x4c5101, _0x49d531) {
59
- return _0x5cd0(_0x49d531 - 0x1ea, _0x4c5101);
60
- }
61
- const proConfig = _0x483d02, pool = new Pool(proConfig), createSettingsTable = async () => {
62
- function _0x146b90(_0x216337, _0x19990a) {
63
- return _0x4adb12(_0x19990a, _0x216337 - -0xda);
64
- }
65
- function _0x238549(_0x286e0f, _0x55271f) {
66
- return _0x571c39(_0x286e0f, _0x55271f - -0x3c8);
67
- }
68
- await pool[_0x146b90(0x2c1, 0x2cc)]('\x43\x52\x45\x41\x54\x45\x20\x54\x41\x42' + '\x4c\x45\x20\x49\x46\x20\x4e\x4f\x54\x20' + _0x146b90(0x2e7, 0x2e3) + _0x146b90(0x2e6, 0x2da) + _0x238549(-0x13d, -0x136) + _0x146b90(0x2ce, 0x2d2) + _0x146b90(0x2e5, 0x2dd) + '\x29\x3b');
69
- };
70
- module[_0x4adb12(0x3b6, 0x3bb)][_0x4adb12(0x383, 0x38b) + _0x571c39(0x2a3, 0x299)] = async (_0x582b9a, _0x41a84f) => {
71
- function _0x3af1f9(_0x473e93, _0x19e624) {
72
- return _0x571c39(_0x473e93, _0x19e624 - -0x397);
73
- }
26
+ require('dotenv').config()
27
+ const { Pool } = require("pg");
28
+
29
+ const proConfig = {
30
+ connectionString: process.env.DATABASE_URL,
31
+ ssl: {
32
+ rejectUnauthorized: false,
33
+ },
34
+ };
35
+
36
+ const pool = new Pool(proConfig);
37
+
38
+ const createSettingsTable = async () => {
39
+ await pool.query(
40
+ "CREATE TABLE IF NOT EXISTS settingsTable(settingtype text , input text);"
41
+ );
42
+ };
43
+
44
+ // Settings DB
45
+ module.exports.inputSettings = async (settingtype, input) => {
74
46
  await createSettingsTable();
75
- let _0x31b266 = await pool['\x71\x75\x65\x72\x79']('\x73\x65\x6c\x65\x63\x74\x20\x2a\x20\x66' + _0x4ad615(-0x128, -0x123) + _0x3af1f9(-0x10a, -0x115) + '\x45\x52\x45\x20\x73\x65\x74\x74\x69\x6e' + _0x3af1f9(-0x110, -0x111), [_0x582b9a]);
76
- function _0x4ad615(_0x40dc35, _0x2a6ffa) {
77
- return _0x4adb12(_0x2a6ffa, _0x40dc35 - -0x4df);
47
+
48
+ let result = await pool.query(
49
+ "select * from settingsTable WHERE settingtype=$1;",
50
+ [settingtype]
51
+ );
52
+
53
+ if (result.rows.length) {
54
+ let count = result.rows[0].count;
55
+ await pool.query(
56
+ "UPDATE settingsTable SET input = $1 WHERE settingtype=$2;",
57
+ [input, settingtype]
58
+ );
59
+ await pool.query("commit;");
60
+ return count;
61
+ } else {
62
+ await pool.query("INSERT INTO settingsTable VALUES($1,$2);", [
63
+ settingtype,
64
+ input,
65
+ ]);
66
+ await pool.query("commit;");
67
+ return 1;
78
68
  }
79
- if (_0x31b266[_0x4ad615(-0x148, -0x138)][_0x4ad615(-0x14e, -0x15c)]) {
80
- let _0x53e2b7 = _0x31b266['\x72\x6f\x77\x73'][0x0][_0x4ad615(-0x150, -0x133)];
81
- return await pool[_0x3af1f9(-0x11b, -0x106)](_0x3af1f9(-0xe6, -0x101) + _0x4ad615(-0x11f, -0x118) + '\x20\x53\x45\x54\x20\x69\x6e\x70\x75\x74' + _0x4ad615(-0x11c, -0x106) + _0x4ad615(-0x131, -0x135) + _0x3af1f9(-0xdf, -0xdf), [
82
- _0x41a84f,
83
- _0x582b9a
84
- ]), await pool['\x71\x75\x65\x72\x79'](_0x3af1f9(-0xf6, -0xe7)), _0x53e2b7;
85
- } else
86
- return await pool[_0x4ad615(-0x144, -0x158)](_0x3af1f9(-0x105, -0x100) + '\x4f\x20\x73\x65\x74\x74\x69\x6e\x67\x73' + _0x3af1f9(-0xef, -0x104) + _0x4ad615(-0x14d, -0x15f), [
87
- _0x582b9a,
88
- _0x41a84f
89
- ]), await pool[_0x4ad615(-0x144, -0x148)]('\x63\x6f\x6d\x6d\x69\x74\x3b'), 0x1;
90
- }, module[_0x4adb12(0x3cd, 0x3bb)][_0x4adb12(0x3c0, 0x3a9) + '\x73'] = async _0x2d461d => {
69
+ };
70
+
71
+ module.exports.getSettings = async (settingtype) => {
91
72
  await createSettingsTable();
92
- function _0x282f21(_0x11a96e, _0x9e64b1) {
93
- return _0x4adb12(_0x11a96e, _0x9e64b1 - -0x224);
73
+ let result = await pool.query(
74
+ "SELECT input FROM settingsTable WHERE settingtype=$1;",
75
+ [settingtype]
76
+ );
77
+ if (result.rowCount) {
78
+ return result.rows[0];
79
+ } else {
80
+ return -1;
94
81
  }
95
- let _0x4b4a10 = await pool['\x71\x75\x65\x72\x79'](_0x5c1540(0x2ef, 0x30c) + _0x5c1540(0x2ee, 0x2e2) + _0x5c1540(0x317, 0x308) + _0x282f21(0x1a4, 0x188) + _0x5c1540(0x31a, 0x321) + '\x24\x31\x3b', [_0x2d461d]);
96
- function _0x5c1540(_0x4561a3, _0x1272ef) {
97
- return _0x571c39(_0x1272ef, _0x4561a3 - 0x6f);
98
- }
99
- return _0x4b4a10[_0x5c1540(0x322, 0x30d)] ? _0x4b4a10['\x72\x6f\x77\x73'][0x0] : -0x1;
100
82
  };
101
- function _0x4adb12(_0xe6b1c4, _0x614806) {
102
- return _0x5cd0(_0x614806 - 0x2f4, _0xe6b1c4);
103
- }
104
- function _0x51ac() {
105
- const _0x4c2a7b = [
106
- '\x32\x34\x33\x5a\x4e\x77\x51\x43\x47',
107
- '\x53\x74\x72\x69\x6e\x67',
108
- '\x63\x6f\x75\x6e\x74',
109
- '\x67\x74\x79\x70\x65\x3d\x24\x31\x3b',
110
- '\x6c\x65\x6e\x67\x74\x68',
111
- '\x45\x53\x28\x24\x31\x2c\x24\x32\x29\x3b',
112
- '\x62\x6c\x65\x3b',
113
- '\x73\x65\x74\x74\x69\x6e\x67\x73\x54\x61',
114
- '\x4f\x20\x73\x65\x74\x74\x69\x6e\x67\x73',
115
- '\x38\x31\x34\x33\x30\x39\x36\x69\x6c\x4c\x4a\x54\x66',
116
- '\x72\x6f\x77\x73',
117
- '\x69\x6e\x67\x73',
118
- '\x65\x74\x74\x69\x6e\x67\x74\x79\x70\x65',
119
- '\x72\x65\x6d\x6f\x76\x65\x53\x65\x74\x74',
120
- '\x71\x75\x65\x72\x79',
121
- '\x28\x73\x65\x74\x74\x69\x6e\x67\x74\x79',
122
- '\x54\x61\x62\x6c\x65\x20\x56\x41\x4c\x55',
123
- '\x65\x6e\x76',
124
- '\x33\x30\x32\x31\x31\x30\x76\x6e\x67\x53\x7a\x43',
125
- '\x55\x50\x44\x41\x54\x45\x20\x73\x65\x74',
126
- '\x49\x4e\x53\x45\x52\x54\x20\x49\x4e\x54',
127
- '\x31\x36\x35\x38\x36\x36\x32\x4d\x68\x54\x64\x66\x5a',
128
- '\x6e\x67\x73',
129
- '\x37\x57\x4e\x70\x76\x68\x48',
130
- '\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e',
131
- '\x72\x65\x6a\x65\x63\x74\x55\x6e\x61\x75',
132
- '\x37\x39\x31\x39\x38\x34\x30\x59\x47\x71\x54\x61\x5a',
133
- '\x70\x65\x20\x74\x65\x78\x74\x20\x2c\x20',
134
- '\x67\x65\x74\x53\x65\x74\x74\x69\x6e\x67',
135
- '\x38\x36\x32\x37\x33\x34\x5a\x4e\x51\x58\x78\x75',
136
- '\x45\x52\x45\x20\x73\x65\x74\x74\x69\x6e',
137
- '\x65\x20\x57\x48\x45\x52\x45\x20\x73\x65',
138
- '\x31\x32\x30\x36\x30\x35\x31\x30\x79\x63\x75\x74\x63\x78',
139
- '\x45\x20\x73\x65\x74\x74\x69\x6e\x67\x74',
140
- '\x63\x6f\x6e\x66\x69\x67',
141
- '\x73\x73\x6c',
142
- '\x20\x3d\x20\x27\x64\x65\x66\x61\x75\x6c',
143
- '\x74\x74\x69\x6e\x67\x73\x54\x61\x62\x6c',
144
- '\x33\x34\x35\x31\x34\x38\x59\x77\x6f\x41\x65\x4b',
145
- '\x20\x53\x45\x54\x20\x69\x6e\x70\x75\x74',
146
- '\x74\x74\x69\x6e\x67\x74\x79\x70\x65\x3d',
147
- '\x31\x5a\x53\x54\x47\x64\x76',
148
- '\x72\x6f\x6d\x20\x73\x65\x74\x74\x69\x6e',
149
- '\x44\x41\x54\x41\x42\x41\x53\x45\x5f\x55',
150
- '\x74\x27\x20\x57\x48\x45\x52\x45\x20\x73',
151
- '\x63\x6f\x6d\x6d\x69\x74\x3b',
152
- '\x65\x78\x70\x6f\x72\x74\x73',
153
- '\x32\x31\x73\x52\x51\x76\x57\x70',
154
- '\x72\x6f\x77\x43\x6f\x75\x6e\x74',
155
- '\x74\x68\x6f\x72\x69\x7a\x65\x64',
156
- '\x69\x6e\x70\x75\x74\x20\x74\x65\x78\x74',
157
- '\x74\x69\x6e\x67\x73\x54\x61\x62\x6c\x65',
158
- '\x45\x58\x49\x53\x54\x53\x20\x73\x65\x74',
159
- '\x79\x70\x65\x3d\x24\x32\x3b',
160
- '\x20\x3d\x20\x24\x31\x20\x57\x48\x45\x52',
161
- '\x75\x74\x20\x46\x52\x4f\x4d\x20\x73\x65',
162
- '\x53\x45\x4c\x45\x43\x54\x20\x69\x6e\x70',
163
- '\x69\x6e\x70\x75\x74\x53\x65\x74\x74\x69',
164
- '\x67\x73\x54\x61\x62\x6c\x65\x20\x57\x48'
165
- ];
166
- _0x51ac = function () {
167
- return _0x4c2a7b;
168
- };
169
- return _0x51ac();
170
- }
171
- module[_0x4adb12(0x3b9, 0x3bb)][_0x4adb12(0x399, 0x3a9) + '\x73\x4c\x69\x73\x74'] = async () => {
172
- function _0x3d2b3e(_0x422149, _0x22ad09) {
173
- return _0x571c39(_0x422149, _0x22ad09 - -0xa2);
174
- }
83
+
84
+ module.exports.getSettingsList = async () => {
175
85
  await createSettingsTable();
176
- function _0xd06e5b(_0x3d19fd, _0x4b550e) {
177
- return _0x571c39(_0x3d19fd, _0x4b550e - -0x27f);
86
+ let result = await pool.query(
87
+ "SELECT input,settingtype FROM settingsTable;"
88
+ );
89
+ if (result.rowCount) {
90
+ return result.rows;
91
+ } else {
92
+ return [];
178
93
  }
179
- let _0x20bc6c = await pool[_0xd06e5b(0xc, 0x12)](_0x3d2b3e(0x1e2, 0x1de) + '\x75\x74\x2c\x73\x65\x74\x74\x69\x6e\x67' + '\x74\x79\x70\x65\x20\x46\x52\x4f\x4d\x20' + _0xd06e5b(0xc, 0xb) + _0xd06e5b(0xe, 0xa));
180
- return _0x20bc6c[_0xd06e5b(0x18, 0x34)] ? _0x20bc6c[_0xd06e5b(0x17, 0xe)] : [];
181
- }, module['\x65\x78\x70\x6f\x72\x74\x73'][_0x4adb12(0x39f, 0x39a) + _0x4adb12(0x3aa, 0x398)] = async _0x219704 => {
94
+ };
95
+
96
+ module.exports.removeSettings = async (settingtype) => {
182
97
  await createSettingsTable();
183
- function _0x27e1dc(_0x40d660, _0xefa5eb) {
184
- return _0x571c39(_0x40d660, _0xefa5eb - -0x46f);
185
- }
186
- let _0x1017f8 = await pool[_0x27e1dc(-0x1f7, -0x1de)]('\x73\x65\x6c\x65\x63\x74\x20\x2a\x20\x66' + '\x72\x6f\x6d\x20\x73\x65\x74\x74\x69\x6e' + _0x4638be(-0x1c3, -0x1ca) + _0x27e1dc(-0x1d0, -0x1ce) + '\x67\x74\x79\x70\x65\x3d\x24\x31\x3b', [_0x219704]);
187
- function _0x4638be(_0x24510c, _0x1cfa16) {
188
- return _0x4adb12(_0x24510c, _0x1cfa16 - -0x556);
98
+
99
+ let result = await pool.query(
100
+ "select * from settingsTable WHERE settingtype=$1;",
101
+ [settingtype]
102
+ );
103
+
104
+ if (result.rows.length) {
105
+ let count = result.rows[0].count;
106
+ await pool.query(
107
+ "UPDATE settingsTable SET input = 'default' WHERE settingtype=$1;",
108
+ [settingtype]
109
+ );
110
+ await pool.query("commit;");
111
+ return count;
112
+ } else {
113
+ await pool.query("INSERT INTO settingsTable VALUES($1,$2);", [
114
+ settingtype,
115
+ 'default',
116
+ ]);
117
+ await pool.query("commit;");
118
+ return 1;
189
119
  }
190
- if (_0x1017f8['\x72\x6f\x77\x73']['\x6c\x65\x6e\x67\x74\x68']) {
191
- let _0x1dc421 = _0x1017f8[_0x4638be(-0x1ac, -0x1bf)][0x0][_0x4638be(-0x1bf, -0x1c7)];
192
- return await pool[_0x27e1dc(-0x1c8, -0x1de)]('\x55\x50\x44\x41\x54\x45\x20\x73\x65\x74' + _0x4638be(-0x193, -0x196) + _0x27e1dc(-0x1b5, -0x1c5) + _0x4638be(-0x199, -0x1a5) + _0x27e1dc(-0x1be, -0x1c0) + _0x27e1dc(-0x1e1, -0x1e0) + '\x3d\x24\x31\x3b', [_0x219704]), await pool[_0x4638be(-0x1a0, -0x1bb)](_0x27e1dc(-0x1a4, -0x1bf)), _0x1dc421;
193
- } else
194
- return await pool[_0x4638be(-0x1c8, -0x1bb)](_0x27e1dc(-0x1c2, -0x1d8) + _0x27e1dc(-0x1e9, -0x1e4) + _0x4638be(-0x1d0, -0x1b9) + _0x27e1dc(-0x1cf, -0x1e7), [
195
- _0x219704,
196
- '\x64\x65\x66\x61\x75\x6c\x74'
197
- ]), await pool[_0x4638be(-0x1d8, -0x1bb)](_0x4638be(-0x19c, -0x19c)), 0x1;
198
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "queenamdi-functions-beta",
3
- "version": "0.0.29",
3
+ "version": "0.1.2",
4
4
  "description": "NPM Package for Queen Amdi Public version.",
5
5
  "main": "index.js",
6
6
  "directories": {