diff --git a/BotsApp.js b/BotsApp.js index ab31ae3..a8b4ea2 100644 --- a/BotsApp.js +++ b/BotsApp.js @@ -7,28 +7,25 @@ const chalk = require('chalk'); const wa = require('./core/helper'); const { MessageType } = require('@adiwajshing/baileys'); const Greetings = require('./database/greeting'); -const Users = require('./database/user'); const sequelize = config.DATABASE; -const adminCommands = require("./sidekick/input-sanitization").adminCommands; -const sudoCommands = require("./sidekick/input-sanitization").sudoCommands; const STRINGS = require("./lib/db"); +const Blacklist = require('./database/blacklist'); const GENERAL = STRINGS.general; // const gitPull = require('./core/gitpull'); +const clearance = require('./core/clearance'); var client = conn.WhatsApp; async function main() { - + client.logger.level = 'error'; console.log(banner); var commandHandler = new Map(); - console.log(chalk.yellowBright.bold("[INFO] Checking for updates...")); - // await gitPull(); - try{ + try { var session = conn.restoreSession(config.STRING_SESSION) client.loadAuthInfo(session) - } catch(err) { - if (err instanceof TypeError || err.message === "given authInfo is null" || err instanceof SyntaxError){ + } catch (err) { + if (err instanceof TypeError || err.message === "given authInfo is null" || err instanceof SyntaxError) { console.log( chalk.redBright.bold("Incorrect Session String. Please authenticate again using command -> "), chalk.yellowBright.bold("npm start") @@ -53,15 +50,15 @@ async function main() { client.on('open', async () => { console.log(chalk.yellowBright.bold("[INFO] Installing Plugins... Please wait.")); var moduleFiles = fs.readdirSync(join(__dirname, 'modules')).filter((file) => file.endsWith('.js')) - for(var file of moduleFiles){ - try{ + for (var file of moduleFiles) { + try { const command = require(join(__dirname, 'modules', `${file}`)); console.log( chalk.magentaBright("[INFO] Successfully imported module"), chalk.cyanBright.bold(`${file}`) ) commandHandler.set(command.name, command); - }catch(error){ + } catch (error) { console.log( chalk.blueBright.bold("[INFO] Could not import module"), chalk.redBright.bold(`${file}`) @@ -96,16 +93,16 @@ async function main() { client.on('group-participants-update', async update => { - console.log("-------------------"+ "GROUP PARTICIPANT UPDATE" + "-------------------" ); - console.log(update.participants); - console.log(update.action); - console.log(update.jid); + // console.log("-------------------" + "GROUP PARTICIPANT UPDATE" + "-------------------"); + // console.log(update.participants); + // console.log(update.action); + // console.log(update.jid); var groupId = update.jid; - try{ - if(update.action === 'add'){ - var enable = await Greetings.checkSettings(groupId,"welcome"); - if(enable === false || enable === "OFF"){ + try { + if (update.action === 'add') { + var enable = await Greetings.checkSettings(groupId, "welcome"); + if (enable === false || enable === "OFF") { return; } var Msg = await Greetings.getMessage(groupId, "welcome"); @@ -113,19 +110,19 @@ async function main() { client.sendMessage(groupId, Msg.message, MessageType.text); return; } - else if(update.action === 'remove'){ + else if (update.action === 'remove') { var enable = await Greetings.checkSettings(groupId, "goodbye"); - if(enable === false || enable === "OFF"){ + if (enable === false || enable === "OFF") { return; } var Msg = await Greetings.getMessage(groupId, "goodbye"); - + client.sendMessage(groupId, Msg.message, MessageType.text); return; } } - catch(err){ - console.log("Greeting message are off"); + catch (err) { + // console.log("Greeting message are off"); } }); @@ -138,107 +135,33 @@ async function main() { const groupMetadata = sender.endsWith("@g.us") ? await client.groupMetadata(sender) : ''; var BotsApp = wa.resolve(chat, client, groupMetadata); // console.log(BotsApp); - if(BotsApp.chatId === "917838204238-1634977991@g.us") return; - if (BotsApp.isCmd && (!BotsApp.fromMe && !BotsApp.isSenderSUDO)) { - if (config.WORK_TYPE === "public") { - if (adminCommands.indexOf(BotsApp.commandName) >= 0 && !BotsApp.isSenderGroupAdmin) { - console.log( - chalk.redBright.bold(`[INFO] admin commmand `), - chalk.greenBright.bold(`${BotsApp.commandName}`), - chalk.redBright.bold( - `not executed in public Work Type.` - ) - ); - return client.sendMessage( - BotsApp.chatId, - GENERAL.ADMIN_PERMISSION, - MessageType.text - ); - } else if (sudoCommands.indexOf(BotsApp.commandName) >= 0 && !BotsApp.isSenderSUDO) { - console.log( - chalk.redBright.bold(`[INFO] sudo commmand `), - chalk.greenBright.bold(`${BotsApp.commandName}`), - chalk.redBright.bold( - `not executed in public Work Type.` - ) - ); - var messageSent = await Users.getUser(BotsApp.chatId); - if(messageSent){ - return console.log(chalk.blueBright.bold("[INFO] Promo message had already been sent to " + BotsApp.chatId)); - } - else{ - await Users.addUser(BotsApp.chatId) - return client.sendMessage( - BotsApp.chatId, - GENERAL.SUDO_PERMISSION.format({ worktype: "public", groupName: BotsApp.groupName ? BotsApp.groupName : "private chat", commandName: BotsApp.commandName }), - MessageType.text, - { - contextInfo: { - stanzaId: chat.key.id, - participant: BotsApp.sender, - quotedMessage: { - conversation: BotsApp.body, - }, - }, - } - ); - } - - } - } - else if(config.WORK_TYPE === "private" && !BotsApp.isSenderSUDO){ - console.log( - chalk.redBright.bold(`[INFO] commmand `), - chalk.greenBright.bold(`${BotsApp.commandName}`), - chalk.redBright.bold( - `not executed in private Work Type.` - ) - ); - var messageSent = await Users.getUser(BotsApp.chatId); - if(messageSent){ - return console.log(chalk.blueBright.bold("[INFO] Promo message had already been sent to " + BotsApp.chatId)); - } - else{ - await Users.addUser(BotsApp.chatId) - return client.sendMessage( - BotsApp.chatId, - GENERAL.SUDO_PERMISSION.format({ worktype: "private", groupName: BotsApp.groupName ? BotsApp.groupName : "private chat", commandName: BotsApp.commandName }), - MessageType.text, - { - contextInfo: { - stanzaId: chat.key.id, - participant: BotsApp.sender, - quotedMessage: { - conversation: BotsApp.body, - }, - }, - } - ); - } + if (BotsApp.isCmd) { + let isBlacklist = await Blacklist.getBlacklistUser(BotsApp.sender, BotsApp.chatId); + const cleared = await clearance(BotsApp, client, isBlacklist); + if (!cleared) { + return; } - } - if(BotsApp.isCmd){ console.log(chalk.redBright.bold(`[INFO] ${BotsApp.commandName} command executed.`)); const command = commandHandler.get(BotsApp.commandName); var args = BotsApp.body.trim().split(/\s+/).slice(1); // console.log("ARGS -> " + args); // args.forEach(arg => console.log("arg -> " + arg + " type -> " + typeof(arg))); // console.log("-------------------------------------------") - if(!command){ + if (!command) { client.sendMessage(BotsApp.chatId, "```Woops, invalid command! Use``` *.help* ```to display the command list.```", MessageType.text); return; - }else if (command && BotsApp.commandName == "help"){ - try{ + } else if (command && BotsApp.commandName == "help") { + try { command.handle(client, chat, BotsApp, args, commandHandler); return; - }catch(err){ + } catch (err) { console.log(chalk.red("[ERROR] ", err)); return; } } - try{ + try { command.handle(client, chat, BotsApp, args).catch(err => console.log("[ERROR] " + err)); - }catch(err){ + } catch (err) { console.log(chalk.red("[ERROR] ", err)); } } diff --git a/CHANGELOG.md b/CHANGELOG.md index ad86a15..35c5556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,22 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] ### Added -- Disable the bot in support group #1. +- Disable the bot in support group #1 and support group #2. +- Ability to blacklist certain people / chats from using the bot in public mode. +- Generate invite link to invite people who cannot be added directly. +- Rename and resend file directly on WhatsApp. +- Create groups with the tagged person directly. +- Execute C++ code and get output directly on WhatsApp. +- Search for meaning in the dictionary for a word. +- Create QR code from text. +- Decode QR code to extract text. + +### Changed +- Removed case sensitivity issue for WORK_TYPE. +- The getdp module can now get profile pictures of a tagged person as well. +- Improved the lyrics search module. +- Make the permission check asynchronous. +- Switch back to stable version of baileys. ## [1.0.1] - 2020-11-15 ### Added diff --git a/Dockerfile b/Dockerfile index 1c3242c..7239145 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,6 @@ RUN git reset --hard origin/main RUN npm install -RUN cp -r /root/Baileys/lib /BotsApp/node_modules/@adiwajshing/baileys/ +# RUN cp -r /root/Baileys/lib /BotsApp/node_modules/@adiwajshing/baileys/ CMD [ "npm", "start"] \ No newline at end of file diff --git a/README.md b/README.md index 56b6033..bd28ebe 100644 --- a/README.md +++ b/README.md @@ -123,4 +123,7 @@ Feel free to post your queries or concerns on any of the discussion forums menti ## Copyright & License - Copyright (C) 2021 - 2022 by [BotsAppOfficial](https://github.com/BotsAppOfficial) -- Licensed under the terms by [GNU GENERAL PUBLIC LICENSE](https://github.com/BotsAppOfficial/BotsApp/blob/main/LICENSE) \ No newline at end of file +- Licensed under the terms by [GNU GENERAL PUBLIC LICENSE](https://github.com/BotsAppOfficial/BotsApp/blob/main/LICENSE) + +## Legal +This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk. \ No newline at end of file diff --git a/core/clearance.js b/core/clearance.js new file mode 100644 index 0000000..126a2aa --- /dev/null +++ b/core/clearance.js @@ -0,0 +1,108 @@ +const chalk = require('chalk'); +const config = require('../config') +const adminCommands = require("../sidekick/input-sanitization").adminCommands; +const sudoCommands = require("../sidekick/input-sanitization").sudoCommands; +const STRINGS = require("../lib/db"); +const GENERAL = STRINGS.general; +const Users = require('../database/user'); +const { MessageType } = require('@adiwajshing/baileys'); + +const clearance = async(BotsApp, client, isBlacklist) => { + if((!BotsApp.fromMe && !BotsApp.isSenderSUDO && !BotsApp.isSenderGroupAdmin) && (isBlacklist)){ + console.log(chalk.blueBright.bold(`[INFO] Blacklisted Chat or User.`)); + return false; + } + else if(BotsApp.chatId === "917838204238-1634977991@g.us" || BotsApp.chatId === "120363020858647962@g.us"){ + console.log(chalk.blueBright.bold(`[INFO] Blacklisted Chat or User.`)); + return false; + } + if (BotsApp.isCmd && (!BotsApp.fromMe && !BotsApp.isSenderSUDO)) { + if (config.WORK_TYPE.toLowerCase() === "public") { + if (adminCommands.indexOf(BotsApp.commandName) >= 0 && !BotsApp.isSenderGroupAdmin) { + console.log( + chalk.redBright.bold(`[INFO] admin commmand `), + chalk.greenBright.bold(`${BotsApp.commandName}`), + chalk.redBright.bold( + `not executed in public Work Type.` + ) + ); + await client.sendMessage( + BotsApp.chatId, + GENERAL.ADMIN_PERMISSION, + MessageType.text + ); + return false; + } else if (sudoCommands.indexOf(BotsApp.commandName) >= 0 && !BotsApp.isSenderSUDO) { + console.log( + chalk.redBright.bold(`[INFO] sudo commmand `), + chalk.greenBright.bold(`${BotsApp.commandName}`), + chalk.redBright.bold( + `not executed in public Work Type.` + ) + ); + var messageSent = await Users.getUser(BotsApp.chatId); + if(messageSent){ + console.log(chalk.blueBright.bold("[INFO] Promo message had already been sent to " + BotsApp.chatId)) + return false; + } + else{ + await client.sendMessage( + BotsApp.chatId, + GENERAL.SUDO_PERMISSION.format({ worktype: "public", groupName: BotsApp.groupName ? BotsApp.groupName : "private chat", commandName: BotsApp.commandName }), + MessageType.text, + { + contextInfo: { + stanzaId: BotsApp.chatId, + participant: BotsApp.sender, + quotedMessage: { + conversation: BotsApp.body, + }, + }, + } + ); + await Users.addUser(BotsApp.chatId) + return false; + } + + }else{ + return true; + } + } + else if(config.WORK_TYPE.toLowerCase() != "public" && !BotsApp.isSenderSUDO){ + console.log( + chalk.redBright.bold(`[INFO] commmand `), + chalk.greenBright.bold(`${BotsApp.commandName}`), + chalk.redBright.bold( + `not executed in private Work Type.` + ) + ); + var messageSent = await Users.getUser(BotsApp.chatId); + if(messageSent){ + console.log(chalk.blueBright.bold("[INFO] Promo message had already been sent to " + BotsApp.chatId)) + return false; + } + else{ + await client.sendMessage( + BotsApp.chatId, + GENERAL.SUDO_PERMISSION.format({ worktype: "private", groupName: BotsApp.groupName ? BotsApp.groupName : "private chat", commandName: BotsApp.commandName }), + MessageType.text, + { + contextInfo: { + stanzaId: BotsApp.chatId, + participant: BotsApp.sender, + quotedMessage: { + conversation: BotsApp.body, + }, + }, + } + ); + await Users.addUser(BotsApp.chatId) + return false; + } + } + }else{ + return true; + } +} + +module.exports = clearance; \ No newline at end of file diff --git a/core/gitpull.js b/core/gitpull.js index b86e9c5..79f6a19 100644 --- a/core/gitpull.js +++ b/core/gitpull.js @@ -4,6 +4,7 @@ const chalk = require('chalk'); const exec = require('child_process').exec; const gitPull = async () => { + console.log(chalk.yellowBright.bold("[INFO] Checking for updates...")); await git.fetch(); var newCommits = await git.log(['main..origin/main']) if (newCommits.total) { diff --git a/database/blacklist.js b/database/blacklist.js new file mode 100644 index 0000000..51d236c --- /dev/null +++ b/database/blacklist.js @@ -0,0 +1,87 @@ +const config = require("../config"); +const { DataTypes } = require("sequelize"); +const sequelize = config.DATABASE; + +const Blacklist = sequelize.define( + "Blacklist", + { + JID: { + type: DataTypes.STRING, + allowNull: false, + }, + GRPID: { + type: DataTypes.STRING, + allowNull: false, + }, + }, + { + tableName: "Blacklist", + } +); + +async function addBlacklistUser(jid = "", GrpId = "") { + Blacklist.findOrCreate({ + where: { + JID: jid, + GRPID: GrpId, + }, + }); +} + +async function getBlacklistUser(jid = "", GrpId = "") { + var Msg = await Blacklist.findAll({ + where: { + JID: "", + GRPID: GrpId, + }, + }); + + if (Msg.length < 1) { + var Msg = await Blacklist.findAll({ + where: { + JID: jid, + GRPID: "", + }, + }); + + if (Msg.length < 1) { + var Msg = await Blacklist.findAll({ + where: { + JID: jid, + GRPID: GrpId, + }, + }); + + if (Msg.length < 1) { + return false; + } else { + return true; + } + } else { + return true; + } + } else { + return true; + } +} + +async function removeBlacklistUser(jid = "", GrpId = "") { + var Msg = await Blacklist.findAll({ + where: { + JID: jid, + GRPID: GrpId, + }, + }); + if (Msg.length < 1) { + return false; + } else { + return await Msg[0].destroy(); + } +} + +module.exports = { + Blacklist: Blacklist, + addBlacklistUser: addBlacklistUser, + getBlacklistUser: getBlacklistUser, + removeBlacklistUser: removeBlacklistUser, +}; diff --git a/images/BotsApp_invite.jpeg b/images/BotsApp_invite.jpeg new file mode 100644 index 0000000..3bb8441 Binary files /dev/null and b/images/BotsApp_invite.jpeg differ diff --git a/images/default_dp.png b/images/default_dp.png new file mode 100644 index 0000000..f4b4a6d Binary files /dev/null and b/images/default_dp.png differ diff --git a/lib/db.js b/lib/db.js index b755eb1..de2a59e 100644 --- a/lib/db.js +++ b/lib/db.js @@ -1,289 +1,356 @@ const data = { - general: { - NUMBER_SYNTAX_ERROR: - "```Enter a valid contact number as per the syntax below:\n 1. XXXXXXXXXX\n 2. Tag the person\n 3. YYXXXXXXXXXX (YY- Country Code, without zeros)```", - MESSAGE_NOT_TAGGED: "```Tag a message or enter a number.```", - NOT_A_GROUP: "```Command only applicable in a group chat.```", - BOT_NOT_ADMIN: "```Sorry, don't have permission to do so since I am not an admin.```", - ADMIN_PERMISSION: - "```You need to be an admin to execute this command.```", - SUDO_PERMISSION: - "```Hey there, I am 💠BotsApp💠. I guess you were trying to use my commands in``` *{BotsApp.groupName}*```. However, the bot is currently in {worktype} mode. This enables only the owner and sudo users to use the command``` *{commandName}* ```.\n\nIf you are keen to use my features, you can deploy BotsApp on your own account without much effort, in less than 5 minutes! Check out the links given below.```\n\n🔗https://mybotsapp.com\n🔗https://github.com/BotsAppOfficial/BotsApp", - ERROR_TEMPLATE: - "```Looks like something went wrong. Need not worry. Here are some logs since when the bot was not responding as expected.```\n```---------```\n```🧐 Command:``` *{commandName}*\n```😎 From Me?:``` *{fromMe}*\n```🗣️ Was a reply?:``` *{isReply}*\n```👥 In a group?``` *{isGroup}*\n```📥 In Inbox?``` *{isPm}*\n```📸 Command with image?``` *{isImage}*\n```🕺🏻 Is Bot group admin?``` *{isBotGroupAdmin}*\n```📈 Was Sender group admin?``` *{isSenderGroupAdmin}*\n```🫂 Was sender sudo?``` *{isSenderSudo}*\n```⚠️ Error:``` \n*{err}*\n```---------```\n_To figure out what exactly went wrong, please report/raise the issue on our support chat at_ https://chat.whatsapp.com/C9x3AIKKwp53JNEKPPtEvp", - SUCCESSFUL_CONNECTION: "*BotsApp successfuly integrated.*\n```Bot is currently working in``` *{worktype}* ```mode.```\n```For more information regarding Bot working and permissions check out:``` \n🔗https://github.com/BotsAppOfficial/BotsApp." - }, - add: { - DESCRIPTION: "Module to add a person to a group.", - EXTENDED_DESCRIPTION: - "```Add new people to a group by entering their mobile number as per the format mentioned below.\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX ()\n\nFor example -\n``` *.add 9861212121*", - NUMBER_SYNTAX_ERROR: - "```Valid formats -\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX\n\nFor example-```\n*.add 9861212121*\n*.add 919861212121*", - NO_ARG_ERROR: - "```Enter the number you want to add.\n\nFor instance,``` *.add * .", - NO_24HR_BAN: - "```The number entered cannot be added back before 24 hours.```", - ALREADY_MEMBER: - "```The number entered is already a member of this group.```", - NOT_ON_WHATSAPP: - "```The number you're trying to add isn't available on WhatsApp.\nPlease verify the number again.```", - SUCCESS: " added successfully!" - }, - admins: { - DESCRIPTION: "Tag admins", - EXTENDED_DESCRIPTION: - "```Tag admins of a group (either as a reply to another message or a direct tag).```", - NOT_GROUP_CHAT: - "*.admins* ```command is only applicable for group chats.```" - }, - alive: { - DESCRIPTION: "Check if bot is online.", - EXTENDED_DESCRIPTION: - "```This module can be used to check if the bot is currently online or not.\n\nExample usage,```\n*.alive*", - ALIVE_MSG: "```💠 BotsApp has been integrated successfully. 💠\n\nUse the ``` *.help* ``` command to get a list of plugins that will make your WhatsApp experience much easier.\n\nIf you are impressed with my service, consider supporting the Bot on GitHub-\n```https://github.com/BotsAppOfficial/BotsApp\n\n```Check out our official website for any new updates.```" - }, - block: { - DESCRIPTION: "Block contact", - EXTENDED_DESCRIPTION: "```Add the number to blocklist. You can reply to the person in group / pm or use .block .```", - NUMBER_SYNTAX_ERROR: - "```Enter a valid contact number as per the syntax below:\n 1. XXXXXXXXXX\n 2. Tag the person\n 3. +YYXXXXXXXXXX (YY-Country Code, without zeros)```", - MESSAGE_NOT_TAGGED: "```Tag a message or enter a number to proceed.```", - NOT_BLOCK_BOT: "```Bot can not block itself```" - }, - carbon: { - DESCRIPTION: "Convert text/code to a carbon image.", - EXTENDED_DESCRIPTION: "```This module can be used to convert text/code into carbon images.\n\nExample Usage,```\n *.carbon * \n *.carbon* ```and reply to a text message.\n\nUse the -t flag after``` *.carbon* ```to get the list of themes availble.\nIn order to specify the theme, use``` *.carbon -t * .", - NO_INPUT: "```No input provided.\nPlease use the command``` *.carbon * ```or reply to a text message with``` *.carbon* ```to carbonize the text.```", - CARBONIZING: "```Converting your text into a code snippet. Please wait...```", - OUTPUT: "*<< Here's your carbon image! >>*\n```Carbonized by BotsApp\nColour Scheme: {}```", - INVALID_REPLY: "```The replied message should be text.```", - INVALID_THEME: "```Please enter a valid theme.\nDo note that theme names are``` *case sensitive*." - }, - demote: { - DESCRIPTION: "Demote a person from admin", - EXTENDED_DESCRIPTION: - "```Use this module to demote a person from admin by entering the person's mobile number. Valid Syntaxes -\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX ()\n\nFor example``` -\n*.demote 9861212121*", - NOT_A_GROUP: "```This command is only applicable for group chats.```", - BOT_NOT_ADMIN: "```Sorry, dont have the permission to do so since I am not an admin.```", - PERSON_NOT_IN_GROUP: "```Person not found.```", - MESSAGE_NOT_TAGGED: - "```Reply/tag/enter contact number of the person to be demoted.```" - }, - disappear: { - DESCRIPTION: "Toggle disappearing messages", - EXTENDED_DESCRIPTION: "```Toggle disappearing messages by using command``` *.dissapear* ." - }, - getdp: { - DESCRIPTION: "Get display picture", - EXTENDED_DESCRIPTION: "```Get the profile picture of the group in a group conversation or the profile picture of BotsApp itself in personal chat.```", - IMAGE_CAPTION: "```Here is the display image. Procured by BotsApp.```", - PROCESSING: "```Getting display picture...```", - TRY_AGAIN: "```Display picture not found. Upload an image and try again.```" - }, - github: { - DESCRIPTION: "Github Profile", - EXTENDED_DESCRIPTION: "```Get the github profile by command``` *.github * ```or replying``` *.github* .", - NO_ARG_ERROR:"```Please enter the username.```", - ERROR_MSG:"```Enter a valid username.```", - FETCHING: "```Fetching user details from GitHub. Please wait...```" - }, - help: { - DESCRIPTION: "Get the command list and info on modules", - EXTENDED_DESCRIPTION: - "This module is used to get info on other modules and their triggers.", - HEAD: "🌀 *BotsApp Menu* 🌀\n```Use .help command for detailed info on a module.```", - TEMPLATE: "\n\n🤖 *Command* - ```{}```\n💡 *Info* - ```{}```", - COMMAND_INTERFACE: "🌀 *BotsApp Command Interface* 🌀\n\n", - COMMAND_INTERFACE_TEMPLATE: "💠 *Triggers -* ```{}```\n📚 *Info -* {}", - FOOTER: "```\n\nClick on the button below to get a preview of the plugin.```" - }, - invite: { - DESCRIPTION: "Module to create group invite link", - EXTENDED_DESCRIPTION: - "```Use this module to send a group invite link in the group or personally to someone.```", - LINK_SENT: "```Invite link sent in DM, please check.```" - }, - lyrics: { - DESCRIPTION: "Module to find lyrics of song", - EXTENDED_DESCRIPTION: "```Use this module to find the lyrics of a song by using``` *.lyrics* ```command.```", - NO_ARG: "```Please enter the song name.```", - NOT_FOUND: "```Song not found !```", - PROCESSING: "```Searching. Please wait....```" - }, - mute: { - DESCRIPTION: "Mute group chat for a specified time.", - EXTENDED_DESCRIPTION: "Mute non-admin members of a group. You can even specify the duration using s, m or h.\n\nFor example:\n .mute 15 m will change chat permissions to admin-only for 15 minutes.", - NOT_GROUP_CHAT: - "*.mute* ```command is only applicable in a group chat.```", - NOT_ADMIN: - "```Sorry, dont have the permission to do so since I am not an admin.```", - CHAT_ADMIN_ONLY: "```Chat permissions changed to``` *admin only*.", - MENTION_DURATION: - "```Please mention how long you want to mute the chat. For example,```\n*.mute 10 s* ```to mute for 10 seconds.```", - CHAT_ALL_MEMBERS: - "```Chat permissions changed to``` *all group members*." - }, - neko: { - DESCRIPTION: "Copy your text to nekobin", - EXTENDED_DESCRIPTION: - "```Use this module to paste your text to a pastebin (NEKOBIN). Enter text with the command``` *.neko* .", - ENTER_TEXT: "```Please enter a text message along with the command.```", - TRY_LATER: "```Too many tries. Please try again later.```", - PROCESSING: "```Pasting text to nekobin. Please wait...```" - }, - ocr: { - DESCRIPTION: "Optical Character Recognition", - EXTENDED_DESCRIPTION: "```Use this module to obtain text from an image by``` *.ocr* ```command.```", - PROCESSING: "```Processing. Please wait...```", - ERROR_MSG:"```Please tag a valid message.```", - NO_TEXT: "Couldn't find text in the image" - }, - promote: { - DESCRIPTION: "Promote a member to admin", - EXTENDED_DESCRIPTION: - "```Use this module to promote a member to admin. You can enter the person's mobile number as per the format below. Valid Syntaxes -\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX ()\n\nFor example-\n``` *.promote 9861212121*", - NOT_A_GROUP: "```This command is only applicable in a group chat.```", - BOT_NOT_ADMIN: "```Sorry, dont have the permission to do so since I am not an admin.```", - PERSON_NOT_IN_GROUP: "```Person is not in the group.```", - MESSAGE_NOT_TAGGED: - "```Reply/tag/enter contact number of the person to be promoted.```" - }, - remove: { - DESCRIPTION: "Module to remove a person from a group.", - EXTENDED_DESCRIPTION: - "```Use this module to remove people from a group by tagging them``` *.remove @* ```or replying to them``` *.remove*.", - INPUT_ERROR: "```Reply to the person you want to remove or tag them.\n\nFor instance,``` *.remove @* ```or reply using``` *.remove*." - }, - setdp: { - DESCRIPTION: "Change the group icon", - EXTENDED_DESCRIPTION: - "```Use this module to change the group's icon. Tag image with the command or send the desired image with caption as the command```", - NOT_AN_IMAGE: "```Please reply or caption the image you want to make the group icon.```", - NOT_A_GROUP: "```This command is only applicable in a group chat.```", - ICON_CHANGED: "```Chnaging icon/group image...```" - }, - song: { - DESCRIPTION: "Download songs", - EXTENDED_DESCRIPTION: "Use this module to download audio of your choice either by specifying a YouTube link or the name of the song.", - ENTER_SONG: "```Enter song with the command```", - SONG_NOT_FOUND: "```Could not find the song you entered. Check whether the link or keyword entered is correct.```", - DOWNLOADING: "```Downloading your song...```", - UPLOADING: "```Uploading song...```", - INTRO: "" - }, - sticker: { - DESCRIPTION: "Module to convert image to sticker", - EXTENDED_DESCRIPTION: - "```Use this module to convert any image from your chat to a sticker. Reply to an image message with the command``` *.sticker* ```to convert and send that image as a sticker.```", - TAG_A_VALID_MEDIA_MESSAGE: - "```Please tag a valid image/video/gif message to convert to sticker.```", - DOWNLOADING: "```Your sticker is downloading. Please wait...```" - }, - stoi: { - DESCRIPTION: "Module to convert sticker to image", - EXTENDED_DESCRIPTION: - "```Use this module to convert any sticker from your chat to an image. Reply to a sticker message with the command``` *.stoi* ```to convert and send that sticker as an image.```", - ANIMATED_STICKER_ERROR : "```Tagged sticker message is animated, ``` *Can not convert animated sticker to image*, ```Try again with a static sticker.```", - TAG_A_VALID_STICKER_MESSAGE: - "```Please tag a valid sticker message to convert to an image.```", - DOWNLOADING: "```Your image is downloading. Please wait...```", - ERROR: "```Woops, something went wrong. Try again later, or proabaly not with this again...```" - }, - tr: { - DESCRIPTION: "Language Translator", - EXTENDED_DESCRIPTION: "```Use``` *.tr | * ```to translate text to the specified language. You can also reply to a text message with syntax``` *.tr * ```to translate text.\nIf you do not specify a language, it defaults to ```", - PROCESSING: "```Translating. Please wait...```", - TOO_LONG: "*Total characters should be less than 4000.*\n```Total characters for current input were``` ```{}.```", - LANGUAGE_NOT_SUPPORTED: "```Language is invalid.```", - INVALID_REPLY: "```Please reply to a text message.```", - SUCCESS: "*TR:* Translate [*{}* -> *{}*]\n\n{}", - NO_INPUT: "```No input was detected. Please use``` *.help tts* ```for info on how to use this module.```" - }, - tts: { - DESCRIPTION: "Text To Speech.", - EXTENDED_DESCRIPTION: "```Use``` *.tts * ```or``` *.tts | * ```to convert text to speech.\nYou can also reply to a text message with syntax``` *.tr * ```to translate text.```", - PROCESSING: "```Converting text to speech. Please wait...```", - TOO_LONG: "*Total characters should be less than 200.*\n```Total characters for current input were``` ```{}.```", - INVALID_LANG_CODE: "*The Language Code was incorrect.*\n```The Language Code is generally the first two letters of the language you're trying to convert to.```", - NO_INPUT: "```No input was detected. Please use``` *.help tts* ```for info on how to use this module.```" - }, - tagall: { - DESCRIPTION: "Module to tag evryone in a group.", - EXTENDED_DESCRIPTION: - "```Use this module to tag everyone in the group by either replying to a message or simply using``` *.tagall* ```command.```", - TAG_MESSAGE: "*Everyone!*" - }, - ud: { - DESCRIPTION: "Urban Dictionary", - EXTENDED_DESCRIPTION: "```Use this module to find the meaning of a word in Urban Dictionary. Enter``` *.ud* ```command.```", - NO_ARG: "```Please enter the word to be search.```", - NOT_FOUND: "```Term``` *{}* ```Not Found!```", - PROCESSING: "```Searching. Please wait....```" - }, - unblock: { - DESCRIPTION: "Unblock contact", - EXTENDED_DESCRIPTION: "```Remove number from the blocklist.```", - NUMBER_SYNTAX_ERROR: - "```Enter a valid contact number. Valid syntax,\n 1. XXXXXXXXXX\n 2. Tag the person\n 3. +YYXXXXXXXXXX (YY- Country Code, without zeros)```", - MESSAGE_NOT_TAGGED: "```Tag a message or enter a number.```", - NOT_UNBLOCK_BOT: "```Bot can not unblock itself```" - }, - unmute: { - DESCRIPTION: "Unmute group chat", - EXTENDED_DESCRIPTION: "Unmute non-admin members of a group", - NOT_GROUP_CHAT: - "*.unmute* ```command is only applicable for a group chat.```", - NOT_ADMIN: - "```Sorry, dont have the permissions to do so since I am not an admin.```", - CHAT_ALL_MEMBERS: - "```Chat permissions changed to``` *all group members*." - }, - weather: { - DESCRIPTION: "Get weather data of a city", - EXTENDED_DESCRIPTION: - "```Obtain weather info by entering the city name.```", - WEATHER_DATA: - "*Temperature:* {tempInC} °C | {tempInF} °F\n*Min Temp:* {minTempInC} °C | {minTempInF} °F\n*Max Temp:* {maxTempInC} °C | {maxTempInF} °F\n*Humidity:* {humidity}%\n*Wind:* {windSpeedInkmph} kmph | {windSpeedInmph} mph , {degree}°\n*Sunrise:* {sunriseTime}\n*Sunset:* {sunsetTime}\n\n\n*{weatherDescription}*\n{cityName} , {country}\n{dateAndTime}", - CITY_NAME_REQUIRED: - "```Please mention the city name to search weather data.```", - ERROR_OCCURED: - "```Woops, cannot process this request. Try again later.```", - DOWNLOADING: "```Processing data. Please wait...```", - NOT_FOUND: "```City not found. Please recheck the spelling and adhere to syntax.```" - }, - welcome: { - DESCRIPTION: "Welcome new members to the group with a custom message.", - EXTENDED_DESCRIPTION: - "```New members of a group chat will be welcomed with a message. It can be an image, video, gif with caption or just a text message.\n\nUse this module to either set, update or delete the existing message.\n\nThe welcome option can be disabled but saved using the ``` *.welcome off* ```command. In order to delete the existing message, use``` *.welcome delete*. ```Do note, the welcome option is still enabled after you use the delete option.```", - NOT_A_GROUP: "```This command is only applicable in a group chat.```", - SET_WELCOME_FIRST: "```Set a welcome message first.```", - GREETINGS_ENABLED: "```Welcome message has been enabled.```", - GREETINGS_UNENABLED: "```Welcome message has been disabled.```", - CURRENTLY_ENABLED: "```Greetings are enabled: True \nCurrently greeting new members with:```", - CURRENTLY_DISABLED: "```Greetings are enabled: False \nCurrently greeting new members with:```", - WELCOME_DELETED: "```Welcome message deleted.```", - WELCOME_UPDATED: "```Welcome message updated and enabled.```" - }, - goodbye: { - DESCRIPTION: "A goodbye message for group chat whenever someone leaves.", - EXTENDED_DESCRIPTION: - "```A goodbye message will be sent when any member leaves the group. It can be an image, video, gif with caption or just a text message.\n\nUse this module to either set, update or delete the existing message.\n\nThe goodbye option can be disabled but saved using the``` *.goodbye off* ```command. In order to delete the existing message, use``` *.goodbye delete*. ```Do note, the goodbye option is still enabled after you use the delete option.```", - NOT_A_GROUP: "```This is not a group```", - SET_GOODBYE_FIRST: "```Set a goodbye message first.```", - GREETINGS_ENABLED: "```Goodbye message has been enabled.```", - GREETINGS_UNENABLED: "```Goodbye message has been disabled.```", - CURRENTLY_ENABLED: "```Greetings are enabled: True \nCurrently greeting new members with:```", - CURRENTLY_DISABLED: "```Greetings are enabled: True \nCurrently greeting new members with:```", - GOODBYE_DELETED: "```Goodbye message deleted.```", - GOODBYE_UPDATED: "```Goodbye message updated and enabled.```" - }, - yt: { - DESCRIPTION: "Get recommendations and links from Youtube", - EXTENDED_DESCRIPTION: - "```Get the first 10 recommendations from YouTube with their authorname, timestamp and link. Mention the keywords that are required to be searched along with the command.```", - REPLY: "```Obtaining the recommendations...```", - NO_VIDEOS: "```No videos could be found.```" - } + general: { + NUMBER_SYNTAX_ERROR: + "```Enter a valid contact number as per the syntax below:\n 1. XXXXXXXXXX\n 2. Tag the person\n 3. YYXXXXXXXXXX (YY- Country Code, without zeros)```", + MESSAGE_NOT_TAGGED: "```Tag a message or enter a number.```", + NOT_A_GROUP: "```Command only applicable in a group chat.```", + BOT_NOT_ADMIN: "```Sorry, don't have permission to do so since I am not an admin.```", + ADMIN_PERMISSION: + "```You need to be an admin to execute this command.```", + SUDO_PERMISSION: + "```Hey there, I am 💠BotsApp💠. I guess you were trying to use my commands in``` *{BotsApp.groupName}*```. However, the bot is currently in {worktype} mode. This enables only the owner and sudo users to use the command``` *{commandName}* ```.\n\nIf you are keen to use my features, you can deploy BotsApp on your own account without much effort, in less than 5 minutes! Check out the links given below.```\n\n🔗https://mybotsapp.com\n🔗https://github.com/BotsAppOfficial/BotsApp", + ERROR_TEMPLATE: + "```Looks like something went wrong. Need not worry. Here are some logs since when the bot was not responding as expected.```\n```---------```\n```🧐 Command:``` *{commandName}*\n```😎 From Me?:``` *{fromMe}*\n```🗣️ Was a reply?:``` *{isReply}*\n```👥 In a group?``` *{isGroup}*\n```📥 In Inbox?``` *{isPm}*\n```📸 Command with image?``` *{isImage}*\n```🕺🏻 Is Bot group admin?``` *{isBotGroupAdmin}*\n```📈 Was Sender group admin?``` *{isSenderGroupAdmin}*\n```🫂 Was sender sudo?``` *{isSenderSudo}*\n```⚠️ Error:``` \n*{err}*\n```---------```\n_To figure out what exactly went wrong, please report/raise the issue on our support chat at_ https://chat.whatsapp.com/Gc8gNMoue2uHyd6xhFwvEP", + SUCCESSFUL_CONNECTION: "*BotsApp successfuly integrated.*\n```Bot is currently working in``` *{worktype}* ```mode.```\n```For more information regarding Bot working and permissions check out:``` \n🔗https://github.com/BotsAppOfficial/BotsApp." + }, + abl: { + DESCRIPTION: "Module to blacklist a person or a chat from using the bot.", + EXTENDED_DESCRIPTION: + "```Add people to blacklist and``` *restrict them* ```from using the bot. You can blacklist specific``` *groups* or *people in groups* or *people altogether* ```from using the bot. These are the configurations -\n\n1. If you send the command in a group``` *without replying* ```to anyone, the bot will be``` *disabled for that group.*\n```2. If you send the command in a group and``` *reply to someone*, ```they will not be able to use the bot in that``` *specific group.*\n```3. If you tag someone in a group like``` *.abl @*, ```they will not be able to use the bot in that specific group.\n4. If you send the command in``` *personal chat* ```of a person, they will be blacklisted from using the bot in``` *any group.*", + PM_ACKNOWLEDGEMENT: "```{user} banned from using the bot in all chats.```", + CAN_NOT_BLACKLIST_BOT: "```Bot cannot blacklist itself. Tag or reply to a different user.```", + GRP_ACKNOWLEDGEMENT: "```{user} has been blacklisted from using the bot in this group.```", + GRP_BAN: "```Bot has been disabled for the group {user}. For more configurations use the``` *.help abl* ```command.```" + }, + add: { + DESCRIPTION: "Module to add a person to a group.", + EXTENDED_DESCRIPTION: + "```Add new people to a group by entering their mobile number as per the format mentioned below.\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX ()\n\nFor example -\n``` *.add 9861212121*", + NUMBER_SYNTAX_ERROR: + "```Valid formats -\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX\n\nFor example-```\n*.add 9861212121*\n*.add 919861212121*", + NO_ARG_ERROR: + "```Enter the number you want to add.\n\nFor instance,``` *.add * .", + NO_24HR_BAN: + "```The number entered cannot be added back before 24 hours.```", + ALREADY_MEMBER: + "```The number entered is already a member of this group.```", + NOT_ON_WHATSAPP: + "```The number you're trying to add isn't available on WhatsApp.\nPlease verify the number again.```", + SUCCESS: " added successfully!", + PRIVACY: "```The number you're trying to add cannot be added to the group directly. An invite link has been sent to them.```" + }, + admins: { + DESCRIPTION: "Tag admins", + EXTENDED_DESCRIPTION: + "```Tag admins of a group (either as a reply to another message or a direct tag).```", + NOT_GROUP_CHAT: + "*.admins* ```command is only applicable for group chats.```" + }, + alive: { + DESCRIPTION: "Check if bot is online.", + EXTENDED_DESCRIPTION: + "```This module can be used to check if the bot is currently online or not.\n\nExample usage,```\n*.alive*", + ALIVE_MSG: "```💠 BotsApp has been integrated successfully. 💠\n\nUse the ``` *.help* ``` command to get a list of plugins that will make your WhatsApp experience much easier.\n\nIf you are impressed with my service, consider supporting the Bot on GitHub-\n```https://github.com/BotsAppOfficial/BotsApp\n\n```Check out our official website for any new updates.```" + }, + block: { + DESCRIPTION: "Block contact", + EXTENDED_DESCRIPTION: "```Add the number to blocklist. You can reply to the person in group / pm or use .block .```", + NUMBER_SYNTAX_ERROR: + "```Enter a valid contact number as per the syntax below:\n 1. XXXXXXXXXX\n 2. Tag the person\n 3. +YYXXXXXXXXXX (YY-Country Code, without zeros)```", + MESSAGE_NOT_TAGGED: "```Tag a message or enter a number to proceed.```", + NOT_BLOCK_BOT: "```Bot can not block itself```" + }, + carbon: { + DESCRIPTION: "Convert text/code to a carbon image.", + EXTENDED_DESCRIPTION: "```This module can be used to convert text/code into carbon images.\n\nExample Usage,```\n *.carbon * \n *.carbon* ```and reply to a text message.\n\nUse the -t flag after``` *.carbon* ```to get the list of themes availble.\nIn order to specify the theme, use``` *.carbon -t * .", + NO_INPUT: "```No input provided.\nPlease use the command``` *.carbon * ```or reply to a text message with``` *.carbon* ```to carbonize the text.```", + CARBONIZING: "```Converting your text into a code snippet. Please wait...```", + OUTPUT: "*<< Here's your carbon image! >>*\n```Carbonized by BotsApp\nColour Scheme: {}```", + INVALID_REPLY: "```The replied message should be text.```", + INVALID_THEME: "```Please enter a valid theme.\nDo note that theme names are``` *case sensitive*." + }, + create: { + DESCRIPTION: "Create a new group with the person replied to", + EXTENDED_DESCRIPTION: "```This module will create a new WhatsApp group and it will add the replied person in the group.", + NO_TEXT: "```Enter the name of the group```", + TAG_PERSON: "```Reply to the person that should be included in group```", + GROUP_CREATED: "```Group has been created successfully.```" + }, + cpp: { + DESCRIPTION: "Execute C++ code and directly get output to WhatsApp.", + EXTENDED_DESCRIPTION: "```Use this module to execute C++ code and get the output directly on WhatsApp. To avoid errors, try to not use input.\nIn case you want to provide input, use the``` *-i flag* ```to provide input. Check out the example for an idea.```", + NO_INPUT: "```Give some C++ code to execute. Use the``` *.help cpp* ```command to get more info on this module.```", + BOILERPLATE: "#include \nusing namespace std;\n\nint main(){\n {code}\n}", + OUTPUT_TEMPLATE: "⭐ *Output:*```\n{stdout}```\n\n⚠️ *Error:*```\n{stderr}```\n\n👨🏻‍💻 *Command:*```\n{code}```", + PROCESSING: "```Executing, please wait...```" + }, + decodeqr: { + DESCRIPTION: "Decode QR code", + EXTENDED_DESCRIPTION: "```Use this plugin to decode a QR code by simply replying to an existing QR image in the chat using``` *.decodeqr* ```or uploading a QR image with caption as``` *.decodeqr*", + INVALID_REPLY: "```Please ensure that you are replying to a QR image/sticker.```", + INVALID_INPUT: "```Invalid input. Use``` *.help decodeqr* ```for more info.```", + PROCESSING: "```Decoding. Please wait...```" + }, + demote: { + DESCRIPTION: "Demote a person from admin", + EXTENDED_DESCRIPTION: + "```Use this module to demote a person from admin by entering the person's mobile number. Valid Syntaxes -\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX ()\n\nFor example``` -\n*.demote 9861212121*", + NOT_A_GROUP: "```This command is only applicable for group chats.```", + BOT_NOT_ADMIN: "```Sorry, dont have the permission to do so since I am not an admin.```", + PERSON_NOT_IN_GROUP: "```Person not found.```", + MESSAGE_NOT_TAGGED: + "```Reply/tag/enter contact number of the person to be demoted.```" + }, + disappear: { + DESCRIPTION: "Toggle disappearing messages", + EXTENDED_DESCRIPTION: "```Toggle disappearing messages by using command``` *.dissapear* ." + }, + getdp: { + DESCRIPTION: "Get display picture", + EXTENDED_DESCRIPTION: "```Get the profile picture of the group in a group conversation or the profile picture of BotsApp itself in personal chat. Tag a person in a group to get their profile picture.```", + IMAGE_CAPTION: "```Here is the display image. Procured by BotsApp.```", + PROCESSING: "```Getting display picture...```", + TRY_AGAIN: "```Display picture not found. Upload an image and try again.```" + }, + github: { + DESCRIPTION: "Github Profile", + EXTENDED_DESCRIPTION: "```Get the github profile by command``` *.github * ```or replying``` *.github* .", + NO_ARG_ERROR: "```Please enter the username. Use the``` *.help github* ```command for more info.```", + ERROR_MSG: "```Enter a valid username.```", + FETCHING: "```Fetching user details from GitHub. Please wait...```" + }, + help: { + DESCRIPTION: "Get the command list and info on modules", + EXTENDED_DESCRIPTION: + "This module is used to get info on other modules and their triggers.", + HEAD: "🌀 *BotsApp Menu* 🌀\n```Use .help command for detailed info on a module.```", + TEMPLATE: "\n\n🤖 *Command* - ```{}```\n💡 *Info* - ```{}```", + COMMAND_INTERFACE: "🌀 *BotsApp Command Interface* 🌀\n\n", + COMMAND_INTERFACE_TEMPLATE: "💠 *Triggers -* ```{}```\n📚 *Info -* {}", + FOOTER: "```\n\nClick on the button below to get a preview of the plugin.```" + }, + invite: { + DESCRIPTION: "Module to create group invite link", + EXTENDED_DESCRIPTION: + "```Use this module to send a group invite link in the group or personally to someone.```", + LINK_SENT: "```Invite link sent in DM, please check.```" + }, + lyrics: { + DESCRIPTION: "Module to find lyrics of song", + EXTENDED_DESCRIPTION: "```Use this module to find the lyrics of a song by using``` *.lyrics* ```command.```", + NO_ARG: "```Please enter the song name.```", + NOT_FOUND: "```Song not found !```", + PROCESSING: "```Searching. Please wait....```" + }, + meaning: { + DESCRIPTION: "Find meaning of a word in dictionary.", + EXTENDED_DESCRIPTION: "Find meaning of a word in dictionary by using .meaning .", + NO_ARG: "```Please enter a word.```", + NOT_FOUND: "```Word not found in dictionary!```", + }, + mute: { + DESCRIPTION: "Mute group chat for a specified time.", + EXTENDED_DESCRIPTION: "Mute non-admin members of a group. You can even specify the duration using s, m or h.\n\nFor example:\n .mute 15 m will change chat permissions to admin-only for 15 minutes.", + NOT_GROUP_CHAT: + "*.mute* ```command is only applicable in a group chat.```", + NOT_ADMIN: + "```Sorry, dont have the permission to do so since I am not an admin.```", + CHAT_ADMIN_ONLY: "```Chat permissions changed to``` *admin only*.", + MENTION_DURATION: + "```Please mention how long you want to mute the chat. For example,```\n*.mute 10 s* ```to mute for 10 seconds.```", + CHAT_ALL_MEMBERS: + "```Chat permissions changed to``` *all group members*." + }, + neko: { + DESCRIPTION: "Copy your text to nekobin", + EXTENDED_DESCRIPTION: + "```Use this module to paste your text to a pastebin (NEKOBIN). Enter text with the command``` *.neko* .", + ENTER_TEXT: "```Please enter a text message along with the command.```", + TRY_LATER: "```Too many tries. Please try again later.```", + PROCESSING: "```Pasting text to nekobin. Please wait...```" + }, + ocr: { + DESCRIPTION: "Optical Character Recognition", + EXTENDED_DESCRIPTION: "```Use this module to obtain text from an image by``` *.ocr* ```command.```", + PROCESSING: "```Processing. Please wait...```", + ERROR_MSG: "```OCR stand for Optical Character Recognition. Reply to an image with text to get that text. Use the``` *.help ocr* ```command for more info.```", + NO_TEXT: "Couldn't find text in the image" + }, + promote: { + DESCRIPTION: "Promote a member to admin", + EXTENDED_DESCRIPTION: + "```Use this module to promote a member to admin. You can enter the person's mobile number as per the format below. Valid Syntaxes -\n 1. XXXXXXXXXX\n 2. YYXXXXXXXXXX ()\n\nFor example-\n``` *.promote 9861212121*", + NOT_A_GROUP: "```This command is only applicable in a group chat.```", + BOT_NOT_ADMIN: "```Sorry, dont have the permission to do so since I am not an admin.```", + PERSON_NOT_IN_GROUP: "```Person is not in the group.```", + MESSAGE_NOT_TAGGED: + "```Reply/tag/enter contact number of the person to be promoted.```" + }, + qr: { + DESCRIPTION: "Convert a text/image to a QR code", + EXTENDED_DESCRIPTION: + "```Use this module to convert a text into a qr code. You can either specify the text after the .qr command or reply to a message using .qr.```", + INVALID_INPUT: + "```No input provided. Specify the text to be converted to QR code after the ``` *.qr* ```command or reply to a text/image using the``` *.qr* ```command.```", + PROCESSING: "```Generating QR code. Please wait...```", + IMAGE_CAPTION: "```Here's your QR image.```", + }, + rbl: { + DESCRIPTION: "Module to enable a blacklist person or group to use the bot.", + EXTENDED_DESCRIPTION: + "```Remove people or group from blacklist. Works in a similar manner to abl. Use``` *.help abl* ```for more info.```", + PM_ACKNOWLEDGEMENT: "```{user} removed from Blacklist for all the chats.```", + GRP_ACKNOWLEDGEMENT: "```{user} has been removed from the Blacklist for this group.```", + GRP_BAN: "```Bot has been enabled for the group {user}```", + NOT_IN_BLACKLIST: "```Entry for {user} not found in the Blacklist.```", + }, + remove: { + DESCRIPTION: "Module to remove a person from a group.", + EXTENDED_DESCRIPTION: + "```Use this module to remove people from a group by tagging them``` *.remove @* ```or replying to them``` *.remove*.", + INPUT_ERROR: "```Reply to the person you want to remove or tag them.\n\nFor instance,``` *.remove @* ```or reply using``` *.remove*." + }, + rename: { + DESCRIPTION: "Module to rename a pdf or text document.", + EXTENDED_DESCRIPTION: + "```Use this module to rename documents by ```replying to them``` *.rename *.", + DOWNLOADING: "```Your document is being processed...```", + PROVIDE_NEW_NAME: "```Provide a new name for your document.```", + REPLY_TO_DOCUMENT: "```Reply to a valid document message to change it's file name.```", + ERROR: "```Woops, something went wrong. Try again later, or proabaly not with this again...```" + + }, + setdp: { + DESCRIPTION: "Change the group icon", + EXTENDED_DESCRIPTION: + "```Use this module to change the group's icon. Tag image with the command or send the desired image with caption as the command```", + NOT_AN_IMAGE: "```Please reply or caption the image you want to make the group icon.```", + NOT_A_GROUP: "```This command is only applicable in a group chat.```", + ICON_CHANGED: "```Chnaging icon/group image...```" + }, + song: { + DESCRIPTION: "Download songs", + EXTENDED_DESCRIPTION: "Use this module to download audio of your choice either by specifying a YouTube link or the name of the song.", + ENTER_SONG: "```Enter song with the command```", + SONG_NOT_FOUND: "```Could not find the song you entered. Check whether the link or keyword entered is correct.```", + DOWNLOADING: "```Downloading your song...```", + UPLOADING: "```Uploading song...```", + INTRO: "" + }, + sticker: { + DESCRIPTION: "Module to convert image to sticker", + EXTENDED_DESCRIPTION: + "```Use this module to convert any image from your chat to a sticker. Reply to an image message with the command``` *.sticker* ```to convert and send that image as a sticker.```", + TAG_A_VALID_MEDIA_MESSAGE: + "```Please tag a valid image/video/gif message to convert to sticker.```", + DOWNLOADING: "```Your sticker is downloading. Please wait...```" + }, + stoi: { + DESCRIPTION: "Module to convert sticker to image", + EXTENDED_DESCRIPTION: + "```Use this module to convert any sticker from your chat to an image. Reply to a sticker message with the command``` *.stoi* ```to convert and send that sticker as an image.```", + ANIMATED_STICKER_ERROR: "```Tagged sticker message is animated, ``` *Can not convert animated sticker to image*, ```Try again with a static sticker.```", + TAG_A_VALID_STICKER_MESSAGE: + "```Please tag a valid sticker message to convert to an image.```", + DOWNLOADING: "```Your image is downloading. Please wait...```", + ERROR: "```Woops, something went wrong. Try again later, or proabaly not with this again...```" + }, + tr: { + DESCRIPTION: "Language Translator", + EXTENDED_DESCRIPTION: "```Use``` *.tr | * ```to translate text to the specified language. You can also reply to a text message with syntax``` *.tr * ```to translate text.\nIf you do not specify a language, it defaults to ```", + PROCESSING: "```Translating. Please wait...```", + TOO_LONG: "*Total characters should be less than 4000.*\n```Total characters for current input were``` ```{}.```", + LANGUAGE_NOT_SUPPORTED: "```Language is invalid.```", + INVALID_REPLY: "```Please reply to a text message.```", + SUCCESS: "*TR:* Translate [*{}* -> *{}*]\n\n{}", + NO_INPUT: "```No input was detected. Please use``` *.help tts* ```for info on how to use this module.```" + }, + tts: { + DESCRIPTION: "Text To Speech.", + EXTENDED_DESCRIPTION: "```Use``` *.tts * ```or``` *.tts | * ```to convert text to speech.\nYou can also reply to a text message with syntax``` *.tr * ```to translate text.```", + PROCESSING: "```Converting text to speech. Please wait...```", + TOO_LONG: "*Total characters should be less than 200.*\n```Total characters for current input were``` ```{}.```", + INVALID_LANG_CODE: "*The Language Code was incorrect.*\n```The Language Code is generally the first two letters of the language you're trying to convert to.```", + NO_INPUT: "```No input was detected. Please use``` *.help tts* ```for info on how to use this module.```" + }, + tagall: { + DESCRIPTION: "Module to tag evryone in a group.", + EXTENDED_DESCRIPTION: + "```Use this module to tag everyone in the group by either replying to a message or simply using``` *.tagall* ```command.```", + TAG_MESSAGE: "*Everyone!*" + }, + ud: { + DESCRIPTION: "Urban Dictionary", + EXTENDED_DESCRIPTION: "```Use this module to find the meaning of a word in Urban Dictionary. Enter``` *.ud* ```command.```", + NO_ARG: "```Please enter the word to be search.```", + NOT_FOUND: "```Term``` *{}* ```Not Found!```", + PROCESSING: "```Searching. Please wait....```" + }, + unblock: { + DESCRIPTION: "Unblock contact", + EXTENDED_DESCRIPTION: "```Remove number from the blocklist.```", + NUMBER_SYNTAX_ERROR: + "```Enter a valid contact number. Valid syntax,\n 1. XXXXXXXXXX\n 2. Tag the person\n 3. +YYXXXXXXXXXX (YY- Country Code, without zeros)```", + MESSAGE_NOT_TAGGED: "```Tag a message or enter a number.```", + NOT_UNBLOCK_BOT: "```Bot can not unblock itself```" + }, + unmute: { + DESCRIPTION: "Unmute group chat", + EXTENDED_DESCRIPTION: "Unmute non-admin members of a group", + NOT_GROUP_CHAT: + "*.unmute* ```command is only applicable for a group chat.```", + NOT_ADMIN: + "```Sorry, dont have the permissions to do so since I am not an admin.```", + CHAT_ALL_MEMBERS: + "```Chat permissions changed to``` *all group members*." + }, + weather: { + DESCRIPTION: "Get weather data of a city", + EXTENDED_DESCRIPTION: + "```Obtain weather info by entering the city name.```", + WEATHER_DATA: + "*Temperature:* {tempInC} °C | {tempInF} °F\n*Min Temp:* {minTempInC} °C | {minTempInF} °F\n*Max Temp:* {maxTempInC} °C | {maxTempInF} °F\n*Humidity:* {humidity}%\n*Wind:* {windSpeedInkmph} kmph | {windSpeedInmph} mph , {degree}°\n*Sunrise:* {sunriseTime}\n*Sunset:* {sunsetTime}\n\n\n*{weatherDescription}*\n{cityName} , {country}\n{dateAndTime}", + CITY_NAME_REQUIRED: + "```Please mention the city name to search weather data.```", + ERROR_OCCURED: + "```Woops, cannot process this request. Try again later.```", + DOWNLOADING: "```Processing data. Please wait...```", + NOT_FOUND: "```City not found. Please recheck the spelling and adhere to syntax.```" + }, + welcome: { + DESCRIPTION: "Welcome new members to the group with a custom message.", + EXTENDED_DESCRIPTION: + "```New members of a group chat will be welcomed with a message. It can be an image, video, gif with caption or just a text message.\n\nUse this module to either set, update or delete the existing message.\n\nThe welcome option can be disabled but saved using the ``` *.welcome off* ```command. In order to delete the existing message, use``` *.welcome delete*. ```Do note, the welcome option is still enabled after you use the delete option.```", + NOT_A_GROUP: "```This command is only applicable in a group chat.```", + SET_WELCOME_FIRST: "```Set a welcome message first.```", + GREETINGS_ENABLED: "```Welcome message has been enabled.```", + GREETINGS_UNENABLED: "```Welcome message has been disabled.```", + CURRENTLY_ENABLED: "```Greetings are enabled: True \nCurrently greeting new members with:```", + CURRENTLY_DISABLED: "```Greetings are enabled: False \nCurrently greeting new members with:```", + WELCOME_DELETED: "```Welcome message deleted.```", + WELCOME_UPDATED: "```Welcome message updated and enabled.```" + }, + goodbye: { + DESCRIPTION: "A goodbye message for group chat whenever someone leaves.", + EXTENDED_DESCRIPTION: + "```A goodbye message will be sent when any member leaves the group. It can be an image, video, gif with caption or just a text message.\n\nUse this module to either set, update or delete the existing message.\n\nThe goodbye option can be disabled but saved using the``` *.goodbye off* ```command. In order to delete the existing message, use``` *.goodbye delete*. ```Do note, the goodbye option is still enabled after you use the delete option.```", + NOT_A_GROUP: "```This is not a group```", + SET_GOODBYE_FIRST: "```Set a goodbye message first.```", + GREETINGS_ENABLED: "```Goodbye message has been enabled.```", + GREETINGS_UNENABLED: "```Goodbye message has been disabled.```", + CURRENTLY_ENABLED: "```Greetings are enabled: True \nCurrently greeting new members with:```", + CURRENTLY_DISABLED: "```Greetings are enabled: True \nCurrently greeting new members with:```", + GOODBYE_DELETED: "```Goodbye message deleted.```", + GOODBYE_UPDATED: "```Goodbye message updated and enabled.```" + }, + yt: { + DESCRIPTION: "Get recommendations and links from Youtube", + EXTENDED_DESCRIPTION: + "```Get the first 10 recommendations from YouTube with their authorname, timestamp and link. Mention the keywords that are required to be searched along with the command.```", + REPLY: "```Obtaining the recommendations...```", + NO_VIDEOS: "```No videos could be found.```", + ENTER_INPUT: "```Please enter the query you want to search for. Use the``` *.help yt* ```command for more info.```" + } }; module.exports = data; diff --git a/lib/neko.js b/lib/neko.js new file mode 100644 index 0000000..32e18a9 --- /dev/null +++ b/lib/neko.js @@ -0,0 +1,75 @@ +// Disabled till fix can be found. + +// const { MessageType } = require("@adiwajshing/baileys"); +// const inputSanitization = require("../sidekick/input-sanitization"); +// const String = require("../lib/db.js"); +// const got = require("got"); +// const REPLY = String.neko; +// module.exports = { +// name: "neko", +// description: REPLY.DESCRIPTION, +// extendedDescription: REPLY.EXTENDED_DESCRIPTION, +// demo: { +// isEnabled: true, +// text: '.neko #include \nint main() \n{\n std::cout << "Hello BotsApp!"; \n return 0;\n}', +// }, +// async handle(client, chat, BotsApp, args) { +// try { +// if (args.length === 0 && !BotsApp.isReply) { +// await client.sendMessage( +// BotsApp.chatId, +// REPLY.ENTER_TEXT, +// MessageType.text +// ).catch(err => inputSanitization.handleError(err, client, BotsApp)); +// return; +// } +// const processing = await client.sendMessage( +// BotsApp.chatId, +// REPLY.PROCESSING, +// MessageType.text +// ).catch(err => inputSanitization.handleError(err, client, BotsApp)); +// if (!BotsApp.isReply) { +// var json = { +// content: BotsApp.body.replace( +// BotsApp.body[0] + BotsApp.commandName + " ", +// "" +// ), +// }; +// } else { +// var json = { +// content: BotsApp.replyMessage.replace( +// BotsApp.body[0] + BotsApp.commandName + " ", +// "" +// ), +// }; +// } +// let text = await got.post("https://nekobin.com/api/documents", { +// json, +// }); +// json = JSON.parse(text.body); +// neko_url = "https://nekobin.com/" + json.result.key; +// client.sendMessage(BotsApp.chatId, neko_url, MessageType.text).catch(err => inputSanitization.handleError(err, client, BotsApp)); +// return await client.deleteMessage(BotsApp.chatId, { +// id: processing.key.id, +// remoteJid: BotsApp.chatId, +// fromMe: true, +// }).catch(err => inputSanitization.handleError(err, client, BotsApp)); +// } catch (err) { +// if (json.result == undefined) { +// await inputSanitization.handleError( +// err, +// client, +// BotsApp, +// REPLY.TRY_LATER +// ); +// } else { +// await inputSanitization.handleError(err, client, BotsApp); +// } +// return await client.deleteMessage(BotsApp.chatId, { +// id: processing.key.id, +// remoteJid: BotsApp.chatId, +// fromMe: true, +// }).catch(err => inputSanitization.handleError(err, client, BotsApp)); +// } +// }, +// }; diff --git a/modules/abl.js b/modules/abl.js new file mode 100644 index 0000000..f6ffd5d --- /dev/null +++ b/modules/abl.js @@ -0,0 +1,95 @@ +const { MessageType } = require("@adiwajshing/baileys"); +const Strings = require("../lib/db"); +const format = require("python-format-js"); +const inputSanitization = require("../sidekick/input-sanitization"); +const abl = Strings.abl; +const Blacklist = require("../database/blacklist"); + +module.exports = { + name: "abl", + description: abl.DESCRIPTION, + extendedDescription: abl.EXTENDED_DESCRIPTION, + demo: { isEnabled: true, text: ".abl" }, + async handle(client, chat, BotsApp, args) { + try { + if (BotsApp.isPm && BotsApp.fromMe) { + let PersonToBlacklist = BotsApp.chatId; + Blacklist.addBlacklistUser(PersonToBlacklist, ""); + return client.sendMessage( + BotsApp.chatId, + abl.PM_ACKNOWLEDGEMENT.format({ + user: PersonToBlacklist.substring( + 0, + PersonToBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } else { + if (args.length > 0) { + let PersonToBlacklist = + await inputSanitization.getCleanedContact( + args, + client, + BotsApp + ); + if (PersonToBlacklist === undefined) return; + PersonToBlacklist += "@s.whatsapp.net"; + if (BotsApp.owner === PersonToBlacklist) { + return client.sendMessage( + BotsApp.chatId, + abl.CAN_NOT_BLACKLIST_BOT, + MessageType.text + ); + } + Blacklist.addBlacklistUser( + PersonToBlacklist, + BotsApp.chatId + ); + return client.sendMessage( + BotsApp.chatId, + abl.GRP_ACKNOWLEDGEMENT.format({ + user: PersonToBlacklist.substring( + 0, + PersonToBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } else if (BotsApp.isReply) { + let PersonToBlacklist = BotsApp.replyParticipant; + if (BotsApp.owner === PersonToBlacklist) { + return client.sendMessage( + BotsApp.chatId, + abl.CAN_NOT_BLACKLIST_BOT, + MessageType.text + ); + } + Blacklist.addBlacklistUser( + PersonToBlacklist, + BotsApp.chatId + ); + return client.sendMessage( + BotsApp.chatId, + abl.GRP_ACKNOWLEDGEMENT.format({ + user: PersonToBlacklist.substring( + 0, + PersonToBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } else { + Blacklist.addBlacklistUser("", BotsApp.chatId); + return client.sendMessage( + BotsApp.chatId, + abl.GRP_BAN.format({ user: BotsApp.groupName }), + MessageType.text + ); + } + } + } catch (err) { + await inputSanitization.handleError(err, client, BotsApp); + } + }, +}; diff --git a/modules/add.js b/modules/add.js index 1cb2ac6..1d5ec56 100644 --- a/modules/add.js +++ b/modules/add.js @@ -3,6 +3,8 @@ const chalk = require("chalk"); const STRINGS = require("../lib/db.js"); const ADD = STRINGS.add; const inputSanitization = require("../sidekick/input-sanitization"); +const CONFIG = require("../config") +const fs = require('fs'); module.exports = { name: "add", @@ -45,7 +47,7 @@ module.exports = { return; } if (args[0].length == 10 && !isNaN(args[0])) { - number = "91" + args[0]; + number = CONFIG.COUNTRY_CODE + args[0]; } else { number = args[0]; } @@ -73,6 +75,32 @@ module.exports = { MessageType.text ).catch(err => inputSanitization.handleError(err, client, BotsApp)); return; + } else if (response[number + "@c.us"] == 403) { + for (const index in response.participants) { + if ([number + "@c.us"] in response.participants[index]) { + var code = response.participants[index][number + "@c.us"].invite_code; + var tom = response.participants[index][number + "@c.us"].invite_code_exp; + } + } + var invite = { + caption: "```Hi! You have been invited to join this WhatsApp group by BotsApp!```\n\n🔗https://mybotsapp.com", + groupJid: BotsApp.groupId, + groupName: BotsApp.groupName, + inviteCode: code, + inviteExpiration: tom, + jpegThumbnail: fs.readFileSync('./images/BotsApp_invite.jpeg') + } + await client.sendMessage( + number + "@s.whatsapp.net", + invite, + MessageType.groupInviteMessage + ); + client.sendMessage( + BotsApp.chatId, + ADD.PRIVACY, + MessageType.text + ).catch(err => inputSanitization.handleError(err, client, BotsApp)); + return; } else if (response[number + "@c.us"] == 409) { client.sendMessage( BotsApp.chatId, @@ -83,7 +111,7 @@ module.exports = { } client.sendMessage( BotsApp.chatId, - "``` " + number + ADD.SUCCESS + "```", + "```" + number + ADD.SUCCESS + "```", MessageType.text ); } catch (err) { diff --git a/modules/cpp.js b/modules/cpp.js new file mode 100644 index 0000000..6f0c755 --- /dev/null +++ b/modules/cpp.js @@ -0,0 +1,120 @@ +const { MessageType, Mimetype } = require("@adiwajshing/baileys"); +const Strings = require("../lib/db"); +const format = require("python-format-js"); +const inputSanitization = require("../sidekick/input-sanitization"); +const CPP = Strings.cpp; +const fs = require("fs"); +const { promisify } = require('util'); +const exec = promisify(require("child_process").exec); +var execFile = require('child_process').execFile +const config = require('../config') + +module.exports = { + name: "cpp", + description: CPP.DESCRIPTION, + extendedDescription: CPP.EXTENDED_DESCRIPTION, + demo: { isEnabled: true, text: ['.cpp printf("Hello from BotsApp!");', '.cpp float x, y;\ncin >> x >> y;\ncout<<"sum of provide numbers is -> " << x + y; -i 6 0.9', '.cpp #include \nusing namespace std;\n\nint main() {\n cout << "BotsApp is the best!" << endl;\n}'] }, + async handle(client, chat, BotsApp, args) { + try { + if (args[0] == null) { + await client.sendMessage( + BotsApp.chatId, + CPP.NO_INPUT, + MessageType.text + ).catch(err => inputSanitization.handleError(err, client, BotsApp)); + return; + } + var processing = await client.sendMessage( + BotsApp.chatId, + CPP.PROCESSING, + MessageType.text + ) + var body = BotsApp.body.replace( + BotsApp.body[0] + BotsApp.commandName + " ", + "" + ); + try{ + var text = body.split("-i") + var code = text[0] + var input = text[1].substring(1) + + }catch(err){ + var code = body; + } + var cpp = "" + if (!(/main\(/g.test(code))) { + cpp = CPP.BOILERPLATE.replace("{code}", code); + } else { + cpp = code; + } + fs.writeFileSync('./tmp/cpp-botsapp.cpp', cpp); + var out = { + stderr: 'N/A', + stdout: 'N/A', + code: cpp + } + var compile = "g++ ./tmp/cpp-botsapp.cpp -o ./tmp/cppBotsApp.out" + var execute = "env -i ./tmp/cppBotsApp.out" + try { + await exec(compile) + var child = execFile("env -i ./tmp/cppBotsApp.out", [], {shell: true}, + async function (error, stdout, stderr) { + if(stdout){ + out.stdout = stdout + } + if(stderr){ + out.stderr = stderr + }else if(error){ + if(error.code == null){ + out.stderr = "Execution timed out (10 seconds). Please make sure that the input has been provided and is in correct order. Use the``` *.help cpp* ```command for more info!" + }else{ + out.stderr = error + } + out.stdout = "N/A" + } + await client.sendMessage( + BotsApp.chatId, + CPP.OUTPUT_TEMPLATE.format(out), + MessageType.text + ) + await client.deleteMessage(BotsApp.chatId, { + id: processing.key.id, + remoteJid: BotsApp.chatId, + fromMe: true, + }) + } + ); + if(input){ + child.stdin.setEncoding('utf-8'); + child.stdin.write(input + "\n"); + out.code += "\n\nWith Input - " + input + } + } catch (err) { + out.stderr = err.stderr + await client.sendMessage( + BotsApp.chatId, + CPP.OUTPUT_TEMPLATE.format(out), + MessageType.text + ) + return await client.deleteMessage(BotsApp.chatId, { + id: processing.key.id, + remoteJid: BotsApp.chatId, + fromMe: true, + }) + } + setTimeout(() => { + try{ + child.kill(); // Does not terminate the Node.js process in the shell. + inputSanitization.deleteFiles( + "./tmp/cppBotsApp.out", + "./tmp/cpp-botsapp.cpp" + ); + }catch(err){ + // Do nothing lmao + } + }, 10000); + } catch (err) { + await inputSanitization.handleError(err, client, BotsApp); + } + } +}; diff --git a/modules/create.js b/modules/create.js new file mode 100644 index 0000000..d517152 --- /dev/null +++ b/modules/create.js @@ -0,0 +1,46 @@ +const { MessageType, Mimetype } = require("@adiwajshing/baileys"); +const chalk = require("chalk"); +const inputSanitization = require("../sidekick/input-sanitization"); +const strings = require("../lib/db") +const CREATE = strings.create; + +module.exports = { + name: "create", + description: CREATE.DESCRIPTION, + extendedDescription: CREATE.EXTENDED_DESCRIPTION, + demo: { isEnabled: false }, + async handle(client, chat, BotsApp, args) { + try{ + if(args.length === 0) { + client.sendMessage(BotsApp.chatId, CREATE.NO_TEXT, MessageType.text); + return; + } + let nameOfTheGrp = + BotsApp.body.replace( + BotsApp.body[0] + BotsApp.commandName + " ", + "" + ); + + if(BotsApp.isPm) { + const group = await client.groupCreate (nameOfTheGrp, [BotsApp.owner, BotsApp.sender]); + client.sendMessage(BotsApp.chatId, CREATE.GROUP_CREATED, MessageType.text); + return; + } + else { + if(BotsApp.isReply){ + const group = await client.groupCreate (nameOfTheGrp, [BotsApp.sender, BotsApp.replyParticipant]); + client.sendMessage(BotsApp.chatId, CREATE.GROUP_CREATED, MessageType.text); + return; + } + else { + client.sendMessage(BotsApp.chatId, CREATE.TAG_PERSON, MessageType.text); + return; + } + } + } + + catch(err) { + await inputSanitization.handleError(err, client, BotsApp); + } + } +} \ No newline at end of file diff --git a/modules/decodeqr.js b/modules/decodeqr.js new file mode 100644 index 0000000..4a0a60d --- /dev/null +++ b/modules/decodeqr.js @@ -0,0 +1,140 @@ +const { MessageType } = require("@adiwajshing/baileys"); +const Jimp = require("jimp"); +const fs = require("fs"); +const ffmpeg = require("fluent-ffmpeg"); +const { JSDOM } = require("jsdom"); +const { window } = new JSDOM(); +const inputSanitization = require("../sidekick/input-sanitization"); +const qrCode = require("qrcode-reader"); +const Strings = require("../lib/db"); +const DECODE = Strings.decodeqr; + +module.exports = { + name: "dqr", + description: DECODE.DESCRIPTION, + extendedDescription: DECODE.EXTENDED_DESCRIPTION, + demo: { isEnabled: false }, + + async handle(client, chat, BotsApp, args) { + var startTime = window.performance.now(); + + var processing, filePath; + + // Function to convert qr to text + const qrToText = async (imagePath, processing) => { + var buffer = fs.readFileSync(imagePath); + Jimp.read(buffer, function (err, image) { + if (err) { + console.error(err); + } + let qrcode = new qrCode(); + qrcode.callback = async function (err, value) { + if (err) { + console.error(err); + } else { + // Printing the decrypted value + console.log(value.result); + await client + .sendMessage(BotsApp.chatId, value.result, MessageType.text) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + } + }; + + // Decoding the QR code + qrcode.decode(image.bitmap); + }); + + //Image and message deletion + await inputSanitization.deleteFiles(imagePath); + return await client + .deleteMessage(BotsApp.chatId, { + id: processing.key.id, + remoteJid: BotsApp.chatId, + fromMe: true, + }) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + }; + + // Function to convert sticker to image + const convertToImage = async (stickerId, replyChat, processing) => { + const fileName = "./tmp/convert_to_image-" + stickerId; + const filePath = await client + .downloadAndSaveMediaMessage(replyChat, fileName) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + const imagePath = "./tmp/image-" + stickerId + ".png"; + + try { + ffmpeg(filePath) + .save(imagePath) + .on("error", async function (err, stdout, stderr) { + inputSanitization.deleteFiles(filePath); + inputSanitization.performanceTime(startTime); + throw err; + }) + .on("end", async () => { + inputSanitization.deleteFiles(filePath); + inputSanitization.performanceTime(startTime); + qrToText(imagePath, processing); + }); + + } catch (err) { + await inputSanitization.handleError(err, client, BotsApp); + } + }; + + try { + if (BotsApp.isReply && (BotsApp.isReplyAudio || BotsApp.isReplyVideo || BotsApp.isReplyAnimatedSticker)) { + + await client + .sendMessage(BotsApp.chatId, DECODE.INVALID_REPLY, MessageType.text) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + inputSanitization.performanceTime(startTime); + return; + + } else if (BotsApp.isReplySticker) { + + processing = await client + .sendMessage(BotsApp.chatId, DECODE.PROCESSING, MessageType.text) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + var replyChatObject = { + message: chat.message.extendedTextMessage.contextInfo.quotedMessage, + }; + var stickerId = chat.message.extendedTextMessage.contextInfo.stanzaId; + filePath = await convertToImage(stickerId, replyChatObject, processing); + + } else if (BotsApp.isReplyImage) { + + processing = await client + .sendMessage(BotsApp.chatId, DECODE.PROCESSING, MessageType.text) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + var imageId = chat.key.id; + const fileName = "./tmp/qr_pic" + imageId; + filePath = await client + .downloadAndSaveMediaMessage( + { + message: + chat.message.extendedTextMessage.contextInfo.quotedMessage, + }, + fileName + ) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + + qrToText(filePath, processing); + + } else if (!BotsApp.isImage) { + + await client + .sendMessage(BotsApp.chatId, DECODE.INVALID_INPUT, MessageType.text) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + inputSanitization.performanceTime(startTime); + return; + + } + + } catch (err) { + await inputSanitization.handleError(err, client, BotsApp); + } + }, +}; diff --git a/modules/getdp.js b/modules/getdp.js index fe3bb96..885f618 100644 --- a/modules/getdp.js +++ b/modules/getdp.js @@ -1,53 +1,53 @@ const { MessageType, Mimetype } = require("@adiwajshing/baileys"); const inputSanitization = require("../sidekick/input-sanitization"); +const chalk = require("chalk"); +const fs = require("fs"); const Strings = require("../lib/db"); const GETDP = Strings.getdp; module.exports = { - name: "getdp", - description: GETDP.DESCRIPTION, - extendedDescription: GETDP.EXTENDED_DESCRIPTION, - demo: { isEnabled: true, text: ".getdp" }, - async handle(client, chat, BotsApp, args) { - const processing = await client.sendMessage( - BotsApp.chatId, - GETDP.PROCESSING, - MessageType.text - ); - try { - let url = await client.getProfilePicture(BotsApp.chatId); - await client.sendMessage( - BotsApp.chatId, - { url: url }, - MessageType.image, - { - mimetype: Mimetype.png, - caption: GETDP.IMAGE_CAPTION, - thumbnail: null, - } - ); - return client.deleteMessage(BotsApp.chatId, { - id: processing.key.id, - remoteJid: BotsApp.chatId, - fromMe: true, - }); - } catch (err) { - if (err.status == 404) { - await inputSanitization.handleError( - err, - client, - BotsApp, - GETDP.TRY_AGAIN - ); - } else { - await inputSanitization.handleError(err, client, BotsApp); - } + name: "getdp", + description: GETDP.DESCRIPTION, + extendedDescription: GETDP.EXTENDED_DESCRIPTION, + demo: { isEnabled: true, text: ".getdp" }, + async handle(client, chat, BotsApp, args) { + try { + let url; + if (!args[0]) { + url = await client.getProfilePicture(BotsApp.chatId); + } else { + let jid = args[0].split("@")[1] + "@s.whatsapp.net"; + url = await client.getProfilePicture(jid); + } - return client.deleteMessage(BotsApp.chatId, { - id: processing.key.id, - remoteJid: BotsApp.chatId, - fromMe: true, - }); + await client.sendMessage( + BotsApp.chatId, + { url: url }, + MessageType.image, + { + mimetype: Mimetype.png, + caption: GETDP.IMAGE_CAPTION, + thumbnail: null, } - }, + ); + return + } catch (err) { + if (err.status == 404) { + await client.sendMessage( + BotsApp.chatId, + fs.readFileSync("./images/default_dp.png"), + MessageType.image, + { + mimetype: Mimetype.png, + caption: "```This is the display picture visible to me. :P```", + thumbnail: null, + } + ); + } else { + await inputSanitization.handleError(err, client, BotsApp); + } + + return + } + }, }; diff --git a/modules/lyrics.js b/modules/lyrics.js index df80ad3..1c51aaa 100644 --- a/modules/lyrics.js +++ b/modules/lyrics.js @@ -2,12 +2,13 @@ const got = require("got"); const { MessageType, Mimetype } = require("@adiwajshing/baileys"); const inputSanitization = require("../sidekick/input-sanitization"); const STRINGS = require("../lib/db"); +const songlyrics = require("songlyrics").default; module.exports = { name: "lyrics", description: STRINGS.lyrics.DESCRIPTION, extendedDescription: STRINGS.lyrics.EXTENDED_DESCRIPTION, - demo: { isEnabled: true, text: ".lyrics love nwantiti" }, + demo: { isEnabled: true, text: ".lyrics Stairway to heaven" }, async handle(client, chat, BotsApp, args) { const processing = await client.sendMessage( BotsApp.chatId, @@ -61,17 +62,35 @@ module.exports = { }); // return; } catch (err) { - await inputSanitization.handleError( - err, - client, - BotsApp, - STRINGS.lyrics.NOT_FOUND - ); - return await client.deleteMessage(BotsApp.chatId, { - id: processing.key.id, - remoteJid: BotsApp.chatId, - fromMe: true, - }); + try{ + let data = await songlyrics(song) + let caption = + "*Title :* " + + song + + "\n*Source :* " + + data.source.link + + "\n*Lyrics :*\n" + + data.lyrics; + + await client.sendMessage(BotsApp.chatId, caption, MessageType.text); + await client.deleteMessage(BotsApp.chatId, { + id: processing.key.id, + remoteJid: BotsApp.chatId, + fromMe: true, + }); + }catch(err){ + await inputSanitization.handleError( + err, + client, + BotsApp, + STRINGS.lyrics.NOT_FOUND + ); + return await client.deleteMessage(BotsApp.chatId, { + id: processing.key.id, + remoteJid: BotsApp.chatId, + fromMe: true, + }); + } } }, }; diff --git a/modules/meaning.js b/modules/meaning.js new file mode 100644 index 0000000..c99a102 --- /dev/null +++ b/modules/meaning.js @@ -0,0 +1,59 @@ +const {MessageType} = require("@adiwajshing/baileys"); +const Strings = require("../lib/db"); +const inputSanitization = require("../sidekick/input-sanitization"); +const MEANING = Strings.meaning; +const googleDictionaryApi = require("google-dictionary-api"); + +module.exports = { + name: "meaning", + description: MEANING.DESCRIPTION, + extendedDescription: MEANING.EXTENDED_DESCRIPTION, + demo: {isEnabled: true, text: ".meaning meaning"}, + async handle(client, chat, BotsApp, args) { + try { + var word = ""; + if (BotsApp.isReply) { + word = BotsApp.replyMessage; + } else if (args.length === 0) { + client.sendMessage( + BotsApp.chatId, + MEANING.NO_ARG, + MessageType.text + ); + return; + } else { + word = args.join(" "); + } + googleDictionaryApi + .search(word) + .then((results) => { + let mean = ""; + for(let key in results[0].meaning){ + mean += "\n\n" + mean += "*[" + key + "]* : " + mean += results[0].meaning[key][0].definition + } + const msg = + "*Word :* " + results[0].word + "\n\n*Meaning :*" + mean; + client + .sendMessage(BotsApp.chatId, msg, MessageType.text) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + }) + .catch(() => { + client + .sendMessage( + BotsApp.chatId, + MEANING.NOT_FOUND.format(word), + MessageType.text + ) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + }); + } catch (err) { + await inputSanitization.handleError(err, client, BotsApp); + } + }, +}; diff --git a/modules/neko.js b/modules/neko.js deleted file mode 100644 index 9899b7e..0000000 --- a/modules/neko.js +++ /dev/null @@ -1,73 +0,0 @@ -const { MessageType } = require("@adiwajshing/baileys"); -const inputSanitization = require("../sidekick/input-sanitization"); -const String = require("../lib/db.js"); -const got = require("got"); -const REPLY = String.neko; -module.exports = { - name: "neko", - description: REPLY.DESCRIPTION, - extendedDescription: REPLY.EXTENDED_DESCRIPTION, - demo: { - isEnabled: true, - text: '.neko #include \nint main() \n{\n std::cout << "Hello BotsApp!"; \n return 0;\n}', - }, - async handle(client, chat, BotsApp, args) { - try { - if (args.length === 0 && !BotsApp.isReply) { - await client.sendMessage( - BotsApp.chatId, - REPLY.ENTER_TEXT, - MessageType.text - ).catch(err => inputSanitization.handleError(err, client, BotsApp)); - return; - } - const processing = await client.sendMessage( - BotsApp.chatId, - REPLY.PROCESSING, - MessageType.text - ).catch(err => inputSanitization.handleError(err, client, BotsApp)); - if (!BotsApp.isReply) { - var json = { - content: BotsApp.body.replace( - BotsApp.body[0] + BotsApp.commandName + " ", - "" - ), - }; - } else { - var json = { - content: BotsApp.replyMessage.replace( - BotsApp.body[0] + BotsApp.commandName + " ", - "" - ), - }; - } - let text = await got.post("https://nekobin.com/api/documents", { - json, - }); - json = JSON.parse(text.body); - neko_url = "https://nekobin.com/" + json.result.key; - client.sendMessage(BotsApp.chatId, neko_url, MessageType.text).catch(err => inputSanitization.handleError(err, client, BotsApp)); - return await client.deleteMessage(BotsApp.chatId, { - id: processing.key.id, - remoteJid: BotsApp.chatId, - fromMe: true, - }).catch(err => inputSanitization.handleError(err, client, BotsApp)); - } catch (err) { - if (json.result == undefined) { - await inputSanitization.handleError( - err, - client, - BotsApp, - REPLY.TRY_LATER - ); - } else { - await inputSanitization.handleError(err, client, BotsApp); - } - return await client.deleteMessage(BotsApp.chatId, { - id: processing.key.id, - remoteJid: BotsApp.chatId, - fromMe: true, - }).catch(err => inputSanitization.handleError(err, client, BotsApp)); - } - }, -}; diff --git a/modules/qr.js b/modules/qr.js new file mode 100644 index 0000000..001e323 --- /dev/null +++ b/modules/qr.js @@ -0,0 +1,81 @@ +const { MessageType, Mimetype } = require("@adiwajshing/baileys"); +const inputSanitization = require("../sidekick/input-sanitization"); +const Strings = require("../lib/db"); +const QR = Strings.qr; +const { Encoder, QRByte, ErrorCorrectionLevel } = require("@nuintun/qrcode"); +const fs = require("fs"); + +module.exports = { + name: "qr", + description: QR.DESCRIPTION, + extendedDescription: QR.EXTENDED_DESCRIPTION, + demo: { isEnabled: true, text: ".qr Hey, I am BotsApp." }, + async handle(client, chat, BotsApp, args) { + try { + if (args.length === 0 && !BotsApp.isReply) { + await client + .sendMessage(BotsApp.chatId, QR.INVALID_INPUT, MessageType.text) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + return; + } + + const processing = await client + .sendMessage(BotsApp.chatId, QR.PROCESSING, MessageType.text) + .catch((err) => inputSanitization.handleError(err, client, BotsApp)); + + let message; + if (!BotsApp.isReply) { + message = args.join(" "); + } else { + message = BotsApp.replyMessage; + } + + const qrcode = new Encoder(); + + qrcode.setEncodingHint(true); + qrcode.setErrorCorrectionLevel(ErrorCorrectionLevel.Q); + qrcode.write(new QRByte(message)); + qrcode.make(); + const output = qrcode.toDataURL().split(",")[1]; + + const imagePath = "./tmp/qr.png"; + fs.writeFileSync( + imagePath, + output, + { encoding: "base64" }, + function (err) { + if (err) { + console.log(err); + } + } + ); + + await client.sendMessage( + BotsApp.chatId, + fs.readFileSync(imagePath), + MessageType.image, + { + mimetype: Mimetype.png, + caption: QR.IMAGE_CAPTION, + }).catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + + inputSanitization.deleteFiles(imagePath); + + await client + .deleteMessage(BotsApp.chatId, { + id: processing.key.id, + remoteJid: BotsApp.chatId, + fromMe: true, + }) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + return; + + } catch (err) { + await inputSanitization.handleError(err, client, BotsApp); + } + } +}; diff --git a/modules/rbl.js b/modules/rbl.js new file mode 100644 index 0000000..af544b8 --- /dev/null +++ b/modules/rbl.js @@ -0,0 +1,144 @@ +const { MessageType } = require("@adiwajshing/baileys"); +const Strings = require("../lib/db"); +const format = require("python-format-js"); +const inputSanitization = require("../sidekick/input-sanitization"); +const rbl = Strings.rbl; +const Blacklist = require("../database/blacklist"); + +module.exports = { + name: "rbl", + description: rbl.DESCRIPTION, + extendedDescription: rbl.EXTENDED_DESCRIPTION, + demo: { isEnabled: true, text: ".rbl" }, + async handle(client, chat, BotsApp, args) { + try { + if (BotsApp.isPm && BotsApp.fromMe) { + let PersonToRemoveFromBlacklist = BotsApp.chatId; + if ( + !(await Blacklist.getBlacklistUser( + PersonToRemoveFromBlacklist, + "" + )) + ) { + return client.sendMessage( + BotsApp.chatId, + rbl.NOT_IN_BLACKLISTformat({ + user: PersonToRemoveFromBlacklist.substring( + 0, + PersonToRemoveFromBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } + Blacklist.removeBlacklistUser(PersonToRemoveFromBlacklist, ""); + return client.sendMessage( + BotsApp.chatId, + rbl.PM_ACKNOWLEDGEMENT.format({ + user: PersonToRemoveFromBlacklist.substring( + 0, + PersonToRemoveFromBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } else { + if (args.length > 0) { + let PersonToRemoveFromBlacklist = + await inputSanitization.getCleanedContact( + args, + client, + BotsApp + ); + + if (PersonToRemoveFromBlacklist === undefined) return; + PersonToRemoveFromBlacklist += "@s.whatsapp.net"; + if ( + !(await Blacklist.getBlacklistUser( + PersonToRemoveFromBlacklist, + BotsApp.chatId + )) + ) { + return client.sendMessage( + BotsApp.chatId, + rbl.NOT_IN_BLACKLIST.format({ + user: PersonToRemoveFromBlacklist.substring( + 0, + PersonToRemoveFromBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } + Blacklist.removeBlacklistUser( + PersonToRemoveFromBlacklist, + BotsApp.chatId + ); + return client.sendMessage( + BotsApp.chatId, + rbl.GRP_ACKNOWLEDGEMENT.format({ + user: PersonToRemoveFromBlacklist.substring( + 0, + PersonToRemoveFromBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } else if (BotsApp.isReply) { + let PersonToRemoveFromBlacklist = BotsApp.replyParticipant; + if ( + !(await Blacklist.getBlacklistUser( + PersonToRemoveFromBlacklist, + BotsApp.chatId + )) + ) { + return client.sendMessage( + BotsApp.chatId, + rbl.NOT_IN_BLACKLIST.format({ + user: PersonToRemoveFromBlacklist.substring( + 0, + PersonToRemoveFromBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } + Blacklist.removeBlacklistUser( + PersonToRemoveFromBlacklist, + BotsApp.chatId + ); + return client.sendMessage( + BotsApp.chatId, + rbl.GRP_ACKNOWLEDGEMENT.format({ + user: PersonToRemoveFromBlacklist.substring( + 0, + PersonToRemoveFromBlacklist.indexOf("@") + ), + }), + MessageType.text + ); + } else { + if ( + !(await Blacklist.getBlacklistUser("", BotsApp.chatId)) + ) { + return client.sendMessage( + BotsApp.chatId, + rbl.NOT_IN_BLACKLIST.format({ + user: BotsApp.groupName, + }), + MessageType.text + ); + } + Blacklist.removeBlacklistUser("", BotsApp.chatId); + return client.sendMessage( + BotsApp.chatId, + rbl.GRP_BAN.format({ user: BotsApp.groupName }), + MessageType.text + ); + } + } + } catch (err) { + await inputSanitization.handleError(err, client, BotsApp); + } + }, +}; diff --git a/modules/rename.js b/modules/rename.js new file mode 100644 index 0000000..7f8a56a --- /dev/null +++ b/modules/rename.js @@ -0,0 +1,109 @@ +const { MessageType, Mimetype } = require("@adiwajshing/baileys"); +const ffmpeg = require("fluent-ffmpeg"); +const fs = require("fs"); +const inputSanitization = require("../sidekick/input-sanitization"); +const { JSDOM } = require("jsdom"); +const { window } = new JSDOM(); +const Strings = require("../lib/db"); +const rename = Strings.rename; + +module.exports = { + name: "rename", + description: rename.DESCRIPTION, + extendedDescription: rename.EXTENDED_DESCRIPTION, + demo: { isEnabled: false }, + async handle(client, chat, BotsApp, args) { + // Task starts here + try { + var startTime = window.performance.now(); + + // Function to convert media to sticker + const changeName = async ( + replyChat, + mediaType, + mimetype, + title + ) => { + mediaType = mediaType.substring( + 0, + mediaType.indexOf("Message") + ); + var downloading = await client + .sendMessage( + BotsApp.chatId, + rename.DOWNLOADING, + MessageType.text + ) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + const updatedName = args.join(" "); + const fileName = "./tmp/" + updatedName; + const filePath = await client + .downloadAndSaveMediaMessage(replyChat, fileName) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + var endTime = window.performance.now(); + const time = (endTime - startTime) / 1000; + await client + .sendMessage( + BotsApp.chatId, + fs.readFileSync(filePath), + MessageType.document, + { + mimetype: mimetype, + thumbnail: null, + filename: updatedName, + caption: `BotsApp changed file name from ${title} to ${updatedName} in ${time} second(s).`, + } + ) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + inputSanitization.deleteFiles(filePath); + inputSanitization.performanceTime(startTime); + return client + .deleteMessage(BotsApp.chatId, { + id: downloading.key.id, + remoteJid: BotsApp.chatId, + fromMe: true, + }) + .catch((err) => + inputSanitization.handleError(err, client, BotsApp) + ); + }; + if (BotsApp.isReply) { + if (args.length < 1) { + return client.sendMessage( + BotsApp.chatId, + rename.PROVIDE_NEW_NAME, + MessageType.text + ); + } + let replyChat = { + message: + chat.message.extendedTextMessage.contextInfo + .quotedMessage, + }; + let mediaType = Object.keys(replyChat.message)[0]; + let title = replyChat.message[mediaType].title; + let mimetype = replyChat.message[mediaType].mimetype; + changeName(replyChat, mediaType, mimetype, title); + } else { + return client.sendMessage( + BotsApp.chatId, + rename.REPLY_TO_DOCUMENT, + MessageType.text + ); + } + } catch (err) { + await inputSanitization.handleError( + err, + client, + BotsApp, + rename.ERROR + ); + } + }, +}; diff --git a/modules/yt.js b/modules/yt.js index 602a8b4..fc126f0 100644 --- a/modules/yt.js +++ b/modules/yt.js @@ -8,9 +8,17 @@ module.exports = { name: "yt", description: YT.DESCRIPTION, extendedDescription: YT.EXTENDED_DESCRIPTION, - demo: { isEnabled: true, text: ".yt Boston Dynamics Atlas" }, + demo: { isEnabled: true, text: ".yt BotsApp Deployment Tutorial" }, async handle(client, chat, BotsApp, args) { try { + if(args.length === 0){ + await client.sendMessage( + BotsApp.chatId, + YT.ENTER_INPUT, + MessageType.text + ).catch(err => inputSanitization.handleError(err, client, BotsApp)); + return; + } const keyword = await yts(args.join(" ")); const videos = keyword.videos.slice(0, 10); var topRequests = ""; @@ -49,7 +57,11 @@ module.exports = { fromMe: true, }); } catch (err) { - inputSanitization.handleError(err, client, BotsApp, YT.NO_VIDEOS); + await client.sendMessage( + BotsApp.chatId, + YT.NO_VIDEOS, + MessageType.text + ).catch(err => inputSanitization.handleError(err, client, BotsApp)); await client.deleteMessage(BotsApp.chatId, { id: reply.key.id, remoteJid: BotsApp.chatId, diff --git a/package.json b/package.json index 160c3e0..feb4e10 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,13 @@ "author": "Prince Mendiratta", "license": "ISC", "dependencies": { - "@adiwajshing/baileys": "github:adiwajshing/baileys", + "@adiwajshing/baileys": "^3.5.3", + "@nuintun/qrcode": "^3.0.1", "@vitalets/google-translate-api": "^7.0.0", "chalk": "^4.1.1", "dotenv": "^10.0.0", "fluent-ffmpeg": "^2.1.2", + "google-dictionary-api": "^1.0.8", "google-search-results-nodejs": "^2.0.1", "google-tts-api": "^2.0.2", "got": "^11.8.2", @@ -22,8 +24,10 @@ "ocr-space-api-wrapper": "^1.0.6", "pg": "^8.7.1", "python-format-js": "^1.3.9", + "qrcode-reader": "^1.0.4", "sequelize": "^6.7.0", "simple-git": "^2.47.0", + "songlyrics": "^2.2.4", "sqlite3": "^5.0.2", "unofficial-carbon-now": "^1.0.3", "urban-dictionary": "^3.0.2", diff --git a/sidekick/input-sanitization.js b/sidekick/input-sanitization.js index f73ab7d..623f670 100644 --- a/sidekick/input-sanitization.js +++ b/sidekick/input-sanitization.js @@ -18,7 +18,7 @@ exports.getCleanedContact = async (args,client,BotsApp) => { } else { client.sendMessage(BotsApp.chatId,"*Enter valid contact number.* Approved Syntax:\n```1. XXXXXXXXXX``` \n```2. Tag the person``` \n```3. +(YYY)XXXXXXXXXX.``` \n_(YY- Country Code, without zeros)_",MessageType.text); - return; + return undefined; } } else { jidNumber = args[0]; @@ -30,7 +30,7 @@ exports.getCleanedContact = async (args,client,BotsApp) => { "*Enter valid contact number.* Approved Syntax:\n```1. XXXXXXXXXX``` \n```2. Tag the person``` \n```3. +(YYY)XXXXXXXXXX.``` \n_(YY- Country Code, without zeros)_", MessageType.text ); - return; + return undefined; } else if (jidNumber.length === 10) { jidNumber = countryCode + jidNumber; @@ -109,7 +109,9 @@ exports.adminCommands = [ "disappear", "goodbye", "setdp", - "tagall" + "tagall", + "abl", + "rbl" ]; exports.sudoCommands = ["block", "unblock"];