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 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
@@ -5,8 +5,8 @@ module.exports = (myBot, m) => {
5
5
  fc.from = m.chat.id //id chat
6
6
 
7
7
  //message
8
- fc.messageId = m.message_id
9
- fc.messageType = m.photo ? "photo" :
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.messageTime = m.date
21
- fc.messageText = m.text || m.caption || ""
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.userFirstName = m.from.first_name
28
- fc.userUsername = m.from.username || ""
29
- fc.userId = m.from.id
30
- fc.userLang = m.from.language_code
31
- fc.userIsBot = m.from.is_bot
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.groupId = m.chat.id
36
- fc.groupName = m.chat.title
37
- fc.groupUsername = m.chat.username || ""
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.messageType == "photo"){
44
+ if(fc.message_type == "photo"){
45
+ fc.photo = {}
42
46
  let ses = m.photo[m.photo.length - 1]
43
- fc.photo_file_id = ses.file_id
44
- fc.photo_size_byte = ses.file_size
45
- fc.photo_size_kilobyte = ses.file_size / 1024
46
- fc.photo_size_megabyte = ses.file_size / 1024 / 1024
47
- fc.photo_width = ses.width
48
- fc.photo_height = ses.height
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.messageType == "video"){
53
- fc.video_duration = m.video.duration
54
- fc.video_height = m.video.height
55
- fc.video_width = m.video.width
56
- fc.video_mime_type = m.video.mime_type
57
- fc.video_file_id = m.video.file_id
58
- fc.video_size_byte = m.video.file_size
59
- fc.video_size_kilobyte = m.video.file_size / 1024
60
- fc.video_size_megabyte = m.video.file_size / 1024 / 1024
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.messageType == "document"){
65
- fc.doc_file_name = m.document.file_name
66
- fc.doc_mime_type = m.document.mime_type
67
- fc.doc_file_id = m.document.file_id
68
- fc.doc_size_byte = m.document.file_size
69
- fc.doc_size_kilobyte = m.document.file_size / 1024
70
- fc.doc_size_megabyte = m.document.file_size / 1024 / 1024
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.messageType == "location"){
75
- fc.loc_latitude = m.location.latitude
76
- fc.loc_longitude = m.location.longitude
77
- fc.loc_liveTimes = m.location.live_period
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.messageType == "location spesific"){
82
- fc.loc_latitude = m.venue.location.latitude
83
- fc.loc_longitude = m.venue.location.longitude
84
- fc.loc_title = m.venue.title
85
- fc.loc_address = m.venue.address
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.messageType == "contact"){
89
- fc.contact_number = m.contact.phone_number
90
- fc.contact_first_name = m.contact.first_name
91
- fc.contact_vcard = m.contact.vcard
92
- fc.contact_user_id_telegram = m.contact.user_id
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.messageType == "audio"){
97
- fc.audio_duration = m.audio.duration
98
- fc.audio_file_name = m.audio.file_name
99
- fc.audio_mime_type = m.audio.mime_type
100
- fc.audio_title = m.audio.title
101
- fc.audio_performer = m.audio.performer
102
- fc.audio_file_id = m.audio.file_id
103
- fc.audio_size_byte = m.audio.file_size
104
- fc.audio_size_kilobyte = m.audio.file_size / 1024
105
- fc.audio_size_megabyte = m.audio.file_size / 1024 / 1024
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.messageType == "voice"){
110
- fc.voice_duration = m.voice.duration
111
- fc.voice_mime_type = m.voice.mime_type
112
- fc.voice_file_id = m.voice.file_id
113
- fc.voice_size_byte = m.voice.file_size
114
- fc.voice_size_kilobyte = m.voice.file_size / 1024
115
- fc.voice_size_megabyte = m.voice.file_size / 1024 / 1024
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.messageType == "video note"){
120
- fc.vidnot_duration = m.video_note.duration
121
- fc.vidnot_length = m.video_note.length
122
- fc.vidnot_file_id = m.video_note.file_id
123
- fc.vidnot_size_byte = m.video_note.file_size
124
- fc.vidnot_size_kilobyte = m.video_note.file_size / 1024
125
- fc.vidnot_size_megabyte = m.video_note.file_size / 1024 / 1024
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uzi_telegram-parser",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "This module is for parser message event on module node-telegram-bot-api",
5
5
  "main": "index.js",
6
6
  "scripts": {