uzi_telegram-parser 1.0.3 → 1.1.0
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/index.js +5 -1
- package/myModule/seriChannel.js +0 -0
- package/myModule/seriMessage.js +85 -73
- package/myModule/seriQuery.js +0 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
console.log("Terimaskasih telah menggunakan module ini, support terus module ini untuk berkembang lebih baik!")
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
|
-
mParsing: require("./myModule/seriMessage.js")
|
|
4
|
+
mParsing: require("./myModule/seriMessage.js"),
|
|
5
|
+
qParsing: require("./myModule/seriQuery.js"),
|
|
6
|
+
cParsing: require("./myModule/seriChannel.js"),
|
|
3
7
|
}
|
|
File without changes
|
package/myModule/seriMessage.js
CHANGED
|
@@ -5,8 +5,8 @@ module.exports = (myBot, m) => {
|
|
|
5
5
|
fc.from = m.chat.id //id chat
|
|
6
6
|
|
|
7
7
|
//message
|
|
8
|
-
fc.
|
|
9
|
-
fc.
|
|
8
|
+
fc.message_id = m.message_id
|
|
9
|
+
fc.message_type = m.photo ? "photo" :
|
|
10
10
|
m.video ? "video" :
|
|
11
11
|
m.document ? "document" :
|
|
12
12
|
m.location ? "location" :
|
|
@@ -17,112 +17,124 @@ module.exports = (myBot, m) => {
|
|
|
17
17
|
m.video_note ? "video note" :
|
|
18
18
|
m.text ? "text" :
|
|
19
19
|
"undefined type"
|
|
20
|
-
fc.
|
|
21
|
-
fc.
|
|
20
|
+
fc.message_time = m.date
|
|
21
|
+
fc.message_text = m.text || m.caption || ""
|
|
22
|
+
if(m.entities) fc.message_entities = m.entities
|
|
22
23
|
|
|
23
24
|
//chat
|
|
24
25
|
fc.chatType = m.chat.type
|
|
25
26
|
|
|
26
27
|
//pribadi pengirim
|
|
27
|
-
fc.
|
|
28
|
-
fc.
|
|
29
|
-
fc.
|
|
30
|
-
fc.
|
|
31
|
-
fc.
|
|
28
|
+
fc.user = {}
|
|
29
|
+
fc.user.first_name = m.from.first_name
|
|
30
|
+
fc.user.username = m.from.username || ""
|
|
31
|
+
fc.user.id = m.from.id
|
|
32
|
+
fc.user.lang = m.from.language_code
|
|
33
|
+
fc.user.isBot = m.from.is_bot
|
|
32
34
|
|
|
33
35
|
// jika adalah grup
|
|
34
36
|
if(fc.chatType != "private"){
|
|
35
|
-
fc.
|
|
36
|
-
fc.
|
|
37
|
-
fc.
|
|
37
|
+
fc.group = {}
|
|
38
|
+
fc.group.id = m.chat.id
|
|
39
|
+
fc.group.name = m.chat.title
|
|
40
|
+
fc.group.username = m.chat.username || ""
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
//kalau pesan adalah foto
|
|
41
|
-
if(fc.
|
|
44
|
+
if(fc.message_type == "photo"){
|
|
45
|
+
fc.photo = {}
|
|
42
46
|
let ses = m.photo[m.photo.length - 1]
|
|
43
|
-
fc.
|
|
44
|
-
fc.
|
|
45
|
-
fc.
|
|
46
|
-
fc.
|
|
47
|
-
fc.
|
|
48
|
-
fc.
|
|
47
|
+
fc.photo.file_id = ses.file_id
|
|
48
|
+
fc.photo.size_byte = ses.file_size
|
|
49
|
+
fc.photo.size_kilobyte = ses.file_size / 1024
|
|
50
|
+
fc.photo.size_megabyte = ses.file_size / 1024 / 1024
|
|
51
|
+
fc.photo.width = ses.width
|
|
52
|
+
fc.photo.height = ses.height
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
//kalau pesan adalah video
|
|
52
|
-
if(fc.
|
|
53
|
-
fc.
|
|
54
|
-
fc.
|
|
55
|
-
fc.
|
|
56
|
-
fc.
|
|
57
|
-
fc.
|
|
58
|
-
fc.
|
|
59
|
-
fc.
|
|
60
|
-
fc.
|
|
56
|
+
if(fc.message_type == "video"){
|
|
57
|
+
fc.video = {}
|
|
58
|
+
fc.video.duration = m.video.duration
|
|
59
|
+
fc.video.height = m.video.height
|
|
60
|
+
fc.video.width = m.video.width
|
|
61
|
+
fc.video.mime_type = m.video.mime_type
|
|
62
|
+
fc.video.file_id = m.video.file_id
|
|
63
|
+
fc.video.size_byte = m.video.file_size
|
|
64
|
+
fc.video.size_kilobyte = m.video.file_size / 1024
|
|
65
|
+
fc.video.size_megabyte = m.video.file_size / 1024 / 1024
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
//kalau pesan itu dokumen
|
|
64
|
-
if(fc.
|
|
65
|
-
fc.
|
|
66
|
-
fc.
|
|
67
|
-
fc.
|
|
68
|
-
fc.
|
|
69
|
-
fc.
|
|
70
|
-
fc.
|
|
69
|
+
if(fc.message_type == "document"){
|
|
70
|
+
fc.doc = {}
|
|
71
|
+
fc.doc.file_name = m.document.file_name
|
|
72
|
+
fc.doc.mime_type = m.document.mime_type
|
|
73
|
+
fc.doc.file_id = m.document.file_id
|
|
74
|
+
fc.doc.size_byte = m.document.file_size
|
|
75
|
+
fc.doc.size_kilobyte = m.document.file_size / 1024
|
|
76
|
+
fc.doc.size_megabyte = m.document.file_size / 1024 / 1024
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
//kalau pesan ada locatiom
|
|
74
|
-
if(fc.
|
|
75
|
-
fc.
|
|
76
|
-
fc.
|
|
77
|
-
fc.
|
|
80
|
+
if(fc.message_type == "location"){
|
|
81
|
+
fc.loc = {}
|
|
82
|
+
fc.loc.latitude = m.location.latitude
|
|
83
|
+
fc.loc.longitude = m.location.longitude
|
|
84
|
+
fc.loc.liveTimes = m.location.live_period
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
//kalau lokasi spesifik
|
|
81
|
-
if(fc.
|
|
82
|
-
fc.
|
|
83
|
-
fc.
|
|
84
|
-
fc.
|
|
85
|
-
fc.
|
|
88
|
+
if(fc.message_type == "location spesific"){
|
|
89
|
+
fc.loc = {}
|
|
90
|
+
fc.loc.latitude = m.venue.location.latitude
|
|
91
|
+
fc.loc.longitude = m.venue.location.longitude
|
|
92
|
+
fc.loc.title = m.venue.title
|
|
93
|
+
fc.loc.address = m.venue.address
|
|
86
94
|
}
|
|
87
95
|
|
|
88
|
-
if(fc.
|
|
89
|
-
fc.
|
|
90
|
-
fc.
|
|
91
|
-
fc.
|
|
92
|
-
fc.
|
|
96
|
+
if(fc.message_type == "contact"){
|
|
97
|
+
fc.contact = {}
|
|
98
|
+
fc.contact.number = m.contact.phone_number
|
|
99
|
+
fc.contact.first_name = m.contact.first_name
|
|
100
|
+
fc.contact.vcard = m.contact.vcard
|
|
101
|
+
fc.contact.user_id = m.contact.user_id
|
|
93
102
|
}
|
|
94
103
|
|
|
95
104
|
// kalau file audio/music
|
|
96
|
-
if(fc.
|
|
97
|
-
fc.
|
|
98
|
-
fc.
|
|
99
|
-
fc.
|
|
100
|
-
fc.
|
|
101
|
-
fc.
|
|
102
|
-
fc.
|
|
103
|
-
fc.
|
|
104
|
-
fc.
|
|
105
|
-
fc.
|
|
105
|
+
if(fc.message_type == "audio"){
|
|
106
|
+
fc.audio = {}
|
|
107
|
+
fc.audio.duration = m.audio.duration
|
|
108
|
+
fc.audio.file_name = m.audio.file_name
|
|
109
|
+
fc.audio.mime_type = m.audio.mime_type
|
|
110
|
+
fc.audio.title = m.audio.title
|
|
111
|
+
fc.audio.performer = m.audio.performer
|
|
112
|
+
fc.audio.file_id = m.audio.file_id
|
|
113
|
+
fc.audio.size_byte = m.audio.file_size
|
|
114
|
+
fc.audio.size_kilobyte = m.audio.file_size / 1024
|
|
115
|
+
fc.audio.size_megabyte = m.audio.file_size / 1024 / 1024
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
//kalau voice note
|
|
109
|
-
if(fc.
|
|
110
|
-
fc.
|
|
111
|
-
fc.
|
|
112
|
-
fc.
|
|
113
|
-
fc.
|
|
114
|
-
fc.
|
|
115
|
-
fc.
|
|
119
|
+
if(fc.message_type == "voice"){
|
|
120
|
+
fc.voice = {}
|
|
121
|
+
fc.voice.duration = m.voice.duration
|
|
122
|
+
fc.voice.mime_type = m.voice.mime_type
|
|
123
|
+
fc.voice.file_id = m.voice.file_id
|
|
124
|
+
fc.voice.size_byte = m.voice.file_size
|
|
125
|
+
fc.voice.size_kilobyte = m.voice.file_size / 1024
|
|
126
|
+
fc.voice.size_megabyte = m.voice.file_size / 1024 / 1024
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
//kalau video note
|
|
119
|
-
if(fc.
|
|
120
|
-
fc.
|
|
121
|
-
fc.
|
|
122
|
-
fc.
|
|
123
|
-
fc.
|
|
124
|
-
fc.
|
|
125
|
-
fc.
|
|
130
|
+
if(fc.message_type == "video note"){
|
|
131
|
+
fc.vidnot = {}
|
|
132
|
+
fc.vidnot.duration = m.video_note.duration
|
|
133
|
+
fc.vidnot.length = m.video_note.length
|
|
134
|
+
fc.vidnot.file_id = m.video_note.file_id
|
|
135
|
+
fc.vidnot.size_byte = m.video_note.file_size
|
|
136
|
+
fc.vidnot.size_kilobyte = m.video_note.file_size / 1024
|
|
137
|
+
fc.vidnot.size_megabyte = m.video_note.file_size / 1024 / 1024
|
|
126
138
|
}
|
|
127
139
|
|
|
128
140
|
return fc
|
|
File without changes
|