queen_amdi_core 1.2.9 → 1.3.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.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @project_name Queen Amdi [WA Multi-device]
3
+ * @author BlackAmda <https://github.com/BlackAmda>
4
+ * @description A WhatsApp based 3ʳᵈ party application that provide many services with a real-time automated conversational experience
5
+ * @link <https://github.com/BlackAmda/QueenAmdi>
6
+ * @version 4.0.5
7
+ * @file settings.js - QueenAmdi bot settings
8
+
9
+ © 2022 Black Amda, ANTECH. All rights reserved.
10
+ Licensed under the GPL-3.0 License;
11
+ you may not use this file except in compliance with the License.*/
12
+
13
+ const { AMDI, _default_list_sections, Language } = require('queen_amdi_core/dist/scripts')
14
+ const { settingList, applyList } = _default_list_sections
15
+ const Lang = Language.getString('settings');
16
+
17
+
18
+ AMDI({ cmd: "apply", desc: Lang.setDesc, type: "profile", react: "👩🏻‍🎨" }, (async (amdiWA) => {
19
+ let { prefix, isReply, reply, replied_text, sendListMsg } = amdiWA.msgLayout;
20
+
21
+ if (!isReply) return reply(Lang.needReplymsg)
22
+
23
+ var listInfo = {}
24
+ listInfo.title = Lang.applyTitle
25
+ listInfo.text = Lang.applyText
26
+ listInfo.buttonTXT = 'default'
27
+
28
+ const sections = await applyList(prefix, replied_text);
29
+ return await sendListMsg(listInfo, sections);
30
+ }));
31
+
32
+
33
+ AMDI({ cmd: "settings", desc: Lang.setDesc, type: "profile", react: "⚙️" }, (async (amdiWA) => {
34
+ let { prefix, sendListMsg } = amdiWA.msgLayout;
35
+
36
+ var listInfo = {}
37
+ listInfo.title = Lang.setListTitle
38
+ listInfo.text = Lang.setListText
39
+ listInfo.buttonTXT = 'default'
40
+
41
+ const sections = settingList(prefix, amdiWA.clientJID);
42
+ return await sendListMsg(listInfo, sections);
43
+ }));
@@ -0,0 +1,205 @@
1
+ /**
2
+ * @project_name Queen Amdi [WA Multi-device]
3
+ * @author BlackAmda <https://github.com/BlackAmda>
4
+ * @description A WhatsApp based 3ʳᵈ party application that provide many services with a real-time automated conversational experience
5
+ * @link <https://github.com/BlackAmda/QueenAmdi>
6
+ * @version 4.0.5
7
+ * @file stickers.js - QueenAmdi sticker maker
8
+
9
+ © 2022 Black Amda, ANTECH. All rights reserved.
10
+ Licensed under the GPL-3.0 License;
11
+ you may not use this file except in compliance with the License.*/
12
+
13
+ const { AMDI, amdiDB, emoji2sticker, isEmoji, Language, sticker } = require('queen_amdi_core/dist/scripts')
14
+ const { getSettings } = amdiDB.settingsDB
15
+ const { getMiscData } = amdiDB.miscDB
16
+ require('dotenv').config();
17
+ const axios = require("axios");
18
+ const fs = require('fs');
19
+ const ffmpeg = require('fluent-ffmpeg');
20
+ const Lang = Language.getString('stickers');
21
+
22
+
23
+ AMDI({ cmd: ["sticker", "s", "stic"], desc: Lang.stickerDesc, example: Lang.stickEx, type: "primary", react: "🖼️" }, (async (amdiWA) => {
24
+ const { clearMedia, react, reply, downloadMedia, reply_message, isMedia, isTaggedDocument, isTaggedImage, isTaggedOneTimeImage, isTaggedOneTimeVideo, isTaggedVideo, isTaggedSticker } = amdiWA.msgLayout;
25
+
26
+ const customName = await getMiscData('SNAME')
27
+ const customAuth = await getMiscData('SAUTHOR')
28
+ var packName = await sticker.packNAME(amdiWA, customName.data);
29
+ var authorName = await sticker.authorNAME(amdiWA, customAuth.data);
30
+
31
+ const media = await downloadMedia();
32
+ if (!media.file) return await reply(Lang.errStic);
33
+
34
+ try {
35
+ await react("🔄️");
36
+ if ((isMedia && !amdiWA.msg.message.videoMessage) || isTaggedImage || isTaggedDocument || isTaggedOneTimeImage) {
37
+ await sticker.makeSticker(amdiWA, media.file, packName, authorName);
38
+ } else if ((isTaggedOneTimeVideo) || (isMedia && amdiWA.msg.message.videoMessage.seconds < 11) || (isTaggedVideo && reply_message.videoMessage.seconds < 11)) {
39
+ await sticker.animateSticker(amdiWA, media.file, packName, authorName);
40
+ }
41
+ if (isTaggedSticker) {
42
+ await react("✏️");
43
+ await sticker.changeINFO(amdiWA, media.file, packName, authorName, media.isAnimated);
44
+ }
45
+ return await react("✔️");
46
+ } catch (e) {
47
+ console.log(e);
48
+ return await reply("Error".fetchError(e), "❌", 1);
49
+ }
50
+ }));
51
+
52
+
53
+ AMDI({ cmd: ["imagestic", "stickerimage", "imagesticker", "stic2img"], desc: Lang.imgStic, type: "primary", react: "🔁" }, (async (amdiWA) => {
54
+ let { downloadMedia, footerTXT, isTaggedSticker, react, reply, reply_message } = amdiWA.msgLayout;
55
+
56
+ if (!isTaggedSticker) return reply(Lang.giveSTICKER, "❓");
57
+
58
+ const captionDB = await getSettings('CAPTION')
59
+ let caption = captionDB.input == undefined ? footerTXT : captionDB.input
60
+
61
+ if (!reply_message.stickerMessage.isAnimated && isTaggedSticker) {
62
+ await react("🔄️");
63
+ const media = await downloadMedia();
64
+ const isOwnerSticker = await sticker.isOwnerStic(media.file);
65
+ if (isOwnerSticker) return await reply("*You can't get owner's stickers! 😏*");
66
+ ffmpeg(`./${media.file}`)
67
+ .fromFormat("webp_pipe")
68
+ .save("result.png")
69
+ .on("error", (err) => {
70
+ console.log(err);
71
+ return reply(`*Error:*\n${err.message}`);
72
+ })
73
+ .on("end", async () => {
74
+ await amdiWA.web.sendMessage(amdiWA.clientJID, { image: fs.readFileSync("result.png"), caption: caption }, { mimetype: 'image/png', quoted: (amdiWA.fromMe === false ? amdiWA.msg : ''), ephemeralExpiration: amdiWA.ephDuration });
75
+ try {
76
+ fs.unlinkSync(media.file)
77
+ fs.unlinkSync("result.png");
78
+ } catch { }
79
+ return await react("✔️");
80
+ });
81
+ } else {
82
+ return await reply(Lang.nonAnim);
83
+ }
84
+ }));
85
+
86
+
87
+ AMDI({ cmd: ["sticvid", "stickervideo", "s2v"], desc: Lang.VIDSTICDESC, type: "primary", react: "🔁" }, (async (amdiWA) => {
88
+ let { downloadMedia, footerTXT, isTaggedSticker, react, reply, reply_message } = amdiWA.msgLayout;
89
+
90
+ if (!isTaggedSticker) return reply(Lang.giveSTICKER, "❓");
91
+
92
+ const captionDB = await getSettings('CAPTION')
93
+ let caption = captionDB.input == undefined ? footerTXT : captionDB.input
94
+
95
+ if (reply_message.stickerMessage.isAnimated && isTaggedSticker) {
96
+ const media = await downloadMedia();
97
+ const isOwnerSticker = await sticker.isOwnerStic(media.file);
98
+ if (isOwnerSticker) return await reply("*You can't get owner's stickers! 😏*");
99
+ await react("🔄️");
100
+ await sticker.sticVID(amdiWA, media.file, caption)
101
+ return await react("✔️");
102
+ } else {
103
+ return await reply(Lang.nonImage);
104
+ }
105
+ }));
106
+
107
+
108
+ AMDI({ cmd: ["stickerinfo", "sticinfo"], desc: Lang.STICINFODESC, type: "primary", react: "ℹ️" }, (async (amdiWA) => {
109
+ const { clearMedia, reply, downloadMedia, isTaggedSticker } = amdiWA.msgLayout;
110
+
111
+ if (isTaggedSticker) {
112
+ const media = await downloadMedia();
113
+ if (!media) return await reply(Lang.NOSTICKER);
114
+ await sticker.getSticInfo(amdiWA, media.file, Lang.STICINFO);
115
+ return clearMedia(media.file);
116
+ }
117
+ }));
118
+
119
+
120
+ AMDI({ cmd: ["sticpack", "bulksticker"], desc: Lang.STICPACKDESC, type: "primary", react: "📁" }, (async (amdiWA) => {
121
+ const { clearMedia, react, reply, downloadMedia, isMedia, isTaggedDocument } = amdiWA.msgLayout;
122
+
123
+ var packName = await sticker.packNAME(amdiWA);
124
+ var authorName = await sticker.authorNAME(amdiWA);
125
+ const media = await downloadMedia();
126
+
127
+ if ((isTaggedDocument && media.ext === "zip") || (isMedia && media.ext === "zip")) {
128
+ try {
129
+ await react("🔄️");
130
+ await sticker.bulkSticker(amdiWA, media.file, packName, authorName);
131
+ await reply(Lang.CHECKURDM)
132
+ await clearMedia(media.file);
133
+ return await react("✔️");
134
+ } catch (e) {
135
+ console.log(e);
136
+ return await reply("Error".fetchError(e), "❌", 1);
137
+ }
138
+ } else {
139
+ return await reply(Lang.STICZIP, "❓");
140
+ }
141
+ }));
142
+
143
+
144
+ AMDI({ cmd: ["emoji", "emostic"], desc: Lang.EMO2STICDESC, type: "primary", react: "🔄️" }, (async (amdiWA) => {
145
+ const { prefix, reply, input, isLINK, sendListMsg } = amdiWA.msgLayout;
146
+
147
+ try {
148
+ if (!isLINK(input)) {
149
+ if (!input || !input.match(isEmoji())) return await reply(Lang.GIVE_EMOJI, "❓");
150
+ const emojiData = await emoji2sticker(prefix, input, "emostic");
151
+
152
+ var listInfo = {}
153
+ listInfo.title = emojiData.title
154
+ listInfo.text = emojiData.text
155
+ listInfo.buttonTXT = emojiData.buttonTXT
156
+
157
+ return await sendListMsg(listInfo, emojiData.section);
158
+ } else {
159
+ return await sticker.sendSticker(amdiWA, input);
160
+ }
161
+ } catch (e) {
162
+ console.log(e);
163
+ return await reply("Error".fetchError(e), "❌", 1);
164
+ }
165
+ }));
166
+
167
+
168
+ AMDI({ cmd: ["pemoji", "emoimg"], desc: Lang.EMO2PICDESC, type: "primary", react: "🖼️" }, (async (amdiWA) => {
169
+ const { footerTXT, prefix, reply, input, isLINK, sendListMsg, sendImage } = amdiWA.msgLayout;
170
+
171
+ try {
172
+ if (!isLINK(input)) {
173
+ if (!input || !input.match(isEmoji())) return await reply(Lang.GIVE_EMOJI, "❓");
174
+ const emojiData = await emoji2sticker(prefix, input, "emoimg");
175
+
176
+ var listInfo = {}
177
+ listInfo.title = emojiData.title
178
+ listInfo.text = emojiData.text
179
+ listInfo.buttonTXT = emojiData.buttonTXT
180
+
181
+ return await sendListMsg(listInfo, emojiData.section);
182
+ } else {
183
+ return await sendImage({ url: input }, { caption: footerTXT, quoted: true });
184
+ }
185
+ } catch (e) {
186
+ console.log(e);
187
+ return await reply("Error".fetchError(e), "❌", 1);
188
+ }
189
+ }));
190
+
191
+
192
+ AMDI({ cmd: ["emomix", "mixemoji"], desc: Lang.EMOMIXDESC, example: Lang.EMOMIX_EX, type: "primary", react: "🎨" }, (async (amdiWA) => {
193
+ const { reply, input } = amdiWA.msgLayout;
194
+
195
+ try {
196
+ if (!input || !input.includes("+")) return await reply(Lang.GIVE2EMOJI, "❓");
197
+ const emojis = input.split("+");
198
+ const response = await axios.get('https://tenor.googleapis.com/v2/featured?key=AIzaSyAyimkuYQYF_FXVALexPuGQctUWRURdCYQ&contentfilter=high&media_filter=png_transparent&component=proactive&collection=emoji_kitchen_v5&q=' + encodeURI(emojis[0]) + '_' + encodeURI(emojis[1]))
199
+ if (response.data.results.length === 0) return await reply("*Can't mix these 2 emojis!*");
200
+ return await sticker.sendSticker(amdiWA, response.data.results[0].url);
201
+ } catch (e) {
202
+ console.log(e);
203
+ return await reply("Error".fetchError(e), "❌", 1);
204
+ }
205
+ }));
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @project_name Queen Amdi [WA Multi-device]
3
+ * @author BlackAmda <https://github.com/BlackAmda>
4
+ * @description A WhatsApp based 3ʳᵈ party application that provide many services with a real-time automated conversational experience
5
+ * @link <https://github.com/BlackAmda/QueenAmdi>
6
+ * @version 4.0.5
7
+ * @file system_status.js - QueenAmdi system status
8
+
9
+ © 2022 Black Amda, ANTECH. All rights reserved.
10
+ Licensed under the GPL-3.0 License;
11
+ you may not use this file except in compliance with the License.*/
12
+
13
+ const { AMDI, amdiDB, customizeButtons, _default, Language, Package, system_stats } = require('queen_amdi_core/dist/scripts')
14
+ const { aliveTXT0, alivePicURL0 } = _default
15
+ const { getSettings } = amdiDB.settingsDB
16
+ const { customAlive } = customizeButtons
17
+ const Lang = Language.getString('system_status');
18
+
19
+ AMDI({ cmd: ["alive", "hi", "online"], desc: Lang.AliveDesc, type: "primary", react: "💃🏻" }, (async (amdiWA) => {
20
+ let { prefix, sendButtonsMsg } = amdiWA.msgLayout;
21
+
22
+ var ALIVE_MSG = await getSettings("ALIVE_MSG");
23
+ if (ALIVE_MSG.input === 'default' || ALIVE_MSG.input == undefined) {
24
+ const buttons = [
25
+ {type: "url", displayText: "💃🏻 Official Website", url: 'https://amdaniwasa.com/'},
26
+ {type: "url", displayText: "🎞️ AN Tech YouTube Channel", url: 'https://www.youtube.com/channel/UCZx8U1EU95-Wn9mH4dn15vQ'},
27
+ {type: "click", displayText: Lang.sysStats, buttonCMD: `${prefix}system`},
28
+ {type: "click", displayText: Lang.vercheck, buttonCMD: `${prefix}qaversion`}
29
+ ]
30
+ return await sendButtonsMsg(buttons, {text: aliveTXT0, image: {url: alivePicURL0}, tagMsg: true});
31
+ } else {
32
+ const customMap = ALIVE_MSG.input
33
+ await customAlive(amdiWA.web, customMap, amdiWA.msgLayout, getSettings);
34
+ }
35
+ }));
36
+
37
+
38
+ AMDI({ cmd: "ping", desc: Lang.PingDesc, type: "primary", react: "📍" }, (async (amdiWA) => {
39
+ let { reply, sendText } = amdiWA.msgLayout
40
+ var start = new Date()
41
+ var checkSTS = await sendText('_Pinging to amdiModule_', {});
42
+ var end = new Date()
43
+ await reply(`📍 *Ping: ` + (end - start) + 'ms*');
44
+ return await amdiWA.web.sendMessage(amdiWA.clientJID, { delete: checkSTS.key })
45
+ }));
46
+
47
+
48
+ AMDI({ cmd: "system", desc: "Bot Status", cmdHideInMenu: true }, (async (amdiWA) => {
49
+ let { reply } = amdiWA.msgLayout;
50
+
51
+ return await reply(system_stats(), "💻");
52
+ }));
53
+
54
+
55
+ AMDI({ cmd: ["qaversion", "version"], desc: "Version check", cmdHideInMenu: true }, (async (amdiWA) => {
56
+ let { reply } = amdiWA.msgLayout;
57
+ const version = Package.version
58
+ return await reply(`*🧬 Queen Amdi Version 🧬*\n\n` + '```Installed version``` : ' + version +'\n' + '\n```Check github``` : https://github.com/BlackAmda/QueenAmdi/');
59
+ }));
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @project_name Queen Amdi [WA Multi-device]
3
+ * @author BlackAmda <https://github.com/BlackAmda>
4
+ * @description A WhatsApp based 3ʳᵈ party application that provide many services with a real-time automated conversational experience
5
+ * @link <https://github.com/BlackAmda/QueenAmdi>
6
+ * @version 4.0.5
7
+ * @file tags.js - Tagging commands
8
+
9
+ © 2022 Black Amda, ANTECH. All rights reserved.
10
+ Licensed under the GPL-3.0 License;
11
+ you may not use this file except in compliance with the License.*/
12
+
13
+ const { _default, AMDI, allParticipants, isGroup, Language } = require('queen_amdi_core/dist/scripts')
14
+ const { mahinda } = _default
15
+ const Lang = Language.getString('tags');
16
+
17
+ AMDI({ cmd: "tagwa", desc: "Tag official whatsapp.", type: "primary", react: "💃🏻" }, (async (amdiWA) => {
18
+ let { sendText } = amdiWA.msgLayout;
19
+ return await sendText(`Whatsapp : @0`, { mentionJIDS: ['0@s.whatsapp.net'], quoted: true, reactEmoji: "✅" });
20
+ }));
21
+
22
+ AMDI({ cmd: "dialog", cmdHideInMenu: true, type: "primary" }, (async (amdiWA) => {
23
+ let { sendText } = amdiWA.msgLayout;
24
+ return await sendText(`Dialog Axiata : @94777678678`, { mentionJIDS: ['94777678678@s.whatsapp.net'], quoted: true, reactEmoji: "✅" });
25
+ }));
26
+
27
+ AMDI({ cmd: "mobitel", cmdHideInMenu: true, type: "primary" }, (async (amdiWA) => {
28
+ let { sendText } = amdiWA.msgLayout;
29
+ return await sendText(`Mobitel : @94711755777`, { mentionJIDS: ['94711755777@s.whatsapp.net'], quoted: true, reactEmoji: "✅" });
30
+ }));
31
+
32
+ AMDI({ cmd: "hutch", cmdHideInMenu: true, type: "primary" }, (async (amdiWA) => {
33
+ let { sendText } = amdiWA.msgLayout;
34
+ return await sendText(`Hutch : @94788777111`, { mentionJIDS: ['94788777111@s.whatsapp.net'], quoted: true, reactEmoji: "✅" });
35
+ }));
36
+
37
+ AMDI({ cmd: "tagall", desc: Lang.tagallDESC, example: Lang.tagallEX, type: "primary", react: "🏷️" }, (async (amdiWA) => {
38
+ let { allGroupMembers, allGroupParticipants, isAllowedNumb, footerTXT, groupAdmins, input, isReply, isGroupAdmin, replied_text, sendText } = amdiWA.msgLayout;
39
+
40
+ if (isGroupAdmin || isAllowedNumb || amdiWA.fromMe) {
41
+ if (!input && !isReply && !replied_text) {
42
+ adminMSG = '';
43
+ groupAdmins.forEach(data => {
44
+ adminMSG += '║ 👑 @' + data.split('@')[0] + '\n';
45
+ });
46
+
47
+ memberMSG = '';
48
+ allGroupMembers.forEach(data => {
49
+ memberMSG += '║ 👤 @' + data.split('@')[0] + '\n';
50
+ });
51
+ const allTAGMSG = `╔════════════════\n║ *📧 Group Participants 📧*\n║ \n${adminMSG}${memberMSG}╚════════════════\n${footerTXT}`
52
+ return await sendText(allTAGMSG, { mentionJIDS: allGroupParticipants, reactEmoji: "✅" });
53
+ };
54
+
55
+ let textMSG;
56
+ if (!input) { textMSG = replied_text }
57
+ else { textMSG = input };
58
+ return await sendText(textMSG, { mentionJIDS: allGroupParticipants });
59
+ }
60
+ }));
61
+
62
+
63
+ AMDI({ cmd: "taggrp", desc: Lang.TAGGRPDESC, example: Lang.TAGGRPEX, type: "profile", react: "🏷️" }, (async (amdiWA) => {
64
+ let { input, isReply, react, reply, replied_text, sendText } = amdiWA.msgLayout;
65
+
66
+ if (!input && !isGroup(input)) return await reply(Lang.GIVEMEJID, "❓");
67
+ if (!isReply && !replied_text) return await reply(Lang.GIVEMETEXT, "❓");
68
+
69
+ try {
70
+ const groupMetaData = await amdiWA.web.groupMetadata(input);
71
+ const groupMembers = allParticipants(groupMetaData.participants);
72
+ await sendText(replied_text, { jid: input, mentionJIDS: groupMembers });
73
+ return await react("✔️");
74
+ } catch (e) {
75
+ console.log(e);
76
+ return await reply("Error".fetchError(e), "❌", 1);
77
+ }
78
+ }));
79
+
80
+
81
+ AMDI({ cmd: "මහින්ද", desc: "For bayyas people.", type: "primary", react: "👑", cmdHideInMenu: true }, (async (amdiWA) => {
82
+ let { input, sendAudioMsg, msgDevice } = amdiWA.msgLayout
83
+
84
+ if (input === "මහත්තයා") {
85
+ await amdiWA.web.sendMessage(amdiWA.clientJID, { sticker: { url: 'https://i.ibb.co/wYdVdMX/mahinda-mahattaya.webp' } }, { quoted: (amdiWA.fromMe === false ? amdiWA.msg : ''), ephemeralExpiration: amdiWA.ephDuration });
86
+ let mimeType = msgDevice == 'ios' ? 'audio/mp4' : 'audio/ogg; codecs=opus'
87
+ return await sendAudioMsg({ url: mahinda }, { mimetype: mimeType, ptt: true });
88
+ }
89
+ }));
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @project_name Queen Amdi [WA Multi-device]
3
+ * @author BlackAmda <https://github.com/BlackAmda>
4
+ * @description A WhatsApp based 3ʳᵈ party application that provide many services with a real-time automated conversational experience
5
+ * @link <https://github.com/BlackAmda/QueenAmdi>
6
+ * @version 4.0.5
7
+ * @file votepolls.js - QueenAmdi vote poll messages
8
+
9
+ © 2022 Black Amda, ANTECH. All rights reserved.
10
+ Licensed under the GPL-3.0 License;
11
+ you may not use this file except in compliance with the License.*/
12
+
13
+ const { AMDI, Language } = require('queen_amdi_core/dist/scripts')
14
+ const Lang = Language.getString('votepolls');
15
+
16
+ AMDI({ cmd: "vote", desc: Lang.voteDESC, example: Lang.voteEX, type: "admin", react: "📊" }, (async (amdiWA) => {
17
+ let { input, reply, sendVotePoll, footerTXT } = amdiWA.msgLayout
18
+
19
+ if (!input && !input.includes('{')) return await reply(Lang.noINPUT, "❗");
20
+
21
+ const text = input.split('{')[0]
22
+ const optINPUT = input.split('{')[1].split('}')[0]
23
+ const isEMOJI = input.split('}')[1].replace(/ /g, "")
24
+ //let reactEmoji = isEMOJI == '' ? "☑️" : isEMOJI ----FUTURE UPDATES
25
+
26
+ return await sendVotePoll(text, optINPUT);
27
+ }));