├── .env.example ├── .gitignore ├── .prettierrc.json ├── .replit ├── .vscode └── settings.json ├── Dockerfile ├── LICENSE ├── MongoDB_Guide.md ├── Procfile ├── README.md ├── app.json ├── package-lock.json ├── package.json ├── replit.nix └── src ├── Commands ├── Dev │ ├── ban.js │ ├── broadcast.js │ ├── eval.js │ ├── join.js │ ├── leave.js │ ├── restart.js │ ├── unban.js │ └── update.js ├── Fun │ ├── advice.js │ ├── checkuser.js │ ├── fact.js │ ├── meme.js │ ├── quote.js │ ├── reaction.js │ ├── ship.js │ └── truth_dare.js ├── General │ ├── delete.js │ ├── help.js │ ├── info.js │ ├── leaderboard.js │ ├── profile.js │ ├── rank.js │ └── repo.js ├── Media │ ├── lyrics.js │ ├── spotify.js │ ├── ytaudio.js │ ├── ytsearch.js │ └── ytvideo.js ├── Moderation │ ├── demote.js │ ├── groupAnnounce.js │ ├── invite.js │ ├── promote.js │ ├── remove.js │ ├── revoke.js │ ├── tagall.js │ └── toggle.js ├── Music │ ├── alive.js │ ├── ping.js │ └── stats.js ├── Utils │ ├── Img.js │ ├── gify.js │ ├── google.js │ ├── gpt.js │ ├── imagesearch.js │ ├── removebg.js │ ├── steal.js │ ├── sticker.js │ └── subraddit.js └── Weeb │ ├── aniNews.js │ ├── anime.js │ ├── character.js │ ├── haigusha.js │ ├── neko.js │ └── waifu.js ├── Handlers ├── Events.js └── Message.js ├── Helper ├── WAclient.js ├── contacts.js └── function.js ├── Library ├── AI_lib.js ├── Spotify.js ├── YT.js └── stats.js ├── getConfig.js └── krypton.js /.env.example: -------------------------------------------------------------------------------- 1 | NAME=Krypton 2 | PREFIX=! 3 | MODS=917003213xxx 4 | PORT=3000 5 | WRITE_SONIC= 6 | BG_API_KEY= 7 | SESSION= 8 | URL=mongodb+srv://:@cluster0.xxwc771.mongodb.net/?retryWrites=true&w=majority -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | session 3 | yarn.lock -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "trailingComma": "none", 4 | "singleQuote": true, 5 | "printWidth": 120, 6 | "tabWidth": 4 7 | } -------------------------------------------------------------------------------- /.replit: -------------------------------------------------------------------------------- 1 | language = 'nodejs' 2 | run = 'pm2 start src/krypton.js --deep-monitoring --attach' 3 | entrypoint = "src/krypton.js" 4 | hidden = [".config", "package-lock.json"] 5 | 6 | [languages] 7 | 8 | [languages.javascript] 9 | pattern = "**/{*.js,*.jsx,*.ts,*.tsx}" 10 | 11 | [languages.javascript.languageServer] 12 | start = "typescript-language-server --stdio" 13 | 14 | [debugger] 15 | support = true 16 | 17 | [debugger.interactive] 18 | transport = "localhost:0" 19 | startCommand = ["dap-node"] 20 | 21 | [debugger.interactive.initializeMessage] 22 | command = "initialize" 23 | type = "request" 24 | 25 | [debugger.interactive.initializeMessage.arguments] 26 | clientID = "replit" 27 | clientName = "replit.com" 28 | columnsStartAt1 = true 29 | linesStartAt1 = true 30 | locale = "en-us" 31 | pathFormat = "path" 32 | supportsInvalidatedEvent = true 33 | supportsProgressReporting = true 34 | supportsRunInTerminalRequest = true 35 | supportsVariablePaging = true 36 | supportsVariableType = true 37 | 38 | [debugger.interactive.launchMessage] 39 | command = "launch" 40 | type = "request" 41 | 42 | [debugger.interactive.launchMessage.arguments] 43 | console = "externalTerminal" 44 | cwd = "." 45 | pauseForSourceMap = false 46 | program = "src/krypton.js" 47 | request = "launch" 48 | sourceMaps = true 49 | stopOnEntry = false 50 | type = "pwa-node" 51 | 52 | [packager] 53 | language = "nodejs" 54 | 55 | [packager.features] 56 | packageSearch = true 57 | guessImports = true 58 | enabledForHosting = false 59 | 60 | [interpreter] 61 | command = ["prybar-nodejs", "-q", "--ps1", "\u0001\u001B[33m\u0002\u0001\u001B[00m\u0002 ", "-i"] 62 | 63 | [unitTest] 64 | language = "nodejs" 65 | 66 | [nix] 67 | channel = "stable-22_11" 68 | 69 | [env] 70 | XDG_CONFIG_HOME = "/home/runner/$REPL_SLUG/.config" 71 | PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin" 72 | npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global" 73 | 74 | [gitHubImport] 75 | requiredFiles = [".replit", "replit.nix", ".config", "package.json", "package-lock.json"] 76 | 77 | [[hints]] 78 | regex = 'Error \[ERR_REQUIRE_ESM\]' 79 | message = "We see that you are using require(...) inside your code. We currently do not support this syntax. Please use 'import' instead when using external modules. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)" 80 | 81 | [deployment] 82 | run = ["sh", "-c", "node src/krypton.js"] 83 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "compile-hero.disable-compile-files-on-did-save-code": true 3 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-buster 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y \ 5 | ffmpeg \ 6 | imagemagick \ 7 | webp && \ 8 | apt-get upgrade -y && \ 9 | npm i pm2 -g && \ 10 | rm -rf /var/lib/apt/lists/* 11 | 12 | COPY package.json . 13 | 14 | RUN yarn install 15 | 16 | COPY . . 17 | 18 | CMD ["yarn", "start"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /MongoDB_Guide.md: -------------------------------------------------------------------------------- 1 | ## Mongo Atlas Guide 📱 2 | ----------------- 3 | 1. Go to [MongoDB cloud atlas](https://www.mongodb.com/cloud/atlas) 4 | 5 | 2. Sign up if you don't have an account already or log in if you have one already. 6 | PS: If you don't want to use your email, go to https://temp-mail.org/en/ and generate a temporary disposable email address uwu)/ 7 | 3. Create a new cluster on Mongo Atlas. [It takes time, so don't worry] 8 | 4. After creating a cluster, click on the 'CONNECT' button on the cluster which you've created. 9 | 5. On Setup connection security, I'd recommend you to add 'Your Current IP Address' for security concerns but if you are not willing to go through a little bit of pain, then simply add 'Access from anywhere. Also, you can change this anytime by opening your "IP Access list tab". 10 | 6. Then, create a database user, fill up the name and password and MAKE SURE TO REMEMBER THEM. 11 | 7. Click on the "Choose a connection method" and then click on the "Connect Your Application" option. 12 | 8. Finally, on the "Connect" tab select "Nodejs" as _DRIVER_ with "3.6 or later" in _VERSION_. 13 | 9. Copy the connection string that is provided below and paste it somewhere and replace with 'the password you added while creating database user', also make sure to remove '< >' these from . This will be your _MONGO CLUSTER URI_. 14 | #### Example [Mongo Atlas Cluster URI] 15 | ```mongodb+srv://NekoDaKamiSama:kamisamaofdaculture@cluster0.v93qb.mongodb.net/myFirstDatabase?retryWrites=true&w=majority``` 16 | 10. That's it You now have a MongoDB cluster hosted on Mongo-Atlas. You can use this cluster for other projects too 17 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: npm run start 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | PFP 4 | 5 |
6 | 7 |
8 | 9 | 10 | 11 |
12 | 13 |
14 |

Don't forget to click ⭐️ and fork this repository

15 |
16 | 17 | --- 18 | 19 |

This whatsapp bot project use 20 | Baileys Multi-Device. 21 |

22 | 23 |

24 | 25 | 26 |

27 | 28 | --- 29 | 30 |

31 | whatsapp-bot out-of-the-box support on... 32 |

33 | 34 |

35 | 36 | 37 |

38 |

39 | 40 | 41 |

42 | 43 |

Need help? please create an issues

