├── LICENSE
├── README.md
├── config.js
├── index.js
├── install.sh
├── lib
├── exif.js
├── myfunc.js
├── scrapper.js
├── uploader.js
└── y2mate.js
├── package.json
├── shiro.js
├── src
├── banido.mp4
├── nsfw.json
├── rules.json
├── settings.json
├── shiro.gif
└── shiro.jpg
└── start.sh
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Shiro Bot ✨
6 |
7 |
8 | ## Disclaimer
9 | ```
10 | /**
11 | ⚠️ Warning ⚠️
12 |
13 | this bot is for exclusive use in a specific
14 | group if you want to use this source make
15 | your own modifications
16 | /**
17 | ```
18 |
19 | ### All credits
20 |
21 | * [BaileysMD](https://github.com/adiwajshing/baileys/tree/multi-device)
22 | * [Hisoka](https://github.com/DikaArdnt/Hisoka-Morou)
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Base Create By Dika Ardnt.
3 | * Updated by fnixdev
4 | * Follow https://github.com/fnixdev
5 | */
6 |
7 |
8 | const fs = require('fs')
9 | const chalk = require('chalk')
10 | const apikey = JSON.parse(fs.readFileSync('./src/settings.json'))
11 |
12 |
13 |
14 | // Outros
15 | global.owner = ['553189092420']
16 | global.prefix = ['/']
17 | global.packname = 'Shiro Bot'
18 | global.author = 'fnixdev'
19 | global.sp = '✾'
20 | global.api = apikey.apikey
21 | global.mess = {
22 | admin: '_Apenas admins podem usar esse comando!_',
23 | botAdmin: '_Eu preciso que você me coloque como admin para fazer isso!_',
24 | owner: '_Apenas meu dono pode usar isso!_',
25 | isowner: '_Lol ele é meu dono._',
26 | group: '_Isso só pode ser usado em um grupo!_',
27 | private: '_Isso só pode ser usado no privado_',
28 | bot: '_Isso é uma função exclusiva do bot_',
29 | wait: '_Tudo bem querido, aguarde um momento._',
30 | text: '_Eu preciso que você digite algo_'
31 | }
32 | global.thumb = fs.readFileSync('./src/shiro.jpg')
33 |
34 | let file = require.resolve(__filename)
35 | fs.watchFile(file, () => {
36 | fs.unwatchFile(file)
37 | console.log(chalk.redBright(`Update'${__filename}'`))
38 | delete require.cache[file]
39 | require(file)
40 | })
41 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Base Create By Dika Ardnt.
3 | * Updated by fnixdev
4 | * Follow https://github.com/fnixdev
5 | */
6 |
7 |
8 | require('./config')
9 | const { default: shiroConnect, useSingleFileAuthState, DisconnectReason, generateForwardMessageContent, prepareWAMessageMedia, generateWAMessageFromContent, downloadContentFromMessage, makeInMemoryStore, jidDecode, proto } = require("@adiwajshing/baileys")
10 | const { state, saveState } = useSingleFileAuthState(`./shiro.json`)
11 | const pino = require('pino')
12 | const fs = require('fs')
13 | const { Boom } = require('@hapi/boom')
14 | const chalk = require('chalk')
15 | const FileType = require('file-type')
16 | const PhoneNumber = require('awesome-phonenumber')
17 | const { imageToWebp, videoToWebp, writeExifImg, writeExifVid } = require('./lib/exif')
18 | const { smsg, getBuffer, getSizeMedia, sleep } = require('./lib/myfunc')
19 |
20 | const store = makeInMemoryStore({ logger: pino().child({ level: 'silent', stream: 'store' }) })
21 |
22 | // Client Bot
23 | async function startShiro() {
24 | const shiro = shiroConnect({
25 | logger: pino({ level: 'silent' }),
26 | printQRInTerminal: true,
27 | browser: ['Shiro MD', 'Safari', '1.0.1'],
28 | auth: state,
29 | version: [2, 2204, 13]
30 | })
31 |
32 | store.bind(shiro.ev)
33 |
34 | // anticall auto block
35 | shiro.ws.on('CB:call', async (json) => {
36 | const callerId = json.content[0].attrs['call-creator']
37 | if (json.content[0].tag == 'offer') {
38 | let pa7rick = await shiro.sendContact(callerId, global.owner)
39 | shiro.sendMessage(callerId, { text: `*_A.I Auto Block System_*. \n\n_Parece que você tentou me ligar, infelizmente você sera bloqueado automaticamente._\n_Qualquer duvida entre em contato com meu dono._` }, { quoted: pa7rick })
40 | await sleep(8000)
41 | await shiro.updateBlockStatus(callerId, "block")
42 | }
43 | })
44 |
45 | shiro.ev.on('messages.upsert', async chatUpdate => {
46 | //console.log(JSON.stringify(chatUpdate, undefined, 2))
47 | try {
48 | mek = chatUpdate.messages[0]
49 | if (!mek.message) return
50 | mek.message = (Object.keys(mek.message)[0] === 'ephemeralMessage') ? mek.message.ephemeralMessage.message : mek.message
51 | if (mek.key && mek.key.remoteJid === 'status@broadcast') return
52 | if (!shiro.public && !mek.key.fromMe && chatUpdate.type === 'notify') return
53 | if (mek.key.id.startsWith('BAE5') && mek.key.id.length === 16) return
54 | m = smsg(shiro, mek, store)
55 | require("./shiro")(shiro, m, chatUpdate, store)
56 | } catch (err) {
57 | console.log(err)
58 | }
59 | })
60 |
61 | shiro.ev.on('group-participants.update', async (anu) => {
62 | let metadata = await shiro.groupMetadata(anu.id)
63 | console.log(anu)
64 | try {
65 | let welkompic = { url: 'https://telegra.ph/file/69adf1d87f488d4c6a2fe.png' }
66 | let participants = anu.participants
67 | let btn = [{
68 | urlButton: {
69 | displayText: 'Baixar APK do Minecraft',
70 | url: `http://kuuhaku.ddns.net/Minecraft_1.19.2.apk`
71 | }
72 | }, {
73 | quickReplyButton: {
74 | displayText: 'Servidor',
75 | id: `${prefix}server`
76 | }
77 | }]
78 | for (let num of participants) {
79 | if (anu.action == 'add') {
80 | let txt = `Opa, bem vindo ao grupo ${metadata.subject}. Leia as regras e fique a vontade para interagir no grupo.`
81 | shiro.sendWelkom(anu.id, txt, shiro.user.name, welkompic, btn)
82 | }
83 | }
84 | } catch (err) {
85 | console.log(err)
86 | }
87 | })
88 |
89 |
90 | // Setting
91 |
92 | shiro.decodeJid = (jid) => {
93 | if (!jid) return jid
94 | if (/:\d+@/gi.test(jid)) {
95 | let decode = jidDecode(jid) || {}
96 | return decode.user && decode.server && decode.user + '@' + decode.server || jid
97 | } else return jid
98 | }
99 | shiro.ev.on('contacts.update', update => {
100 | for (let contact of update) {
101 | let id = shiro.decodeJid(contact.id)
102 | if (store && store.contacts) store.contacts[id] = { id, name: contact.notify }
103 | }
104 | })
105 |
106 | shiro.getName = (jid, withoutContact = false) => {
107 | id = shiro.decodeJid(jid)
108 | withoutContact = shiro.withoutContact || withoutContact
109 | let v
110 | if (id.endsWith("@g.us")) return new Promise(async (resolve) => {
111 | v = store.contacts[id] || {}
112 | if (!(v.name || v.subject)) v = shiro.groupMetadata(id) || {}
113 | resolve(v.name || v.subject || PhoneNumber('+' + id.replace('@s.whatsapp.net', '')).getNumber('international'))
114 | })
115 | else v = id === '0@s.whatsapp.net' ? {
116 | id,
117 | name: 'WhatsApp'
118 | } : id === shiro.decodeJid(shiro.user.id) ?
119 | shiro.user :
120 | (store.contacts[id] || {})
121 | return (withoutContact ? '' : v.name) || v.subject || v.verifiedName || PhoneNumber('+' + jid.replace('@s.whatsapp.net', '')).getNumber('international')
122 | }
123 |
124 | shiro.sendContact = async (jid, kon, quoted = '', opts = {}) => {
125 | let list = []
126 | for (let i of kon) {
127 | list.push({
128 | displayName: await shiro.getName(i + '@s.whatsapp.net'),
129 | vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await shiro.getName(i + '@s.whatsapp.net')}\nFN:${await shiro.getName(i + '@s.whatsapp.net')}\nitem1.TEL;waid=${i}:${i}\nitem1.X-ABLabel:Ponsel\nitem2.EMAIL;type=INTERNET:okeae2410@gmail.com\nitem2.X-ABLabel:Email\nitem3.URL:https://instagram.com/cak_haho\nitem3.X-ABLabel:Instagram\nitem4.ADR:;;Indonesia;;;;\nitem4.X-ABLabel:Region\nEND:VCARD`
130 | })
131 | }
132 | shiro.sendMessage(jid, { contacts: { displayName: `${list.length} Kontak`, contacts: list }, ...opts }, { quoted })
133 | }
134 |
135 | shiro.setStatus = (status) => {
136 | shiro.query({
137 | tag: 'iq',
138 | attrs: {
139 | to: '@s.whatsapp.net',
140 | type: 'set',
141 | xmlns: 'status',
142 | },
143 | content: [{
144 | tag: 'status',
145 | attrs: {},
146 | content: Buffer.from(status, 'utf-8')
147 | }]
148 | })
149 | return status
150 | }
151 |
152 | shiro.public = true
153 |
154 | shiro.serializeM = (m) => smsg(shiro, m, store)
155 |
156 | shiro.ev.on('connection.update', async (update) => {
157 | const { connection, lastDisconnect } = update
158 | if (connection === 'close') {
159 | let reason = new Boom(lastDisconnect?.error)?.output.statusCode
160 | if (reason === DisconnectReason.badSession) { console.log(`Bad Session File, Please Delete Session and Scan Again`); shiro.logout(); }
161 | else if (reason === DisconnectReason.connectionClosed) { console.log("Connection closed, reconnecting...."); startShiro(); }
162 | else if (reason === DisconnectReason.connectionLost) { console.log("Connection Lost from Server, reconnecting..."); startShiro(); }
163 | else if (reason === DisconnectReason.connectionReplaced) { console.log("Connection Replaced, Another New Session Opened, Please Close Current Session First"); shiro.logout(); }
164 | else if (reason === DisconnectReason.loggedOut) { console.log(`Device Logged Out, Please Scan Again And Run.`); shiro.logout(); }
165 | else if (reason === DisconnectReason.restartRequired) { console.log("Restart Required, Restarting..."); startShiro(); }
166 | else if (reason === DisconnectReason.timedOut) { console.log("Connection TimedOut, Reconnecting..."); startShiro(); }
167 | else shiro.end(`Unknown DisconnectReason: ${reason}|${connection}`)
168 | }
169 | console.log('Connected...', update)
170 | })
171 |
172 | shiro.ev.on('creds.update', saveState)
173 | // Add Other
174 | /** Send Button 5 Image
175 | *
176 | * @param {*} jid
177 | * @param {*} text
178 | * @param {*} footer
179 | * @param {*} image
180 | * @param [*] button
181 | * @param {*} options
182 | * @returns
183 | */
184 | shiro.send5ButImg = async (jid, text = '', footer = '', img, but = [], options = {}) => {
185 | let message = await prepareWAMessageMedia({ image: img }, { upload: shiro.waUploadToServer })
186 | var template = generateWAMessageFromContent(m.chat, proto.Message.fromObject({
187 | templateMessage: {
188 | hydratedTemplate: {
189 | imageMessage: message.imageMessage,
190 | "hydratedContentText": text,
191 | "hydratedFooterText": footer,
192 | "hydratedButtons": but
193 | }
194 | }
195 | }), options)
196 | shiro.relayMessage(jid, template.message, { messageId: template.key.id })
197 | }
198 |
199 | shiro.sendWelkom = async (jid, text = '', footer = '', img, but = [], options = {}) => {
200 | let message = await prepareWAMessageMedia({ image: img }, { upload: shiro.waUploadToServer })
201 | var template = generateWAMessageFromContent(jid, proto.Message.fromObject({
202 | templateMessage: {
203 | hydratedTemplate: {
204 | imageMessage: message.imageMessage,
205 | "hydratedContentText": text,
206 | "hydratedFooterText": footer,
207 | "hydratedButtons": but
208 | }
209 | }
210 | }), options)
211 | shiro.relayMessage(jid, template.message, { messageId: template.key.id })
212 | }
213 | /**
214 | *
215 | * @param {*} jid
216 | * @param {*} buttons
217 | * @param {*} caption
218 | * @param {*} footer
219 | * @param {*} quoted
220 | * @param {*} options
221 | */
222 | shiro.sendButtonText = (jid, buttons = [], text, footer, quoted = '', options = {}) => {
223 | let buttonMessage = {
224 | text,
225 | footer,
226 | buttons,
227 | headerType: 2,
228 | ...options
229 | }
230 | shiro.sendMessage(jid, buttonMessage, { quoted, ...options })
231 | }
232 |
233 | /**
234 | *
235 | * @param {*} jid
236 | * @param {*} text
237 | * @param {*} quoted
238 | * @param {*} options
239 | * @returns
240 | */
241 | shiro.sendText = (jid, text, quoted = '', options) => shiro.sendMessage(jid, { text: text, ...options }, { quoted })
242 |
243 | /**
244 | *
245 | * @param {*} jid
246 | * @param {*} path
247 | * @param {*} caption
248 | * @param {*} quoted
249 | * @param {*} options
250 | * @returns
251 | */
252 | shiro.sendImage = async (jid, path, caption = '', quoted = '', options) => {
253 | let buffer = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
254 | return await shiro.sendMessage(jid, { image: buffer, caption: caption, ...options }, { quoted })
255 | }
256 |
257 | /**
258 | *
259 | * @param {*} jid
260 | * @param {*} path
261 | * @param {*} caption
262 | * @param {*} quoted
263 | * @param {*} options
264 | * @returns
265 | */
266 | shiro.sendVideo = async (jid, path, caption = '', quoted = '', gif = false, options) => {
267 | let buffer = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
268 | return await shiro.sendMessage(jid, { video: buffer, caption: caption, gifPlayback: gif, ...options }, { quoted })
269 | }
270 |
271 | /**
272 | *
273 | * @param {*} jid
274 | * @param {*} path
275 | * @param {*} quoted
276 | * @param {*} mime
277 | * @param {*} options
278 | * @returns
279 | */
280 | shiro.sendAudio = async (jid, path, quoted = '', ptt = false, options) => {
281 | let buffer = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
282 | return await shiro.sendMessage(jid, { audio: buffer, ptt: ptt, ...options }, { quoted })
283 | }
284 |
285 | /**
286 | *
287 | * @param {*} jid
288 | * @param {*} text
289 | * @param {*} quoted
290 | * @param {*} options
291 | * @returns
292 | */
293 | shiro.sendTextWithMentions = async (jid, text, quoted, options = {}) => shiro.sendMessage(jid, { text: text, contextInfo: { mentionedJid: [...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] + '@s.whatsapp.net') }, ...options }, { quoted })
294 |
295 | /**
296 | *
297 | * @param {*} jid
298 | * @param {*} path
299 | * @param {*} quoted
300 | * @param {*} options
301 | * @returns
302 | */
303 | shiro.sendImageAsSticker = async (jid, path, quoted, options = {}) => {
304 | let buff = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
305 | let buffer
306 | if (options && (options.packname || options.author)) {
307 | buffer = await writeExifImg(buff, options)
308 | } else {
309 | buffer = await imageToWebp(buff)
310 | }
311 |
312 | await shiro.sendMessage(jid, { sticker: { url: buffer }, ...options }, { quoted })
313 | return buffer
314 | }
315 |
316 | /**
317 | *
318 | * @param {*} jid
319 | * @param {*} path
320 | * @param {*} quoted
321 | * @param {*} options
322 | * @returns
323 | */
324 | shiro.sendVideoAsSticker = async (jid, path, quoted, options = {}) => {
325 | let buff = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
326 | let buffer
327 | if (options && (options.packname || options.author)) {
328 | buffer = await writeExifVid(buff, options)
329 | } else {
330 | buffer = await videoToWebp(buff)
331 | }
332 |
333 | await shiro.sendMessage(jid, { sticker: { url: buffer }, ...options }, { quoted })
334 | return buffer
335 | }
336 |
337 | /**
338 | *
339 | * @param {*} message
340 | * @param {*} filename
341 | * @param {*} attachExtension
342 | * @returns
343 | */
344 | shiro.downloadAndSaveMediaMessage = async (message, filename, attachExtension = true) => {
345 | let quoted = message.msg ? message.msg : message
346 | let mime = (message.msg || message).mimetype || ''
347 | let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]
348 | const stream = await downloadContentFromMessage(quoted, messageType)
349 | let buffer = Buffer.from([])
350 | for await (const chunk of stream) {
351 | buffer = Buffer.concat([buffer, chunk])
352 | }
353 | let type = await FileType.fromBuffer(buffer)
354 | trueFileName = attachExtension ? (filename + '.' + type.ext) : filename
355 | // save to file
356 | await fs.writeFileSync(trueFileName, buffer)
357 | return trueFileName
358 | }
359 |
360 | shiro.downloadMediaMessage = async (message) => {
361 | let mime = (message.msg || message).mimetype || ''
362 | let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]
363 | const stream = await downloadContentFromMessage(message, messageType)
364 | let buffer = Buffer.from([])
365 | for await (const chunk of stream) {
366 | buffer = Buffer.concat([buffer, chunk])
367 | }
368 |
369 | return buffer
370 | }
371 |
372 | /**
373 | *
374 | * @param {*} jid
375 | * @param {*} path
376 | * @param {*} filename
377 | * @param {*} caption
378 | * @param {*} quoted
379 | * @param {*} options
380 | * @returns
381 | */
382 | shiro.sendMedia = async (jid, path, fileName = '', caption = '', quoted = '', options = {}) => {
383 | let types = await shiro.getFile(path, true)
384 | let { mime, ext, res, data, filename } = types
385 | if (res && res.status !== 200 || file.length <= 65536) {
386 | try { throw { json: JSON.parse(file.toString()) } }
387 | catch (e) { if (e.json) throw e.json }
388 | }
389 | let type = '', mimetype = mime, pathFile = filename
390 | if (options.asDocument) type = 'document'
391 | if (options.asSticker || /webp/.test(mime)) {
392 | let { writeExif } = require('./lib/exif')
393 | let media = { mimetype: mime, data }
394 | pathFile = await writeExif(media, { packname: options.packname ? options.packname : global.packname, author: options.author ? options.author : global.author, categories: options.categories ? options.categories : [] })
395 | await fs.promises.unlink(filename)
396 | type = 'sticker'
397 | mimetype = 'image/webp'
398 | }
399 | else if (/image/.test(mime)) type = 'image'
400 | else if (/video/.test(mime)) type = 'video'
401 | else if (/audio/.test(mime)) type = 'audio'
402 | else type = 'document'
403 | await shiro.sendMessage(jid, { [type]: { url: pathFile }, caption, mimetype, fileName, ...options }, { quoted, ...options })
404 | return fs.promises.unlink(pathFile)
405 | }
406 |
407 | /**
408 | *
409 | * @param {*} jid
410 | * @param {*} message
411 | * @param {*} forceForward
412 | * @param {*} options
413 | * @returns
414 | */
415 | shiro.copyNForward = async (jid, message, forceForward = false, options = {}) => {
416 | let vtype
417 | if (options.readViewOnce) {
418 | message.message = message.message && message.message.ephemeralMessage && message.message.ephemeralMessage.message ? message.message.ephemeralMessage.message : (message.message || undefined)
419 | vtype = Object.keys(message.message.viewOnceMessage.message)[0]
420 | delete (message.message && message.message.ignore ? message.message.ignore : (message.message || undefined))
421 | delete message.message.viewOnceMessage.message[vtype].viewOnce
422 | message.message = {
423 | ...message.message.viewOnceMessage.message
424 | }
425 | }
426 |
427 | let mtype = Object.keys(message.message)[0]
428 | let content = await generateForwardMessageContent(message, forceForward)
429 | let ctype = Object.keys(content)[0]
430 | let context = {}
431 | if (mtype != "conversation") context = message.message[mtype].contextInfo
432 | content[ctype].contextInfo = {
433 | ...context,
434 | ...content[ctype].contextInfo
435 | }
436 | const waMessage = await generateWAMessageFromContent(jid, content, options ? {
437 | ...content[ctype],
438 | ...options,
439 | ...(options.contextInfo ? {
440 | contextInfo: {
441 | ...content[ctype].contextInfo,
442 | ...options.contextInfo
443 | }
444 | } : {})
445 | } : {})
446 | await shiro.relayMessage(jid, waMessage.message, { messageId: waMessage.key.id })
447 | return waMessage
448 | }
449 |
450 | shiro.cMod = (jid, copy, text = '', sender = shiro.user.id, options = {}) => {
451 | //let copy = message.toJSON()
452 | let mtype = Object.keys(copy.message)[0]
453 | let isEphemeral = mtype === 'ephemeralMessage'
454 | if (isEphemeral) {
455 | mtype = Object.keys(copy.message.ephemeralMessage.message)[0]
456 | }
457 | let msg = isEphemeral ? copy.message.ephemeralMessage.message : copy.message
458 | let content = msg[mtype]
459 | if (typeof content === 'string') msg[mtype] = text || content
460 | else if (content.caption) content.caption = text || content.caption
461 | else if (content.text) content.text = text || content.text
462 | if (typeof content !== 'string') msg[mtype] = {
463 | ...content,
464 | ...options
465 | }
466 | if (copy.key.participant) sender = copy.key.participant = sender || copy.key.participant
467 | else if (copy.key.participant) sender = copy.key.participant = sender || copy.key.participant
468 | if (copy.key.remoteJid.includes('@s.whatsapp.net')) sender = sender || copy.key.remoteJid
469 | else if (copy.key.remoteJid.includes('@broadcast')) sender = sender || copy.key.remoteJid
470 | copy.key.remoteJid = jid
471 | copy.key.fromMe = sender === shiro.user.id
472 |
473 | return proto.WebMessageInfo.fromObject(copy)
474 | }
475 |
476 |
477 | /**
478 | *
479 | * @param {*} path
480 | * @returns
481 | */
482 | shiro.getFile = async (PATH, save) => {
483 | let res
484 | let data = Buffer.isBuffer(PATH) ? PATH : /^data:.*?\/.*?;base64,/i.test(PATH) ? Buffer.from(PATH.split`,`[1], 'base64') : /^https?:\/\//.test(PATH) ? await (res = await getBuffer(PATH)) : fs.existsSync(PATH) ? (filename = PATH, fs.readFileSync(PATH)) : typeof PATH === 'string' ? PATH : Buffer.alloc(0)
485 | //if (!Buffer.isBuffer(data)) throw new TypeError('Result is not a buffer')
486 | let type = await FileType.fromBuffer(data) || {
487 | mime: 'application/octet-stream',
488 | ext: '.bin'
489 | }
490 | filename = path.join(__filename, '../src/' + new Date * 1 + '.' + type.ext)
491 | if (data && save) fs.promises.writeFile(filename, data)
492 | return {
493 | res,
494 | filename,
495 | size: await getSizeMedia(data),
496 | ...type,
497 | data
498 | }
499 |
500 | }
501 |
502 | return shiro
503 | }
504 |
505 | startShiro()
506 |
507 |
508 | let file = require.resolve(__filename)
509 | fs.watchFile(file, () => {
510 | fs.unwatchFile(file)
511 | console.log(chalk.redBright(`Update ${__filename}`))
512 | delete require.cache[file]
513 | require(file)
514 | })
515 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | sudo apt-get update -y
4 | sudo apt-get upgrade -y
5 | sudo apt-get install -y npm libwebp ffmpeg wget git
6 |
7 | curl -fsSL https://deb.nodesource.com/setup_16.x | sudo bash -
8 | sudo apt-get install nodejs -y
9 | sudo rm nodesource_setup.sh
10 |
11 | npm install
12 |
13 | echo "[*] Todas dependências foram instaladas, por favor inicie o bit usando: \"npm start\""
14 |
--------------------------------------------------------------------------------
/lib/exif.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Base Create By Dika Ardnt.
3 | * Updated by fnixdev
4 | * Follow https://github.com/fnixdev
5 | */
6 |
7 |
8 | const fs = require('fs')
9 | const { tmpdir } = require("os")
10 | const Crypto = require("crypto")
11 | const ff = require('fluent-ffmpeg')
12 | const webp = require("node-webpmux")
13 | const path = require("path")
14 |
15 |
16 | async function imageToWebp (media) {
17 |
18 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
19 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.jpg`)
20 |
21 | fs.writeFileSync(tmpFileIn, media)
22 |
23 | await new Promise((resolve, reject) => {
24 | ff(tmpFileIn)
25 | .on("error", reject)
26 | .on("end", () => resolve(true))
27 | .addOutputOptions([
28 | "-vcodec",
29 | "libwebp",
30 | "-vf",
31 | "scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15, pad=320:320:-1:-1:color=white@0.0, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse"
32 | ])
33 | .toFormat("webp")
34 | .save(tmpFileOut)
35 | })
36 |
37 | const buff = fs.readFileSync(tmpFileOut)
38 | fs.unlinkSync(tmpFileOut)
39 | fs.unlinkSync(tmpFileIn)
40 | return buff
41 | }
42 |
43 | async function videoToWebp (media) {
44 |
45 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
46 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.mp4`)
47 |
48 | fs.writeFileSync(tmpFileIn, media)
49 |
50 | await new Promise((resolve, reject) => {
51 | ff(tmpFileIn)
52 | .on("error", reject)
53 | .on("end", () => resolve(true))
54 | .addOutputOptions([
55 | "-vcodec",
56 | "libwebp",
57 | "-vf",
58 | "scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15, pad=320:320:-1:-1:color=white@0.0, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse",
59 | "-loop",
60 | "0",
61 | "-ss",
62 | "00:00:00",
63 | "-t",
64 | "00:00:05",
65 | "-preset",
66 | "default",
67 | "-an",
68 | "-vsync",
69 | "0"
70 | ])
71 | .toFormat("webp")
72 | .save(tmpFileOut)
73 | })
74 |
75 | const buff = fs.readFileSync(tmpFileOut)
76 | fs.unlinkSync(tmpFileOut)
77 | fs.unlinkSync(tmpFileIn)
78 | return buff
79 | }
80 |
81 | async function writeExifImg (media, metadata) {
82 | let wMedia = await imageToWebp(media)
83 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
84 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
85 | fs.writeFileSync(tmpFileIn, wMedia)
86 |
87 | if (metadata.packname || metadata.author) {
88 | const img = new webp.Image()
89 | const json = { "sticker-pack-id": `https://github.com/fnixdev/ShiroBot`, "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, "emojis": metadata.categories ? metadata.categories : [""] }
90 | const exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00])
91 | const jsonBuff = Buffer.from(JSON.stringify(json), "utf-8")
92 | const exif = Buffer.concat([exifAttr, jsonBuff])
93 | exif.writeUIntLE(jsonBuff.length, 14, 4)
94 | await img.load(tmpFileIn)
95 | fs.unlinkSync(tmpFileIn)
96 | img.exif = exif
97 | await img.save(tmpFileOut)
98 | return tmpFileOut
99 | }
100 | }
101 |
102 | async function writeExifVid (media, metadata) {
103 | let wMedia = await videoToWebp(media)
104 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
105 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
106 | fs.writeFileSync(tmpFileIn, wMedia)
107 |
108 | if (metadata.packname || metadata.author) {
109 | const img = new webp.Image()
110 | const json = { "sticker-pack-id": `https://github.com/fnixdev/ShiroBot`, "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, "emojis": metadata.categories ? metadata.categories : [""] }
111 | const exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00])
112 | const jsonBuff = Buffer.from(JSON.stringify(json), "utf-8")
113 | const exif = Buffer.concat([exifAttr, jsonBuff])
114 | exif.writeUIntLE(jsonBuff.length, 14, 4)
115 | await img.load(tmpFileIn)
116 | fs.unlinkSync(tmpFileIn)
117 | img.exif = exif
118 | await img.save(tmpFileOut)
119 | return tmpFileOut
120 | }
121 | }
122 |
123 | async function writeExif (media, metadata) {
124 | let wMedia = /webp/.test(media.mimetype) ? media.data : /image/.test(media.mimetype) ? await imageToWebp(media.data) : /video/.test(media.mimetype) ? await videoToWebp(media.data) : ""
125 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
126 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
127 | fs.writeFileSync(tmpFileIn, wMedia)
128 |
129 | if (metadata.packname || metadata.author) {
130 | const img = new webp.Image()
131 | const json = { "sticker-pack-id": `https://github.com/fnixdev/ShiroBot`, "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, "emojis": metadata.categories ? metadata.categories : [""] }
132 | const exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00])
133 | const jsonBuff = Buffer.from(JSON.stringify(json), "utf-8")
134 | const exif = Buffer.concat([exifAttr, jsonBuff])
135 | exif.writeUIntLE(jsonBuff.length, 14, 4)
136 | await img.load(tmpFileIn)
137 | fs.unlinkSync(tmpFileIn)
138 | img.exif = exif
139 | await img.save(tmpFileOut)
140 | return tmpFileOut
141 | }
142 | }
143 |
144 | module.exports = { imageToWebp, videoToWebp, writeExifImg, writeExifVid, writeExif }
145 |
--------------------------------------------------------------------------------
/lib/myfunc.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Base Create By Dika Ardnt.
3 | * Updated by fnixdev
4 | * Follow https://github.com/fnixdev
5 | */
6 |
7 |
8 | const { proto, delay, getContentType } = require('@adiwajshing/baileys')
9 | const chalk = require('chalk')
10 | const fetch = require('node-fetch')
11 | const fs = require('fs')
12 | const Crypto = require('crypto')
13 | const axios = require('axios')
14 | const moment = require('moment-timezone')
15 | const { sizeFormatter } = require('human-readable')
16 | const util = require('util')
17 | const Jimp = require('jimp')
18 | const { defaultMaxListeners } = require('stream')
19 |
20 |
21 |
22 | const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1000)
23 |
24 | exports.unixTimestampSeconds = unixTimestampSeconds
25 |
26 | exports.generateMessageTag = (epoch) => {
27 | let tag = (0, exports.unixTimestampSeconds)().toString();
28 | if (epoch)
29 | tag += '.--' + epoch; // attach epoch if provided
30 | return tag;
31 | }
32 |
33 | exports.processTime = (timestamp, now) => {
34 | return moment.duration(now - moment(timestamp * 1000)).asSeconds()
35 | }
36 |
37 | exports.getRandom = (ext) => {
38 | return `${Math.floor(Math.random() * 10000)}${ext}`
39 | }
40 |
41 | exports.getBuffer = async (url, options) => {
42 | try {
43 | options ? options : {}
44 | const res = await axios({
45 | method: "get",
46 | url,
47 | headers: {
48 | 'DNT': 1,
49 | 'Upgrade-Insecure-Request': 1
50 | },
51 | ...options,
52 | responseType: 'arraybuffer'
53 | })
54 | return res.data
55 | } catch (err) {
56 | return err
57 | }
58 | }
59 |
60 | exports.fetchJson = async (url, options) => {
61 | try {
62 | options ? options : {}
63 | const res = await axios({
64 | method: 'GET',
65 | url: url,
66 | headers: {
67 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'
68 | },
69 | ...options
70 | })
71 | return res.data
72 | } catch (err) {
73 | return err
74 | }
75 | }
76 |
77 | exports.runtime = function(seconds) {
78 | seconds = Number(seconds);
79 | var d = Math.floor(seconds / (3600 * 24));
80 | var h = Math.floor(seconds % (3600 * 24) / 3600);
81 | var m = Math.floor(seconds % 3600 / 60);
82 | var s = Math.floor(seconds % 60);
83 | var dDisplay = d > 0 ? d + (d == 1 ? " day, " : " days, ") : "";
84 | var hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " hours, ") : "";
85 | var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
86 | var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "";
87 | return dDisplay + hDisplay + mDisplay + sDisplay;
88 | }
89 |
90 | exports.clockString = function(seconds) {
91 | let h = isNaN(seconds) ? '--' : Math.floor(seconds % (3600 * 24) / 3600)
92 | let m = isNaN(seconds) ? '--' : Math.floor(seconds % 3600 / 60)
93 | let s = isNaN(seconds) ? '--' : Math.floor(seconds % 60)
94 | return [h, m, s].map(v => v.toString().padStart(2, 0)).join(':')
95 | }
96 |
97 | exports.sleep = async (ms) => {
98 | return new Promise(resolve => setTimeout(resolve, ms));
99 | }
100 |
101 | exports.isUrl = (url) => {
102 | return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/, 'gi'))
103 | }
104 |
105 | exports.getTime = (format, date) => {
106 | if (date) {
107 | return moment(date).locale('id').format(format)
108 | } else {
109 | return moment.tz('America/Sao_Paulo').locale('id').format(format)
110 | }
111 | }
112 |
113 | exports.formatDate = (n, locale = 'id') => {
114 | let d = new Date(n)
115 | return d.toLocaleDateString(locale, {
116 | weekday: 'long',
117 | day: 'numeric',
118 | month: 'long',
119 | year: 'numeric',
120 | hour: 'numeric',
121 | minute: 'numeric',
122 | second: 'numeric'
123 | })
124 | }
125 |
126 | exports.tanggal = (numer) => {
127 | myMonths = ["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"];
128 | myDays = ['Minggu','Senin','Selasa','Rabu','Kamis','Jum’at','Sabtu'];
129 | var tgl = new Date(numer);
130 | var day = tgl.getDate()
131 | bulan = tgl.getMonth()
132 | var thisDay = tgl.getDay(),
133 | thisDay = myDays[thisDay];
134 | var yy = tgl.getYear()
135 | var year = (yy < 1000) ? yy + 1900 : yy;
136 | const time = moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss')
137 | let d = new Date
138 | let locale = 'id'
139 | let gmt = new Date(0).getTime() - new Date('1 January 1970').getTime()
140 | let weton = ['Pahing', 'Pon','Wage','Kliwon','Legi'][Math.floor(((d * 1) + gmt) / 84600000) % 5]
141 |
142 | return`${thisDay}, ${day} - ${myMonths[bulan]} - ${year}`
143 | }
144 |
145 | exports.formatp = sizeFormatter({
146 | std: 'JEDEC', //'SI' = default | 'IEC' | 'JEDEC'
147 | decimalPlaces: 2,
148 | keepTrailingZeroes: false,
149 | render: (literal, symbol) => `${literal} ${symbol}B`,
150 | })
151 |
152 | exports.jsonformat = (string) => {
153 | return JSON.stringify(string, null, 2)
154 | }
155 |
156 | function format(...args) {
157 | return util.format(...args)
158 | }
159 |
160 | exports.logic = (check, inp, out) => {
161 | if (inp.length !== out.length) throw new Error('A entrada e a saída devem ter o mesmo comprimento')
162 | for (let i in inp)
163 | if (util.isDeepStrictEqual(check, inp[i])) return out[i]
164 | return null
165 | }
166 |
167 | exports.generateProfilePicture = async (buffer) => {
168 | const jimp = await Jimp.read(buffer)
169 | const min = jimp.getWidth()
170 | const max = jimp.getHeight()
171 | const cropped = jimp.crop(0, 0, min, max)
172 | return {
173 | img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG),
174 | preview: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG)
175 | }
176 | }
177 |
178 |
179 | exports.parseMention = (text = '') => {
180 | return [...text.matchAll(/@([0-9]{5,16}|0)/g)].map(v => v[1] + '@s.whatsapp.net')
181 | }
182 |
183 | exports.getGroupAdmins = (participantes) => {
184 | var admins = []
185 | for (let i of participantes) {
186 | i.admin === "admin" ? admins.push(i.id) : ''
187 | }
188 | return admins
189 | }
190 |
191 | /**
192 | * Serialize Message
193 | * @param {WAConnection} conn
194 | * @param {Object} m
195 | * @param {store} store
196 | */
197 | exports.smsg = (conn, m, store) => {
198 | if (!m) return m
199 | let M = proto.WebMessageInfo
200 | if (m.key) {
201 | m.id = m.key.id
202 | m.isBaileys = m.id.startsWith('BAE5') && m.id.length === 16
203 | m.chat = m.key.remoteJid
204 | m.fromMe = m.key.fromMe
205 | m.isGroup = m.chat.endsWith('@g.us')
206 | m.sender = conn.decodeJid(m.fromMe && conn.user.id || m.participant || m.key.participant || m.chat || '')
207 | if (m.isGroup) m.participant = conn.decodeJid(m.key.participant) || ''
208 | }
209 | if (m.message) {
210 | m.mtype = getContentType(m.message)
211 | m.msg = (m.mtype == 'viewOnceMessage' ? m.message[m.mtype].message[getContentType(m.message[m.mtype].message)] : m.message[m.mtype])
212 | m.body = m.message.conversation || m.msg.caption || m.msg.text || (m.mtype == 'listResponseMessage') && m.msg.singleSelectReply.selectedRowId || (m.mtype == 'buttonsResponseMessage') && m.msg.selectedButtonId || (m.mtype == 'viewOnceMessage') && m.msg.caption || m.text
213 | let quoted = m.quoted = m.msg.contextInfo ? m.msg.contextInfo.quotedMessage : null
214 | m.mentionedJid = m.msg.contextInfo ? m.msg.contextInfo.mentionedJid : []
215 | if (m.quoted) {
216 | let type = getContentType(quoted)
217 | m.quoted = m.quoted[type]
218 | if (['productMessage'].includes(type)) {
219 | type = getContentType(m.quoted)
220 | m.quoted = m.quoted[type]
221 | }
222 | if (typeof m.quoted === 'string') m.quoted = {
223 | text: m.quoted
224 | }
225 | m.quoted.mtype = type
226 | m.quoted.id = m.msg.contextInfo.stanzaId
227 | m.quoted.chat = m.msg.contextInfo.remoteJid || m.chat
228 | m.quoted.isBaileys = m.quoted.id ? m.quoted.id.startsWith('BAE5') && m.quoted.id.length === 16 : false
229 | m.quoted.sender = conn.decodeJid(m.msg.contextInfo.participant)
230 | m.quoted.fromMe = m.quoted.sender === (conn.user && conn.user.id)
231 | m.quoted.text = m.quoted.text || m.quoted.caption || m.quoted.conversation || m.quoted.contentText || m.quoted.selectedDisplayText || m.quoted.title || ''
232 | m.quoted.mentionedJid = m.msg.contextInfo ? m.msg.contextInfo.mentionedJid : []
233 | m.getQuotedObj = m.getQuotedMessage = async () => {
234 | if (!m.quoted.id) return false
235 | let q = await store.loadMessage(m.chat, m.quoted.id, conn)
236 | return exports.smsg(conn, q, store)
237 | }
238 | let vM = m.quoted.fakeObj = M.fromObject({
239 | key: {
240 | remoteJid: m.quoted.chat,
241 | fromMe: m.quoted.fromMe,
242 | id: m.quoted.id
243 | },
244 | message: quoted,
245 | ...(m.isGroup ? { participant: m.quoted.sender } : {})
246 | })
247 |
248 | /**
249 | *
250 | * @returns
251 | */
252 | m.quoted.delete = () => conn.sendMessage(m.quoted.chat, { delete: vM.key })
253 |
254 |
255 | /**
256 | *
257 | * @param {*} jid
258 | * @param {*} forceForward
259 | * @param {*} options
260 | * @returns
261 | */
262 | m.quoted.copyNForward = (jid, forceForward = false, options = {}) => conn.copyNForward(jid, vM, forceForward, options)
263 |
264 | /**
265 | *
266 | * @returns
267 | */
268 | m.quoted.download = () => conn.downloadMediaMessage(m.quoted)
269 | }
270 | }
271 | if (m.msg.url) m.download = () => conn.downloadMediaMessage(m.msg)
272 | m.text = m.msg.text || m.msg.caption || m.message.conversation || m.msg.contentText || m.msg.selectedDisplayText || m.msg.title || ''
273 | /**
274 | * Reply to this message
275 | * @param {String|Object} text
276 | * @param {String|false} chatId
277 | * @param {Object} options
278 | */
279 | m.reply = (text, chatId = m.chat, options = {}) => Buffer.isBuffer(text) ? conn.sendMedia(chatId, text, 'file', '', m, { ...options }) : conn.sendText(chatId, text, m, { ...options })
280 | /**
281 | * Copy this message
282 | */
283 | m.copy = () => exports.smsg(conn, M.fromObject(M.toObject(m)))
284 |
285 | /**
286 | *
287 | * @param {*} jid
288 | * @param {*} forceForward
289 | * @param {*} options
290 | * @returns
291 | */
292 | m.copyNForward = (jid = m.chat, forceForward = false, options = {}) => conn.copyNForward(jid, m, forceForward, options)
293 |
294 | return m
295 | }
296 |
297 |
298 |
299 | let file = require.resolve(__filename)
300 | fs.watchFile(file, () => {
301 | fs.unwatchFile(file)
302 | console.log(chalk.redBright(`Update ${__filename}`))
303 | delete require.cache[file]
304 | require(file)
305 | })
306 |
--------------------------------------------------------------------------------
/lib/scrapper.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Base Create By Dika Ardnt.
3 | * Updated by fnixdev
4 | * Follow https://github.com/fnixdev
5 | */
6 |
7 | const axios = require('axios')
8 | const cheerio = require('cheerio')
9 |
10 |
11 | function pinterest(querry){
12 | return new Promise(async(resolve,reject) => {
13 | axios.get('https://id.pinterest.com/search/pins/?autologin=true&q=' + querry, {
14 | headers: {
15 | "cookie" : "_auth=1; _b=\"AVna7S1p7l1C5I9u0+nR3YzijpvXOPc6d09SyCzO+DcwpersQH36SmGiYfymBKhZcGg=\"; _pinterest_sess=TWc9PSZHamJOZ0JobUFiSEpSN3Z4a2NsMk9wZ3gxL1NSc2k2NkFLaUw5bVY5cXR5alZHR0gxY2h2MVZDZlNQalNpUUJFRVR5L3NlYy9JZkthekp3bHo5bXFuaFZzVHJFMnkrR3lTbm56U3YvQXBBTW96VUgzVUhuK1Z4VURGKzczUi9hNHdDeTJ5Y2pBTmxhc2owZ2hkSGlDemtUSnYvVXh5dDNkaDN3TjZCTk8ycTdHRHVsOFg2b2NQWCtpOWxqeDNjNkk3cS85MkhhSklSb0hwTnZvZVFyZmJEUllwbG9UVnpCYVNTRzZxOXNJcmduOVc4aURtM3NtRFo3STlmWjJvSjlWTU5ITzg0VUg1NGhOTEZzME9SNFNhVWJRWjRJK3pGMFA4Q3UvcHBnWHdaYXZpa2FUNkx6Z3RNQjEzTFJEOHZoaHRvazc1c1UrYlRuUmdKcDg3ZEY4cjNtZlBLRTRBZjNYK0lPTXZJTzQ5dU8ybDdVS015bWJKT0tjTWYyRlBzclpiamdsNmtpeUZnRjlwVGJXUmdOMXdTUkFHRWloVjBMR0JlTE5YcmhxVHdoNzFHbDZ0YmFHZ1VLQXU1QnpkM1FqUTNMTnhYb3VKeDVGbnhNSkdkNXFSMXQybjRGL3pyZXRLR0ZTc0xHZ0JvbTJCNnAzQzE0cW1WTndIK0trY05HV1gxS09NRktadnFCSDR2YzBoWmRiUGZiWXFQNjcwWmZhaDZQRm1UbzNxc21pV1p5WDlabm1UWGQzanc1SGlrZXB1bDVDWXQvUis3elN2SVFDbm1DSVE5Z0d4YW1sa2hsSkZJb1h0MTFpck5BdDR0d0lZOW1Pa2RDVzNySWpXWmUwOUFhQmFSVUpaOFQ3WlhOQldNMkExeDIvMjZHeXdnNjdMYWdiQUhUSEFBUlhUVTdBMThRRmh1ekJMYWZ2YTJkNlg0cmFCdnU2WEpwcXlPOVZYcGNhNkZDd051S3lGZmo0eHV0ZE42NW8xRm5aRWpoQnNKNnNlSGFad1MzOHNkdWtER0xQTFN5Z3lmRERsZnZWWE5CZEJneVRlMDd2VmNPMjloK0g5eCswZUVJTS9CRkFweHc5RUh6K1JocGN6clc1JmZtL3JhRE1sc0NMTFlpMVErRGtPcllvTGdldz0=; _ir=0"
16 | }
17 | }).then(({ data }) => {
18 | const $ = cheerio.load(data)
19 | const result = [];
20 | const hasil = [];
21 | $('div > a').get().map(b => {
22 | const link = $(b).find('img').attr('src')
23 | result.push(link)
24 | });
25 | result.forEach(v => {
26 | if(v == undefined) return
27 | hasil.push(v.replace(/236/g,'736'))
28 | })
29 | hasil.shift();
30 | resolve(hasil)
31 | })
32 | })
33 | }
--------------------------------------------------------------------------------
/lib/uploader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Base Create By Dika Ardnt.
3 | * Updated by fnixdev
4 | * Follow https://github.com/fnixdev
5 | */
6 |
7 |
8 | let axios = require('axios')
9 | let BodyForm = require('form-data')
10 | let { fromBuffer } = require('file-type')
11 | let fetch = require('node-fetch')
12 | let fs = require('fs')
13 | let cheerio = require('cheerio')
14 |
15 |
16 |
17 | function TelegraPh (Path) {
18 | return new Promise (async (resolve, reject) => {
19 | if (!fs.existsSync(Path)) return reject(new Error("File not Found"))
20 | try {
21 | const form = new BodyForm();
22 | form.append("file", fs.createReadStream(Path))
23 | const data = await axios({
24 | url: "https://telegra.ph/upload",
25 | method: "POST",
26 | headers: {
27 | ...form.getHeaders()
28 | },
29 | data: form
30 | })
31 | return resolve("https://telegra.ph" + data.data[0].src)
32 | } catch (err) {
33 | return reject(new Error(String(err)))
34 | }
35 | })
36 | }
37 |
38 | async function UploadFileUgu (input) {
39 | return new Promise (async (resolve, reject) => {
40 | const form = new BodyForm();
41 | form.append("files[]", fs.createReadStream(input))
42 | await axios({
43 | url: "https://uguu.se/upload.php",
44 | method: "POST",
45 | headers: {
46 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36",
47 | ...form.getHeaders()
48 | },
49 | data: form
50 | }).then((data) => {
51 | resolve(data.data.files[0])
52 | }).catch((err) => reject(err))
53 | })
54 | }
55 |
56 | function webp2mp4File(path) {
57 | return new Promise((resolve, reject) => {
58 | const form = new BodyForm()
59 | form.append('new-image-url', '')
60 | form.append('new-image', fs.createReadStream(path))
61 | axios({
62 | method: 'post',
63 | url: 'https://s6.ezgif.com/webp-to-mp4',
64 | data: form,
65 | headers: {
66 | 'Content-Type': `multipart/form-data; boundary=${form._boundary}`
67 | }
68 | }).then(({ data }) => {
69 | const bodyFormThen = new BodyForm()
70 | const $ = cheerio.load(data)
71 | const file = $('input[name="file"]').attr('value')
72 | const token = $('input[name="token"]').attr('value')
73 | const convert = $('input[name="file"]').attr('value')
74 | const gotdata = {
75 | file: file,
76 | token: token,
77 | convert: convert
78 | }
79 | bodyFormThen.append('file', gotdata.file)
80 | bodyFormThen.append('token', gotdata.token)
81 | bodyFormThen.append('convert', gotdata.convert)
82 | axios({
83 | method: 'post',
84 | url: 'https://ezgif.com/webp-to-mp4/' + gotdata.file,
85 | data: bodyFormThen,
86 | headers: {
87 | 'Content-Type': `multipart/form-data; boundary=${bodyFormThen._boundary}`
88 | }
89 | }).then(({ data }) => {
90 | const $ = cheerio.load(data)
91 | const result = 'https:' + $('div#output > p.outfile > video > source').attr('src')
92 | resolve({
93 | status: true,
94 | message: "Created By MRHRTZ",
95 | result: result
96 | })
97 | }).catch(reject)
98 | }).catch(reject)
99 | })
100 | }
101 |
102 | module.exports = { TelegraPh, UploadFileUgu, webp2mp4File }
103 |
--------------------------------------------------------------------------------
/lib/y2mate.js:
--------------------------------------------------------------------------------
1 | let fetch = require('node-fetch')
2 | let { JSDOM } = require('jsdom')
3 |
4 | function post(url, formdata) {
5 | return fetch(url, {
6 | method: 'POST',
7 | headers: {
8 | accept: "*/*",
9 | 'accept-language': "en-US,en;q=0.9",
10 | 'content-type': "application/x-www-form-urlencoded; charset=UTF-8"
11 | },
12 | body: new URLSearchParams(Object.entries(formdata))
13 | })
14 | }
15 | const ytIdRegex = /(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/
16 |
17 | /**
18 | * Download YouTube Video via y2mate
19 | * @param {String} url YouTube Video URL
20 | * @param {String} quality (avaiable: `144p`, `240p`, `360p`, `480p`, `720p`, `1080p`, `1440p`, `2160p`)
21 | * @param {String} type (avaiable: `mp3`, `mp4`)
22 | * @param {String} bitrate (avaiable for video: `144`, `240`, `360`, `480`, `720`, `1080`, `1440`, `2160`)
23 | * (avaiable for audio: `128`)
24 | * @param {String} server (avaiable: `id4`, `en60`, `en61`, `en68`)
25 | */
26 | async function yt(url, quality, type, bitrate, server = 'en68') {
27 | let ytId = ytIdRegex.exec(url)
28 | url = 'https://youtu.be/' + ytId[1]
29 | let res = await post(`https://www.y2mate.com/mates/${server}/analyze/ajax`, {
30 | url,
31 | q_auto: 0,
32 | ajax: 1
33 | })
34 | let json = await res.json()
35 | let { document } = (new JSDOM(json.result)).window
36 | let tables = document.querySelectorAll('table')
37 | let table = tables[{ mp4: 0, mp3: 1 }[type] || 0]
38 | let list
39 | switch (type) {
40 | case 'mp4':
41 | list = Object.fromEntries([...table.querySelectorAll('td > a[href="#"]')].filter(v => !/\.3gp/.test(v.innerHTML)).map(v => [v.innerHTML.match(/.*?(?=\()/)[0].trim(), v.parentElement.nextSibling.nextSibling.innerHTML]))
42 | break
43 | case 'mp3':
44 | list = {
45 | '128kbps': table.querySelector('td > a[href="#"]').parentElement.nextSibling.nextSibling.innerHTML
46 | }
47 | break
48 | default:
49 | list = {}
50 | }
51 | let filesize = list[quality]
52 | let id = /var k__id = "(.*?)"/.exec(document.body.innerHTML) || ['', '']
53 | let thumb = document.querySelector('img').src
54 | let title = document.querySelector('b').innerHTML
55 | let res2 = await post(`https://www.y2mate.com/mates/${server}/convert`, {
56 | type: 'youtube',
57 | _id: id[1],
58 | v_id: ytId[1],
59 | ajax: '1',
60 | token: '',
61 | ftype: type,
62 | fquality: bitrate
63 | })
64 | let json2 = await res2.json()
65 | let KB = parseFloat(filesize) * (1000 * /MB$/.test(filesize))
66 | let resUrl = / {
75 | try {
76 | var body = (m.mtype === 'conversation') ? m.message.conversation : (m.mtype == 'imageMessage') ? m.message.imageMessage.caption : (m.mtype == 'videoMessage') ? m.message.videoMessage.caption : (m.mtype == 'extendedTextMessage') ? m.message.extendedTextMessage.text : (m.mtype == 'buttonsResponseMessage') ? m.message.buttonsResponseMessage.selectedButtonId : (m.mtype == 'listResponseMessage') ? m.message.listResponseMessage.singleSelectReply.selectedRowId : (m.mtype == 'templateButtonReplyMessage') ? m.message.templateButtonReplyMessage.selectedId : (m.mtype === 'messageContextInfo') ? (m.message.buttonsResponseMessage?.selectedButtonId || m.message.listResponseMessage?.singleSelectReply.selectedRowId || m.text) : ''
77 | var budy = (typeof m.text == 'string' ? m.text : '')
78 |
79 | // Comandos
80 |
81 | const isCmd = prefix.includes(body != '' && body.slice(0, 1)) && body.slice(1) != ''
82 | const command = isCmd ? body.slice(1).trim().split(' ')[0].toLowerCase() : ''
83 |
84 | //
85 |
86 | const args = body.trim().split(/ +/).slice(1)
87 | const pushname = m.pushName || "No Name"
88 | const botNumber = await shiro.decodeJid(shiro.user.id)
89 | const isCreator = [shiro.user.id, ...global.owner].map(v => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender)
90 | const isOwner = global.owner + '@s.whatsapp.net'
91 |
92 | const itsMe = m.sender == shiro.user.id ? true : false
93 | const text = q = args.join(" ")
94 | const quoted = m.quoted ? m.quoted : m
95 | const mime = (quoted.msg || quoted).mimetype || ''
96 | const isMedia = /image|video|sticker|audio/.test(mime)
97 |
98 | // Group
99 | const groupMetadata = m.isGroup ? await shiro.groupMetadata(m.chat).catch(e => { }) : ''
100 | const groupName = m.isGroup ? groupMetadata.subject : ''
101 | const participants = m.isGroup ? await groupMetadata.participants : ''
102 | const groupAdmins = m.isGroup ? await getGroupAdmins(participants) : ''
103 | const isBotAdmins = m.isGroup ? groupAdmins.includes(botNumber) : false
104 | const isGroupAdmins = m.isGroup ? groupAdmins.includes(m.sender) : false
105 |
106 | // NSFW
107 | const isNsfw = m.isGroup ? nsfw.includes(groupMetadata.id) : false
108 |
109 | // Rules
110 | const savedRules = m.isGroup ? rules.includes(groupMetadata.id) : false
111 |
112 |
113 | // AFK
114 | // const isAfkOn = afk.checkAfkUser(m.sender, _afk)
115 |
116 | // Bot Status
117 | const used = process.memoryUsage()
118 | const cpus = os.cpus().map(cpu => {
119 | cpu.total = Object.keys(cpu.times).reduce((last, type) => last + cpu.times[type], 0)
120 | return cpu
121 | })
122 | const cpu = cpus.reduce((last, cpu, _, {
123 | length
124 | }) => {
125 | last.total += cpu.total
126 | last.speed += cpu.speed / length
127 | last.times.user += cpu.times.user
128 | last.times.nice += cpu.times.nice
129 | last.times.sys += cpu.times.sys
130 | last.times.idle += cpu.times.idle
131 | last.times.irq += cpu.times.irq
132 | return last
133 | }, {
134 | speed: 0,
135 | total: 0,
136 | times: {
137 | user: 0,
138 | nice: 0,
139 | sys: 0,
140 | idle: 0,
141 | irq: 0
142 | }
143 | })
144 |
145 |
146 | ///////////////////////////////////////////////////////////
147 | // //
148 | // Public/Self //
149 | // //
150 | ///////////////////////////////////////////////////////////
151 |
152 | if (!shiro.public) {
153 | if (!m.key.fromMe) return
154 | }
155 |
156 | ///////////////////////////////////////////////////////////
157 | // //
158 | // Lida com as mensagens no console //
159 | // //
160 | ///////////////////////////////////////////////////////////
161 |
162 | if (isCmd) {
163 | console.log(chalk.black(chalk.bgCyanBright('[ CMD ]')), chalk.black(chalk.cyan.bold(budy || m.mtype)) + '\n' + chalk.magenta('=> De'), chalk.green(pushname), chalk.yellow(m.sender) + '\n' + chalk.magenta('=> Em'), chalk.green(m.isGroup ? groupName : groupName))
164 | } else {
165 | console.log(chalk.black(chalk.bgWhiteBright('[ MSG ]')), chalk.black(chalk.white.bold(budy || m.mtype)) + '\n' + chalk.magenta('=> De'), chalk.green(pushname), chalk.yellow(m.sender) + '\n' + chalk.magenta('=> Em'), chalk.green(m.isGroup ? groupName : groupName))
166 | }
167 |
168 | ///////////////////////////////////////////////////////////
169 | // //
170 | // Comandos de Dono //
171 | // //
172 | ///////////////////////////////////////////////////////////
173 | switch (command) {
174 |
175 | case 'test': {
176 | if (!isCreator) throw mess.owner
177 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
178 | m.reply(isOwner)
179 | }
180 | break
181 | case 'bc':
182 | case 'bcgc':
183 | case 'bcgroup': {
184 | if (!isCreator) throw mess.owner
185 | if (!text) throw mess.text
186 | let getGroups = await shiro.groupFetchAllParticipating()
187 | let groups = Object.entries(getGroups).slice(0).map(entry => entry[1])
188 | let anu = groups.map(v => v.id)
189 | m.reply(`Enviando broadcast em ${anu.length} grupos.`)
190 | for (let i of anu) {
191 | await sleep(1500)
192 | txt = `「 Mensagem de Transmissão 」\n\n${text}`
193 | shiro.sendMessage(i, { text: txt })
194 | }
195 | m.reply(`Mensagens enviadas em ${anu.length} grupos.`)
196 | }
197 | break
198 |
199 | case 'chat': {
200 | if (!isCreator) throw mess.owner
201 | if (!q) throw '_Opções_ :\n1 - mute\n2 - unmute'
202 | if (args[0] === 'mute') {
203 | shiro.chatModify({
204 | mute: 'Infinity'
205 | }, m.chat, []).then((res) => m.reply(jsonformat(res))).catch((err) => m.reply(jsonformat(err)))
206 | } else if (args[0] === 'unmute') {
207 | shiro.chatModify({
208 | mute: null
209 | }, m.chat, []).then((res) => m.reply(jsonformat(res))).catch((err) => m.reply(jsonformat(err)))
210 | }
211 | }
212 | break
213 | case 'listgp': {
214 | if (!isCreator) throw mess.owner
215 | let anu = await store.chats.all().filter(v => v.id.endsWith('@g.us')).map(v => v.id)
216 | let teks = `⬣ *Lista de Grupos*\n\nTotal : ${anu.length} Group\n\n`
217 | for (let i of anu) {
218 | let metadata = await shiro.groupMetadata(i)
219 | teks += `⬡ *Nome :* ${metadata.subject}\n⬡ *Dono :* @${metadata.owner.split('@')[0]}\n⬡ *ID :* ${metadata.id}\n⬡ *Criado :* ${moment(metadata.creation * 1000).tz('America/Sao_Paulo').format('DD/MM/YYYY HH:mm:ss')}\n⬡ *Membros :* ${metadata.participants.length}\n\n────────────────────────\n\n`
220 | }
221 | shiro.sendTextWithMentions(m.chat, teks, m)
222 | }
223 | break
224 | case 'join': {
225 | if (!isCreator) throw mess.owner
226 | if (!text) throw 'Insira o link do grupo!'
227 | if (!isUrl(args[0]) && !args[0].includes('whatsapp.com')) throw 'Link Invalido!'
228 | m.reply(mess.wait)
229 | let result = args[0].split('https://chat.whatsapp.com/')[1]
230 | await shiro.groupAcceptInvite(result).then((res) => m.reply(jsonformat(res))).catch((err) => m.reply(jsonformat(err)))
231 | }
232 | break
233 | case 'public': {
234 | if (!isCreator) throw mess.owner
235 | shiro.public = true
236 | m.reply('_Ok senpai, passarei a responder outros membros a partir de agora._')
237 | }
238 | break
239 | case 'self': {
240 | if (!isCreator) throw mess.owner
241 | shiro.public = false
242 | m.reply('_Ok, permanecerei calada a partir de agora._')
243 | }
244 | break
245 | case 'ping':
246 | case 'botstatus':
247 | case 'statusbot': {
248 | if (!isCreator) throw mess.owner
249 | let timestamp = speed()
250 | let latensi = speed() - timestamp
251 | neww = performance.now()
252 | oldd = performance.now()
253 | respon = `*Ping*: ${latensi.toFixed(4)}ms\n*Uptime*: ${runtime(process.uptime())}\n*RAM*: ${formatp(os.totalmem() - os.freemem())} / ${formatp(os.totalmem())}\n\n*NodeJS Usage*\n${Object.keys(used).map((key, _, arr) => `${key.padEnd(Math.max(...arr.map(v => v.length)), ' ')}: ${formatp(used[key])}`).join('\n')}
254 | `.trim()
255 | m.reply(respon)
256 | }
257 | break
258 | case 'block': {
259 | if (!isCreator) throw mess.owner
260 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
261 | await shiro.updateBlockStatus(users, 'block').then((res) => m.reply('_Usuario bloquedo_')).catch((err) => m.reply(jsonformat(err)))
262 | }
263 | break
264 | case 'unblock': {
265 | if (!isCreator) throw mess.owner
266 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
267 | await shiro.updateBlockStatus(users, 'unblock').then((res) => m.reply('_Usuario desbloqueado_')).catch((err) => m.reply(jsonformat(err)))
268 | }
269 | break
270 | case 'update': {
271 | if (!isCreator) throw mess.owner
272 | stdout = execSync('git remote set-url origin https://github.com/fnixdev/ShiroBot.git && git pull')
273 | m.reply(stdout.toString())
274 | }
275 | break
276 | case 'listgp': {
277 | if (!isCreator) throw mess.owner
278 | let grup = Object.values(await shiro.groupFetchAllParticipating()).map(v => `${v.subject}\n${v.id}`).join`\n\n`
279 | m.reply('Lista de Grupos:\n\n' + grup)
280 | }
281 | break
282 | case 'setprefix': {
283 | if (!isCreator) throw mess.owner
284 | if (!text) return m.reply('_Eu preciso que você informe um prefixo._')
285 | global.prefix = text[0]
286 | m.reply(`_Prefixo alterado para ${text[0]}_`)
287 | }
288 | break
289 | case 'restart': {
290 | if (!isCreator) throw mess.owner
291 | await m.reply('Reiniciando...')
292 | process.send('reset')
293 | }
294 | break
295 | case 'sh':
296 | case 'term': {
297 | if (!isCreator) throw mess.owner
298 | if (!text) throw mess.text
299 | exec(text, (err, stdout) => {
300 | if (err) return m.reply('_Erro ao executar comando no terminal_')
301 | if (stdout) return m.reply(stdout)
302 | })
303 | }
304 | break
305 |
306 | ///////////////////////////////////////////////////////////
307 | // //
308 | // Comandos de ADM //
309 | // //
310 | ///////////////////////////////////////////////////////////
311 |
312 | case 'setrules':
313 | if (!m.isGroup) throw mess.group
314 | if (!isGroupAdmins) throw mess.admin
315 | if (!text) throw mess.text
316 | let gId = groupMetadata.id
317 | objeto = { group_id: gId, rules: text }
318 | data = JSON.stringify(objeto)
319 | fs.writeFileSync(rules, data)
320 | await m.reply("_As novas regras foram salvas._")
321 | break
322 |
323 | case 'regras': {
324 | if (!savedRules) throw '_Nenhuma regra definida pelos admins._'
325 | gid = groupMetadata.id
326 | data = fs.readFileSync(rules)
327 | shiro.sendMessage(m.chat, { text: anu }, { quoted: m })
328 | }
329 | break
330 | case 'tagall':
331 | if (!m.isGroup) throw mess.group
332 | if (!isGroupAdmins) throw mess.admin
333 | if (!text) throw mess.text
334 | shiro.sendMessage(m.chat, {
335 | text: q ? q : '',
336 | mentions: participants.map(a => a.id)
337 | })
338 | break
339 | case 'kick': {
340 | if (!m.isGroup) throw mess.group
341 | if (!isGroupAdmins) throw mess.admin
342 | if (!isBotAdmins) throw mess.botAdmin
343 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
344 | if (users == isOwner) throw mess.isowner
345 | if (users) {
346 | await shiro.sendMessage(m.chat, {
347 | video: {
348 | url: "./src/banido.mp4"
349 | },
350 | caption: '_banido, pam, banido_'
351 | }, {
352 | quoted: m
353 | }), shiro.groupParticipantsUpdate(m.chat, [users], 'remove')
354 | } else {
355 | await m.reply('_Eu preciso que você marque ou mencione um usuario_')
356 | }
357 | }
358 | break
359 | case 'promote': {
360 | if (!m.isGroup) throw mess.group
361 | if (!isGroupAdmins) throw mess.admin
362 | if (!isBotAdmins) throw mess.botAdmin
363 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
364 | await shiro.groupParticipantsUpdate(m.chat, [users], 'promote').then(m.reply('_Usuario Promovido_')).catch((err) => m.reply(jsonformat(err)))
365 | }
366 | break
367 | case 'demote': {
368 | if (!m.isGroup) throw mess.group
369 | if (!isGroupAdmins) throw mess.admin
370 | if (!isBotAdmins) throw mess.botAdmin
371 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
372 | if (users == isOwner) throw mess.isowner
373 | await shiro.groupParticipantsUpdate(m.chat, [users], 'demote').then(m.reply('_Usuario foi rebaixado a membro comum_')).catch((err) => m.reply(jsonformat(err)))
374 | }
375 | break
376 | case 'nsfw':
377 | if (!m.isGroup) throw mess.group
378 | if (!isGroupAdmins) throw mess.admin
379 | if (!text) throw mess.text
380 | if (Number(text[0]) === 1) {
381 | if (isNsfw) return m.reply('_A putaria ja esta liberada._')
382 | nsfw.push(groupMetadata.id)
383 | fs.writeFileSync('./src/nsfw.json', JSON.stringify(nsfw))
384 | m.reply('_A putaria foi liberada 😈_')
385 | } else if (Number(args[0]) === 0) {
386 | nsfw.splice(groupMetadata.id, 1)
387 | fs.writeFileSync('./src/nsfw.json', JSON.stringify(nsfw))
388 | m.reply('_Nsfw foi desativado no grupo_')
389 | } else {
390 | m.reply('_Digite 1 para ativar ou 0 para desativar._')
391 | }
392 | break
393 |
394 | ///////////////////////////////////////////////////////////
395 | // //
396 | // Comandos Gerais //
397 | // //
398 | ///////////////////////////////////////////////////////////
399 |
400 | case 'linkgrupo':
401 | case 'link': {
402 | if (!m.isGroup) throw mess.group
403 | let response = await shiro.groupInviteCode(m.chat)
404 | shiro.sendText(m.chat, `https://chat.whatsapp.com/${response}\n\nLink do grupo : ${groupMetadata.subject}`, m, {
405 | detectLink: true
406 | })
407 | }
408 | break
409 |
410 | // server
411 | case 'server':
412 | case 'servidor': {
413 | link = { url: 'https://telegra.ph/file/ebdef6e0e27291626c026.jpg' }
414 | txt = `--> IP: kuuhaku.ddns.net (sem http)
415 | --> Porta: 19132
416 |
417 | *Detalhes:*
418 | - Servidor 24h.
419 | - Suporte para Java e Bedrock.
420 | - Proteção de terreno para cada jogador.
421 | - Servidor survivor com elementos RPG para incrementar a experiencia do jogador.`
422 | let btn = [{
423 | urlButton: {
424 | displayText: 'Mapa do Servidor',
425 | url: 'http://kuuhaku.ddns.net:5000/'
426 | }
427 | }, {
428 | urlButton: {
429 | displayText: 'Textura Recomendada(Bedrock)',
430 | url: `https://www.mediafire.com/file/tw0syo849nb4x8m/Minecraft+3D+128x.mcpack/file`
431 | }
432 | }]
433 | shiro.send5ButImg(m.chat, txt, shiro.user.name, link, btn)
434 | }
435 | break
436 |
437 | case 'source':
438 | case 'shiro':
439 | case 'sobre': {
440 | link = { url: 'https://telegra.ph/file/8481268cd704d86ca0a5c.jpg' }
441 | txt = `*「 O que é a Shiro? 」*\n\n_Inicialmente um projeto para enviar episódios de animes para o servidor, mas que aos poucos foi crescendo com funções administrativas entre outras._\n\n*「 Posso usar a Shiro? 」*\n\n_Se você deseja usar esse número em seu grupo, peça ao dono para usa-lo. Se deseja instalar este bot em um número secindario sinta-se livre para usar a source no GitHub._\n\n*「 Como fazer uma "Shiro?" 」*\n\n_Bom, isso é complicado, e se você planeja fazer algo assim, você deve aprender a programar, escolha uma linguagem de programação e pronto! Você saberá fazer uma Shiro._`
442 | let btn = [{
443 | urlButton: {
444 | displayText: 'Source',
445 | url: 'https://github.com/fnixdev/ShiroBot/'
446 | }
447 | }, {
448 | quickReplyButton: {
449 | displayText: 'Doar',
450 | id: `${prefix}pix`
451 | }
452 | }, {
453 | quickReplyButton: {
454 | displayText: 'Dono',
455 | id: `${prefix}dono`
456 | }
457 | }]
458 | shiro.send5ButImg(m.chat, txt, shiro.user.name, link, btn)
459 | }
460 | break
461 | case 'donate': case 'doar': case 'pix': {
462 | aceitas = 'https://telegra.ph/file/4c2400cb1b2d05849cddc.jpg'
463 | txt = '\nEu aceito: 6d850fc0-7676-4ecb-9277-848c7b3bddc9'
464 | shiro.sendImage(m.chat, aceitas, txt)
465 | }
466 | break
467 | case 'sticker':
468 | case 's':
469 | case 'stickergif':
470 | case 'sgif': {
471 | if (!m.isGroup) return m.reply(mess.group)
472 | if (!quoted) throw `Responda a uma imagem/video ${prefix + command}`
473 | m.reply(mess.wait)
474 | if (/image/.test(mime)) {
475 | let media = await quoted.download()
476 | let encmedia = await shiro.sendImageAsSticker(m.chat, media, m, { packname: global.packname, author: global.author })
477 | await fs.unlinkSync(encmedia)
478 | } else if (/video/.test(mime)) {
479 | if ((quoted.msg || quoted).seconds > 11) return m.reply('10 segundos no máximo!')
480 | let media = await quoted.download()
481 | let encmedia = await shiro.sendVideoAsSticker(m.chat, media, m, { packname: global.packname, author: global.author })
482 | await fs.unlinkSync(encmedia)
483 | } else {
484 | throw `Envie uma foto/video\nO video deve ter de 1 a 9 segundos`
485 | }
486 | }
487 | break
488 | case 'casal': {
489 | if (!m.isGroup) throw mess.group
490 | let member = participants.map(u => u.id)
491 | let user1 = member[Math.floor(Math.random() * member.length)]
492 | let user2 = member[Math.floor(Math.random() * member.length)]
493 | shiro.sendTextWithMentions(m.chat, `👫 Casal do dia\n@${user1.split('@')[0]} ❤️ @${user2.split('@')[0]}`, m)
494 | }
495 | break
496 |
497 | case 'pinterest': {
498 | if (!m.isGroup) return m.reply(mess.group)
499 | m.reply(mess.wait)
500 | let { pinterest } = require('./lib/scraper')
501 | anu = await pinterest(text)
502 | result = anu[Math.floor(Math.random() * anu.length)]
503 | shiro.sendMessage(m.chat, { image: { url: result }}, { quoted: m })
504 | }
505 |
506 | break
507 |
508 | case 'owner':
509 | case 'creator':
510 | case 'dono': {
511 | let vcard = 'BEGIN:VCARD\n' // metadata of the contact card
512 | +
513 | 'VERSION:3.0\n' +
514 | 'N:;fnix.;;;' +
515 | 'FN:Luis Gustavo.\n' +
516 | 'ORG:fnix (KuuhakuTeam);\n' +
517 | 'TEL;type=CELL;type=VOICE;waid=553189092420:+55 31 89092420\n' +
518 | 'END:VCARD'
519 | shiro.sendMessage(m.chat, {
520 | contacts: {
521 | displayName: 'fnix.',
522 | contacts: [{
523 | vcard
524 | }]
525 | }
526 | }, {
527 | quoted: m
528 | })
529 | }
530 | break
531 | case 'menu':
532 | case 'help': {
533 | txt = `
534 | ╭────ꕥ Shiro Bot ꕥ────
535 | │✾ Prefixo: ${prefix}
536 | │✾ Versão: v1.0.1
537 | │✾ Biblioteca: Baileys-MD
538 | │✾ Uptime: ${runtime(process.uptime())}
539 | ╰❑
540 | `
541 | let btn = [{
542 | urlButton: {
543 | displayText: 'Source',
544 | url: 'https://github.com/fnixdev/ShiroBot/'
545 | }
546 | }, {
547 | quickReplyButton: {
548 | displayText: 'Menu Principal',
549 | id: `${prefix}replymenu`
550 | }
551 | }, {
552 | quickReplyButton: {
553 | displayText: 'Menu Anime',
554 | id: `${prefix}menuanime`
555 | }
556 | }]
557 | shiro.send5ButImg(m.chat, txt, shiro.user.name, global.thumb, btn)
558 | }
559 | break
560 | case 'replymenu': {
561 | anu = `
562 | ╭─❑ 「 *Menu de Grupo* 」 ❑──
563 | │ ${prefix}link
564 | │ ${prefix}casal
565 | │ ${prefix}kick @user [ADM]
566 | │ ${prefix}promote @user [ADM]
567 | │ ${prefix}demote @user [ADM]
568 | │ ${prefix}nsfw [opção] [ADM]
569 | ╰❑
570 |
571 | ╭─❑ 「 *Download Menu* 」 ❑──
572 | │ ${prefix}play
573 | │ ${prefix}ytvideo
574 | │ ${prefix}ytaudio
575 | │ ${prefix}pinterest
576 | ╰❑
577 |
578 | ╭─❑ 「 *Ultilidades* 」 ❑──
579 | │ ${prefix}minecraft
580 | │ ${prefix}discord
581 | │ ${prefix}servidor
582 | ╰❑
583 |
584 | ╭─❑ 「 *Sobre o Bot* 」 ❑──
585 | │ ${prefix}dono
586 | │ ${prefix}source
587 | ╰❑
588 |
589 | ╭─❑ 「 *Menu do Dono* 」 ❑──
590 | │ ${prefix}ping
591 | │ ${prefix}chat [opção]
592 | │ ${prefix}join [link]
593 | │ ${prefix}leave
594 | │ ${prefix}block @user
595 | │ ${prefix}unblock @user
596 | ╰❑
597 | `
598 | shiro.sendMessage(m.chat, { text: anu }, { quoted: m })
599 | }
600 | break
601 |
602 | case 'mine':
603 | case 'minecraft': {
604 | link = { url: 'https://telegra.ph/file/0c97e206340a796a1e0cc.jpg' }
605 | caption = `_Escolha uma das opções abaixo para baixar o minecraft_`
606 | let btn = [{
607 | urlButton: {
608 | displayText: 'Baixar APK',
609 | url: `http://kuuhaku.ddns.net/Minecraft_1.19.2.apk`
610 | }
611 | }]
612 | shiro.send5ButImg(m.chat, caption, shiro.user.name, link, btn)
613 | }
614 | break
615 | case 'discord': {
616 | link = { url: 'https://telegra.ph/file/5202907a4419530e0848d.jpg' }
617 | caption = `_Clique no botão abaixo para baixar entrar no nosso servidor do Discord_`
618 | let btn = [{
619 | urlButton: {
620 | displayText: 'Entrar no Discord',
621 | url: `https://discord.gg/PQncrzqHmb`
622 | }
623 | }]
624 | shiro.send5ButImg(m.chat, caption, shiro.user.name, link, btn)
625 | }
626 | break
627 |
628 | ///////////////////////////////////////////////////////////
629 | // //
630 | // Anime //
631 | // //
632 | ///////////////////////////////////////////////////////////
633 |
634 | case 'menuanime':
635 | case 'animemenu': {
636 | capt = `
637 | ╭─❑ 「 *Anime/Manga* 」 ❑──
638 | │▸ ${prefix}anime [Nome]
639 | │▸ ${prefix}manga (indisponível)
640 | ╰❑
641 |
642 | ╭─❑ 「 *Fotos/Gifs SFW* 」 ❑──
643 | │▸ ${prefix}neko
644 | │▸ ${prefix}waifu
645 | │▸ ${prefix}wallpaper
646 | │▸ ${prefix}kiss [desativado]
647 | │▸ ${prefix}nekogif [desativado]
648 | │▸ ${prefix}poke [desativado]
649 | │▸ ${prefix}smug [desativado]
650 | │▸ ${prefix}cute [desativado]
651 | │▸ ${prefix}baka [desativado]
652 | │▸ ${prefix}foxgirl [desativado]
653 | ╰❑
654 |
655 | ╭─❑ 「 *Hentai Menu* 」 ❑──
656 | │▸ ${prefix}hentai
657 | │▸ ${prefix}hentaigif
658 | │▸ ${prefix}hentaineko
659 | │▸ ${prefix}anal
660 | │▸ ${prefix}boobs
661 | │▸ ${prefix}pussy
662 | │▸ ${prefix}cum
663 | │▸ ${prefix}blowjob
664 | │▸ ${prefix}feet
665 | │▸ ${prefix}yuri
666 | ╰❑
667 | `
668 | shiro.sendMessage(m.chat, { text: capt }, { quoted: m })
669 | }
670 | break
671 | case 'anime': {
672 | if (!m.isGroup) return m.reply(mess.group)
673 |
674 | if (!text) throw mess.text
675 | m.reply(mess.wait)
676 | const res = await axios.get(`https://api.jikan.moe/v3/search/anime?q=${text}`)
677 | animeinfo = `✨️ *Título:* _${res.data.results[0].title}_\n🎆️ *Episódios:*_ ${res.data.results[0].episodes}_\n💌️ *Avaliação:*_ ${res.data.results[0].rated}_\n❤️ *Score:* _${res.data.results[0].score}_\n💚️ *Descrição:* _${res.data.results[0].synopsis}_\n`
678 | shiro.sendMessage(m.chat, {
679 | image: {
680 | url: res.data.results[0].image_url
681 | },
682 | caption: animeinfo
683 | }, {
684 | quoted: m
685 | })
686 | }
687 | break
688 | case 'manga': {
689 | m.reply('_Funcão ainda em desenvolvimento._')
690 | }
691 | break
692 | case 'nhentai': {
693 | if (!m.isGroup) return m.reply(mess.group)
694 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
695 | if (!text) return m.reply('_Eu preciso que você digite o id de um hentai do nhentai_')
696 | let res = await axios.get(`http://hadi-api.herokuapp.com/api/nhentai?id=${text}`)
697 | if (res.data.status === true) {
698 | let result = `• Nome: ${res.data.result.name}\n\n• Tags: ${res.data.result.tags}\n• Idioma: ${res.data.result.language}\n• Paginas: ${res.data.result.pages}\n• Categoria: ${res.data.result.catefories}\n\n_Fazendo download aguarde..._`
699 | m.reply(result)
700 | shiro.sendMessage(m.chat, {
701 | document: {
702 | url: res.data.result.download_pdf
703 | }
704 | }, {
705 | quoted: m
706 | })
707 | } else {
708 | return m.reply(`_Não foi possível encontrar o hentai, verifique que o ID digitado esta correto_`)
709 | }
710 | }
711 | break
712 | case 'neko': {
713 | if (!m.isGroup) return m.reply(mess.group)
714 | let neko = await axios.get('https://nekos.life/api/v2/img/neko')
715 | shiro.sendMessage(m.chat, {
716 | image: {
717 | url: neko.data.url
718 | }
719 | }, {
720 | quoted: m
721 | })
722 | }
723 | break
724 |
725 | case 'wallpaper': {
726 | if (!m.isGroup) return m.reply(mess.group)
727 | let neko = await axios.get('https://nekos.life/api/v2/img/wallpaper')
728 | shiro.sendMessage(m.chat, {
729 | image: neko.data.url
730 | }, {
731 | quoted: m
732 | })
733 | }
734 | break
735 | case 'waifu': {
736 | if (!m.isGroup) return m.reply(mess.group)
737 | let neko = await axios.get('https://api.waifu.pics/sfw/waifu')
738 | shiro.sendMessage(m.chat, {
739 | image: {
740 | url: neko.data.url
741 | },
742 | }, {
743 | quoted: m
744 | })
745 | }
746 | break
747 |
748 | // NSFW CMDS
749 | case 'xvideos': {
750 | if (!m.isGroup) return m.reply(mess.group)
751 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
752 | if (!text) throw 'Eu preciso que você insira um link!'
753 | if (!isUrl(args[0]) && !args[0].includes('xvideos.com')) throw 'Link Invalido!'
754 | let vid = await axios.get(`https://kuuhaku-api-production.up.railway.app/api/xvideos?url=${text}`)
755 | shiro.sendMessage(m.chat, {
756 | video: {
757 | url: vid.data.url
758 | },
759 | caption: vid.data.title,
760 | gifPlayback: true,
761 | }, {
762 | quoted: m
763 | })
764 | }
765 |
766 |
767 | case 'anal': {
768 | if (!m.isGroup) return m.reply(mess.group)
769 | let neko = await axios.get('https://nekos.life/api/v2/img/anal')
770 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
771 | shiro.sendMessage(m.chat, {
772 | video: {
773 | url: neko.data.url
774 | },
775 | caption: '_Vai bater pra 2d né safado._',
776 | gifPlayback: true,
777 | }, {
778 | quoted: m
779 | })
780 | }
781 | break
782 | case 'hentai': {
783 | if (!m.isGroup) return m.reply(mess.group)
784 | let neko = await axios.get('https://nekos.life/api/v2/img/hentai')
785 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
786 | shiro.sendMessage(m.chat, {
787 | image: {
788 | url: neko.data.url
789 | },
790 | caption: '_Vai bater pra 2d né safado._'
791 | }, {
792 | quoted: m
793 | })
794 | }
795 | break
796 | case 'boobs': {
797 | if (!m.isGroup) return m.reply(mess.group)
798 | let neko = await axios.get('https://nekos.life/api/v2/img/boobs')
799 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
800 | shiro.sendMessage(m.chat, {
801 | video: {
802 | url: neko.data.url
803 | },
804 | caption: '_Vai bater pra 2d né safado._',
805 | gifPlayback: true,
806 | }, {
807 | quoted: m
808 | })
809 | }
810 | break
811 | case 'pussy': {
812 | if (!m.isGroup) return m.reply(mess.group)
813 | let neko = await axios.get('https://nekos.life/api/v2/img/pussy')
814 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
815 | shiro.sendMessage(m.chat, {
816 | video: {
817 | url: neko.data.url
818 | },
819 | caption: '_Vai bater pra 2d né safado._',
820 | gifPlayback: true,
821 | }, {
822 | quoted: m
823 | })
824 | }
825 | break
826 | case 'cum': {
827 | if (!m.isGroup) return m.reply(mess.group)
828 | let neko = await axios.get('https://nekos.life/api/v2/img/cum')
829 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
830 | shiro.sendMessage(m.chat, {
831 | video: {
832 | url: neko.data.url
833 | },
834 | caption: '_Vai bater pra 2d né safado._',
835 | gifPlayback: true,
836 | }, {
837 | quoted: m
838 | })
839 | }
840 | break
841 | case 'blowjob': {
842 | if (!m.isGroup) return m.reply(mess.group)
843 | let neko = await axios.get('https://nekos.life/api/v2/img/bj')
844 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
845 | shiro.sendMessage(m.chat, {
846 | video: {
847 | url: neko.data.url
848 | },
849 | caption: '_Vai bater pra 2d né safado._',
850 | gifPlayback: true,
851 | }, {
852 | quoted: m
853 | })
854 | }
855 | break
856 | case 'hentaineko': {
857 | if (!m.isGroup) return m.reply(mess.group)
858 | let neko = await axios.get('https://nekos.life/api/v2/img/nsfw_neko_gif')
859 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
860 | shiro.sendMessage(m.chat, {
861 | video: {
862 | url: neko.data.url
863 | },
864 | caption: '_Vai bater pra 2d né safado._',
865 | gifPlayback: true,
866 | }, {
867 | quoted: m
868 | })
869 | }
870 | break
871 | case 'hentaigif': {
872 | if (!m.isGroup) return m.reply(mess.group)
873 | let neko = await axios.get('https://nekos.life/api/v2/img/Random_hentai_gif')
874 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
875 | shiro.sendMessage(m.chat, {
876 | video: {
877 | url: neko.data.url
878 | },
879 | caption: '_Vai bater pra 2d né safado._',
880 | gifPlayback: true,
881 | }, {
882 | quoted: m
883 | })
884 | }
885 | break
886 | case 'feet': {
887 | if (!m.isGroup) return m.reply(mess.group)
888 | let neko = await axios.get('https://nekos.life/api/v2/img/feetg')
889 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
890 | shiro.sendMessage(m.chat, {
891 | video: {
892 | url: neko.data.url
893 | },
894 | caption: '_Vai bater pra 2d né safado._',
895 | gifPlayback: true,
896 | }, {
897 | quoted: m
898 | })
899 | }
900 | break
901 | case 'yuri': {
902 | if (!m.isGroup) return m.reply(mess.group)
903 | let neko = await axios.get('https://nekos.life/api/v2/img/eroyuri')
904 | if (!isNsfw) return m.reply('_Comandos +18 estão desativados nesse grupo._')
905 | shiro.sendMessage(m.chat, {
906 | image: {
907 | url: neko.data.url
908 | },
909 | caption: '_Vai bater pra 2d né safado._'
910 | }, {
911 | quoted: m
912 | })
913 | }
914 | break
915 |
916 | ///////////////////////////////////////////////////////////
917 | // //
918 | // Download //
919 | // //
920 | ///////////////////////////////////////////////////////////
921 |
922 | case 'play':
923 | case 'yt': {
924 | if (!m.isGroup) return m.reply(mess.group)
925 | if (!text) throw mess.text
926 | m.reply('_Tudo bem querido eu vou procurar pra você._')
927 | const search = await yts(`${text}`).catch(e => { m.reply('_[ ! ] Não consegui encontrar oque você queria 😔_') })
928 | anu = await yts({ videoId: `${search.all[0].videoId}` })
929 | caption = `
930 | ⭔ Titulo : ${anu.title}
931 | ⭔ Views : ${anu.views}
932 | `
933 | let btn = [{
934 | urlButton: {
935 | displayText: 'Ver no YouTube',
936 | url: `${anu.url}`
937 | }
938 | }, {
939 | quickReplyButton: {
940 | displayText: 'Audio',
941 | id: `${prefix}ytmp3 ${anu.url}`
942 | }
943 | }, {
944 | quickReplyButton: {
945 | displayText: 'Video',
946 | id: `${prefix}ytvideo ${anu.url}`
947 | }
948 | }]
949 | imagem = { url: anu.thumbnail }
950 | shiro.send5ButImg(m.chat, caption, shiro.user.name, imagem, btn)
951 | }
952 | break
953 |
954 | case 'ytmp3': {
955 | if (!m.isGroup) return m.reply(mess.group)
956 | let { yta } = require('./lib/y2mate')
957 | let quality = args[1] ? args[1] : '128kbps'
958 | let media = await yta(text, quality)
959 | if (media.filesize >= 100000) return m.reply(`_O audio que você quer é muito grande, eu só consigo enviar arquivos ate 100mb, este possui ${media.filesizeF}_`)
960 | shiro.sendMessage(m.chat, { audio: { url: media.dl_link }, mimetype: 'audio/mpeg', fileName: `${media.title}.mp3` }, { quoted: m })
961 | }
962 | break
963 |
964 | case 'ytaudio': {
965 | if (!m.isGroup) return m.reply(mess.group)
966 | if (!text) throw mess.text
967 | m.reply(mess.wait)
968 | const search = await yts(`${text}`).catch(e => { m.reply('_[ ! ] Não consegui encontrar oque você queria 😔_') })
969 | argyts = `https://youtu.be/${search.all[0].videoId}`
970 | let quality = '128kbps'
971 | let media = await yta(argyts, quality)
972 | if (media.filesize >= 100000) return m.reply(`_O audio que você quer é muito grande, eu só consigo enviar arquivos ate 100mb, este possui ${media.filesizeF}_`)
973 | shiro.sendImage(m.chat, media.thumb, `⭔ Titulo : ${media.title}\n⭔ Tamanho : ${media.filesizeF}\n⭔ Tipo : MP3`, m)
974 | shiro.sendMessage(m.chat, { audio: { url: media.dl_link }, mimetype: 'audio/mpeg', fileName: `${media.title}.mp3` }, { quoted: m })
975 | }
976 | break
977 |
978 | case 'ytvideo': {
979 | if (!m.isGroup) return m.reply(mess.group)
980 | if (!text) throw mess.text
981 | m.reply(mess.wait)
982 | const search = await yts(`${text}`).catch(e => { m.reply('_[ ! ] Não consegui encontrar oque você queria 😔_') })
983 | argyts = `https://youtu.be/${search.all[0].videoId}`
984 | let quality = '360p'
985 | let media = await ytv(argyts, quality)
986 | if (media.filesize >= 100000) return m.reply(`_O vídeo que você quer é muito grande, eu só consigo enviar arquivos ate 100mb, este possui ${media.filesizeF}_`)
987 | shiro.sendMessage(m.chat, { video: { url: media.dl_link }, mimetype: 'video/mp4', fileName: `${media.title}.mp4`, caption: `⭔ Titulo : ${media.title}\n⭔ Tamanho : ${media.filesizeF}\n⭔ Tipo : MP4` }, { quoted: m })
988 | }
989 | break
990 |
991 | /*
992 | case 'tiktok': {
993 | if (!m.isGroup) return m.reply(mess.group)
994 | //m.reply('_Função desativada temporáriamente._')
995 | if (!text) throw 'Eu preciso que você insira um link!'
996 | if (!isUrl(args[0]) && !args[0].includes('tiktok.com')) throw 'Link Invalido!'
997 | m.reply(mess.wait)
998 | capt = '_Send by ShiroBot_'
999 | res = await axios.get(`http://hadi-api.herokuapp.com/api/tiktok?url=${text}`)
1000 | let vid = res.data.result.video.nowm
1001 | shiro.sendMessage(m.chat, {
1002 | video: {
1003 | url: vid
1004 | },
1005 | caption: capt,
1006 | mimetype: 'video/mp4',
1007 | fileName: 'video.mp4'
1008 | }, {
1009 | quoted: m
1010 | })
1011 | }
1012 | break
1013 | */
1014 | default:
1015 | if (budy.startsWith('=>')) {
1016 | if (!isCreator) return m.reply(mess.owner)
1017 |
1018 | function Return(sul) {
1019 | sat = JSON.stringify(sul, null, 2)
1020 | bang = util.format(sat)
1021 | if (sat == undefined) {
1022 | bang = util.format(sul)
1023 | }
1024 | return m.reply(bang)
1025 | }
1026 | try {
1027 | m.reply(util.format(eval(`(async () => { return ${budy.slice(3)} })()`)))
1028 | } catch (e) {
1029 | m.reply(String(e))
1030 | }
1031 | }
1032 | if (budy.startsWith('>')) {
1033 | if (!isCreator) return m.reply(mess.owner)
1034 | try {
1035 | let evaled = await eval(budy.slice(2))
1036 | if (typeof evaled !== 'string') evaled = require('util').inspect(evaled)
1037 | await m.reply(evaled)
1038 | } catch (err) {
1039 | m = String(err)
1040 | await m.reply(m)
1041 | }
1042 | }
1043 | }
1044 | } catch (err) {
1045 | m.reply(util.format(err))
1046 | }
1047 | }
1048 |
1049 |
1050 | let file = require.resolve(__filename)
1051 | fs.watchFile(file, () => {
1052 | fs.unwatchFile(file)
1053 | console.log(chalk.redBright(`Update ${__filename}`))
1054 | delete require.cache[file]
1055 | require(file)
1056 | })
1057 |
--------------------------------------------------------------------------------
/src/banido.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fnixdev/ShiroBot/c838678d9515fc7821d13ad85acbb97e826c9c5f/src/banido.mp4
--------------------------------------------------------------------------------
/src/nsfw.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/src/rules.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/src/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "apiKey": "YourApiKey"
3 | }
--------------------------------------------------------------------------------
/src/shiro.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fnixdev/ShiroBot/c838678d9515fc7821d13ad85acbb97e826c9c5f/src/shiro.gif
--------------------------------------------------------------------------------
/src/shiro.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fnixdev/ShiroBot/c838678d9515fc7821d13ad85acbb97e826c9c5f/src/shiro.jpg
--------------------------------------------------------------------------------
/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | screen -d -m -S "shiro" sudo nodemon --delay 300 index.js
--------------------------------------------------------------------------------