cuy-cli 3.0.9 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/database.js +1 -2
- package/bin/index.js +8 -10
- package/package.json +1 -1
package/bin/database.js
CHANGED
package/bin/index.js
CHANGED
@@ -44,18 +44,18 @@ const search = [
|
|
44
44
|
const cuyPost = (data) => {
|
45
45
|
if (data.description.length < 8 || data.description.length > 100) {
|
46
46
|
console.log('deskripsi terlalu panjang! min:8 max:100');
|
47
|
-
|
47
|
+
db.destroy();
|
48
48
|
}
|
49
49
|
|
50
50
|
if (data.hashtag.length < 2 || data.hashtag.length > 20) {
|
51
51
|
console.log('hashtag terlalu panjang! min:2 max:20');
|
52
|
-
|
52
|
+
db.destroy();
|
53
53
|
}
|
54
54
|
|
55
55
|
db.query(`SELECT * from users where secret='${data.secret}' AND cuycli=1`, (err, rows) => {
|
56
56
|
if (err) {
|
57
57
|
console.warn('Maaf, saat ini data yang anda masukan tidak dapat kami proses.')
|
58
|
-
|
58
|
+
db.destroy();
|
59
59
|
}
|
60
60
|
if (!err && rows.length > 0) {
|
61
61
|
const { username, id } = rows[0]
|
@@ -63,10 +63,10 @@ const cuyPost = (data) => {
|
|
63
63
|
if (!err) {
|
64
64
|
if (rows != null) {
|
65
65
|
console.info(`congrats ${username} :) anda berhasil membuat postingan baru. silahkan cek di https://cuyuniverse.co`);
|
66
|
-
|
66
|
+
db.destroy();
|
67
67
|
} else {
|
68
68
|
console.log('Terjadi kesalahan, saat ini anda tidak dapat membuat postingan via cuycli. Coba lagi nanti!');
|
69
|
-
|
69
|
+
db.destroy();
|
70
70
|
}
|
71
71
|
} else {
|
72
72
|
console.warn('Maaf, saat ini data yang anda masukan tidak dapat kami proses.')
|
@@ -78,21 +78,19 @@ const cuyPost = (data) => {
|
|
78
78
|
|
79
79
|
const lastSeen = ({ username }) => {
|
80
80
|
db.query(`select last_seen from users where username='${username}'`, (err, rows) => {
|
81
|
-
console.log('error: ', err)
|
82
|
-
console.log('rowsss: ', rows)
|
83
81
|
if (!err && rows.length > 0) {
|
84
82
|
last_seen = rows[0].last_seen
|
85
83
|
if (last_seen == null) {
|
86
84
|
console.info(`${username} belum pernah login`);
|
87
|
-
|
85
|
+
db.destroy();
|
88
86
|
} else {
|
89
87
|
console.info(`${username} terahir terlihat pada ${last_seen}`);
|
90
|
-
|
88
|
+
db.destroy();
|
91
89
|
}
|
92
90
|
}
|
93
91
|
else {
|
94
92
|
console.warn('Maaf, saat ini data yang anda masukan tidak dapat kami proses.')
|
95
|
-
|
93
|
+
db.destroy();
|
96
94
|
}
|
97
95
|
})
|
98
96
|
}
|