44 | 45 | ## Highlights 46 | 47 | --- 48 | 49 | - Written with [NodeJS](https://nodejs.org/) 50 | - Has a plugin that makes it easier to condition the user 51 | - Easy to maintenace without turning off the bot 52 | - Made with Baileys - MD (Best Library right now) 53 | - Using mongodb atlas (cluster example is in [app.json](https://github.com/Debanjan-San/krypton-WhatsappBot/blob/main/app.json)) (helper [MongoDB_Guide.md](https://github.com/Debanjan-San/krypton-WhatsappBot/blob/main/MongoDB_Guide.md)) 54 | - Suitable for those who want to learn Java Script programming 55 | 56 | --- 57 | 58 | ## Hosting 59 | 60 | --- 61 | 62 | - Host the bot in any server 63 | - Use the ```session``` command to get the session in text format 64 | - Copy the session 65 | - Go to [GitHub Gist](https://gist.github.com) 66 | - Paste the session 67 | - Create a gist with name of ```session.json``` 68 | - Copy the raw URL by clicking in the raw button at the top right corner 69 | - Paste the URL in the ```SESSION``` var 70 | 71 | --- 72 | 73 | ## Tutorial 74 | 75 | Here's a tutorial to set up Krypton Bot on your own account in *less than 7 minutes.* The tutorial for which is attached below. 76 | 77 | [![How to deploy](https://img.shields.io/badge/How%20To-Deploy-red.svg?logo=Youtube)](https://youtu.be/6P1Ya6ByEYQ) 78 | 79 | ## Getting Started 80 | 81 | This project require 82 | 83 | - [NodeJS](https://nodejs.org/en/download/) [v16 or greater](https://nodejs.org/dist/) 84 | - [FFMPEG](https://ffmpeg.org/download.html) 85 | 86 | ## Install 87 | 88 |
89 | 90 | ### Clone this project 91 | 92 | ```bash 93 | git clone https://github.com/Debanjan-San/krypton-WhatsappBot.git 94 | cd krypton-WhatsappBot 95 | ``` 96 | 97 | ### Install the dependencies: 98 | 99 | ```bash 100 | npm install 101 | ``` 102 | 103 | ### Setup 104 | 105 | Create .env file based on .env.example, copy the mongo database URL into .env file 106 | 107 | ```bash 108 | NAME=Krypton 109 | PREFIX=! 110 | MODS=917003213xxx 111 | PORT=3000 112 | WRITE_SONIC= 113 | BG_API_KEY= 114 | SESSION= 115 | URL=mongodb+srv://:@cluster0.xxwc771.mongodb.net/?retryWrites=true&w=majority 116 | ``` 117 | 118 |
119 | 120 | ## Usage 121 | 122 |
123 | 124 | `Run the Whatsapp bot` 125 | 126 | ```bash 127 | npm start 128 | ``` 129 | 130 | ## Contributing 131 | 132 |
133 | 134 | If you've ever wanted to contribute to open source, now is your chance! 135 | 136 | - Feel free to open an issue regarding any issue or if you have any feature requests 137 | - Make sure to follow the ESLint Rules while editing the code and run `npm run format` before opening PRs 138 | - If you want to contribute 139 | 140 | 1. Fork this repository 141 | 2. edit/change what you want, for example you want to add features/fix bugs 142 | 3. Test first 143 | 4. You can submit a pull request 144 | 5. If it accepts then delete the old fork and the new fork if you want to pull the request again 145 | 146 |
147 | 148 | ## License 149 | 150 |
151 | 152 | since **whatsapp-bot** use [baileys](https://github.com/adiwajshing/Baileys) is now available under the GPL-3.0 license. See the [LICENSE](LICENSE) file for more info. 153 | 154 |
155 | 156 | --- 157 | 158 |
159 |

Join the community to build Whatsapp-Bot together!

160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 |
AliAryanTech
AliAryanTech

💻
171 | 172 | 173 | 174 | 175 | 176 | 177 |
178 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"Krypton", 3 | "description":"A WhatsApp Bot With Multi Device Supported", 4 | "keywords":[ 5 | "bot", 6 | "whatsapp" 7 | ], 8 | "website":"https://github.com/Kry9toN/KryPtoN-WhatsApp-Bot#readme", 9 | "repository":"https://github.com/Kry9toN/KryPtoN-WhatsApp-Bot.git", 10 | "logo":"https://i.ibb.co/mzcSXdy/koboo.png", 11 | "success_url":"/", 12 | "env":{ 13 | "NAME":{ 14 | "description":"Name of your bot", 15 | "required":true 16 | }, 17 | "PREFIX":{ 18 | "description":"Prefix of your bot", 19 | "required":true 20 | }, 21 | "MODS":{ 22 | "description":"The phone numbers of the users who you want to be admin for the bot (should be in international format without + and multiple numbers must be separated by a comma \",\")", 23 | "required":true 24 | }, 25 | "URL":{ 26 | "description":"A secret String for Mongodb Connection.(Required)", 27 | "required":true 28 | }, 29 | "WRITE_SONIC":{ 30 | "description":"A key used for Write Sonic", 31 | "required":true 32 | }, 33 | "BG_API_KEY":{ 34 | "description":"A key used for www.remove.bg", 35 | "required":true 36 | }, 37 | "PORT":{ 38 | "description":"A port for your app", 39 | "required":true 40 | } 41 | }, 42 | "buildpacks":[ 43 | { 44 | "url":"heroku/nodejs" 45 | }, 46 | { 47 | "url":"https://github.com/PrajjwalDatir/heroku-buildpack-imagemagick.git" 48 | }, 49 | { 50 | "url":"https://github.com/clhuang/heroku-buildpack-webp-binaries.git" 51 | }, 52 | { 53 | "url":"https://github.com/ItsJimi/heroku-buildpack-pm2.git" 54 | }, 55 | { 56 | "url":"https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git" 57 | } 58 | ] 59 | } 60 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "krypton", 3 | "version": "0.0.1", 4 | "description": "krytron based on JavaScript", 5 | "author": "Debanjan-San", 6 | "main": "src/krypton.js", 7 | "keywords": [ 8 | "Whatsapp", 9 | "WhatsApp-Bot", 10 | "bot", 11 | "wabot" 12 | ], 13 | "license": "SEE LICENSE IN LICENSE.md", 14 | "scripts": { 15 | "format": "prettier --write --config .prettierrc.json \"src/**/*.js\"", 16 | "start": "node --optimize_for_size --max_old_space_size=460 src/krypton.js" 17 | }, 18 | "bugs": { 19 | "url": "https://github.com/Debanjan-San/krypton-WhatsappBot/issues" 20 | }, 21 | "homepage": "https://github.com/Debanjan-San/krypton-WhatsappBot", 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/Debanjan-San/krypton-WhatsappBot.git" 25 | }, 26 | "dependencies": { 27 | "@consumet/extensions": "^1.4.17", 28 | "@hapi/boom": "^10.0.0", 29 | "@shineiichijo/canvas-chan": "^1.0.1", 30 | "@whiskeysockets/baileys": "^6.4.0", 31 | "api": "^5.0.8", 32 | "axios": "^1.4.0", 33 | "better-tord": "^1.3.7", 34 | "bing-translate-api": "^2.9.0", 35 | "bluebird": "^3.7.2", 36 | "canvacord": "^5.4.8", 37 | "canvas": "^2.11.2", 38 | "chalk": "4.1.1", 39 | "cheerio": "^1.0.0-rc.12", 40 | "discord.js": "^14.7.1", 41 | "dotenv": "^16.0.3", 42 | "emoji-strip": "^1.0.1", 43 | "express": "^4.18.2", 44 | "fluent-ffmpeg": "^2.1.2", 45 | "form-data": "^4.0.0", 46 | "fs-extra": "^11.1.0", 47 | "google-tts-api": "^2.0.2", 48 | "googlethis": "^1.7.1", 49 | "human-readable": "^0.2.1", 50 | "linkifyjs": "^4.1.1", 51 | "moment-timezone": "^0.5.40", 52 | "mongoose": "^7.0.3", 53 | "openai": "^3.2.1", 54 | "os": "^0.1.2", 55 | "parse-ms": "^2.1.0", 56 | "path": "^0.12.7", 57 | "pino": "^8.8.0", 58 | "prettier": "^3.0.1", 59 | "qr-image": "^3.2.0", 60 | "qrcode-terminal": "^0.12.0", 61 | "quick.db": "^9.0.5", 62 | "quickmongo": "^5.2.0", 63 | "remove.bg": "^1.3.0", 64 | "simple-git": "^3.17.0", 65 | "slot-machine": "^2.1.0", 66 | "sort-array": "^4.1.5", 67 | "spotifydl-x": "^0.3.5", 68 | "wa-sticker-formatter": "^4.4.4", 69 | "welcomer-gif": "^2.0.0", 70 | "youtubedl-core": "^4.11.4", 71 | "yt-search": "^2.10.4" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /replit.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: { 2 | deps = [ 3 | 4 | pkgs.yarn 5 | pkgs.nodejs-16_x 6 | pkgs.libwebp 7 | pkgs.python 8 | pkgs.nodePackages.typescript 9 | pkgs.libuuid 10 | pkgs.ffmpeg 11 | pkgs.imagemagick 12 | pkgs.wget 13 | pkgs.git 14 | pkgs.nodePackages.pm2 15 | ]; 16 | env = { 17 | LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.libuuid]; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /src/Commands/Dev/ban.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (M.quoted?.participant) M.mentions.push(M.quoted.participant) 3 | if (!M.mentions.length) return M.reply('🟥 *Mentions are required to Ban*') 4 | const mentions = client.utils.removeDuplicates(M.mentions) 5 | const banned = (await client.DB.get('banned')) || [] 6 | mentions.filter(async (user) => 7 | !banned.includes(user) 8 | ? (await client.DB.push('banned', user)) && 9 | (await client.sendMessage( 10 | M.from, 11 | { text: `🟩 *@${user.split('@')[0]}* is now banned`, mentions: [user] }, 12 | { quoted: M } 13 | )) 14 | : await client.sendMessage( 15 | M.from, 16 | { text: `🟨 *@${user.split('@')[0]}* is already banned`, mentions: [user] }, 17 | { quoted: M } 18 | ) 19 | ) 20 | } 21 | 22 | module.exports.command = { 23 | name: 'ban', 24 | aliases: ['b'], 25 | exp: 0, 26 | category: 'dev', 27 | usage: '[mention user | quote user]', 28 | description: 'Bans the taged user' 29 | } 30 | -------------------------------------------------------------------------------- /src/Commands/Dev/broadcast.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!arg) return M.reply('🟥 *No query provided!*') 3 | let group = true 4 | let results = await client.getAllGroups() 5 | if (flag.includes('--users')) { 6 | arg = arg.replace('--users', '') 7 | group = false 8 | results = await client.getAllUsers() 9 | } 10 | for (const result of results) { 11 | const text = `*「 ${client.config.name.toUpperCase()} BROADCAST 」*\n\n${arg}\n\n` 12 | await client.sendMessage(result, { 13 | text, 14 | mentions: group ? (await client.groupMetadata(result)).participants.map((x) => x.id) : [] 15 | }) 16 | } 17 | M.reply(`🟩 Successfully Broadcast in ${results.length} ${group ? 'groups' : 'DMs'}`) 18 | } 19 | 20 | module.exports.command = { 21 | name: 'broadcast', 22 | aliases: ['bc'], 23 | category: 'dev', 24 | exp: 0, 25 | usage: '[text] | [text] --users', 26 | description: 'Will make a broadcast for groups where the bot is in. Can be used to make announcements' 27 | } 28 | -------------------------------------------------------------------------------- /src/Commands/Dev/eval.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!arg) return M.reply('Sorry you did not give term!') 3 | let out = '' 4 | try { 5 | const output = (await eval(arg)) || 'Executed JS Successfully!' 6 | console.log(output) 7 | out = JSON.stringify(output) 8 | } catch (err) { 9 | out = err.message 10 | } 11 | return await M.reply(out) 12 | } 13 | 14 | module.exports.command = { 15 | name: 'eval', 16 | aliases: ['e'], 17 | category: 'dev', 18 | exp: 0, 19 | usage: '[code]', 20 | description: 'Evaluates JavaScript' 21 | } 22 | -------------------------------------------------------------------------------- /src/Commands/Dev/join.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!M.urls) return M.reply('🟥 *Sorry you did not give any group link!*') 3 | if (!M.urls[0].includes('whatsapp.com')) return M.reply('🟨 *Sorry you did not give any valid group link!*') 4 | const JoinCode = arg.split('https://chat.whatsapp.com/')[1] 5 | client 6 | .groupAcceptInvite(JoinCode) 7 | .then((res) => M.reply('🟩 *Joined*')) 8 | .catch((res) => M.reply('🟨 *Something went wrong please check the link*')) 9 | } 10 | 11 | module.exports.command = { 12 | name: 'join', 13 | aliases: ['add'], 14 | category: 'dev', 15 | exp: 0, 16 | usage: '[link]', 17 | description: 'Bot joins the group using the link' 18 | } 19 | -------------------------------------------------------------------------------- /src/Commands/Dev/leave.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | client.groupLeave(M.from).catch((res) => M.reply('🟥 *Something went wrong please check the link*')) 3 | } 4 | 5 | module.exports.command = { 6 | name: 'leave', 7 | aliases: ['bye'], 8 | category: 'dev', 9 | usage: '', 10 | exp: 0, 11 | description: 'Bot leaves the group' 12 | } 13 | -------------------------------------------------------------------------------- /src/Commands/Dev/restart.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | M.reply('Restarting...') 3 | await client.utils.restart() 4 | } 5 | 6 | module.exports.command = { 7 | name: 'restart', 8 | aliases: ['relife'], 9 | category: 'dev', 10 | exp: 0, 11 | usage: '', 12 | description: 'Restarts the bot' 13 | } 14 | -------------------------------------------------------------------------------- /src/Commands/Dev/unban.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (M.quoted?.participant) M.mentions.push(M.quoted.participant) 3 | if (!M.mentions.length) return M.reply('🟥 *Mentions are required to Unban*') 4 | const mentions = client.utils.removeDuplicates(M.mentions) 5 | const banned = (await client.DB.get('banned')) || [] 6 | mentions.filter(async (user) => 7 | banned.includes(user) 8 | ? (await client.DB.pull('banned', user)) && 9 | (await client.sendMessage( 10 | M.from, 11 | { text: `🟩 *@${user.split('@')[0]}* is now unbanned`, mentions: [user] }, 12 | { quoted: M } 13 | )) 14 | : await client.sendMessage( 15 | M.from, 16 | { text: `🟨 *@${user.split('@')[0]}* is already unbanned`, mentions: [user] }, 17 | { quoted: M } 18 | ) 19 | ) 20 | } 21 | 22 | module.exports.command = { 23 | name: 'unban', 24 | aliases: ['unb'], 25 | exp: 0, 26 | usage: '[mention user | quote user]', 27 | category: 'dev', 28 | description: 'unans the taged user' 29 | } 30 | -------------------------------------------------------------------------------- /src/Commands/Dev/update.js: -------------------------------------------------------------------------------- 1 | const simpleGit = require('simple-git') 2 | const git = simpleGit() 3 | 4 | module.exports.execute = async (client, flag, arg, M) => { 5 | const command = M.body.split(' ')[0].toLowerCase().slice(client.config.prefix.length).trim() 6 | await git.fetch() 7 | const commits = await git.log(['main' + '..origin/' + 'main']) 8 | if (command == 'updates') { 9 | let updates = '======= *UPDATES* =======\n\n' 10 | if (commits.total == 0) return M.reply('Sorry there is no new updates!!') 11 | commits['all'].map((commit) => { 12 | updates += 13 | '```🔹 [' + commit.date.substring(0, 10) + ']: ' + commit.message + ' <' + commit.author_name + '>```\n' 14 | }) 15 | M.reply(updates) 16 | } 17 | if (command == 'updatenow') { 18 | if (commits.total == 0) return M.reply('You are already using the updated version') 19 | git.pull(async (err, update) => { 20 | if (update && update.summary.changes) { 21 | await M.reply('```Updateing....```') 22 | await client.utils.term('npm install').stderr.pipe(process.stderr) 23 | } else if (err) return M.reply(err) 24 | }) 25 | } 26 | } 27 | 28 | module.exports.command = { 29 | name: 'updates', 30 | aliases: ['updatenow'], 31 | category: 'dev', 32 | usage: '', 33 | exp: 0, 34 | description: 'Updates gives the list of latest commits and updatenow updates the bot' 35 | } 36 | -------------------------------------------------------------------------------- /src/Commands/Fun/advice.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | await axios 5 | .get(`https://api.adviceslip.com/advice`) 6 | .then((response) => { 7 | // console.log(response); 8 | const text = `Advice for you: ${response.data.slip.advice}` 9 | M.reply(text) 10 | }) 11 | .catch((err) => { 12 | M.reply(`🔍 Error: ${err}`) 13 | }) 14 | } 15 | 16 | module.exports.command = { 17 | name: 'advice', 18 | aliases: ['adv'], 19 | category: 'fun', 20 | exp: 5, 21 | usage: '', 22 | description: 'Sends random advices' 23 | } 24 | -------------------------------------------------------------------------------- /src/Commands/Fun/checkuser.js: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | const checks = ['awesomecheck', 'greatcheck', 'gaycheck', 'cutecheck', 'lesbiancheck', 'hornycheck', 'prettycheck', 'lovelycheck', 'uglycheck', 'beautifulcheck', 'handsomecheck', 'charactercheck'] 3 | 4 | module.exports.execute = async (client, flag, arg, M) => { 5 | const text = arg.trim() 6 | const command = M.body.split(' ')[0].toLowerCase().slice(client.config.prefix.length).trim() 7 | if (command == 'checkuser' || command == 'cu') 8 | if (!text) { 9 | const CheckList = `🎃 *Available Checks:*\n\n- ${checks 10 | .map((check) => client.utils.capitalize(check)) 11 | .join('\n- ')}\n🛠️ *Usage:* ${client.config.prefix}check [tag/quote user] | ${ 12 | client.config.prefix 13 | }(check) [tag/quote user]\nExample: ${client.config.prefix}awesomecheck` 14 | return await M.reply(CheckList) 15 | } 16 | if (M.quoted?.participant) M.mentions.push(M.quoted.participant) 17 | if (!M.mentions.length) M.mentions.push(M.sender) 18 | const types = [ 19 | 'Compassionate', 20 | 'Generous', 21 | 'Grumpy', 22 | 'Forgiving', 23 | 'Obedient', 24 | 'Good', 25 | 'Simp', 26 | 'Kind-Hearted', 27 | 'patient', 28 | 'UwU', 29 | 'top, anyway', 30 | 'Helpful' 31 | ] 32 | const character = types[Math.floor(Math.random() * types.length)] 33 | const percentage = Math.floor(Math.random() * 100) + 1 34 | const sentence = command.split('check') 35 | const title = command.toUpperCase() 36 | await client.sendMessage( 37 | M.from, 38 | { 39 | text: `* 🎆 ${title.toUpperCase()} 🎆*\n\n @${M.mentions[0].split('@')[0]} \`\`\`is ${ 40 | command !== 'charactercheck' ? `${percentage}% ${sentence[0]}` : `${percentage}% ${character}` 41 | }\`\`\``, 42 | mentions: [M.mentions[0]] 43 | }, 44 | { 45 | quoted: M 46 | } 47 | ) 48 | } 49 | 50 | module.exports.command = { 51 | name: 'checkuser', 52 | aliases: ['cu', ...checks], 53 | exp: 10, 54 | category: 'fun', 55 | usage: ' | [mention user | quote user]', 56 | description: 'Checks on user' 57 | } 58 | -------------------------------------------------------------------------------- /src/Commands/Fun/fact.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | await axios 5 | .get(`https://nekos.life/api/v2/fact`) 6 | .then((response) => { 7 | // console.log(response); 8 | const text = `Fact for you: ${response.data.fact}` 9 | M.reply(text) 10 | }) 11 | .catch((err) => { 12 | M.reply(`🔍 Error: ${err}`) 13 | }) 14 | } 15 | 16 | module.exports.command = { 17 | name: 'fact', 18 | aliases: ['ft'], 19 | category: 'fun', 20 | exp: 5, 21 | usage: '', 22 | description: 'Sends random facts' 23 | } 24 | -------------------------------------------------------------------------------- /src/Commands/Fun/meme.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | const res = await axios.get(`https://meme-api.com/gimme`).catch((err) => { 5 | return M.reply(err.toString()) 6 | }) 7 | client.sendMessage(M.from, { 8 | image: { 9 | url: res.data.url 10 | }, 11 | caption: `${res.data.title}` 12 | }) 13 | } 14 | 15 | module.exports.command = { 16 | name: 'meme', 17 | aliases: ['gimeme'], 18 | category: 'fun', 19 | exp: 16, 20 | usage: '', 21 | description: 'Sends an image of random meme' 22 | } 23 | -------------------------------------------------------------------------------- /src/Commands/Fun/quote.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | await axios 5 | .get(`https://animechan.vercel.app/api/random`) 6 | .then((response) => { 7 | // console.log(response); 8 | const text = `[${response.data.character}]: ${response.data.quote}` 9 | M.reply(text) 10 | }) 11 | .catch((err) => { 12 | M.reply(`🔍 Error: ${err}`) 13 | }) 14 | } 15 | 16 | module.exports.command = { 17 | name: 'quote', 18 | aliases: ['qu'], 19 | category: 'fun', 20 | exp: 10, 21 | usage: '', 22 | description: 'Sends random quotes' 23 | } 24 | -------------------------------------------------------------------------------- /src/Commands/Fun/reaction.js: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | const suitableWords = { 3 | bite: 'Bit', blush: 'Blushed at', bonk: 'Bonked', bully: 'Bullied', cringe: 'Cringed at', 4 | cry: 'Cried in front of', cuddle: 'Cuddled', dance: 'Danced with', glomp: 'Glomped at', handhold: 'Held the hands of', happy: 'is Happied with', 5 | highfive: 'High-fived', hug: 'Hugged', kick: 'Kicked', kill: 'Killed', kiss: 'Kissed', lick: 'Licked', 6 | nom: 'Nomed', pat: 'Patted', poke: 'Poked', slap: 'Slapped', smile: 'Smiled at', smug: 'Smugged', 7 | wave: 'Waved at', wink: 'Winked at', yeet: 'Yeeted at' 8 | } 9 | const reactions = Object.keys(suitableWords) 10 | 11 | module.exports.execute = async (client, flag, arg, M) => { 12 | const text = arg.trim() 13 | const command = M.body.split(' ')[0].toLowerCase().slice(client.config.prefix.length).trim() 14 | let raw = true 15 | if (command === 'r' || command === 'reaction') raw = false 16 | if (!raw && !text) { 17 | const reactionList = `🎃 *Available Reactions:*\n\n- ${reactions 18 | .map((reaction) => client.utils.capitalize(reaction)) 19 | .join('\n- ')}\n🛠️ *Usage:* ${client.config.prefix}reaction (reaction) [tag/quote user] | ${ 20 | client.config.prefix 21 | }(reaction) [tag/quote user]\nExample: ${client.config.prefix}pat` 22 | return await M.reply(reactionList) 23 | } 24 | const reaction = raw ? command : text.split(' ')[0].trim().toLowerCase() 25 | if (!raw && !reactions.includes(reaction)) 26 | return M.reply(`Invalid reaction. Use *${client.config.prefix}react* to see all of the available reactions`) 27 | const users = M.mentions 28 | if (M.quoted && !users.includes(M.quoted.sender)) users.push(M.quoted.sender) 29 | while (users.length < 1) users.push(M.sender) 30 | const reactant = users[0] 31 | const single = reactant === M.sender 32 | const { url } = await client.utils.fetch(`https://api.waifu.pics/sfw/${reaction}`) 33 | const result = await client.utils.getBuffer(url) 34 | const buffer = await client.utils.gifToMp4(result) 35 | await client.sendMessage( 36 | M.from, 37 | { 38 | video: buffer, 39 | gifPlayback: true, 40 | caption: `*@${M.sender.split('@')[0]} ${suitableWords[reaction]} ${ 41 | single ? 'Themselves' : `@${reactant.split('@')[0]}` 42 | }*`, 43 | mentions: [M.sender, reactant] 44 | }, 45 | { quoted: M } 46 | ) 47 | } 48 | 49 | module.exports.command = { 50 | name: 'reaction', 51 | description: "React to someone's message with a gif specified by the user.", 52 | category: 'fun', 53 | usage: ' | [mention user | quote user]', 54 | aliases: ['r', ...reactions], 55 | exp: 50 56 | } 57 | -------------------------------------------------------------------------------- /src/Commands/Fun/ship.js: -------------------------------------------------------------------------------- 1 | const { Ship } = require('@shineiichijo/canvas-chan') 2 | const { writeFile } = require('fs-extra') 3 | 4 | module.exports.execute = async (client, flag, arg, M) => { 5 | const shipArray = [] 6 | let users = M.mentions 7 | if (M.quoted && !users.includes(M.quoted.participant)) users.push(M.quoted.participant) 8 | while (users.length < 2) users.push(M.sender) 9 | if (users.includes(M.sender)) users = users.reverse() 10 | 11 | for (const user of users) { 12 | const name = (await client.contact.getContact(user, client)).username 13 | let image 14 | try { 15 | image = await client.utils.getBuffer(await client.profilePictureUrl(user, 'image')) 16 | } catch { 17 | image = await client.utils.getBuffer( 18 | 'https://icon2.cleanpng.com/20180703/lzk/kisspng-computer-icons-error-clip-art-checklist-5b3c119612f6e8.7675651415306633180777.jpg' 19 | ) 20 | } 21 | shipArray.push({ name, image }) 22 | } 23 | 24 | const percentage = Math.floor(Math.random() * 101) 25 | 26 | let text = '' 27 | if (percentage >= 0 && percentage < 10) text = 'Awful' 28 | else if (percentage >= 10 && percentage < 25) text = 'Very Bad' 29 | else if (percentage >= 25 && percentage < 40) text = 'Poor' 30 | else if (percentage >= 40 && percentage < 55) text = 'Average' 31 | else if (percentage >= 55 && percentage < 75) text = 'Good' 32 | else if (percentage >= 75 && percentage < 90) text = 'Great' 33 | else if (percentage >= 90) text = 'Amazing' 34 | 35 | let caption = `\`\`\`🔺Compatibility Meter🔺\`\`\`` 36 | caption += `\n💖 *@${users[0].split('@')[0]} x @${users[1].split('@')[0]} 💖*\n` 37 | caption += `*🔻 ${percentage} ${percentage < 50 ? '💔' : '💞'} ${text}* 🔻` 38 | 39 | const image = await new Ship(shipArray, percentage, text).build() 40 | //user.substring(3, 7) 41 | client.sendMessage( 42 | M.from, 43 | { 44 | image, 45 | caption, 46 | mentions: [users[0], users[1]] 47 | }, 48 | { 49 | quoted: M 50 | } 51 | ) 52 | } 53 | 54 | module.exports.command = { 55 | name: 'ship', 56 | aliases: ['shipper'], 57 | category: 'fun', 58 | exp: 5, 59 | usage: '[mention user | quote user]', 60 | description: 'Ship People! ♥' 61 | } 62 | -------------------------------------------------------------------------------- /src/Commands/Fun/truth_dare.js: -------------------------------------------------------------------------------- 1 | const TD = require('better-tord') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 5 | const Available = ['truth', 'dare'] 6 | if (!Available.includes(arg.trim())) 7 | return M.reply(`🔷 *Please provide a valid terms\n\n*Available:* ${Available.join(', ')}*`) 8 | M.reply(arg == 'truth' ? await TD.get_truth() : await TD.get_dare()) 9 | } 10 | 11 | module.exports.command = { 12 | name: 'truth_dare', 13 | aliases: ['td'], 14 | category: 'fun', 15 | exp: 9, 16 | usage: 'truth | dare', 17 | description: 'Gives you tuth and dare' 18 | } 19 | -------------------------------------------------------------------------------- /src/Commands/General/delete.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!M.quoted) return M.reply('🟥 *Quote the message that you want me to delete, Baka!*') 3 | await client.sendMessage(M.from, { 4 | delete: M.quoted.key 5 | }) 6 | } 7 | 8 | module.exports.command = { 9 | name: 'delete', 10 | aliases: ['del'], 11 | category: 'general', 12 | usage: '[quote the bot message]', 13 | exp: 5, 14 | description: 'Deletes the quoted message' 15 | } 16 | -------------------------------------------------------------------------------- /src/Commands/General/help.js: -------------------------------------------------------------------------------- 1 | const list = [ 2 | { 3 | id: 'general', 4 | font: 'Gҽɳҽɾαʅ', 5 | emoji: '🔰' 6 | }, 7 | { 8 | id: 'dev', 9 | font: 'Dҽʋ', 10 | emoji: '👨‍💻' 11 | }, 12 | { 13 | id: 'fun', 14 | font: 'Fυɳ', 15 | emoji: '🎡' 16 | }, 17 | { 18 | id: 'music', 19 | font: 'Mυʂιƈ', 20 | emoji: '💠' 21 | }, 22 | { 23 | id: 'media', 24 | font: 'Mҽԃια', 25 | emoji: '🔉' 26 | }, 27 | { 28 | id: 'moderation', 29 | font: 'Mσԃҽɾαƚισɳ', 30 | emoji: '💮' 31 | }, 32 | { 33 | id: 'utils', 34 | font: 'Uƚιʅʂ', 35 | emoji: '⚙️' 36 | }, 37 | { 38 | id: 'weeb', 39 | font: 'WҽҽႦ', 40 | emoji: '🎐' 41 | } 42 | ] 43 | 44 | module.exports.execute = async (client, flag, arg, M) => { 45 | if (!arg) { 46 | let obj = {} 47 | client.cmd.forEach((item) => { 48 | if (obj[item.command.category]) obj[item.command.category].push(item.command.name) 49 | else { 50 | obj[item.command.category] = [] 51 | obj[item.command.category].push(item.command.name) 52 | } 53 | }) 54 | let base = `⛩️ *❯─「Kɾყρƚσɳ」─❮* ⛩️ 55 | 56 | 👋 *Hi ${M.pushName}* 🍃! 57 | 58 | 🎋 *Support us by following us on instagram:* https://www.instagram.com/das_abae 59 | 60 | This help menu is designed to help you get started with the bot.` 61 | base += '\n\n ⟾ *📪Command list📪*' 62 | const keys = Object.keys(obj).filter((c) => c !== 'dev') 63 | for (const key of keys) { 64 | const data = list.find((x) => x.id.toLowerCase() === key.toLocaleLowerCase()) 65 | base += `\n\n *❯──「${data?.font}」──❮* \n➪ \`\`\`${obj[key].join(', ')}\`\`\`` 66 | } 67 | base += '\n\n' 68 | base += `*📇 Notes:* 69 | *➪ Use ${client.config.prefix}help from help the list to see its description and usage* 70 | *➪ Eg: ${client.config.prefix}help profile* 71 | *➪ <> means required and [ ] means optional, don't include <> or [ ] when using command.*` 72 | await client.sendMessage( 73 | M.from, 74 | { 75 | video: await client.utils.getBuffer('https://media.tenor.com/QHpICcsD_QAAAAPo/marin-nervous.mp4'), 76 | caption: base, 77 | gifPlayback: true 78 | }, 79 | { 80 | quoted: M 81 | } 82 | ) 83 | return 84 | } 85 | const command = 86 | client.cmd.get(arg)?.command ?? 87 | client.cmd.find((cmd) => cmd.command.aliases && cmd.command.aliases.includes(arg))?.command 88 | if (!command) return M.reply('🟥 *Command does not exsist*') 89 | M.reply( 90 | `*🟥 Name:* ${command.name}\n*⬜ Exp:* ${command.exp}\n*🟧 Admin:* ${ 91 | command.category == 'moderation' ? 'Required' : 'Not_Required' 92 | }\n*🟪 Category:* ${command.category} ${ 93 | list.find((x) => x.id.toLowerCase() === command.category.toLocaleLowerCase()).emoji 94 | }\n*🟩 Aliases:* ${command.aliases.join(', ')}\n*🟦 Usage:* ${client.config.prefix}${command.name} ${ 95 | command.usage 96 | }\n*🟨 Desc:* ${command.description}` 97 | ) 98 | } 99 | 100 | module.exports.command = { 101 | name: 'help', 102 | aliases: ['h', 'menu', 'list', 'commands'], 103 | category: 'general', 104 | usage: '| [cmd]', 105 | exp: 10, 106 | description: 'Let you see the command list' 107 | } 108 | -------------------------------------------------------------------------------- /src/Commands/General/info.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | const uptime = client.utils.formatSeconds(process.uptime()) 3 | const groups = await client.getAllGroups() 4 | const users = await client.getAllUsers() 5 | return M.reply( 6 | `💚 *UPTIME: ${uptime}*\n\n🌃 *USERS: ${users.length}*\n\n💬 *GROUPS ${groups.length}*\n\n🧧 *COMMANDS: ${client.cmd.size}*` 7 | ) 8 | } 9 | 10 | module.exports.command = { 11 | name: 'information', 12 | aliases: ['info'], 13 | category: 'general', 14 | exp: 0, 15 | usage: '', 16 | description: 'Get information bot information' 17 | } 18 | -------------------------------------------------------------------------------- /src/Commands/General/leaderboard.js: -------------------------------------------------------------------------------- 1 | const { getStats } = require('../../Library/stats') 2 | const sortArray = require('sort-array') 3 | 4 | module.exports.execute = async (client, flag, arg, M) => { 5 | const group = ['--gc', '--group'] 6 | const groupMetadata = await client.groupMetadata(M.from) 7 | const groupMembers = groupMetadata?.participants.map((x) => x.id.split('.whatsapp.net')[0]) ?? [] 8 | const exp = Object.values(await client.exp.all()) ?? [] 9 | 10 | const users = exp.map((x) => ({ 11 | user: x.id, 12 | xp: x.value.whatsapp.net 13 | })) 14 | 15 | const lb = sortArray(users, { 16 | by: 'xp', 17 | order: 'desc' 18 | }) 19 | 20 | const filtered = group.includes(flag[0]) ? lb.filter((x) => groupMembers.includes(x.user)) : lb 21 | 22 | if (filtered.length < 10) return M.reply('🟥 *Sorry there is no enough users to create a leaderboard*') 23 | const myPosition = filtered.findIndex((x) => x.user == M.sender.split('.whatsapp.net')[0]) 24 | let text = `☆☆💥 LEADERBOARD 💥☆☆\n\n*${ 25 | (await client.contact.getContact(M.sender, client)).username 26 | }'s Position is ${myPosition + 1}*` 27 | for (let i = 0; i < 10; i++) { 28 | const level = (await client.DB.get(`${filtered[i].user}.whatsapp.net_LEVEL`)) ?? 1 29 | const { requiredXpToLevelUp, rank } = getStats(level) 30 | const username = (await client.contact.getContact(filtered[i].user, client)).username.whatsapp.net 31 | text += `\n\n*(${i + 1})*\n` 32 | text += `⛩ *Username: ${username}*#${filtered[i].user.substring( 33 | 3, 34 | 7 35 | )}\n〽️ *Level: ${level}*\n🎡 *Rank: ${rank}*\n⭐ *Exp: ${ 36 | filtered[i].xp 37 | }*\n🍥 *RequiredXpToLevelUp: ${requiredXpToLevelUp} exp required*` 38 | } 39 | 40 | client.sendMessage( 41 | M.from, 42 | { 43 | video: { 44 | url: 'https://media.tenor.com/MqSOkI7a96cAAAPo/banner-discord.mp4' 45 | }, 46 | caption: text, 47 | gifPlayback: true 48 | }, 49 | { 50 | quoted: M 51 | } 52 | ) 53 | } 54 | 55 | module.exports.command = { 56 | name: 'leaderboard', 57 | aliases: ['lb'], 58 | category: 'general', 59 | usage: '| --gc', 60 | exp: 5, 61 | description: "Displays global's or group's leaderboord of a specific field\nEx: lb --gc" 62 | } 63 | -------------------------------------------------------------------------------- /src/Commands/General/profile.js: -------------------------------------------------------------------------------- 1 | const { getStats } = require('../../Library/stats') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | const groupMetadata = await client.groupMetadata(M.from) 5 | const groupMembers = groupMetadata?.participants || [] 6 | const groupAdmins = groupMembers.filter((v) => v.admin).map((v) => v.id) 7 | const user = M.mentions[0] ?? M.sender 8 | 9 | let pfp 10 | try { 11 | pfp = await client.profilePictureUrl(user, 'image') 12 | } catch { 13 | pfp = 14 | 'https://w0.peakpx.com/wallpaper/346/996/HD-wallpaper-love-live-sunshine-404-error-love-live-sunshine-anime-girl-anime.jpg' 15 | } 16 | 17 | let bio 18 | try { 19 | bio = (await client.fetchStatus(user)).status 20 | } catch { 21 | bio = '' 22 | } 23 | 24 | const level = (await client.DB.get(`${user}_LEVEL`)) || 1 25 | const { requiredXpToLevelUp, rank } = getStats(level) 26 | const username = (await client.contact.getContact(user, client)).username 27 | const experience = (await client.exp.get(user)) || 0 28 | const banned = (await client.DB.get('banned')) || [] 29 | 30 | let text = '' 31 | text += `🍥 *Username: ${username}#${user.substring(3, 7)}*\n\n` 32 | text += `📑 *Bio: ${bio}*\n\n` 33 | text += `⛩ *Number: wa.me/${user.split('@')[0]}*\n\n` 34 | text += `🌟 *Experience:* ${experience}*\n\n` 35 | text += `👑 *Level: ${level}*\n\n` 36 | text += `🎡 *Rank: ${rank}*\n\n` 37 | text += `🍥 *RequiredXpToLevelUp: ${requiredXpToLevelUp} exp required*\n\n` 38 | text += `💮 *Admin: ${groupAdmins.includes(user) ? 'T' : 'F'}*\n\n` 39 | text += `🔴 *Ban: ${banned.includes(user) ? 'T' : 'F'}*` 40 | 41 | //user.substring(3, 7) 42 | client.sendMessage( 43 | M.from, 44 | { 45 | image: { 46 | url: pfp 47 | }, 48 | caption: text 49 | }, 50 | { 51 | quoted: M 52 | } 53 | ) 54 | } 55 | 56 | module.exports.command = { 57 | name: 'profile', 58 | aliases: ['p'], 59 | category: 'general', 60 | usage: '', 61 | exp: 5, 62 | description: 'Gives you your stats' 63 | } 64 | -------------------------------------------------------------------------------- /src/Commands/General/rank.js: -------------------------------------------------------------------------------- 1 | const { getStats } = require('../../Library/stats') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | let pfp 5 | try { 6 | pfp = await client.profilePictureUrl(M.mentions[0] ?? M.sender, 'image') 7 | } catch { 8 | pfp = 9 | 'https://w0.peakpx.com/wallpaper/346/996/HD-wallpaper-love-live-sunshine-404-error-love-live-sunshine-anime-girl-anime.jpg' 10 | } 11 | 12 | const level = (await client.DB.get(`${M.mentions[0] ?? M.sender}_LEVEL`)) || 1 13 | const { requiredXpToLevelUp, rank } = getStats(level) 14 | const username = (await client.contact.getContact(M.mentions[0] ?? M.sender, client)).username 15 | const experience = (await client.exp.get(M.mentions[0] ?? M.sender)) || 0 16 | 17 | M.reply(` 18 | 🏷️ *Username: ${username}* 19 | 20 | 🪄 *Experience: ${experience}* 21 | 22 | 🏆 *Level: ${level}* 23 | 24 | 🎡 *Rank: ${rank}* 25 | 26 | 🍥 *RequiredXpToLevelUp: ${requiredXpToLevelUp} exp required*`) 27 | } 28 | 29 | module.exports.command = { 30 | name: 'rank', 31 | aliases: ['rk'], 32 | category: 'general', 33 | usage: '', 34 | exp: 5, 35 | description: 'Gives you your rank' 36 | } 37 | -------------------------------------------------------------------------------- /src/Commands/General/repo.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | const image = await client.utils.getBuffer( 3 | 'https://i.pinimg.com/564x/3b/d8/bb/3bd8bb87812f4af49d6a52b7a2394c6d.jpg' 4 | ) 5 | const result = await client.utils.fetch('https://api.github.com/repos/Debanjan-San/krypton-WhatsappBot') 6 | let caption = '' 7 | caption += `*${result.name}* ✨\n\n` 8 | caption += `✍🏻 *Author: ${result.owner.login}*\n` 9 | caption += `⭐ *Star's: ${result.stargazers_count}*\n` 10 | caption += `🍴 *Forks: ${result.forks_count}*\n` 11 | caption += `⚠️ *Issues: ${result.open_issues_count}*\n` 12 | caption += `🌐 *Visibility: ${result.visibility}*\n` 13 | caption += `💠 *Language: ${result.language}*\n` 14 | caption += `🛡️ *License: ${result.license.name}*\n` 15 | caption += `⚙️ *Repo Link: ${result.html_url}*` 16 | await client.sendMessage(M.from, { image, caption }, { quoted: M }) 17 | } 18 | 19 | module.exports.command = { 20 | name: 'repo', 21 | aliases: ['script'], 22 | category: 'general', 23 | usage: '', 24 | exp: 100, 25 | description: 'Get the base repo of the bot' 26 | } 27 | -------------------------------------------------------------------------------- /src/Commands/Media/lyrics.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!arg) return void M.reply('🟥 *Provide the name of the song to search the lyrics*') 3 | const term = arg.trim() 4 | const data = await client.utils.fetch(`https://weeb-api.vercel.app/genius?query=${term}`) 5 | if (!data.length) return void M.reply(`🟨 *Couldn't find any lyrics* | "${term}"`) 6 | const image = await client.utils.getBuffer(data[0].image) 7 | let caption = `🎊 *Title:* ${data[0].title} *(${data[0].fullTitle})*\n🖋️ *Artist:* ${data[0].artist}` 8 | const lyrics = await client.utils.fetch(`https://weeb-api.vercel.app/lyrics?url=${data[0].url}`) 9 | caption += `\n\n ${lyrics}` 10 | return void (await client.sendMessage(M.from, { image, caption }, { quoted: M })) 11 | } 12 | 13 | module.exports.command = { 14 | name: 'lyrics', 15 | category: 'media', 16 | exp: 50, 17 | usage: '[text]', 18 | description: 'Sends the lyrics of a given song' 19 | } 20 | -------------------------------------------------------------------------------- /src/Commands/Media/spotify.js: -------------------------------------------------------------------------------- 1 | const { spotifydl } = require('../../Library/Spotify') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | const link = M.urls[0] 5 | if (!link.includes('https://open.spotify.com/track/')) 6 | return M.reply('🟥 *Please use command with a valid spodify link*') 7 | const audioSpotify = await spotifydl(link.trim()).catch((err) => { 8 | return M.reply(err.toString()) 9 | client.log(err, 'red') 10 | }) 11 | 12 | if (spotifydl.error) return M.reply(`🟨 *Error Fetching: ${link.trim()}. Check if the url is valid and try again*`) 13 | M.reply('🟩 *Downloading has started please have some pesence*') 14 | 15 | const caption = `🎧 *Title: ${audioSpotify.data.name || ''}*\n\n🎤 *Artists: ${( 16 | audioSpotify.data.artists || [] 17 | ).join(', ')}*\n\n💽 *Album: ${audioSpotify.data.album_name}*\n\n📆 *Release Date: ${ 18 | audioSpotify.data.release_date || '' 19 | }*` 20 | 21 | client.sendMessage( 22 | M.from, 23 | { 24 | image: audioSpotify.coverimage, 25 | caption: caption 26 | }, 27 | { 28 | quoted: M 29 | } 30 | ) 31 | await client.sendMessage( 32 | M.from, 33 | { 34 | document: audioSpotify.audio, 35 | mimetype: 'audio/mpeg', 36 | fileName: audioSpotify.data.name + '.mp3' 37 | }, 38 | { 39 | quoted: M 40 | } 41 | ) 42 | } 43 | 44 | module.exports.command = { 45 | name: 'spotify', 46 | aliases: ['sp'], 47 | category: 'media', 48 | usage: '[link]', 49 | exp: 5, 50 | description: 'Downloads given spotify track and sends it as Audio' 51 | } 52 | -------------------------------------------------------------------------------- /src/Commands/Media/ytaudio.js: -------------------------------------------------------------------------------- 1 | const YT = require('../../Library/YT') 2 | const yts = require('yt-search') 3 | 4 | module.exports.execute = async (client, flag, arg, M) => { 5 | const link = async (term) => { 6 | const { videos } = await yts(term.trim()) 7 | if (!videos || !videos.length) return null 8 | return videos[0].url 9 | } 10 | if (!arg) return M.reply('🟥 *Please use this command with a valid youtube.com link*') 11 | const validPathDomains = /^https?:\/\/(youtu\.be\/|(www\.)?youtube\.com\/(embed|v|shorts)\/)/ 12 | const term = validPathDomains.test(arg) ? arg.trim() : await link(arg) 13 | if (!term) return M.reply('🟨 *Please use this command with a valid youtube contant term*') 14 | if (!YT.validateURL(term.trim())) return M.reply('🟨 *Please use this command with a valid youtube.com link*') 15 | const { videoDetails } = await YT.getInfo(term) 16 | M.reply('🟩 *Downloading has started please have some pesence*') 17 | let text = `⚡ *Title: ${videoDetails.title}*\n\n🚀 *Views: ${videoDetails.viewCount}*\n\n🎞 *Type: Audio*\n\n⏱ *Duration: ${videoDetails.lengthSeconds}*\n\n📌 *Channel: ${videoDetails.author.name}*\n\n📅 *Uploaded: ${videoDetails.uploadDate}*\n\n🌍 *Url: ${videoDetails.video_url}*\n\n🎬 *Description:* ${videoDetails.description}` 18 | client.sendMessage( 19 | M.from, 20 | { 21 | image: { 22 | url: `https://i.ytimg.com/vi/${videoDetails.videoId}/maxresdefault.jpg` 23 | }, 24 | caption: text 25 | }, 26 | { 27 | quoted: M 28 | } 29 | ) 30 | if (Number(videoDetails.lengthSeconds) > 1800) return M.reply('Cannot download audio longer than 30 minutes') 31 | const audio = YT.getBuffer(term, 'audio') 32 | .then(async (res) => { 33 | await client.sendMessage( 34 | M.from, 35 | { 36 | document: res, 37 | mimetype: 'audio/mpeg', 38 | fileName: videoDetails.title + '.mp3' 39 | }, 40 | { 41 | quoted: M 42 | } 43 | ) 44 | }) 45 | .catch((err) => { 46 | return M.reply(err.toString()) 47 | client.log(err, 'red') 48 | }) 49 | } 50 | 51 | module.exports.command = { 52 | name: 'ytaudio', 53 | aliases: ['yta'], 54 | category: 'media', 55 | usage: '[term | link]', 56 | exp: 5, 57 | description: 'Downloads given YT Video and sends it as Audio' 58 | } 59 | -------------------------------------------------------------------------------- /src/Commands/Media/ytsearch.js: -------------------------------------------------------------------------------- 1 | const yts = require('yt-search') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 5 | const { videos } = await yts(arg.trim()) 6 | if (!videos || !videos.length) return M.reply(`🟨 *No videos found* | "${query}"`) 7 | let text = '' 8 | const length = videos.length >= 10 ? 10 : videos.length 9 | for (let i = 0; i < length; i++) { 10 | text += `*#${i + 1}*\n📗 *Title: ${videos[i].title}*\n📕 *Channel: ${videos[i].author.name}*\n📙 *Duration: ${ 11 | videos[i].seconds 12 | }s*\n🔗 *URL: ${videos[i].url}*\n\n` 13 | } 14 | M.reply(text) 15 | } 16 | 17 | module.exports.command = { 18 | name: 'ytsearch', 19 | aliases: ['yts'], 20 | category: 'media', 21 | usage: '[term]', 22 | exp: 5, 23 | description: 'Searches the video of the given query in YouTube' 24 | } 25 | -------------------------------------------------------------------------------- /src/Commands/Media/ytvideo.js: -------------------------------------------------------------------------------- 1 | const YT = require('../../Library/YT') 2 | const yts = require('yt-search') 3 | 4 | module.exports.execute = async (client, flag, arg, M) => { 5 | const link = async (term) => { 6 | const { videos } = await yts(term.trim()) 7 | if (!videos || !videos.length) return null 8 | return videos[0].url 9 | } 10 | if (!arg) return M.reply('🟥 *Please use this command with a valid youtube.com link*') 11 | const validPathDomains = /^https?:\/\/(youtu\.be\/|(www\.)?youtube\.com\/(embed|v|shorts)\/)/ 12 | const term = validPathDomains.test(arg) ? arg.trim() : await link(arg) 13 | if (!term) return M.reply('🟨 *Please use this command with a valid youtube contant term*') 14 | if (!YT.validateURL(term.trim())) return M.reply('🟨 *Please use this command with a valid youtube.com link*') 15 | const { videoDetails } = await YT.getInfo(term) 16 | M.reply('🟩 *Downloading has started please have some pesence*') 17 | let text = `⚡ *Title: ${videoDetails.title}*\n\n🚀 *Views: ${videoDetails.viewCount}*\n\n🎞 *Type: Video*\n\n⏱ *Duration: ${videoDetails.lengthSeconds}*\n\n📌 *Channel: ${videoDetails.author.name}*\n\n📅 *Uploaded: ${videoDetails.uploadDate}*\n\n🌍 *Url: ${videoDetails.video_url}*\n\n🎬 *Description:* ${videoDetails.description}` 18 | 19 | client.sendMessage( 20 | M.from, 21 | { 22 | image: { 23 | url: `https://i.ytimg.com/vi/${videoDetails.videoId}/maxresdefault.jpg` 24 | }, 25 | caption: text 26 | }, 27 | { 28 | quoted: M 29 | } 30 | ) 31 | if (Number(videoDetails.lengthSeconds) > 1800) return M.reply('Cannot download video longer than 30 minutes') 32 | const audio = YT.getBuffer(term, 'video') 33 | .then(async (res) => { 34 | await client.sendMessage( 35 | M.from, 36 | { 37 | document: res, 38 | mimetype: 'video/mp4', 39 | fileName: videoDetails.title + '.mp4' 40 | }, 41 | { 42 | quoted: M 43 | } 44 | ) 45 | }) 46 | .catch((err) => { 47 | return M.reply(err.toString()) 48 | client.log(err, 'red') 49 | }) 50 | } 51 | 52 | module.exports.command = { 53 | name: 'ytvideo', 54 | aliases: ['ytv'], 55 | category: 'media', 56 | usage: '[term | link]', 57 | exp: 5, 58 | description: 'Downloads given YT Video' 59 | } 60 | -------------------------------------------------------------------------------- /src/Commands/Moderation/demote.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!M.mentions.length) return M.reply(`🟥 *Mentions are required to demote*`) 3 | const mentions = client.utils.removeDuplicates(M.mentions) 4 | if (mentions.length > 5) 5 | return M.reply(`🟥 *You can only demote up to 5 users at a time, Remove some users and try again*`) 6 | const groupMetadata = await client.groupMetadata(M.from) 7 | const groupMembers = groupMetadata?.participants || [] 8 | const groupAdmins = groupMembers.filter((v) => v.admin).map((v) => v.id) 9 | let text = `🎖️ _*Demote Users..._*\n` 10 | for (const jid of mentions) { 11 | const number = jid.split('@')[0] 12 | if (!groupAdmins.includes(jid)) text += `\n🟨 *@${number}* is already not an admin` 13 | else { 14 | await client.groupParticipantsUpdate(M.from, [jid], 'demote') 15 | text += `\n🟩 *Demoted @${number}*` 16 | } 17 | } 18 | await client.sendMessage(M.from, { text, mentions: M.mentions }, { quoted: M }) 19 | } 20 | 21 | module.exports.command = { 22 | name: 'demote', 23 | aliases: ['demo'], 24 | exp: 5, 25 | category: 'moderation', 26 | usage: '[mention user | quote user]', 27 | description: 'Demotes the taged user' 28 | } 29 | -------------------------------------------------------------------------------- /src/Commands/Moderation/groupAnnounce.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | const group = ['open', 'close'] 3 | if (!group.includes(arg)) return M.reply('📢 *Choose the mode!!*') 4 | const groupMetadata = await client.groupMetadata(M.from) 5 | switch (arg) { 6 | case 'open': 7 | if (!groupMetadata.announce) return M.reply('📢 *Group is alrady in Not_Announce mode*') 8 | await client.groupSettingUpdate(M.from, 'not_announcement') 9 | return M.reply('📢 *Group is in Not_Announce mode*') 10 | break 11 | case 'close': 12 | if (groupMetadata.announce) return M.reply('📢 *Group is alrady in Announce mode*') 13 | await client.groupSettingUpdate(M.from, 'announcement') 14 | return M.reply('📢 *Group is in Not_Announce mode*') 15 | break 16 | } 17 | } 18 | 19 | module.exports.command = { 20 | name: 'group', 21 | aliases: ['gc'], 22 | exp: 5, 23 | usage: 'open | close', 24 | category: 'moderation', 25 | description: 'Closes or opens the group' 26 | } 27 | -------------------------------------------------------------------------------- /src/Commands/Moderation/invite.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | const invitelink = (await client.DB.get('invitelink')) || [] 3 | if (!invitelink.includes(M.from)) return M.reply(`🟨 *Invitelink is not registered on this group*`) 4 | const code = await client.groupInviteCode(M.from) 5 | M.reply('https://chat.whatsapp.com/' + code) 6 | } 7 | 8 | module.exports.command = { 9 | name: 'invite', 10 | aliases: ['inv', 'gclink', 'grouplink'], 11 | exp: 10, 12 | usage: '[link]', 13 | category: 'moderation', 14 | description: 'Get the group link' 15 | } 16 | -------------------------------------------------------------------------------- /src/Commands/Moderation/promote.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!M.mentions.length) return M.reply(`🟥 *Mentions are required to promote*`) 3 | const mentions = client.utils.removeDuplicates(M.mentions) 4 | if (mentions.length > 5) 5 | return M.reply(`🟥 *You can only promote up to 5 users at a time, Remove some users and try again*`) 6 | const groupMetadata = await client.groupMetadata(M.from) 7 | const groupMembers = groupMetadata?.participants || [] 8 | const groupAdmins = groupMembers.filter((v) => v.admin).map((v) => v.id) 9 | let text = `🎖️ _*Promote Users..._*\n` 10 | for (const jid of mentions) { 11 | const number = jid.split('@')[0] 12 | if (groupAdmins.includes(jid)) text += `\n🟨 *@${number}* is already an admin` 13 | else { 14 | await client.groupParticipantsUpdate(M.from, [jid], 'promote') 15 | text += `\n🟩 *Promoted @${number}*` 16 | } 17 | } 18 | await client.sendMessage(M.from, { text, mentions: M.mentions }, { quoted: M }) 19 | } 20 | 21 | module.exports.command = { 22 | name: 'promote', 23 | aliases: ['promo'], 24 | exp: 5, 25 | category: 'moderation', 26 | usage: '[mention user | quote user]', 27 | description: 'Promotes the taged user' 28 | } 29 | -------------------------------------------------------------------------------- /src/Commands/Moderation/remove.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!M.mentions.length) return M.reply(`🟥 *Mentions are required to remove*`) 3 | const mentions = client.utils.removeDuplicates(M.mentions) 4 | if (mentions.length > 5) 5 | return M.reply(`🟥 *You can only remove up to 5 users at a time, Remove some users and try again*`) 6 | await client.groupParticipantsUpdate(M.from, mentions, 'remove').then((res) => { 7 | M.reply(`🟩 *Done! removing ${mentions.length} users*`) 8 | }) 9 | } 10 | 11 | module.exports.command = { 12 | name: 'remove', 13 | aliases: ['rem'], 14 | exp: 10, 15 | category: 'moderation', 16 | usage: '[mention user | quote user]', 17 | description: 'Removes the taged user' 18 | } 19 | -------------------------------------------------------------------------------- /src/Commands/Moderation/revoke.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | await client.groupRevokeInvite(M.from).then((res) => { 3 | M.reply(`🟩 *Done! Group link has been reset*`) 4 | }) 5 | } 6 | 7 | module.exports.command = { 8 | name: 'revoke', 9 | aliases: ['reset'], 10 | exp: 10, 11 | usage: '', 12 | category: 'moderation', 13 | description: 'Resets group link' 14 | } 15 | -------------------------------------------------------------------------------- /src/Commands/Moderation/tagall.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | const groupMetadata = await client.groupMetadata(M.from) 3 | const groupMembers = groupMetadata?.participants.map((x) => x.id) || [] 4 | const groupAdmins = groupMetadata.participants.filter((x) => x.admin).map((x) => x.id) 5 | 6 | let text = `${arg !== '' ? `🛒 *Message: ${arg}*\n\n` : ''}🎡 *Group:* ${groupMetadata.subject}\n👥 *Members:* ${ 7 | groupMetadata.participants.length 8 | }\n📣 *Tagger: @${M.sender.split('@')[0]}*\n` 9 | 10 | const admins = [] 11 | const members = [] 12 | 13 | for (const jid of groupMembers) { 14 | if (groupAdmins.includes(jid)) { 15 | admins.push(jid) 16 | continue 17 | } 18 | members.push(jid) 19 | } 20 | 21 | for (let i = 0; i < admins.length; i++) text += `${i === 0 ? '\n\n' : '\n'}🌟 *@${admins[i].split('@')[0]}*` 22 | for (let i = 0; i < members.length; i++) text += `${i === 0 ? '\n\n' : '\n'}👤 *@${members[i].split('@')[0]}*` 23 | 24 | await client.sendMessage(M.from, { text, mentions: groupMembers }, { quoted: M }) 25 | } 26 | 27 | module.exports.command = { 28 | name: 'tagall', 29 | aliases: ['everyone', 'ping'], 30 | exp: 18, 31 | usage: '[text]', 32 | category: 'moderation', 33 | description: 'Tag all the users present in the group' 34 | } 35 | -------------------------------------------------------------------------------- /src/Commands/Moderation/toggle.js: -------------------------------------------------------------------------------- 1 | const settings = [ 2 | { 3 | name: 'mods', 4 | description: 5 | 'Enables the bot to remove the member which sent an invite link for other group (will work if and only if the bot is admin).' 6 | }, 7 | { 8 | name: 'events', 9 | description: 'If enabled, the bot will listen for group events like new members joining, leaving, etc.' 10 | }, 11 | { 12 | name: 'nsfw', 13 | description: 'If enabled, the bot will give access this group to use all the NSFW commands.' 14 | }, 15 | { 16 | name: 'chatbot', 17 | description: 'If enabled, bot will automatically in your chat' 18 | }, 19 | { 20 | name: 'invitelink', 21 | description: 'If enabled, the bot will give access to the invitelink command.' 22 | } 23 | ] 24 | module.exports.execute = async (client, flag, arg, M) => { 25 | const option = ['--true', '--false'] 26 | 27 | if (!option.includes(flag[0])) { 28 | return M.reply( 29 | ` 30 | 🔧 *Toggle Settings* 🔧 31 | 32 | ${settings 33 | .map( 34 | ({ name, description }) => 35 | `🟢 *${name}* - ${description}\n\nTo turn on *${client.config.prefix}toggle ${name} --true*\nTo turn off *${client.config.prefix}toggle ${name} --false*` 36 | ) 37 | .join('\n\n')} 38 | ` 39 | ) 40 | } 41 | if (!settings.map((x) => x.name).includes(arg)) return M.reply(`🟥 *Invalid setting*`) 42 | const Actives = (await client.DB.get(arg)) || [] 43 | if (flag[0] === '--true') { 44 | if (Actives.includes(M.from)) return M.reply(`🟨 *${client.utils.capitalize(arg)} is already enabled*`) 45 | await client.DB.push(arg, M.from) 46 | return M.reply(`🟩 *Enabled "${client.utils.capitalize(arg)}"*`) 47 | } 48 | if (flag[0] === '--false') { 49 | if (!Actives.includes(M.from)) return M.reply(`🟨 *${client.utils.capitalize(arg)} is already disabled*`) 50 | await client.DB.pull(arg, M.from) 51 | return M.reply(`🟩 *Disabled "${client.utils.capitalize(arg)}"*`) 52 | } 53 | return M.reply(`🟥 *Invalid value*`) 54 | } 55 | 56 | module.exports.command = { 57 | name: 'toggle', 58 | aliases: ['tog'], 59 | exp: 10, 60 | category: 'moderation', 61 | usage: '[option] --true | --false', 62 | description: 'Activate certain features on group-chats' 63 | } 64 | -------------------------------------------------------------------------------- /src/Commands/Music/alive.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | M.reply('*Hwllo Human* 🤖') 3 | } 4 | 5 | module.exports.command = { 6 | name: 'alive', 7 | aliases: ['a'], 8 | category: 'music', 9 | usage: '', 10 | exp: 0, 11 | description: 'Testing stuff' 12 | } 13 | -------------------------------------------------------------------------------- /src/Commands/Music/ping.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | await M.reply(`*_${client.utils.calculatePing(M.messageTimestamp, Date.now())} second(s)_*`) 3 | } 4 | 5 | module.exports.command = { 6 | name: 'ping', 7 | aliases: ['speed'], 8 | usage: '', 9 | category: 'music', 10 | exp: 1, 11 | description: 'Bot response in second' 12 | } 13 | -------------------------------------------------------------------------------- /src/Commands/Music/stats.js: -------------------------------------------------------------------------------- 1 | const os = require('os') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | let cpus = os.cpus(), 5 | text = 6 | `*Server:*\n\n- Nodejs: ${process.version}\n- Memory: ${ 7 | client.utils.formatSize(os.totalmem() - os.freemem()) + '/' + client.utils.formatSize(os.totalmem()) 8 | }\n` + 9 | `- CPU: ${cpus[0].model} ${cpus.length > 1 ? `(${cpus.length} core)` : ''}\n- Platform: ${os.platform()}` 10 | await M.reply(text) 11 | } 12 | 13 | module.exports.command = { 14 | name: 'stats', 15 | aliases: ['status'], 16 | category: 'music', 17 | usage: '', 18 | exp: 8, 19 | description: 'Bot Stats' 20 | } 21 | -------------------------------------------------------------------------------- /src/Commands/Utils/Img.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!M.quoted || (M.quoted && M.quoted.mtype !== 'stickerMessage')) 3 | return M.reply('🟥 *Quote the sticker that you want to convert, Baka!*') 4 | const buffer = await M.quoted.download() 5 | const animated = M.quoted?.message?.stickerMessage?.isAnimated 6 | const type = animated ? 'video' : 'image' 7 | try { 8 | const result = animated ? await client.utils.webpToMp4(buffer) : await client.utils.webpToPng(buffer) 9 | await client.sendMessage( 10 | M.from, 11 | { 12 | [type]: result, 13 | gifPlayback: animated ? true : undefined 14 | }, 15 | { quoted: M } 16 | ) 17 | } catch (error) { 18 | client.log(error, 'red') 19 | return await M.reply('*Try Again*') 20 | } 21 | } 22 | 23 | module.exports.command = { 24 | name: 'toimg', 25 | aliases: ['img'], 26 | category: 'utils', 27 | usage: '[quote the image]', 28 | exp: 10, 29 | description: 'Converts sticker to image/gif' 30 | } 31 | -------------------------------------------------------------------------------- /src/Commands/Utils/gify.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 5 | const res = await axios.get(`https://g.tenor.com/v1/search?q=${arg}&key=LIVDSRZULELA&limit=8`).catch(() => null) 6 | if (!res.data) return M.reply('🟨 *Could not find*') 7 | client.sendMessage( 8 | M.from, 9 | { 10 | video: { 11 | url: res.data.results?.[Math.floor(Math.random() * res.data.results.length)]?.media[0]?.mp4?.url 12 | }, 13 | caption: 'Here you go', 14 | gifPlayback: true 15 | }, 16 | { 17 | quoted: M 18 | } 19 | ) 20 | } 21 | 22 | module.exports.command = { 23 | name: 'getgif', 24 | aliases: ['gify'], 25 | category: 'utils', 26 | usage: '[term]', 27 | exp: 7, 28 | description: 'Searches gif' 29 | } 30 | -------------------------------------------------------------------------------- /src/Commands/Utils/google.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | const Apikey = 'AIzaSyDMbI3nvmQUrfjoCJYLS69Lej1hSXQjnWI&cx=baf9bdb0c631236e5' 3 | 4 | module.exports.execute = async (client, flag, arg, M) => { 5 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 6 | const res = await axios.get(`https://www.googleapis.com/customsearch/v1?q=${arg}&key=${Apikey}`).catch((err) => { 7 | return M.reply(err.toString()) 8 | }) 9 | if (res.data.items.length == 0) return M.reply('🟨 *Could not find*') 10 | const results = res.data.items 11 | 12 | let text = `*====GOOGLE SEARCH====*\n\n` 13 | for (const result of results) { 14 | text += `📗 *Title: ${result.title}*\n` 15 | text += `📙 *Description: ${result.snippet}*\n` 16 | text += `🌐 *Link: ${result.link}*\n\n` 17 | } 18 | M.reply(text) 19 | } 20 | 21 | module.exports.command = { 22 | name: 'google', 23 | aliases: ['search'], 24 | category: 'utils', 25 | usage: '[term]', 26 | exp: 5, 27 | description: 'Search topics from google.com' 28 | } 29 | -------------------------------------------------------------------------------- /src/Commands/Utils/gpt.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!arg) return M.reply('🟥 *Sorry you did not give any term!*') 3 | if (!client.config.writesonicAPI) return M.reply('🟥 *You did not provided any api key for useage!*') 4 | await client.AI.WriteSonic_gpt(arg) 5 | .then((res) => M.reply(res.response.data.message)) 6 | .catch((err) => { 7 | return M.reply(err.toString()) 8 | client.log(err, 'red') 9 | }) 10 | } 11 | 12 | module.exports.command = { 13 | name: 'gpt', 14 | aliases: ['g'], 15 | category: 'utils', 16 | usage: '[term]', 17 | exp: 5, 18 | description: 'Let you chat with GPT chat bot' 19 | } 20 | -------------------------------------------------------------------------------- /src/Commands/Utils/imagesearch.js: -------------------------------------------------------------------------------- 1 | const google = require('googlethis') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 5 | const nsfw = (await client.DB.get('nsfw')) || [] 6 | const images = await google.image(arg, { safe: nsfw.includes(M.from) }).catch((err) => { 7 | return M.reply('🟨 *Could not find*') 8 | }) 9 | client.sendMessage(M.from, { 10 | image: { 11 | url: images[0].url 12 | }, 13 | caption: 'Here you go' 14 | }) 15 | } 16 | 17 | module.exports.command = { 18 | name: 'imagesearch', 19 | aliases: ['imgs'], 20 | category: 'utils', 21 | usage: '[term]', 22 | exp: 7, 23 | description: 'Searches image from google.com' 24 | } 25 | -------------------------------------------------------------------------------- /src/Commands/Utils/removebg.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | if (!client.config.bgAPI) return M.reply("🟥 *You didn't provide an api key*") 3 | const content = JSON.stringify(M.quoted) 4 | const isQuoted = M.type === 'extendedTextMessage' && content.includes('imageMessage') 5 | const isImage = isQuoted 6 | ? M.type === 'extendedTextMessage' && content.includes('imageMessage') 7 | : M.type === 'imageMessage' 8 | if (!isImage) return M.reply("🟥 *You didn't provide an image*") 9 | const buffer = isQuoted ? await M.quoted.download() : await M.download() 10 | const image = await client.utils.removeBG(buffer) 11 | 12 | await client.sendMessage( 13 | M.from, 14 | { 15 | image: image 16 | }, 17 | { 18 | quoted: M 19 | } 20 | ) 21 | } 22 | 23 | module.exports.command = { 24 | name: 'removebg', 25 | aliases: ['rbg'], 26 | category: 'utils', 27 | usage: '[quote the image]', 28 | exp: 10, 29 | description: 'Removes background from the image' 30 | } 31 | -------------------------------------------------------------------------------- /src/Commands/Utils/steal.js: -------------------------------------------------------------------------------- 1 | const { Sticker, StickerTypes } = require('wa-sticker-formatter') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | const content = JSON.stringify(M.quoted) 5 | const isQuotedSticker = M.type === 'extendedTextMessage' && content.includes('stickerMessage') 6 | 7 | if (isQuotedSticker) { 8 | const pack = arg.split('|') 9 | const buffer = await M.quoted.download() 10 | const sticker = new Sticker(buffer, { 11 | pack: pack[1] ? pack[1].trim() : '👾 Handcrafted for you by', 12 | author: pack[2] ? pack[2].trim() : `Krypton 👾`, 13 | type: StickerTypes.FULL, 14 | categories: ['🤩', '🎉'], 15 | quality: 70 16 | }) 17 | 18 | await client.sendMessage( 19 | M.from, 20 | { 21 | sticker: await sticker.build() 22 | }, 23 | { 24 | quoted: M 25 | } 26 | ) 27 | } else return M.reply('🟥 *Please quote the sticker!!*') 28 | // console.log(buffer) 29 | } 30 | 31 | module.exports.command = { 32 | name: 'steal', 33 | aliases: ['take'], 34 | category: 'utils', 35 | usage: '[quote the sticker] |PackName|AuthorName', 36 | exp: 10, 37 | description: 'Changes the sticker Pack and Author name' 38 | } 39 | -------------------------------------------------------------------------------- /src/Commands/Utils/sticker.js: -------------------------------------------------------------------------------- 1 | const { Sticker } = require('wa-sticker-formatter') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!M.messageTypes(M.type) && !M.messageTypes(M.quoted.mtype)) 5 | return void M.reply('🟥 *Caption/Quote an image/video/gif message*') 6 | 7 | const pack = arg.split('|') 8 | const buffer = M.quoted ? await M.quoted.download() : await M.download() 9 | const sticker = await new Sticker(buffer, { 10 | pack: pack[1] ? pack[1].trim() : '👾 Handcrafted for you by', 11 | author: pack[2] ? pack[2].trim() : `Krypton 👾`, 12 | categories: ['🤩', '🎉'], 13 | quality: 70, 14 | type: 15 | flag.includes('--c') || flag.includes('--crop') 16 | ? 'crop' 17 | : flag.includes('--s') || flag.includes('--stretch') 18 | ? 'default' 19 | : flag.includes('--circle') 20 | ? 'circle' 21 | : 'full' 22 | }).build() 23 | await client.sendMessage(M.from, { sticker }, { quoted: M }) 24 | } 25 | 26 | module.exports.command = { 27 | name: 'sticker', 28 | aliases: ['s'], 29 | category: 'utils', 30 | usage: '[quote the video or image] |PackName|AuthorName', 31 | exp: 15, 32 | description: 'Converts a normal video or an image into sticker' 33 | } 34 | -------------------------------------------------------------------------------- /src/Commands/Utils/subraddit.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 5 | const nsfw = (await client.DB.get('nsfw')) || [] 6 | try { 7 | const res = await axios.get(`https://meme-api.com/gimme/${arg}`) 8 | if (res.data.code == 404) return M.reply('🟨 *Could not find*') 9 | if (!nsfw.includes(M.from) && res.data.nsfw) return reply(`🟨 *NSFW is not registered on this group*`) 10 | const text = `🖌️ *Title: ${res.data.title}*\n\n*👨‍🎨 Author: ${res.data.postLink}*\n\n*🎏 Subreddit: ${res.data.subreddit}*\n\n*🔞 NSFW: ${res.data.nsfw}*\n\n*🌐 Post: ${res.data.postLink}*\n\n*💢 Spoiler: ${res.data.spoiler}*` 11 | client.sendMessage(M.from, { 12 | image: { 13 | url: res.data.url 14 | }, 15 | caption: text 16 | }) 17 | } catch (err) { 18 | return M.reply('🟥 *Error !!*') 19 | } 20 | } 21 | 22 | module.exports.command = { 23 | name: 'subreddit', 24 | aliases: ['sr'], 25 | category: 'utils', 26 | usage: '[term]', 27 | exp: 7, 28 | description: 'Sends an image of a random waifu' 29 | } 30 | -------------------------------------------------------------------------------- /src/Commands/Weeb/aniNews.js: -------------------------------------------------------------------------------- 1 | const { NEWS } = require('@consumet/extensions') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | try { 5 | const news = await new NEWS.ANN().fetchNewsFeeds() 6 | for (let i = 0; i < 5; i++) { 7 | client.sendMessage(M.from, { 8 | image: { 9 | url: news[i].thumbnail 10 | }, 11 | caption: `📔 *Title: ${news[i].title}*\n\n💾 *ID: ${news[i].id}*\n\n🎋 *Topics: ${news[i].topics 12 | .toString() 13 | .replace(/,/g, '\n')}*\n\n⏱ *UploadedAt: ${news[i].uploadedAt}*\n\n📗 *Intro: ${ 14 | news[i].preview.intro 15 | }*\n\n✔ *Link: ${news[i].url}*\n\n⛩ *Description:* ${news[i].preview.full}` 16 | }) 17 | } 18 | } catch (err) { 19 | M.reply(err.toString()) 20 | client.log(err, 'red') 21 | } 22 | } 23 | 24 | module.exports.command = { 25 | name: 'aninews', 26 | aliases: ['animenews'], 27 | category: 'weeb', 28 | usage: '', 29 | exp: 15, 30 | description: 'Gives you news about anime' 31 | } 32 | -------------------------------------------------------------------------------- /src/Commands/Weeb/anime.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 5 | const res = await axios.get(`https://api.jikan.moe/v4/anime?q=${arg}`) 6 | if (!res.data.data.length) return M.reply('🟨 *Could not find*') 7 | 8 | let text = '' 9 | text += `📔 *Name: ${res.data.data[0].title_english}*\n\n` 10 | text += `💮 *Japanese: ${res.data.data[0].title_japanese}*\n\n` 11 | text += `⏰ *Duration: ${res.data.data[0].duration}*\n\n` 12 | text += `⛩ *Episodes: ${res.data.data[0].episodes}*\n\n` 13 | text += `📊 *Description:* ${res.data.data[0].synopsis}` 14 | // M.reply(text); 15 | client.sendMessage(M.from, { 16 | image: { 17 | url: res.data.data[0].images.jpg.large_image_url 18 | }, 19 | caption: text 20 | }) 21 | } 22 | 23 | module.exports.command = { 24 | name: 'anime', 25 | aliases: ['ani'], 26 | category: 'weeb', 27 | usage: '[term]', 28 | exp: 5, 29 | description: 'Gives you the info of the anime' 30 | } 31 | -------------------------------------------------------------------------------- /src/Commands/Weeb/character.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | if (!arg) return M.reply('🟥 *Sorry you did not give any search term!*') 5 | const chara = await axios.get(`https://api.jikan.moe/v4/characters?q=${arg}`) 6 | if (!chara.data.data.length) return M.reply('🟨 *Could not find*') 7 | 8 | let text = '' 9 | text += `📔 *Name: ${chara.data.data[0].name}*\n\n` 10 | text += `💮 *Japanese: ${chara.data.data[0].name_kanji}*\n\n` 11 | text += `⛩ *Favorites: ${chara.data.data[0].favorites}*\n\n` 12 | text += `💾 *Mal_ID: ${chara.data.data[0].mal_id}*\n\n` 13 | text += `📊 *Description:* ${chara.data.data[0].about}` 14 | // M.reply(text); 15 | client.sendMessage(M.from, { 16 | image: { 17 | url: chara.data.data[0].image.jpg.image_url 18 | }, 19 | caption: text 20 | }) 21 | } 22 | 23 | module.exports.command = { 24 | name: 'character', 25 | aliases: ['char'], 26 | category: 'weeb', 27 | usage: '[term]', 28 | exp: 5, 29 | description: 'Gives you the info of a character from anime' 30 | } 31 | -------------------------------------------------------------------------------- /src/Commands/Weeb/haigusha.js: -------------------------------------------------------------------------------- 1 | module.exports.execute = async (client, flag, arg, M) => { 2 | const result = await client.utils.fetch('https://reina-api.vercel.app/api/mwl/random') 3 | let text = '' 4 | text += `📔 *Name: ${result.data.name}*\n\n` 5 | text += `💮 *Japanese: ${result.data.original_name}*\n\n` 6 | text += `⛩ *Romaji_name: ${result.data.romaji_name}*\n\n` 7 | text += `💾 *Slug: ${result.data.slug}*\n\n` 8 | text += `👥 *Gender: ${result.data.gender}*\n\n` 9 | text += `⏰ *Age: ${result.data.age}*\n\n` 10 | text += `❤ *Popularity_rank: ${result.data.popularity_rank}*\n\n` 11 | text += `✔ *Tags: ${result.data.tags.join(', ')}*\n\n` 12 | text += `🔎 *Url: ${result.data.url}*\n\n` 13 | text += `📊 *Description:* ${result.data.description}` 14 | client.sendMessage(M.from, { 15 | image: { 16 | url: result.data.image 17 | }, 18 | caption: text 19 | }) 20 | } 21 | 22 | module.exports.command = { 23 | name: 'haigusha', 24 | aliases: ['hg'], 25 | category: 'weeb', 26 | usage: '', 27 | exp: 5, 28 | description: 'Summons a random anime character to marry' 29 | } 30 | -------------------------------------------------------------------------------- /src/Commands/Weeb/neko.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | const res = await axios.get(`https://api.waifu.pics/sfw/neko`).catch((err) => { 5 | return M.reply(err.toString()) 6 | client.log(err, 'red') 7 | }) 8 | client.sendMessage(M.from, { 9 | image: { 10 | url: res.data.url 11 | }, 12 | caption: `_Neko Neko Ni~_` 13 | }) 14 | } 15 | 16 | module.exports.command = { 17 | name: 'neko', 18 | aliases: ['catgirl'], 19 | category: 'weeb', 20 | usage: '', 21 | exp: 10, 22 | description: 'Sends an image of random neko' 23 | } 24 | -------------------------------------------------------------------------------- /src/Commands/Weeb/waifu.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | module.exports.execute = async (client, flag, arg, M) => { 4 | const res = await axios.get(`https://api.waifu.im/search/?included_tags=waifu`).catch((err) => { 5 | return M.reply(err.toString()) 6 | client.log(err, 'red') 7 | }) 8 | 9 | client.sendMessage(M.from, { 10 | image: { 11 | url: res.data.images[0].url 12 | }, 13 | caption: `Waifu from ${res.data.images[0].source}` 14 | }) 15 | } 16 | 17 | module.exports.command = { 18 | name: 'waifu', 19 | aliases: ['animegirl'], 20 | category: 'weeb', 21 | usage: '', 22 | exp: 7, 23 | description: 'Sends an image of a random waifu' 24 | } 25 | -------------------------------------------------------------------------------- /src/Handlers/Events.js: -------------------------------------------------------------------------------- 1 | const Welcomer = require('welcomer-gif') 2 | 3 | module.exports = EventsHandler = async (event, client) => { 4 | const activateEvents = (await client.DB.get('events')) || [] 5 | const groupMetadata = await client.groupMetadata(event.id) 6 | if (!activateEvents.includes(event.id)) return 7 | const text = 8 | event.action === 'add' 9 | ? `- ${groupMetadata.subject} -\n\n💈 *Group Description:*\n${ 10 | groupMetadata.desc 11 | }\n\nHope you follow the rules and have fun!\n\n*‣ ${event.participants 12 | .map((jid) => `@${jid.split('@')[0]}`) 13 | .join(' ')}*` 14 | : event.action === 'remove' 15 | ? `Goodbye *${event.participants 16 | .map((jid) => `@${jid.split('@')[0]}`) 17 | .join(', ')}* 👋🏻, we're probably not gonna miss you.` 18 | : event.action === 'demote' 19 | ? `Ara Ara, looks like *@${event.participants[0].split('@')[0]}* got Demoted` 20 | : `Congratulations *@${event.participants[0].split('@')[0]}*, you're now an admin` 21 | if (event.action === 'add') { 22 | const user = event.participants[0] 23 | const username = (await client.contact.getContact(user, client)).username 24 | const tag = ((Math.random() * 10000) | 0).toString().padStart(4, '0') 25 | let imageUrl 26 | try { 27 | imageUrl = await client.profilePictureUrl(user, 'image') 28 | } catch { 29 | imageUrl = 'https://upload.wikimedia.org/wikipedia/commons/a/ac/Default_pfp.jpg' 30 | } 31 | const pfp = await client.utils.getBuffer(imageUrl) 32 | const image = new Welcomer() 33 | .setBackground('https://i.pinimg.com/originals/07/28/dc/0728dc400eca09632215055ff003d8bf.gif') 34 | .setGIF(true) 35 | .setAvatar(pfp) 36 | .setName(username) 37 | .setDiscriminator(tag) 38 | return void (await client.sendMessage(event.id, { 39 | video: await client.utils.gifToMp4(await image.generate()), 40 | gifPlayback: true, 41 | mentions: event.participants, 42 | caption: text 43 | })) 44 | } 45 | client.sendMessage(event.id, { 46 | text, 47 | mentions: event.participants 48 | }) 49 | } 50 | -------------------------------------------------------------------------------- /src/Handlers/Message.js: -------------------------------------------------------------------------------- 1 | const { serialize } = require('../Helper/WAclient') 2 | const { getStats } = require('../Library/stats') 3 | const chalk = require('chalk') 4 | const emojiStrip = require('emoji-strip') 5 | const axios = require('axios') 6 | 7 | module.exports = MessageHandler = async (messages, client) => { 8 | try { 9 | if (messages.type !== 'notify') return 10 | let M = serialize(JSON.parse(JSON.stringify(messages.messages[0])), client) 11 | if (!M.message) return 12 | if (M.key && M.key.remoteJid === 'status@broadcast') return 13 | if (M.type === 'protocolMessage' || M.type === 'senderKeyDistributionMessage' || !M.type || M.type === '') 14 | return 15 | 16 | const { isGroup, sender, from, body } = M 17 | const gcMeta = isGroup ? await client.groupMetadata(from) : '' 18 | const gcName = isGroup ? gcMeta.subject : '' 19 | const isCmd = body.startsWith(client.config.prefix) 20 | const [cmdName, ...args] = body.replace(client.config.prefix, '').split(' ') 21 | const arg = args.filter((x) => !x.startsWith('--')).join(' ') 22 | const flag = args.filter((arg) => arg.startsWith('--')) 23 | const groupMembers = gcMeta?.participants || [] 24 | const groupAdmins = groupMembers.filter((v) => v.admin).map((v) => v.id) 25 | const ActivateMod = (await client.DB.get('mod')) || [] 26 | const ActivateChatBot = (await client.DB.get('chatbot')) || [] 27 | const banned = (await client.DB.get('banned')) || [] 28 | 29 | //Antilink 30 | await antilink(client, M, groupAdmins, ActivateMod, isGroup, sender, body, from) 31 | 32 | //Banned system 33 | if (banned.includes(sender)) return M.reply('🟥 *You are banned from using the bot*') 34 | 35 | //Ai chat 36 | await ai_chat(client, M, isGroup, isCmd, ActivateChatBot, body, from) 37 | 38 | // Logging Message 39 | client.log( 40 | `${chalk[isCmd ? 'red' : 'green'](`${isCmd ? '~EXEC' : '~RECV'}`)} ${ 41 | isCmd ? `${client.config.prefix}${cmdName}` : 'Message' 42 | } ${chalk.white('from')} ${M.pushName} ${chalk.white('in')} ${isGroup ? gcName : 'DM'} ${chalk.white( 43 | `args: [${chalk.blue(args.length)}]` 44 | )}`, 45 | 'yellow' 46 | ) 47 | 48 | if (!isCmd) return 49 | const command = 50 | client.cmd.get(cmdName) || 51 | client.cmd.find((cmd) => cmd.command.aliases && cmd.command.aliases.includes(cmdName)) 52 | 53 | if (!command) return M.reply(`💔 *No such command found!!*`) 54 | if (!groupAdmins.includes(sender) && command.command.category == 'moderation') 55 | return M.reply('🟨 *User Missing Admin Permission*') 56 | if ( 57 | !groupAdmins.includes(client.user.id.split(':')[0] + '@s.whatsapp.net') && 58 | command.command.category == 'moderation' 59 | ) 60 | return M.reply('💔 *Missing admin permission. Try promoting me to admin and try again.*') 61 | if (!isGroup && command.command.category == 'moderation') 62 | return M.reply('🟨 *This command and its aliases can only be used in a group chat*') 63 | if (!client.config.mods.includes(sender.split('@')[0]) && command.command.category == 'dev') 64 | return M.reply('📛 *This command only can be accessed by the mods*') 65 | command.execute(client, flag, arg, M) 66 | 67 | //Experiance 68 | await experience(client, sender, M, from, command) 69 | } catch (err) { 70 | client.log(err, 'red') 71 | } 72 | } 73 | 74 | const antilink = async (client, M, groupAdmins, ActivateMod, isGroup, sender, body, from) => { 75 | // Antilink system 76 | if ( 77 | isGroup && 78 | ActivateMod.includes(from) && 79 | groupAdmins.includes(client.user.id.split(':')[0] + '@s.whatsapp.net') && 80 | body 81 | ) { 82 | const groupCodeRegex = body.match(/chat.whatsapp.com\/(?:invite\/)?([\w\d]*)/) 83 | if (groupCodeRegex && groupCodeRegex.length === 2 && !groupAdmins.includes(sender)) { 84 | const groupCode = groupCodeRegex[1] 85 | const groupNow = await client.groupInviteCode(from) 86 | 87 | if (groupCode !== groupNow) { 88 | await client.sendMessage(from, { delete: M.key }) 89 | return await client.groupParticipantsUpdate(from, [sender], 'remove') 90 | M.reply('❤ *Successfully removed an intruder!!!!*') 91 | } 92 | } 93 | } 94 | } 95 | 96 | const ai_chat = async (client, M, isGroup, isCmd, ActivateChatBot, body, from) => { 97 | // AI chatting using 98 | if (M.quoted?.participant) M.mentions.push(M.quoted.participant) 99 | if ( 100 | M.mentions.includes(client.user.id.split(':')[0] + '@s.whatsapp.net') && 101 | !isCmd && 102 | isGroup && 103 | ActivateChatBot.includes(from) 104 | ) { 105 | const msg = M.mentions 106 | ? M.mentions 107 | .map(async (x) => `${body.replace(x, (await client.contact.getContact(x, client)).username)}`) 108 | .join(', ') 109 | : body 110 | const text = await axios.get(`https://hercai.onrender.com/beta/hercai?question=${encodeURI(msg)}`, { 111 | headers: { 112 | 'content-type': 'application/json' 113 | } 114 | }) 115 | M.reply(text.data.reply) 116 | } 117 | } 118 | 119 | const experience = async (client, sender, M, from, cmd) => { 120 | //Will add exp according to the commands 121 | await client.exp.add(sender, cmd.command.exp) 122 | 123 | //Level up 124 | const level = (await client.DB.get(`${sender}_LEVEL`)) || 0 125 | const experience = await client.exp.get(sender) 126 | const { requiredXpToLevelUp } = getStats(level) 127 | if (requiredXpToLevelUp > experience) return null 128 | await client.DB.add(`${sender}_LEVEL`, 1) 129 | await M.reply(` 🎉 *_You Leveled Up_*\n\n _*${M.pushName}*_ Level up 🆙 *_${level} ==> ${level + 1}_*`) 130 | } 131 | -------------------------------------------------------------------------------- /src/Helper/WAclient.js: -------------------------------------------------------------------------------- 1 | const { proto, getContentType, jidDecode, downloadContentFromMessage } = require('@whiskeysockets/baileys') 2 | 3 | const decodeJid = (jid) => { 4 | const { user, server } = jidDecode(jid) || {} 5 | return user && server ? `${user}@${server}`.trim() : jid 6 | } 7 | 8 | /** 9 | * @param {proto.IMessage} message 10 | * @returns {Promise} 11 | */ 12 | 13 | const downloadMedia = async (message) => { 14 | /**@type {keyof proto.IMessage} */ 15 | let type = Object.keys(message)[0] 16 | let M = message[type] 17 | if (type === 'buttonsMessage' || type === 'viewOnceMessageV2') { 18 | if (type === 'viewOnceMessageV2') { 19 | M = message.viewOnceMessageV2?.message 20 | type = Object.keys(M || {})[0] 21 | } else type = Object.keys(M || {})[1] 22 | M = M[type] 23 | } 24 | const stream = await downloadContentFromMessage(M, type.replace('Message', '')) 25 | let buffer = Buffer.from([]) 26 | for await (const chunk of stream) { 27 | buffer = Buffer.concat([buffer, chunk]) 28 | } 29 | return buffer 30 | } 31 | 32 | /** 33 | * parse message for easy use 34 | * @param {proto.IWebMessageInfo} M 35 | * @param client 36 | */ 37 | function serialize(M, client) { 38 | if (M.key) { 39 | M.id = M.key.id 40 | M.isSelf = M.key.fromMe 41 | M.from = decodeJid(M.key.remoteJid) 42 | M.isGroup = M.from.endsWith('@g.us') 43 | M.sender = M.isGroup ? decodeJid(M.key.participant) : M.isSelf ? decodeJid(client.user.id) : M.from 44 | } 45 | if (M.message) { 46 | M.type = getContentType(M.message) 47 | if (M.type === 'ephemeralMessage') { 48 | M.message = M.message[M.type].message 49 | const tipe = Object.keys(M.message)[0] 50 | M.type = tipe 51 | if (tipe === 'viewOnceMessageV2') { 52 | M.message = M.message[M.type].message 53 | M.type = getContentType(M.message) 54 | } 55 | } 56 | if (M.type === 'viewOnceMessageV2') { 57 | M.message = M.message[M.type].message 58 | M.type = getContentType(M.message) 59 | } 60 | M.messageTypes = (type) => ['videoMessage', 'imageMessage'].includes(type) 61 | try { 62 | const quoted = M.message[M.type]?.contextInfo 63 | if (quoted.quotedMessage['ephemeralMessage']) { 64 | const tipe = Object.keys(quoted.quotedMessage.ephemeralMessage.message)[0] 65 | if (tipe === 'viewOnceMessageV2') { 66 | M.quoted = { 67 | type: 'view_once', 68 | stanzaId: quoted.stanzaId, 69 | participant: decodeJid(quoted.participant), 70 | message: quoted.quotedMessage.ephemeralMessage.message.viewOnceMessage.message 71 | } 72 | } else { 73 | M.quoted = { 74 | type: 'ephemeral', 75 | stanzaId: quoted.stanzaId, 76 | participant: decodeJid(quoted.participant), 77 | message: quoted.quotedMessage.ephemeralMessage.message 78 | } 79 | } 80 | } else if (quoted.quotedMessage['viewOnceMessageV2']) { 81 | M.quoted = { 82 | type: 'view_once', 83 | stanzaId: quoted.stanzaId, 84 | participant: decodeJid(quoted.participant), 85 | message: quoted.quotedMessage.viewOnceMessage.message 86 | } 87 | } else { 88 | M.quoted = { 89 | type: 'normal', 90 | stanzaId: quoted.stanzaId, 91 | participant: decodeJid(quoted.participant), 92 | message: quoted.quotedMessage 93 | } 94 | } 95 | M.quoted.isSelf = M.quoted.participant === decodeJid(client.user.id) 96 | M.quoted.mtype = Object.keys(M.quoted.message).filter( 97 | (v) => v.includes('Message') || v.includes('conversation') 98 | )[0] 99 | M.quoted.text = 100 | M.quoted.message[M.quoted.mtype]?.text || 101 | M.quoted.message[M.quoted.mtype]?.description || 102 | M.quoted.message[M.quoted.mtype]?.caption || 103 | M.quoted.message[M.quoted.mtype]?.hydratedTemplate?.hydratedContentText || 104 | M.quoted.message[M.quoted.mtype] || 105 | '' 106 | M.quoted.key = { 107 | id: M.quoted.stanzaId, 108 | fromMe: M.quoted.isSelf, 109 | remoteJid: M.from 110 | } 111 | M.quoted.download = () => downloadMedia(M.quoted.message) 112 | } catch { 113 | M.quoted = null 114 | } 115 | M.body = 116 | M.message?.conversation || 117 | M.message?.[M.type]?.text || 118 | M.message?.[M.type]?.caption || 119 | (M.type === 'listResponseMessage' && M.message?.[M.type]?.singleSelectReply?.selectedRowId) || 120 | (M.type === 'buttonsResponseMessage' && M.message?.[M.type]?.selectedButtonId) || 121 | (M.type === 'templateButtonReplyMessage' && M.message?.[M.type]?.selectedId) || 122 | '' 123 | M.reply = (text) => 124 | client.sendMessage( 125 | M.from, 126 | { 127 | text 128 | }, 129 | { 130 | quoted: M 131 | } 132 | ) 133 | M.mentions = [] 134 | if (M.quoted?.participant) M.mentions.push(M.quoted.participant) 135 | const array = M?.message?.[M.type]?.contextInfo?.mentionedJid || [] 136 | M.mentions.push(...array.filter(Boolean)) 137 | M.download = () => downloadMedia(M.message) 138 | M.numbers = client.utils.extractNumbers(M.body) 139 | M.urls = client.utils.extractUrls(M.body) 140 | } 141 | return M 142 | } 143 | 144 | module.exports = { 145 | serialize, 146 | decodeJid 147 | } 148 | -------------------------------------------------------------------------------- /src/Helper/contacts.js: -------------------------------------------------------------------------------- 1 | const getContact = async (jid, client) => { 2 | // Get contact information from the contact database using the JID 3 | const contact = await client.contactDB.get(jid) 4 | 5 | // If the contact exists, return their name, otherwise return "User" 6 | const username = contact ?? 'User' 7 | 8 | return { username, jid } 9 | } 10 | 11 | // Saves an array of contacts to the contact database 12 | const saveContacts = async (contacts, client) => { 13 | // Use Promise.all to concurrently process each contact in the array 14 | await Promise.all( 15 | contacts.map(async (contact) => { 16 | // If the contact has an ID, set their notify value in the database 17 | if (contact.id) { 18 | await client.contactDB.set(contact.id, contact.notify ?? '') 19 | } 20 | }) 21 | ) 22 | } 23 | 24 | module.exports = { 25 | saveContacts, 26 | getContact 27 | } 28 | -------------------------------------------------------------------------------- /src/Helper/function.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios').default 2 | const { tmpdir } = require('os') 3 | const { promisify } = require('util') 4 | const linkify = require('linkifyjs') 5 | const FormData = require('form-data') 6 | const { load } = require('cheerio') 7 | const { exec } = require('child_process') 8 | const { createCanvas } = require('canvas') 9 | const { sizeFormatter } = require('human-readable') 10 | const { readFile, unlink, writeFile } = require('fs-extra') 11 | const { removeBackgroundFromImageBase64 } = require('remove.bg') 12 | 13 | /** 14 | * @param {string} url 15 | * @returns {Promise} 16 | */ 17 | 18 | const getBuffer = async (url) => 19 | ( 20 | await axios.get(url, { 21 | responseType: 'arraybuffer' 22 | }) 23 | ).data 24 | 25 | /** 26 | * @param {string} content 27 | * @param {boolean} all 28 | * @returns {string} 29 | */ 30 | 31 | const capitalize = (content, all = false) => { 32 | if (!all) return `${content.charAt(0).toUpperCase()}${content.slice(1)}` 33 | return `${content 34 | .split('') 35 | .map((text) => `${text.charAt(0).toUpperCase()}${text.slice(1)}`) 36 | .join('')}` 37 | } 38 | 39 | const formatSeconds = (seconds) => new Date(seconds * 1000).toISOString().substr(11, 8) 40 | 41 | /** 42 | * @param {Buffer} input 43 | * @returns {Promise} 44 | */ 45 | 46 | const removeBG = async (input) => { 47 | try { 48 | const response = await removeBackgroundFromImageBase64({ 49 | base64img: input.toString('base64'), 50 | apiKey: process.env.BG_API_KEY, 51 | size: 'auto', 52 | type: 'auto' 53 | }) 54 | return Buffer.from(response.base64img, 'base64') 55 | } catch (error) { 56 | throw error 57 | } 58 | } 59 | 60 | /** 61 | * Copyright by (AliAryanTech), give credit! 62 | * @param {string} cardName 63 | * @param {string} expiryDate 64 | * @returns {Promise} 65 | */ 66 | 67 | const generateCreditCardImage = (cardName, expiryDate) => { 68 | const canvas = createCanvas(800, 500) 69 | const ctx = canvas.getContext('2d') 70 | ctx.fillStyle = '#fff' 71 | ctx.fillRect(0, 0, 800, 500) 72 | ctx.fillStyle = '#1e90ff' 73 | ctx.fillRect(0, 0, 800, 80) 74 | ctx.fillStyle = '#555' 75 | ctx.font = '24px Arial, sans-serif' 76 | ctx.fillText('Credit Card', 40, 150) 77 | ctx.fillStyle = '#000' 78 | ctx.font = '48px Arial, sans-serif' 79 | ctx.fillText('1234 5678 9012 3456', 40, 250) // card numbers 80 | ctx.fillStyle = '#555' 81 | ctx.font = '24px Arial, sans-serif' 82 | ctx.fillText('Card Name', 40, 350) 83 | ctx.fillStyle = '#000' 84 | ctx.font = '32px Arial, sans-serif' 85 | ctx.fillText(cardName, 40, 400) 86 | ctx.fillStyle = '#555' 87 | ctx.font = '24px Arial, sans-serif' 88 | ctx.fillText('Expiry Date', 450, 350) 89 | ctx.fillStyle = '#000' 90 | ctx.font = '32px Arial, sans-serif' 91 | ctx.fillText(expiryDate, 450, 400) 92 | return canvas.toBuffer() 93 | } 94 | 95 | /** 96 | * @returns {string} 97 | */ 98 | 99 | const generateRandomHex = () => `#${(~~(Math.random() * (1 << 24))).toString(16)}` 100 | 101 | /** 102 | * @param {string} content 103 | * @returns {number[]} 104 | */ 105 | 106 | const extractNumbers = (content) => { 107 | const numbers = content.match(/(-?\d+)/g) 108 | return numbers ? numbers.map((n) => Math.max(parseInt(n), 0)) : [] 109 | } 110 | 111 | /** 112 | * @param {string} content 113 | * @returns {url[]} 114 | */ 115 | 116 | const extractUrls = (content) => linkify.find(content).map((url) => url.value) 117 | 118 | /** 119 | * @param {string} url 120 | */ 121 | 122 | const fetch = async (url) => (await axios.get(url)).data 123 | 124 | /** 125 | * @param {Buffer} webp 126 | * @returns {Promise} 127 | */ 128 | 129 | const webpToPng = async (webp) => { 130 | const filename = `${tmpdir()}/${Math.random().toString(36)}` 131 | await writeFile(`${filename}.webp`, webp) 132 | await execute(`dwebp "${filename}.webp" -o "${filename}.png"`) 133 | const buffer = await readFile(`${filename}.png`) 134 | Promise.all([unlink(`${filename}.png`), unlink(`${filename}.webp`)]) 135 | return buffer 136 | } 137 | 138 | /** 139 | * @param {Buffer} webp 140 | * @returns {Promise} 141 | */ 142 | 143 | const webpToMp4 = async (webp) => { 144 | const responseFile = async (form, buffer = '') => { 145 | return axios.post(buffer ? `https://ezgif.com/webp-to-mp4/${buffer}` : 'https://ezgif.com/webp-to-mp4', form, { 146 | headers: { 'Content-Type': `multipart/form-data; boundary=${form._boundary}` } 147 | }) 148 | } 149 | return new Promise(async (resolve, reject) => { 150 | const form = new FormData() 151 | form.append('new-image-url', '') 152 | form.append('new-image', webp, { filename: 'blob' }) 153 | responseFile(form) 154 | .then(({ data }) => { 155 | const datafrom = new FormData() 156 | const $ = load(data) 157 | const file = $('input[name="file"]').attr('value') 158 | datafrom.append('file', file) 159 | datafrom.append('convert', 'Convert WebP to MP4!') 160 | responseFile(datafrom, file) 161 | .then(async ({ data }) => { 162 | const $ = load(data) 163 | const result = await getBuffer( 164 | `https:${$('div#output > p.outfile > video > source').attr('src')}` 165 | ) 166 | resolve(result) 167 | }) 168 | .catch(reject) 169 | }) 170 | .catch(reject) 171 | }) 172 | } 173 | 174 | /** 175 | * @param {Buffer} gif 176 | * @param {boolean} write 177 | * @returns {Promise} 178 | */ 179 | 180 | const gifToMp4 = async (gif, write = false) => { 181 | const filename = `${tmpdir()}/${Math.random().toString(36)}` 182 | await writeFile(`${filename}.gif`, gif) 183 | await execute( 184 | `ffmpeg -f gif -i ${filename}.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" ${filename}.mp4` 185 | ) 186 | if (write) return `${filename}.mp4` 187 | const buffer = await readFile(`${filename}.mp4`) 188 | Promise.all([unlink(`${filename}.gif`), unlink(`${filename}.mp4`)]) 189 | return buffer 190 | } 191 | 192 | const execute = promisify(exec) 193 | 194 | const getRandomItem = (array) => array[Math.floor(Math.random() * array.length)] 195 | 196 | const calculatePing = (timestamp, now) => (now - timestamp) / 1000 197 | 198 | const formatSize = sizeFormatter({ 199 | std: 'JEDEC', 200 | decimalPlaces: '2', 201 | keepTrailingZeroes: false, 202 | render: (literal, symbol) => `${literal} ${symbol}B` 203 | }) 204 | 205 | const term = (param) => 206 | new Promise((resolve, reject) => { 207 | console.log('Run terminal =>', param) 208 | exec(param, (error, stdout, stderr) => { 209 | if (error) { 210 | console.log(error.message) 211 | resolve(error.message) 212 | } 213 | if (stderr) { 214 | console.log(stderr) 215 | resolve(stderr) 216 | } 217 | console.log(stdout) 218 | resolve(stdout) 219 | }) 220 | }) 221 | 222 | const restart = () => { 223 | exec('pm2 start src/krypton.js', (err, stdout, stderr) => { 224 | if (err) { 225 | console.log(err) 226 | return 227 | } 228 | console.log(`stdout: ${stdout}`) 229 | console.log(`stderr: ${stderr}`) 230 | }) 231 | } 232 | 233 | const removeDuplicates = (arr) => [...new Set(arr)] 234 | 235 | module.exports = { 236 | removeDuplicates, 237 | calculatePing, 238 | capitalize, 239 | execute, 240 | extractNumbers, 241 | formatSeconds, 242 | fetch, 243 | formatSize, 244 | removeBG, 245 | extractUrls, 246 | generateCreditCardImage, 247 | generateRandomHex, 248 | getBuffer, 249 | getRandomItem, 250 | gifToMp4, 251 | restart, 252 | term, 253 | webpToMp4, 254 | webpToPng 255 | } 256 | -------------------------------------------------------------------------------- /src/Library/AI_lib.js: -------------------------------------------------------------------------------- 1 | const api = require('api')('@writesonic/v2.2#4enbxztlcbti48j') 2 | api.auth(process.env.WRITE_SONIC) 3 | 4 | const WriteSonic_gpt = async (text) => { 5 | const result = await api.chatsonic_V2BusinessContentChatsonic_post( 6 | { 7 | enable_google_results: 'true', 8 | enable_memory: true, 9 | input_text: text 10 | }, 11 | { engine: 'premium' } 12 | ) 13 | 14 | return { 15 | response: result 16 | } 17 | } 18 | 19 | module.exports = { 20 | WriteSonic_gpt 21 | } 22 | -------------------------------------------------------------------------------- /src/Library/Spotify.js: -------------------------------------------------------------------------------- 1 | const Spotify = require('spotifydl-x').default 2 | const canvacord = require('canvacord') 3 | 4 | const credentials = { 5 | clientId: 'acc6302297e040aeb6e4ac1fbdfd62c3', 6 | clientSecret: '0e8439a1280a43aba9a5bc0a16f3f009' 7 | } 8 | const spotify = new Spotify(credentials) 9 | 10 | const spotifydl = async (url) => { 11 | const res = await spotify.getTrack(url).catch(() => { 12 | return { error: 'Failed' } 13 | }) 14 | const card = new canvacord.Spotify() 15 | .setAuthor(res.artists.join(', ')) 16 | .setAlbum(res.album_name) 17 | .setStartTimestamp(40000) 18 | .setEndTimestamp(179000) 19 | .setBackground('COLOR', '#A30000') 20 | .setImage(res.cover_url) 21 | .setTitle(res.name) 22 | 23 | return { data: res, coverimage: await card.build(), audio: await spotify.downloadTrack(url) } 24 | //audio: await spotify.downloadTrack(url) 25 | } 26 | 27 | module.exports = { 28 | spotifydl 29 | } 30 | -------------------------------------------------------------------------------- /src/Library/YT.js: -------------------------------------------------------------------------------- 1 | const ytdl = require('youtubedl-core') 2 | const { validateURL, getInfo } = require('youtubedl-core') 3 | const { createWriteStream, readFile } = require('fs-extra') 4 | const { tmpdir } = require('os') 5 | const axios = require('axios') 6 | const crypto = require('crypto') 7 | 8 | // Generating a random file name 9 | const generateRandomFilename = (length) => 10 | crypto 11 | .randomBytes(Math.ceil(length / 2)) 12 | .toString('hex') 13 | .slice(0, length) 14 | 15 | //Downloading the video or audio file and returning it as a buffer 16 | const getBuffer = (url, type) => { 17 | const filename = `${tmpdir()}/${generateRandomFilename(12)}.${type === 'audio' ? 'mp3' : 'mp4'}` // generate a random file name 18 | const stream = createWriteStream(filename) 19 | ytdl( 20 | url, 21 | { filter: type === 'audio' ? 'audioonly' : 'videoandaudio' }, 22 | { quality: type === 'audio' ? 'highestaudio' : 'highest' } 23 | ).pipe(stream) // Download the video or audio and pipe it to the write stream 24 | return new Promise((resolve, reject) => { 25 | stream.on('finish', () => { 26 | readFile(filename).then(resolve).catch(reject) 27 | }) 28 | stream.on('error', reject) // if there is an error with the write stream, reject the promise with the error 29 | }) 30 | } 31 | 32 | // parsing the video ID from a YouTube video URL 33 | const parseId = (url) => { 34 | const split = url.split('/') 35 | if (url.includes('youtu.be')) return split[split.length - 1] 36 | return url.split('=')[1] 37 | } 38 | 39 | module.exports = { 40 | validateURL, 41 | getInfo, 42 | getBuffer, 43 | parseId 44 | } 45 | -------------------------------------------------------------------------------- /src/Library/stats.js: -------------------------------------------------------------------------------- 1 | const ranks = [ 2 | '🌸 Citizen', 3 | '🔎 Cleric', 4 | '🔮 Wizard', 5 | '♦️ Mage', 6 | '🎯 Noble', 7 | '🎯 Noble II', 8 | '✨ Elite', 9 | '✨ Elite II', 10 | '✨ Elite III', 11 | '🔶️ Ace', 12 | '🔶️ Ace II', 13 | '🔶️ Ace III', 14 | '🔶️ Ace IV', 15 | '☣ Knight', 16 | '☣ Knight II', 17 | '☣ Knight III', 18 | '☣ Knight IV', 19 | '☣ Knight V', 20 | '🌀 Hero', 21 | '🌀 Hero II', 22 | '🌀 Hero III', 23 | '🌀 Hero IV', 24 | '🌀 Hero V', 25 | '💎 Supreme', 26 | '💎 Supreme II', 27 | '💎 Supreme III', 28 | '💎 Supreme IV', 29 | '💎 Supreme V', 30 | '❄️ Mystic', 31 | '❄️ Mystic II', 32 | '❄️ Mystic III', 33 | '❄️ Mystic IV', 34 | '❄️ Mystic V', 35 | '🔆 Legendary', 36 | '🔆 Legendary II', 37 | '🔆 Legendary III', 38 | '🔆 Legendary IV', 39 | '🔆 Legendary V', 40 | '🛡 Guardian', 41 | '🛡 Guardian II', 42 | '🛡 Guardian III', 43 | '🛡 Guardian IV', 44 | '🛡 Guardian V', 45 | '♨ Valor' 46 | ] 47 | 48 | /** 49 | * @param {number} level 50 | * @returns {{requiredXpToLevelUp: number, rank: string}} 51 | */ 52 | 53 | const getStats = (level) => { 54 | let required = 100 55 | for (let i = 1; i <= level; i++) required += 5 * (i * 50) + 100 * i * (i * (i + 1)) + 300 56 | const rank = level > ranks.length ? ranks[ranks.length - 1] : ranks[level - 1] 57 | return { 58 | requiredXpToLevelUp: required, 59 | rank 60 | } 61 | } 62 | 63 | module.exports = { 64 | getStats, 65 | ranks 66 | } 67 | -------------------------------------------------------------------------------- /src/getConfig.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config() 2 | 3 | module.exports.getConfig = () => { 4 | return { 5 | name: process.env.NAME || 'Krypton', 6 | prefix: process.env.PREFIX || '#', 7 | writesonicAPI: process.env.WRITE_SONIC || null, 8 | bgAPI: process.env.BG_API_KEY || null, 9 | mods: (process.env.MODS || '').split(',') 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/krypton.js: -------------------------------------------------------------------------------- 1 | const { 2 | default: Baileys, 3 | DisconnectReason, 4 | useMultiFileAuthState, 5 | fetchLatestBaileysVersion 6 | } = require('@whiskeysockets/baileys') 7 | const { QuickDB } = require('quick.db') 8 | const { getConfig } = require('./getConfig') 9 | const { MongoDriver } = require('quickmongo') 10 | const { Collection } = require('discord.js') 11 | const MessageHandler = require('./Handlers/Message') 12 | const EventsHandler = require('./Handlers/Events') 13 | const contact = require('./Helper/contacts') 14 | const utils = require('./Helper/function') 15 | const openai = require('./Library/AI_lib') 16 | const app = require('express')() 17 | const chalk = require('chalk') 18 | const P = require('pino') 19 | const { Boom } = require('@hapi/boom') 20 | const { join } = require('path') 21 | const { imageSync } = require('qr-image') 22 | const { readdirSync, remove } = require('fs-extra') 23 | const port = process.env.PORT || 3000 24 | const driver = new MongoDriver(process.env.URL) 25 | 26 | const start = async () => { 27 | const { state, saveCreds } = await useMultiFileAuthState('session') 28 | 29 | const client = Baileys({ 30 | version: (await fetchLatestBaileysVersion()).version, 31 | auth: state, 32 | logger: P({ level: 'silent' }), 33 | browser: ['krypton-WhatsappBot', 'silent', '4.0.0'], 34 | printQRInTerminal: true 35 | }) 36 | 37 | //Config 38 | client.config = getConfig() 39 | 40 | //Database 41 | client.DB = new QuickDB({ 42 | driver 43 | }) 44 | //Tables 45 | client.contactDB = client.DB.table('contacts') 46 | 47 | //Contacts 48 | client.contact = contact 49 | 50 | //Open AI 51 | client.AI = openai 52 | 53 | //Experience 54 | client.exp = client.DB.table('experience') 55 | 56 | //Commands 57 | client.cmd = new Collection() 58 | 59 | //Utils 60 | client.utils = utils 61 | 62 | client.messagesMap = new Map() 63 | 64 | /** 65 | * @returns {Promise} 66 | */ 67 | 68 | client.getAllGroups = async () => Object.keys(await client.groupFetchAllParticipating()) 69 | 70 | /** 71 | * @returns {Promise} 72 | */ 73 | 74 | client.getAllUsers = async () => { 75 | const data = (await client.contactDB.all()).map((x) => x.id) 76 | const users = data.filter((element) => /^\d+@s$/.test(element)).map((element) => `${element}.whatsapp.net`) 77 | return users 78 | } 79 | 80 | //Colourful 81 | client.log = (text, color = 'green') => 82 | color ? console.log(chalk.keyword(color)(text)) : console.log(chalk.green(text)) 83 | 84 | //Command Loader 85 | const loadCommands = async () => { 86 | const readCommand = (rootDir) => { 87 | readdirSync(rootDir).forEach(($dir) => { 88 | const commandFiles = readdirSync(join(rootDir, $dir)).filter((file) => file.endsWith('.js')) 89 | for (let file of commandFiles) { 90 | const cmd = require(join(rootDir, $dir, file)) 91 | client.cmd.set(cmd.command.name, cmd) 92 | client.log(`Loaded: ${cmd.command.name.toUpperCase()} from ${file}`) 93 | } 94 | }) 95 | client.log('Successfully Loaded Commands') 96 | } 97 | readCommand(join(__dirname, '.', 'Commands')) 98 | } 99 | 100 | //connection updates 101 | client.ev.on('connection.update', async (update) => { 102 | const { connection, lastDisconnect } = update 103 | if (update.qr) { 104 | client.log(`[${chalk.red('!')}]`, 'white') 105 | client.log(`Scan the QR code above | You can also authenicate in http://localhost:${port}`, 'blue') 106 | client.QR = imageSync(update.qr) 107 | } 108 | if (connection === 'close') { 109 | const { statusCode } = new Boom(lastDisconnect?.error).output 110 | if (statusCode !== DisconnectReason.loggedOut) { 111 | console.log('Connecting...') 112 | setTimeout(() => start(), 3000) 113 | } else { 114 | client.log('Disconnected.', 'red') 115 | await remove('session') 116 | console.log('Starting...') 117 | setTimeout(() => start(), 3000) 118 | } 119 | } 120 | if (connection === 'connecting') { 121 | client.state = 'connecting' 122 | console.log('Connecting to WhatsApp...') 123 | } 124 | if (connection === 'open') { 125 | client.state = 'open' 126 | loadCommands() 127 | client.log('Connected to WhatsApp') 128 | client.log('Total Mods: ' + client.config.mods.length) 129 | } 130 | }) 131 | 132 | app.get('/', (req, res) => { 133 | res.status(200).setHeader('Content-Type', 'image/png').send(client.QR) 134 | }) 135 | 136 | client.ev.on('messages.upsert', async (messages) => await MessageHandler(messages, client)) 137 | 138 | client.ev.on('group-participants.update', async (event) => await EventsHandler(event, client)) 139 | 140 | client.ev.on('contacts.update', async (update) => await contact.saveContacts(update, client)) 141 | 142 | client.ev.on('creds.update', saveCreds) 143 | return client 144 | } 145 | 146 | if (!process.env.URL) return console.error('You have not provided any MongoDB URL!!') 147 | driver 148 | .connect() 149 | .then(() => { 150 | console.log(`Connected to the database!`) 151 | // Starts the script if gets a success in connecting with Database 152 | start() 153 | }) 154 | .catch((err) => console.error(err)) 155 | 156 | app.listen(port, () => console.log(`Server started on PORT : ${port}`)) 157 | --------------------------------------------------------------------------------