queen_amdi_core 1.2.9 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,264 @@
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 grpManager.js - QueenAmdi group managing basic options
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, _default_list_sections, grpManage, Language } = require('queen_amdi_core/dist/scripts')
14
+ const { getAntiLink, insertAntiLink } = amdiDB.antilinkDB
15
+ const { getSettings } = amdiDB.settingsDB
16
+ const { grpSettings } = _default_list_sections
17
+ const Lang = Language.getString('grpManager')
18
+
19
+
20
+ AMDI({ cmd: "group", desc: Lang.grpDESC, type: "admin", react: "🕹️" }, (async (amdiWA) => {
21
+ let { prefix, sendListMsg, groupName } = amdiWA.msgLayout;
22
+
23
+ var listInfo = {}
24
+ listInfo.title = Lang.grpSetTitle.format(groupName)
25
+ listInfo.text = Lang.grpSetText
26
+ listInfo.buttonTXT = 'default'
27
+
28
+ const sections = grpSettings(prefix, amdiWA.clientJID);
29
+ return await sendListMsg(listInfo, sections);
30
+ }));
31
+
32
+
33
+ AMDI({ cmd: "add", desc: Lang.addDESC, example: Lang.addEX, type: "admin", react: "➕" }, (async (amdiWA) => {
34
+ let { botNumberJid, input, isUSERExists, reply, sendText } = amdiWA.msgLayout
35
+
36
+ return await reply('This is command is not functioning correctly.\n\nWill fix this soon!');
37
+ /*if (!input || isNaN(input)) return await reply(Lang.needADDUSER, "❓");
38
+ if (isNaN(input)) return await reply(Lang.needADDUSER, "❓");
39
+ const isUSERExist = await isUSERExists(`${input}@s.whatsapp.net`);
40
+ if (isUSERExist) return await reply(Lang.alreadyIN.format(input), "❗");
41
+ if (input == botNumberJid) return;
42
+ const [result] = await amdiWA.web.onWhatsApp(input)
43
+ if (!result) return await reply(Lang.noWhatsApp, "❗");
44
+ const addMSGSet = await getSettings('ADDMSG')
45
+ let addMSG = !addMSGSet.input ? Lang.added : addMSGSet.input
46
+ try {
47
+ return await grpManage.addUSER(amdiWA, Lang, addMSG);
48
+ } catch {
49
+ return await reply(Lang.failADD.format(input));
50
+ }*/
51
+ }));
52
+
53
+
54
+ AMDI({ cmd: "kick", desc: Lang.kickDESC, example: Lang.kickEXA, type: "admin", react: "🚫" }, (async (amdiWA) => {
55
+ let { allowedNumbs, botNumberJid, groupMetadata, input, inputObj, isReply, isUSERExists, reply, sendText, taggedJid } = amdiWA.msgLayout
56
+
57
+ if (!isReply && !input) return reply(Lang.needUSER, "❓")
58
+
59
+ const isUSERExist = await isUSERExists(taggedJid);
60
+ if (!isUSERExist) return reply(Lang.cantfinduser, "❓");
61
+ if (taggedJid == groupMetadata.owner) return reply(Lang.ISOWNER, "❌");
62
+ if (taggedJid == botNumberJid) return reply(Lang.noBanMe);
63
+ if (allowedNumbs.includes(taggedJid.split('@')[0])) return reply(Lang.noBanOwners);
64
+
65
+ let reason;
66
+ if (inputObj[1]) {
67
+ reason = input.split(`${inputObj[0]} `)[1]
68
+ } else {
69
+ const kickMSG = await getSettings('KICKMSG')
70
+ reason = !kickMSG.input ? Lang.kicked : kickMSG.input
71
+ }
72
+ try {
73
+ await sendText(`@${taggedJid.split('@')[0]}, ${reason}`, { mentionJIDS: [taggedJid] });
74
+ return await amdiWA.web.groupParticipantsUpdate(amdiWA.clientJID, [taggedJid], "remove");
75
+ } catch (e) {
76
+ console.log(e);
77
+ return await reply("Error".fetchError(e), "❌", 1);
78
+ }
79
+ }));
80
+
81
+
82
+ AMDI({ cmd: "promote", desc: Lang.PROMOTE_DESC, example: Lang.PromoEX, type: "admin", react: "🔝" }, (async (amdiWA) => {
83
+ let { input, isReply, checkAdmin, reply, sendText, taggedJid } = amdiWA.msgLayout
84
+
85
+ if (!isReply && !input) return reply(Lang.needUSER, "❓")
86
+
87
+ const isUserAdmin = await checkAdmin(taggedJid);
88
+ if (isUserAdmin) return reply(Lang.ALREADY_PROMOTED, "❓");
89
+
90
+ const promoteMSG = await getSettings('PROMMSG')
91
+ const PROMOTED = !promoteMSG.input ? Lang.PROMOTED : promoteMSG.input
92
+ try {
93
+ await sendText(`@${taggedJid.split('@')[0]}, ${PROMOTED}`, { mentionJIDS: [taggedJid] });
94
+ return await amdiWA.web.groupParticipantsUpdate(amdiWA.clientJID, [taggedJid], "promote");
95
+ } catch (e) {
96
+ console.log(e);
97
+ return await reply("Error".fetchError(e), "❌", 1);
98
+ }
99
+ }));
100
+
101
+
102
+ AMDI({ cmd: "demote", desc: Lang.DEMOTE_DESC, example: Lang.DemoEX, type: "admin", react: "🔙" }, (async (amdiWA) => {
103
+ let { groupMetadata, input, isReply, checkAdmin, reply, sendText, taggedJid } = amdiWA.msgLayout
104
+
105
+ if (!isReply && !input) return reply(Lang.needUSER, "❓")
106
+
107
+ const isUserAdmin = await checkAdmin(taggedJid);
108
+ if (taggedJid == groupMetadata.owner) return;
109
+ if (!isUserAdmin) return reply(Lang.ALREADY_NOT_ADMIN, "❓");
110
+
111
+ const demoteMSG = await getSettings('DEMOMSG')
112
+ const DEMOTED = !demoteMSG.input ? Lang.DEMOTED : demoteMSG.input
113
+ try {
114
+ await sendText(`@${taggedJid.split('@')[0]}, ${DEMOTED}`, { mentionJIDS: [taggedJid] });
115
+ return await amdiWA.web.groupParticipantsUpdate(amdiWA.clientJID, [taggedJid], "demote");
116
+ } catch (e) {
117
+ console.log(e);
118
+ return await reply("Error".fetchError(e), "❌", 1);
119
+ }
120
+ }));
121
+
122
+
123
+ AMDI({ cmd: "mute", desc: Lang.MUTE_DESC, type: "admin", react: "🔇" }, (async (amdiWA) => {
124
+ let { reply } = amdiWA.msgLayout
125
+
126
+ await amdiWA.web.groupSettingUpdate(amdiWA.clientJID, 'announcement');
127
+ const muteMSG = await getSettings('muteMSG')
128
+ const MUTED = !muteMSG.input ? Lang.MUTED : muteMSG.input
129
+ return await reply(MUTED);
130
+ }));
131
+
132
+
133
+ AMDI({ cmd: "unmute", desc: Lang.UNMUTE_DESC, type: "admin", react: "🔊" }, (async (amdiWA) => {
134
+ let { reply } = amdiWA.msgLayout
135
+
136
+ await amdiWA.web.groupSettingUpdate(amdiWA.clientJID, 'not_announcement')
137
+ const unmuteMSG = await getSettings('unmuteMSG')
138
+ const UNMUTED = !unmuteMSG.input ? Lang.UNMUTED : unmuteMSG.input
139
+ return await reply(UNMUTED);
140
+ }));
141
+
142
+
143
+ AMDI({ cmd: "lock", desc: Lang.LOCKGRP_DESC, type: "admin", react: "🔒" }, (async (amdiWA) => {
144
+ let { reply } = amdiWA.msgLayout
145
+
146
+ await amdiWA.web.groupSettingUpdate(amdiWA.clientJID, 'locked');
147
+ const lockMSG = await getSettings('lockMSG')
148
+ const LOCKED = !lockMSG.input ? Lang.LOCKED : lockMSG.input
149
+ return await reply(LOCKED);
150
+ }));
151
+
152
+
153
+ AMDI({ cmd: "unlock", desc: Lang.UNLOCKGRP_DESC, type: "admin", react: "🔒" }, (async (amdiWA) => {
154
+ let { reply } = amdiWA.msgLayout
155
+
156
+ await amdiWA.web.groupSettingUpdate(amdiWA.clientJID, 'unlocked');
157
+ const unlockMSG = await getSettings('unlockMSG')
158
+ const UNLOCKED = !unlockMSG.input ? Lang.UNLOCKED : unlockMSG.input
159
+ return await reply(UNLOCKED);
160
+ }));
161
+
162
+
163
+ AMDI({ cmd: "invite", desc: Lang.inviteDESC, type: "admin", react: "🫱🏻‍🫲🏻" }, (async (amdiWA) => {
164
+ let { groupName, sendClipboard } = amdiWA.msgLayout;
165
+ const invite_code = await amdiWA.web.groupInviteCode(amdiWA.clientJID);
166
+ return await sendClipboard({ text: `*${groupName}*\n\nhttps://chat.whatsapp.com/${invite_code}\n`, clip: `https://chat.whatsapp.com/${invite_code}` });
167
+ }));
168
+
169
+
170
+ AMDI({ cmd: "revoke", desc: Lang.revokeDESC, type: "admin", react: "🔁" }, (async (amdiWA) => {
171
+ let { reply, groupName } = amdiWA.msgLayout;
172
+ await amdiWA.web.groupRevokeInvite(amdiWA.clientJID);
173
+ return await reply(Lang.REVOKED.format(groupName));
174
+ }));
175
+
176
+
177
+ AMDI({ cmd: "subject", desc: Lang.SUBJECTDESC, example: Lang.subEX, type: "admin", react: "✏️" }, (async (amdiWA) => {
178
+ let { groupName, input, reply } = amdiWA.msgLayout;
179
+
180
+ if (!input) return reply(`${Lang.NEED_SUB}\n\n${Lang.subEX}`);
181
+
182
+ await amdiWA.web.groupUpdateSubject(amdiWA.clientJID, input);
183
+ return await reply(`${Lang.SUB}\n\n${groupName}\n > to >\n${input}`, "✔️");
184
+ }));
185
+
186
+
187
+ AMDI({ cmd: "grpdesc", desc: Lang.GRPDESCdesc, example: Lang.grpDESCEX, type: "admin", react: "✏️" }, (async (amdiWA) => {
188
+ let { input, reply } = amdiWA.msgLayout;
189
+
190
+ if (!input) return reply(`${Lang.NEED_DESC}\n\n${Lang.grpDESCEX}`);
191
+
192
+ await amdiWA.web.groupUpdateDescription(amdiWA.clientJID, input);
193
+ return await reply(Lang.DESCGRP, "✔️");
194
+ }));
195
+
196
+
197
+ AMDI({ cmd: "antilink", desc: Lang.ANTILINK_DESC, type: "admin", react: "⛔" }, (async (amdiWA) => {
198
+ let { footerTXT, input, prefix, reply, sendListMsg } = amdiWA.msgLayout;
199
+
200
+ const helpTXT = `*📖 Anti-Links setup instructions*
201
+
202
+ ◆ *Configure Anti-Links:* ${prefix}antilink
203
+
204
+ ◆ ${Lang.ALLOWURLSET}
205
+ Example: .antilink url=facebook.com,youtube.com
206
+
207
+ ◆ ${Lang.NOTALLOWURLSET}
208
+ Example: .antilink url=!chat.whatsapp.com,!twiiter.com
209
+
210
+ ${footerTXT}`
211
+
212
+ const antilink = await getAntiLink(amdiWA.clientJID)
213
+ if (!input) {
214
+ var listInfo = {}
215
+ listInfo.title = Lang.ANTILINK_TITLE
216
+ listInfo.text = Lang.ANTILINK_TXT
217
+ listInfo.buttonTXT = 'default'
218
+
219
+ const sections = [
220
+ {
221
+ title: "Anti-Link switch",
222
+ rows: [
223
+ { title: "🔛 Enable anti-links", rowId: `${prefix}antilink on` },
224
+ { title: "📴 Disable anti-links", rowId: `${prefix}antilink off` }
225
+ ]
226
+ },
227
+ {
228
+ title: "Anti-Link setup",
229
+ rows: [
230
+ { title: 'ℹ️ Anti-Link Settings', rowId: `${prefix}antilink check` },
231
+ { title: "🚮 Delete links from the chat.", rowId: `${prefix}antilink action/delete` },
232
+ { title: "🚫 Kick the user when share link in the chat.", rowId: `${prefix}antilink action/kick` },
233
+ { title: "📖 Anti-Links setup instructions", rowId: `${prefix}antilink help` }
234
+ ]
235
+ }
236
+ ]
237
+
238
+ return await sendListMsg(listInfo, sections);
239
+ }
240
+ else if (input == 'on' || input == 'off') {
241
+ if ((input === 'off' && !antilink.enabled) || (input === 'on' && antilink.enabled)) return await reply(Lang.alreadySetted, "❌");
242
+ await insertAntiLink(amdiWA.clientJID, input === 'on');
243
+ return await reply('```Anti-Links' + ' ⮕ ' + (input == 'on' ? 'Enabled.' : 'Disabled.') + '```' + `\n\nUse *${prefix}antilink help* to get configure instructions`, "✅");
244
+ }
245
+ else if (input == 'check') {
246
+ return await reply(`*Anti-Links Status:* ${antilink.enabled ? 'Enabled' : 'Disabled.'}\n*${antilink.allowedUrls.includes("!") ? "Not Allowed URLs" : "Allowed URLs"} :* ${antilink.allowedUrls}\n*Action :* ${antilink.action}`);
247
+ }
248
+ else if (input == 'help') {
249
+ return await reply(helpTXT);
250
+ }
251
+ else if (input.startsWith('action/')) {
252
+ await insertAntiLink(amdiWA.clientJID, input);
253
+ const action = input.replace('action/', '');
254
+ if (!['delete', 'kick'].includes(action)) return;
255
+ return await reply('```' + 'Anti-Links action' + ' ⮕ ' + action + '```' + Lang.settingAdded, "✅");
256
+ }
257
+ else if (input.startsWith('url=')) {
258
+ const URLs = input.replace('url=', '');
259
+ await insertAntiLink(amdiWA.clientJID, URLs);
260
+ return await reply(`_URLs for Anti-Links checking added. ⮕ ${input}_`);
261
+ } else {
262
+ return await reply(helpTXT);
263
+ }
264
+ }));
@@ -0,0 +1,85 @@
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 info.js - QueenAmdi group/user info
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, info, Language } = require('queen_amdi_core/dist/scripts')
14
+ const Lang = Language.getString('info');
15
+
16
+ AMDI({ cmd: "jid", desc: Lang.jidDESC, type: "primary", react: "📃" }, (async (amdiWA) => {
17
+ let { sendClipboard } = amdiWA.msgLayout
18
+ return await sendClipboard({text: `\n${amdiWA.clientJID}\n`, clip: `${amdiWA.clientJID}`})
19
+ }));
20
+
21
+
22
+ AMDI({ cmd: "info", desc: Lang.infoDESC, type: "primary", react: "ℹ️" }, (async (amdiWA) => {
23
+ let { footerTXT, groupMetadata, groupName, groupDesc, isBotGroupAdmin, isGroup, isGroupAdmin, sendImage } = amdiWA.msgLayout
24
+
25
+ if (isGroup) {
26
+ if (isBotGroupAdmin && isGroupAdmin) {
27
+ const invite_code = await amdiWA.web.groupInviteCode(amdiWA.clientJID)
28
+ var invite = Lang.GRP_COD + `\n https://chat.whatsapp.com/${invite_code}`;
29
+ } else {
30
+ var invite = Lang.GRP_COD + '\n' + Lang.NOADMIN
31
+ }
32
+ const count = info.getParticipantCount(groupMetadata);
33
+ const countAdmin = info.getAdminCount(groupMetadata);
34
+ const ppUrl = await info.getProfilePic(amdiWA);
35
+ try {
36
+ var owner = '+' + groupMetadata.owner.split('@')[0]
37
+ } catch {
38
+ var owner = '_[Unable to fetch group owner]_'
39
+ }
40
+ const msg = Lang.GRP_NAME + `\n ${groupName} \n\n` +
41
+ Lang.GRP_JID + `\n ${amdiWA.clientJID} \n\n` +
42
+ Lang.GRP_OWN + `\n ${owner} \n\n` +
43
+ Lang.ADMIN_COUNT + ` ${countAdmin} \n\n` +
44
+ Lang.MEMBER_COUNT + ` ${count} \n\n` +
45
+ invite +`\n\n` +
46
+ Lang.GRP_DES + `\n ${groupDesc}\n\n` +
47
+ footerTXT
48
+ return await sendImage({url: ppUrl}, {quoted: true, caption: msg});
49
+ } else {
50
+ try {
51
+ var statusDATA = await amdiWA.web.fetchStatus(amdiWA.clientJID)
52
+ var status = statusDATA.status
53
+ var statusAT = '*Date and Time:* ' + statusDATA.setAt
54
+ } catch {
55
+ var status = '_[This user about is private or empty]_'
56
+ var statusAT = ''
57
+ }
58
+ const pp = await info.getProfilePic(amdiWA);
59
+ const nwmsg = Lang.PRO_JID + `\n ${amdiWA.clientJID} \n\n` + Lang.PRO_DES + `\n ${status}\n\n${statusAT}\n\n${footerTXT}`
60
+ return await sendImage({url: pp}, {quoted: true, caption: nwmsg})
61
+ }
62
+ }));
63
+
64
+
65
+ AMDI({ cmd: "wainfo", desc: Lang.wainfoDESC, type: "primary", react: "ℹ️" }, (async (amdiWA) => {
66
+ let { input, footerTXT, reply, sendImage } = amdiWA.msgLayout
67
+
68
+ if (!input) return await reply(Lang.giveUSER, "❓");
69
+ if (isNaN(input)) return await reply(Lang.giveUSER, "❓");
70
+ const JID = input + '@s.whatsapp.net'
71
+ const [result] = await amdiWA.web.onWhatsApp(input)
72
+ if (!result) return await reply(Lang.noWhatsApp, "❗");
73
+
74
+ try {
75
+ var statusDATA = await amdiWA.web.fetchStatus(JID)
76
+ var status = statusDATA.status
77
+ var statusAT = '*Date and Time:* ' + statusDATA.setAt
78
+ } catch {
79
+ var status = '_[This user about is private or empty]_'
80
+ var statusAT = ''
81
+ }
82
+ const pp = await info.getWAProfilePic(amdiWA, JID);
83
+ const nwmsg = Lang.PRO_JID + `\n ${JID} \n\n` + Lang.PRO_DES + `\n ${status}\n\n${statusAT}\n\n${footerTXT}`
84
+ return await sendImage({url: pp}, {quoted: true, caption: nwmsg});
85
+ }));
@@ -0,0 +1,239 @@
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 misc.js - QueenAmdi miscellaneous 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 { AMDI, amdiDB, currency, CurrencyConverter, _default, fakeMsgData, Language, Lyrics } = require('queen_amdi_core/dist/scripts')
14
+ const axios = require("axios")
15
+ let { img2url } = require('@blackamda/telegram-image-url')
16
+ let currencyConverter = new CurrencyConverter()
17
+ const fs = require('fs');
18
+ const got = require('got');
19
+ const FormData = require('form-data');
20
+ const stream = require('stream');
21
+ const translatte = require('translatte');
22
+ const { promisify } = require('util');
23
+ const { getSettings } = amdiDB.settingsDB;
24
+ const pipeline = promisify(stream.pipeline);
25
+ const Lang = Language.getString('misc');
26
+ const LangFake = Language.getString('fake_reply');
27
+
28
+ const getFileName = (ext) => { return `${Math.floor(Math.random() * 10000)}${ext}` };
29
+
30
+
31
+ AMDI({ cmd: "currency", desc: Lang.currencyDesc, example: Lang.currencyEx, type: "primary", react: "💱" }, (async (amdiWA) => {
32
+ let { input, inputObj, prefix, reply, sendListMsg } = amdiWA.msgLayout
33
+
34
+ if (!input) return reply(Lang.giveValidAmount, "❓")
35
+ const isValid = await currency.isValidCurrency(input);
36
+ if (!isValid && inputObj[0] !== 'convert') return reply(Lang.giveValidAmount, "❓")
37
+
38
+ var arrayLength = currency.currenciesList.length;
39
+ var currenciesList = ''
40
+ for (var i = 0; i < arrayLength; i++) {
41
+ currenciesList += '▪️ ' + currency.currenciesList[i] + '\n'
42
+ }
43
+
44
+ var listInfo = {}
45
+ listInfo.title = Lang.currencyTITLE
46
+ listInfo.text = Lang.currencyTXT + currenciesList
47
+ listInfo.buttonTXT = 'Select currency code'
48
+
49
+ if (inputObj[0] === 'convert') {
50
+ const amount = Number(inputObj[1])
51
+ const from = inputObj[2]
52
+ const to = inputObj[3]
53
+ const converted = await currencyConverter.from(from).to(to).amount(amount).convert()
54
+ return await reply('*' + to.toUpperCase() + ' ' + converted + '*', "✅")
55
+ } else {
56
+ const currencyINPUT = await currency.currencyDATA(input)
57
+ var rows = await currency.currencyMENU(prefix, currencyINPUT)
58
+ const sections = [{ title: "Currency Code List", rows: rows }]
59
+ return await sendListMsg(listInfo, sections);
60
+ }
61
+ }));
62
+
63
+
64
+ AMDI({ cmd: "img2url", desc: Lang.img2urlDesc, type: "primary", react: "🔗" }, (async (amdiWA) => {
65
+ let { clearMedia, downloadMedia, isMedia, isTaggedImage, reply, react } = amdiWA.msgLayout;
66
+
67
+ const filename = await downloadMedia();
68
+ if ((isMedia && (amdiWA.msg.message.imageMessage || filename.ext == 'png')) || isTaggedImage) {
69
+ await react("⬇️", amdiWA.msg)
70
+ const imgURL = await img2url(filename.file)
71
+ await react("✔️", amdiWA.msg)
72
+ await reply(`\n${imgURL}\n`);
73
+ } else {
74
+ await reply(Lang.needimage);
75
+ }
76
+ return clearMedia(filename.file);
77
+ }));
78
+
79
+
80
+ AMDI({ cmd: "lyrics", desc: Lang.LY_DESC, type: "primary", react: "🎼" }, (async (amdiWA) => {
81
+ let { footerTXT, input, reply, sendImage } = amdiWA.msgLayout
82
+
83
+ if (!input) return reply(Lang.NEED_TITLE, "❓")
84
+
85
+ try {
86
+ const lyricdata = await Lyrics(input);
87
+ var media = await axios.get(lyricdata.thumb, { responseType: 'arraybuffer' })
88
+ var PIC = Buffer.from(media.data)
89
+ return await sendImage(PIC, { quoted: true, caption: lyricdata.lirik + '\n\n' + footerTXT })
90
+ } catch (e) {
91
+ console.log(e);
92
+ return reply(Lang.NO_RESULT, "❌");
93
+ }
94
+ }));
95
+
96
+
97
+ AMDI({ cmd: "removebg", desc: Lang.REMOVEBG_DESC, type: "primary", react: "✂️" }, (async (amdiWA) => {
98
+ let { clearMedia, downloadMedia, footerTXT, isMedia, isTaggedImage, react, reply, sendDocument } = amdiWA.msgLayout
99
+
100
+ const RBG_API = await getSettings('RBG_API');
101
+ if (!RBG_API.input) return reply(Lang.NO_API_KEY, "🗝️");
102
+
103
+ if (!isMedia && !isTaggedImage) return reply(Lang.NEED_PHOTO, "❓");
104
+
105
+ await react("✂️");
106
+ const filename = await downloadMedia();
107
+ const captionDB = await getSettings('CAPTION')
108
+ let caption = captionDB.input == undefined ? footerTXT : captionDB.input
109
+
110
+ var form = new FormData();
111
+ form.append('image_file', fs.createReadStream(filename.file));
112
+ form.append('size', 'auto');
113
+
114
+ var rbg = await got.stream.post('https://api.remove.bg/v1.0/removebg', {
115
+ body: form,
116
+ headers: {
117
+ 'X-Api-Key': RBG_API.input
118
+ }
119
+ });
120
+ await pipeline(rbg, fs.createWriteStream('rbg.png'));
121
+ await sendDocument(fs.readFileSync('rbg.png'), { quoted: true, fileName: 'QueenAmdi.png', caption: caption, mimetype: 'image/png' })
122
+ await react("✔️");
123
+ fs.unlinkSync('rbg.png');
124
+ return clearMedia(filename.file);
125
+ }));
126
+
127
+
128
+ /**
129
+ * ! temporary removed from the bot
130
+ AMDI({ cmd: "news", desc: Lang.NEWSDESC, type: "primary", react: "📰" }, (async (amdiWA) => {
131
+ let { input, prefix, sendImage, sendListMsg, todayDATE } = amdiWA.msgLayout
132
+
133
+ if (input) {
134
+ const getnews = await news.getnews(input);
135
+ return await sendImage({url: getnews.thumb }, {quoted: true, caption: `*${getnews.title}*\n[${getnews.data}]\n\n${getnews.description}`, reactEmoji: "🗞️"})
136
+ }
137
+
138
+ var listInfo = {}
139
+ listInfo.title = Lang.NEWSLISTTITLE.format(todayDATE())
140
+ listInfo.text = Lang.NEWSTEXT
141
+ listInfo.buttonTXT = 'default'
142
+
143
+ const newsSection = await news.newslist(prefix, Lang);
144
+ return await sendListMsg(listInfo, newsSection);
145
+ }));*/
146
+
147
+
148
+ AMDI({ cmd: ["trt", "translate"], desc: Lang.TRTDESC, example: '.trt en/si', type: "primary", react: "🔠" }, (async (amdiWA) => {
149
+ let { input, isReply, reply, replied_text } = amdiWA.msgLayout
150
+
151
+ if (!isReply) return await reply(Lang.NEED_WORD, "❓");
152
+
153
+ if (input && input.includes('/')) {
154
+ try {
155
+ const code = input.split('/');
156
+ const translated = await translatte(replied_text, { from: code[0], to: code[1] });
157
+ return await reply(translated.text);
158
+ } catch (e) {
159
+ console.log(e);
160
+ return await reply("Error".fetchError(e), "❌", 1);
161
+ }
162
+ } else {
163
+ return await reply(Lang.NEED_LANG.format(_default.langCodes), "❓");
164
+ }
165
+ }));
166
+
167
+ AMDI({ cmd: "tkinfo", desc: "Scarp tk info", react: "💃🏻", type: "primary" }, (async (amdiWA) => {
168
+ let { reply } = amdiWA.msgLayout
169
+
170
+ return await reply("Coming soon..\n\nඕම ඉන්ඩ ඒක හදලා නෑ තාම");
171
+ }));
172
+
173
+
174
+ AMDI({ cmd: "script", desc: "Queen Amdi deploy site info", react: "💃🏻", type: "primary" }, (async (amdiWA) => {
175
+ let { sendText } = amdiWA.msgLayout
176
+
177
+ const text =
178
+ `*🌐 Queen Amdi v4 Official Website💃🏻♥️*
179
+
180
+ ✅ Deploy Website:
181
+ https://amdaniwasa.com
182
+
183
+ 👥 Official beta test group:
184
+ https://chat.whatsapp.com/Kk9FcrtGYzX1xzky4b1aCJ
185
+
186
+ 🧰 Github:
187
+ https://github.com/BlackAmda/QueenAmdi
188
+
189
+ 👨🏻‍💻 Developer:
190
+ https://github.com/BlackAmda
191
+
192
+ ᴘᴏᴡᴇʀᴇᴅ ʙʏ ᴀ.ɴ.ᴛᴇᴄʜ 🐝
193
+ `
194
+ return await sendText(text, { ExAdReply: "Default", quoted: "WhatsApp" })
195
+ }));
196
+
197
+
198
+ AMDI({ cmd: "device", desc: Lang.DEVICEDESC, type: "profile", react: "📟" }, (async (amdiWA) => {
199
+ let { checkDevice, isReply, reply, sendText, taggedJid } = amdiWA.msgLayout;
200
+
201
+ if (!isReply) return reply(Lang.NEED_REPLY);
202
+
203
+ const msgDevice = checkDevice(amdiWA.msg);
204
+ return await sendText(`*@${taggedJid.split('@')[0]} is using :* ${msgDevice} Whatsapp`, { mentionJIDS: [taggedJid], quoted: true });
205
+ }));
206
+
207
+
208
+ AMDI({ cmd: "fakerep", desc: LangFake.FAKE_REP_DESC, type: "profile", react: "☠️" }, (async (amdiWA) => {
209
+ let { allowedNumbs, input, react, replied_text, reply, sendFakeReply } = amdiWA.msgLayout;
210
+
211
+ if (!replied_text) return await reply(LangFake.NEED_FAKE, "❓");
212
+ if (!input) return await reply(LangFake.NEED_DATA, "❓");
213
+
214
+ const textMap = await fakeMsgData(input, replied_text, allowedNumbs);
215
+ if (textMap === 'OWNER_JID_DETECED!') return await reply(LangFake.OWNER_DETECTED, "❌");
216
+ if (!textMap) return await reply(LangFake.NEED_CORRECT_FORMAT, "❌");
217
+
218
+ await sendFakeReply(textMap);
219
+ return await react("✔️");
220
+ }));
221
+
222
+
223
+ AMDI({ cmd: "ss", desc: Lang.SS_DESC, type: "primary", react: "📸" }, (async (amdiWA) => {
224
+ let { footerTXT, input, isLINK, prefix, reply, sendButtonMsg, sendDocument } = amdiWA.msgLayout;
225
+
226
+ const SS_API = await getSettings('SS_API');
227
+ if (!SS_API.input) return reply(Lang.NO_SSAPI_KEY, "🗝️");
228
+
229
+ if (!input) return reply(Lang.needlink, "❓");
230
+ const isNeedFull = input.includes("full//")
231
+ if (!isLINK(isNeedFull ? input.split("full//")[1] : input)) return reply(Lang.needlink, "❓");
232
+
233
+ const captionDB = await getSettings('CAPTION')
234
+ let caption = captionDB.input == undefined ? footerTXT : captionDB.input
235
+ const ss = isNeedFull ? `https://shot.screenshotapi.net/screenshot?token=${SS_API.input}&url=${encodeURIComponent(input.split("full//")[1])}&width=1366&height=768&full_page=true&output=image&file_type=png&block_ads=true&no_cookie_banners=true&dark_mode=true&wait_for_event=networkidle` : `https://shot.screenshotapi.net/screenshot?token=${SS_API.input}&url=${encodeURIComponent(input)}&width=1366&height=768&output=image&file_type=png&block_ads=true&no_cookie_banners=true&dark_mode=true&wait_for_event=networkidle`
236
+
237
+ if (isNeedFull) return await sendDocument({ url: ss }, { mimetype: 'image/png', fileName: input.split("full//")[1], caption: caption, quoted: true });
238
+ return await sendButtonMsg([{ buttonId: `${prefix}ss full//${input}`, buttonText: { displayText: 'Full Screenshot 📸' }, type: 1 }], "*Screenshot taken!*", true, ss);
239
+ }));
@@ -0,0 +1,83 @@
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 search.js - QueenAmdi search engine features
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, apkDL_List, blackamda_API, Language, Packages } = require('queen_amdi_core/dist/scripts')
14
+ const { axios } = Packages;
15
+ const yts = require( 'yt-search' )
16
+ const Lang = Language.getString('search');
17
+
18
+ const searchTITLE = '🔎 *Queen Amdi Search Engine*'
19
+
20
+ AMDI({ cmd: ["yt", "yts", "ytsearch"], desc: Lang.YTSDESC, type: "primary", react: "🔎" }, (async (amdiWA) => {
21
+ let { footerTXT, input, react, reply } = amdiWA.msgLayout;
22
+
23
+ if (!input) return await reply(Lang.needTXT);
24
+
25
+ try {
26
+ var ytsLIST = await yts(input);
27
+ } catch {
28
+ return await reply(Lang.NOT_FOUND.format("YouTube"), "☹️", 1);
29
+ }
30
+ var ytgot = '';
31
+ ytsLIST.all.map((video) => {
32
+ ytgot += '▶️ *' + video.title + '* - ' + video.url + '\n\n'
33
+ });
34
+ await reply(`${searchTITLE}\n${Lang.YTS}\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​\n${ytgot}\n\n${footerTXT}`);
35
+ return await react("✔️", amdiWA.msg);
36
+ }));
37
+
38
+
39
+ AMDI({ cmd: ["ps", "playstore"], desc: Lang.PSDESC, type: "primary", react: "🔎" }, (async (amdiWA) => {
40
+ let { footerTXT, input, isPlaystore, prefix, react, reply, sendImage, sendListMsg } = amdiWA.msgLayout;
41
+
42
+ if (!input) return await reply(Lang.needTXT);
43
+
44
+ try {
45
+ if (input && isPlaystore(input)) {
46
+ const psAPI = await blackamda_API("playstore", `package=${input}`, amdiWA.botNumberJid);
47
+ const response = await axios.get(psAPI);
48
+ const json = response.data
49
+
50
+ if (json.status.error) return await reply("Error".fetchError([{ message: json.status.message }]), "❌", 1);
51
+
52
+ const text = `
53
+ 📚 *Name* : ${json.app_name}
54
+ 🧰 *Version* : ${json.version}
55
+ 👨🏻‍💻 *Developer* : ${json.developer}
56
+ 📲 *Installs* : ${json.installs}
57
+ 📁 *Package name* : ${json.package}
58
+ `
59
+ await sendImage({url: json.icon}, {caption: `${searchTITLE}\n${Lang.PSTORE}\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​${text}\n\n${footerTXT}`, quoted: true});
60
+ return await react("✔️", amdiWA.msg);
61
+ } else if (input) {
62
+ const psAPI = await blackamda_API("search", `platform=playstore&name=${input}`, amdiWA.botNumberJid);
63
+ const response = await axios.get(psAPI);
64
+ const json = response.data
65
+
66
+ if (json.status.error) return await reply("Error".fetchError({ message: json.status.message }), "❌", 1);
67
+
68
+ var listInfo = {}
69
+ listInfo.title = searchTITLE
70
+ listInfo.text = `\n${Lang.PSTORE}\n`
71
+ listInfo.buttonTXT = 'Select app'
72
+
73
+ const sections = apkDL_List(prefix, json.data, true);
74
+
75
+ await sendListMsg(listInfo, sections)
76
+ return await react("✔️", amdiWA.msg);
77
+ }
78
+ } catch (e) {
79
+ console.log(e);
80
+ await reply(Lang.NOT_FOUND.format("Playstore"), "☹️");
81
+ return await react("❌", amdiWA.msg);
82
+ }
83
+ }));