From a25d1acd1d702287b6ca095a4079cf3f898cbe89 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sat, 5 Mar 2022 19:18:38 +0100 Subject: [PATCH] Initial commit --- .gitignore | 108 ++++ LICENSE | 674 +++++++++++++++++++++++++ basic.js | 46 ++ bullshit | 153 ++++++ bullshit.awk | 48 ++ bullshit.js | 22 + common.js | 142 ++++++ death.js | 28 ++ deathmessages.json | 22 + economy.js | 54 ++ hiragana.json | 1 + http.js | 91 ++++ init.js | 43 ++ kill_deathmessages.json | 27 + marriage.js | 57 +++ nsfw.lua | 61 +++ operator.lua | 28 ++ package-lock.json | 833 +++++++++++++++++++++++++++++++ package.json | 25 + random.lua | 132 +++++ roleplay.js | 12 + storage/.gitkeep | 0 utf8.lua | 1049 +++++++++++++++++++++++++++++++++++++++ waifu.js | 120 +++++ 24 files changed, 3776 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 basic.js create mode 100644 bullshit create mode 100644 bullshit.awk create mode 100644 bullshit.js create mode 100644 common.js create mode 100644 death.js create mode 100644 deathmessages.json create mode 100644 economy.js create mode 100644 hiragana.json create mode 100644 http.js create mode 100644 init.js create mode 100644 kill_deathmessages.json create mode 100644 marriage.js create mode 100644 nsfw.lua create mode 100644 operator.lua create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 random.lua create mode 100644 roleplay.js create mode 100644 storage/.gitkeep create mode 100644 utf8.lua create mode 100644 waifu.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..404a2bf --- /dev/null +++ b/.gitignore @@ -0,0 +1,108 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Storage +storage/* +!storage/.gitkeep diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/basic.js b/basic.js new file mode 100644 index 0000000..0ef4f46 --- /dev/null +++ b/basic.js @@ -0,0 +1,46 @@ +module.exports = { + help: { + params: "[]", + help: "Display help for a commands or show list of available commands", + func: (msg, [cmd], {commands}) => { + if (cmd) { + let def = commands[cmd] + + if (def) + msg.reply(`!${cmd}${def.params ? " " + def.params : ""}: ${def.help || "No description given"}`) + else + msg.reply(`Invalid command: ${cmd}`) + } else { + msg.reply("Available commands:\n\t" + Object.keys(commands).join("\n\t")) + } + }, + }, + accept: { + help: "Accept a request", + func: (msg, _, {requests}) => { + const id = msg.author.id + const req = requests[id] + + if (req) { + delete requests[id] + req.func(msg, req.origin) + } else { + msg.reply("Nothing to accept") + } + } + }, + deny: { + help: "Deny a request", + func: (msg, _, {requests}) => { + const id = msg.author.id + const req = requests[id] + + if (req) { + delete requests[id] + msg.reply(`Denied request from <@!${req.origin}>`) + } else { + msg.reply("Nothing to deny") + } + } + } +} diff --git a/bullshit b/bullshit new file mode 100644 index 0000000..73265c4 --- /dev/null +++ b/bullshit @@ -0,0 +1,153 @@ +app +blockchain +cloud +grid +base +engine +metadata +replication +factory +strategy +configuration | +information | +interface +singleton +framework +NoSQL | +cache +persistence | +self-signing | +deep-learning | +scripting | +template +realtime | +realtime-java | +just-in-time | +full-stack | +API +service +event +rails +polling | +injection | +pipelining | +firewall +standard +GPU | +shader +agile ^ +advanced ^ +converged ^ +leveraged ^ +extended ^ +decentralized ^ +basic ^ +core | +hardware +software +database +rich-client | +DOM | +CSS | +CMS | +STM | +map/reduce | +reduce/map | +descriptor +hypervisor +callback | +method +table +package +plugin +browser +extension +open-source ^ +module +enhancement +proxy +hosting +wrapper +storage +social ^ +private ^ +component +markup +lifecycle | +flexible ^ +patented ^ +abstract ^ +stateless ^ +optimized ^ +virtualized ^ +extensible ^ +compliant ^ +scale-out ^ +session | +content-driven | +high-performance | +general-purpose | +out-scaling | +generic ^ +mobile ^ +responsive ^ +progressive ^ +property | +secure ^ +overflow-preventing ^ +non-blocking ^ +self-healing ^ +ISO-certified ^ +encrypted ^ +proven ^ +open ^ +RESTful ^ +content-addressed ^ +asynchronous ^ +object-oriented ^ +immutable ^ +anonymous ^ +transactional ^ +distributed ^ +structured ^ +managed ^ +webscale ^ +lossless ^ +virtual ^ +shared ^ +stable ^ +SQL * +JSON * +XML * +YAML * +XMPP * +SOAP * +HTML * +AJAX * +ORM * +SVG * +ACPI * +WEB2.0 * +SSL * +HTTP * +TOR * +ActivityPub * +layer $ +element | +manager $ +frontend $ +backend $ +control $ +controller $ +framework $ +database $ +generator $ +optimizer $ +interface $ +solution $ +dependency | +locator $ +-oriented % +-based % +-aware % +-scale % diff --git a/bullshit.awk b/bullshit.awk new file mode 100644 index 0000000..e968bc4 --- /dev/null +++ b/bullshit.awk @@ -0,0 +1,48 @@ +function min(a, b){ + if(a > b) + return b + else + return a +} +function suffix(){ + if(hassuffix = (rand() < 0.2)) + return suffixes[int(rand() * nsuffix)] + return "" +} +$2 == "*" { protocol[nprotocol++] = $1; next } +$2 == "$" { end[nend++] = $1; next } +$2 == "%" { suffixes[nsuffix++] = $1; next } +$2 == "^" { start[nstart++] = $1; next } +$2 == "|" { noend[nword] = 1 } +{ word[nword++] = $1; next } +END { + srand() + last = -1 + out = 0 + total = int(rand() * 7) + 3 + n = int(rand() * min(total - out, 3)) + for(i = 0; i < n; i++) + printf "%s ", start[int(rand() * nstart)] + out += n + hassuffix = 0 + n = int(rand() * min(total - out, 3)) + for(i = 0; i < n; i++) + printf "%s%s ", word[last = int(rand() * nword)], suffix() + out += n + if(rand() > 0.5){ + n = int(rand() * 3) + for(i = 0; i < n; i++) + printf "%s %s", protocol[int(rand() * nprotocol)], (i != n-1) ? "over " : "" + out += n + last = -1 + hassuffix = 0 + } + n = int(rand() * min(total - out, 3)) + if(out + n == 1 || last == -1) + n += 2 + for(i = 0; i < n; i++) + printf "%s%s ", word[last = int(rand() * nword)], suffix() + if(rand() < 0.1 || (last >= 0 && noend[last]) || hassuffix) + printf "%s ", end[int(rand() * nend)] + print "" +} diff --git a/bullshit.js b/bullshit.js new file mode 100644 index 0000000..e2aa244 --- /dev/null +++ b/bullshit.js @@ -0,0 +1,22 @@ +const child_process = require("child_process") + +module.exports = { + bullshit: { + help: "Output some random bullshit (ported from the plan9front system)", + func: msg => { + const awk = child_process.spawn("awk", ["-f", "bullshit.awk", "bullshit"]) + let data = "" + + awk.stdout.on("data", chunk => { + data += chunk + }) + + awk.stderr.on("data", console.error) + + awk.on("close", code => { + if (code == 0) + msg.reply(data.slice(0, -2)) + }) + } + } +} diff --git a/common.js b/common.js new file mode 100644 index 0000000..a098c32 --- /dev/null +++ b/common.js @@ -0,0 +1,142 @@ +const fs = require("fs") +const google_images = require("free-google-images") + +/* +const furrybot.list_change_command(cmd, list_name, title, status) + furrybot.commands[cmd] = { + operator = true, + func = function(name, target) + if target then + if furrybot[list_name][target] == status then + furrybot.error_message(name, "Player " .. (status and "already" or "not") .. " " .. title .. ": ", target) + else + furrybot[list_name][target] = status + storage:set_string(list_name, minetest.serialize(furrybot[list_name])) + furrybot.ping_message(name, "Successfully " .. cmd .. (cmd:sub(#cmd, #cmd) == "e" and "" or "e") .. "d " .. target, furrybot.colors.system) + end + else + furrybot.error_message(name, "You need to specify a player") + end + end, + } +end + +function furrybot.list_command(cmd, list_name, title) + furrybot.commands[cmd] = { + func = function() + local names = {} + + for name in pairs(furrybot[list_name]) do + table.insert(names, name) + end + + furrybot.send("List of " .. title .. ": " .. table.concat(names, ", "), furrybot.colors.system) + end, + } +end + +function furrybot.choose(list, color) + return furrybot.colors.random .. list[math.random(#list)] .. color +end + +function furrybot.random(min, max, color) + return furrybot.colors.random .. math.random(min, max) .. color +end + +function furrybot.strrandom(str, seed, ...) + local v = 0 + local pr = PseudoRandom(seed) + for i = 1, #str do + v = v + str:byte(i) * pr:next() + end + return PseudoRandom(v):next(...) +end + +function furrybot.repeat_string(str, times) + local msg = "" + for i = 1, times do + msg = msg .. str + end + return msg +end + +*/ + +const getPing = module.exports.getPing = (msg, ping, allowSelf) => { + if (ping && ping.startsWith("<@!") && ping.endsWith(">")) { + const id = ping.slice("<@!".length, -">".length) + + if (!allowSelf && id == msg.author.id) { + msg.reply("Please mention a user other than yourself") + return + } + + if (msg.guild.members.cache.get(id)) + return id + } + + msg.reply("Please mention a user") +} + +module.exports.uppercase = str => str.slice(0, 1).toUpperCase() + str.slice(1) + +module.exports.requestCommand = (help, onRequest, onAccept) => new Object({ + params: "", + help: "Request to " + help + " another user", + func: (msg, [targetPing], {requests}) => { + const target = getPing(msg, targetPing, false) + + if (target) { + const err = onRequest(msg, target) + + if (err) + msg.reply(err) + else + requests[target] = { + origin: msg.author.id, + func: onAccept, + } + } + + } +}) + +module.exports.soloRoleplayCommand = (help, action) => new Object({ + help: help, + func: msg => google_images.searchRandom(help) + .then(result => msg.channel.send(`<@!${msg.author.id}> ${action}.\n${result.image.url}`)) +}) + +module.exports.interactiveRoleplayCommand = (help, action) => new Object({ + params: "", + help: help + " another user", + func: (msg, [targetPing]) => { + const target = getPing(msg, targetPing, false) + + if (target) + google_images.searchRandom(help) + .then(result => msg.channel.send(`<@!${msg.author.id}> ${action} <@!${target}>.\n${result.image.url}`)) + } +}) + +module.exports.storageLoad = name => { + try { + return require(`storage/${name}.json`) + } catch {} +} + +module.exports.storageSave = (name, data) => fs.writeFileSync(`storage/${name}.json`, JSON.stringify(data)) + +module.exports.choose = (arr, rng = Math) => arr[Math.floor(rng.random() * arr.length)] + +module.exports.chooseWeighted = (arr, rng = Math) => { + let accum = 0 + let edges = [] + + arr.forEach((v, k) => { + edges[k] = (accum += v[1]) + }) + + const r = Math.floor(rng.random() * accum) + return arr.find((_, k) => r < edges[k])[0] +} diff --git a/death.js b/death.js new file mode 100644 index 0000000..a4e65f3 --- /dev/null +++ b/death.js @@ -0,0 +1,28 @@ +const util = require("util") +const google_images = require("free-google-images") +const common = require("./common.js") + +const kill_deathmessages = require("./kill_deathmessages.json") +const deathmessages = require("./deathmessages.json") + +module.exports = { + kill: { + func: (msg, [targetPing]) => { + const user = msg.author.id + const target = common.getPing(msg, targetPing, true) + + if (target) + google_images.searchRandom("kill+meme") + .then(result => msg.channel.send((target == user + ? `<@!${target}> died due to lack of friends.` + : util.format(common.choose(kill_deathmessages), `<@!${target}>`, `<@!${user}>`) + ) + `\n${result.image.url}`)) + } + }, + die: { + func: msg => { + google_images.searchRandom("die+meme") + .then(result => msg.channel.send(util.format(common.choose(deathmessages), `<@!${msg.author.id}>`) + `\n${result.image.url}`)) + } + }, +} diff --git a/deathmessages.json b/deathmessages.json new file mode 100644 index 0000000..918f145 --- /dev/null +++ b/deathmessages.json @@ -0,0 +1,22 @@ +[ + "%s went up in flames", + "%s was struck by lightning", + "%s burned to death", + "%s tried to swim in lava", + "%s discovered the floor was lava", + "%s suffocated in a wall", + "%s drowned", + "%s starved to death", + "%s was pricked to death", + "%s hit the ground too hard", + "%s experienced kinetic energy", + "%s fell out of the world", + "%s died", + "%s was killed by magic", + "%s was roasted in dragon breath", + "%s withered away", + "%s was squashed by a falling anvil", + "%s blew up", + "%s was squished too much", + "%s went off with a bang" +] diff --git a/economy.js b/economy.js new file mode 100644 index 0000000..22d93bb --- /dev/null +++ b/economy.js @@ -0,0 +1,54 @@ +const google_images = require("free-google-images") +const common = require("./common.js") +let moneyStorage = common.storageLoad("money") || {} + +const getMoney = user => moneyStorage[user] || 100 +const setMoney = (user, money) => { + moneyStorage[user] = money + common.storageSave("money", moneyStorage) +} +const addMoney = (user, add) => setMoney(user, getMoney(user) + add) +const takeMoney = (user, remove) => { + const money = getMoney(user) - remove + + if (money < 0) + return false + + setMoney(user, money) + return true +} + +module.exports = { + money: { + func: (msg, [targetPing]) => { + const user = msg.author.id + const target = targetPing ? common.getPing(msg, targetPing, true) : user + + if (target) + msg.reply((user == target ? "You have " : `<@!${target}> has `) + getMoney(target) + ":b:.") + } + }, + pay: { + func: (msg, [targetPing, amountStr]) => { + const user = msg.author.id + const target = common.getPing(msg, targetPing, false) + + if (target) { + const amount = parseInt(amountStr) + + if (amount && amount > 0) { + if (takeMoney(user, amount)) { + addMoney(target, amount) + + google_images.searchRandom("free+bobux") + .then(result => msg.channel.send(`<@!${target}>: <@!${user}> has payed you ${amount}:b:.\n${result.image.url}`)) + } else { + msg.reply("You don't have enough money.") + } + } else { + msg.reply("Invalid amount of money :stuck_out_tongue:") + } + } + } + } +} diff --git a/hiragana.json b/hiragana.json new file mode 100644 index 0000000..28d29ce --- /dev/null +++ b/hiragana.json @@ -0,0 +1 @@ +{"ぎょ":"gyo","と":"to","ば":"ba","ぼ":"bo","じょ":"jo","う":"u","へ":"he","ね":"ne","ぎゅ":"gyu","ひ":"hi","ま":"ma","にゃ":"nya","ふ":"fu","びゅ":"byu","ひょ":"hyo","ぺ":"pe","ぎ":"gi","い":"i","りょ":"ryo","ちゃ":"tya","ほ":"ho","ちゅ":"tyu","ゆ":"yu","び":"bi","た":"ta","びょ":"byo","の":"no","ご":"go","ぞ":"zo","ちょ":"tyo","しゃ":"sya","ぎゃ":"gya","て":"te","そ":"so","びゃ":"bya","や":"ya","ぴ":"pi","ち":"chi","しゅ":"syu","げ":"ge","ぽ":"po","か":"ka","にょ":"nyo","さ":"sa","く":"ku","じゅ":"ju","あ":"a","ず":"zu","じ":"ji","ど":"do","れ":"re","ひゅ":"hyu","が":"ga","だ":"da","にゅ":"nyu","し":"shi","せ":"se","みゃ":"mya","き":"ki","みゅ":"myu","べ":"be","め":"me","じゃ":"ja","きょ":"kyo","きゅ":"kyu","ざ":"za","お":"o","しょ":"sho","でぃ":"di","みょ":"myo","を":"wo","ぱ":"pa","る":"ru","に":"ni","ぷ":"pu","わ":"wa","りゅ":"ryu","す":"su","な":"na","も":"mo","り":"ri","み":"mi","ぢゃ":"dya","つ":"tu","え":"e","ぐ":"gu","どぅ":"du","で":"de","こ":"ko","ろ":"ro","ぜ":"ze","け":"ke","よ":"yo","む":"mu","ぬ":"nu","りゃ":"rya","ぶ":"bu","ひゃ":"hya","は":"ha","ら":"ra","きゃ":"kya"} \ No newline at end of file diff --git a/http.js b/http.js new file mode 100644 index 0000000..604d032 --- /dev/null +++ b/http.js @@ -0,0 +1,91 @@ +const fetch = require("node-fetch") +const google_images = require("free-google-images") +const common = require("./common.js") + +module.exports = { + google: { + params: " [...]", + help: "Google Image Search", + func: (msg, keywords) => { + google_images.searchRandom(keywords.join(" ")) + .then(result => msg.reply(result.image.url)) + } + }, + verse: { + func: msg => fetch("https://labs.bible.org/api/?type=json&passage=random") + .then(res => res.json()) + .then(data => msg.reply(`${data[0].text} [${data[0].bookname} ${data[0].chapter}, ${data[0].verse}]`)) + }, + define: { + func: (msg, [word]) => word ? fetch("https://api.dictionaryapi.dev/api/v1/entries/en_US/" + word) + .then(res => res.json()) + .then(data => { + let def = data[0] + msg.reply(`__**${def.word}**__` + + (def.phonetic ? ` (_${def.phonetic}_)` : "") + + "\n\n" + + Object.entries(def.meaning).reduce((str, meaning) => str + + `_${meaning[0]}_\n` + + meaning[1].reduce((str, definition, i) => str + `\t${i + 1}. ${definition.definition}\n`, "") + , "") + + `\n[Definitions from ${def.sourceUrls.join(", ")}]` + ) + }) + .catch(_ => msg.reply("Not found")) + : msg.reply("You need to specify a word") + }, + urban: { + func: (msg, [word]) => word ? fetch("https://api.urbandictionary.com/v0/define?term=" + word) + .then(res => res.json()) + .then(data => { + let def = common.choose(data.list) + + msg.reply(`__**${def.word}**__\n` + + def.definition.replace(/\[/g,"").replace(/\]/g,"") + "\n\n" + + "**Example:**\n" + + def.example.replace(/\[/g,"").replace(/\]/g,"") + ) + }) + .catch(_ => msg.reply("Not found")) + : msg.reply("You need to specify a word") + }, + insult: { + func: (msg, [targetPing]) => { + const target = common.getPing(msg, targetPing, true) + + if (target) + fetch("https://insult.mattbas.org/api/insult") + .then(res => res.text()) + .then(data => msg.channel.send(`<@!${target}> ${data}`)) + } + } +} +/* + +furrybot.commands.joke = { + func = function(name, first, last) + if not first then + first = "Chuck" + last = "Norris" + elseif not last then + last = "" + end + furrybot.json_http_request("http://api.icndb.com/jokes/random?firstName=" .. first .. "&lastName=" .. last, name, function(data) + local joke = data.value.joke:gsub(""", "\""):gsub(" ", " ") + furrybot.send(joke, furrybot.colors.fun) + end) + end, +} + +furrybot.commands["8ball"] = { + func = function(name) + furrybot.json_http_request("https://8ball.delegator.com/magic/JSON/anything", name, function(data) + furrybot.ping_message(name, data.magic.answer, furrybot.colors.fun) + end) + end, +} + +return function(_http, _env, _storage) + http, env, storage = _http, _env, _storage +end +*/ diff --git a/init.js b/init.js new file mode 100644 index 0000000..75b5d57 --- /dev/null +++ b/init.js @@ -0,0 +1,43 @@ +const Discord = require("discord.js") +const common = require("./common.js") + +const client = module.exports = new Discord.Client({ + intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildMessages] +}) + +client.login(process.env.DISCORD_TOKEN) + +let fb = { + commands: {}, + requests: {}, + operators: common.storageLoad("operators") || [], + ignored: common.storageLoad("ignored") || [], +} + +client.on("messageCreate", msg => { + if (msg.author.id != client.user.id && msg.content.startsWith("!") && !fb.ignored[msg.author.id]) { + let args = msg.content.slice(1).split(" ") + let cmd = args.shift() + let def = fb.commands[cmd] + + if (def) { + if (def.operator && !fb.operators[msg.author.id]) + msg.reply(`Sorry, you need to be an operator run this command: ${cmd}`) + else + def.func(msg, args, fb) + } else { + msg.reply(`Invalid command: ${cmd}`) + } + } +}) + +//const modules = ["nsfw", "random", "http", "operator"] +const modules = ["basic", "bullshit", "marriage", "http", "roleplay", "death", "economy", "waifu"] + +for (let f of modules) { + let m = require(`./${f}.js`) + + if (m) + for (let k in m) + fb.commands[k] = m[k] +} diff --git a/kill_deathmessages.json b/kill_deathmessages.json new file mode 100644 index 0000000..2dbeafb --- /dev/null +++ b/kill_deathmessages.json @@ -0,0 +1,27 @@ +[ + "%s walked into fire whilst fighting %s", + "%s was struck by lightning whilst fighting %s", + "%s was burnt to a crisp whilst fighting %s", + "%s tried to swim in lava to escape %s", + "%s walked into danger zone due to %s", + "%s suffocated in a wall whilst fighting %s", + "%s drowned whilst trying to escape %s", + "%s starved to death whilst fighting %s", + "%s walked into a cactus whilst trying to escape %s", + "%s hit the ground too hard whilst trying to escape %s", + "%s experienced kinetic energy whilst trying to escape %s", + "%s didn't want to live in the same world as %s", + "%s died because of %s", + "%s was killed by magic whilst trying to escape %s", + "%s was killed by %s using magic", + "%s was roasted in dragon breath by %s", + "%s withered away whilst fighting %s", + "%s was shot by a skull from %s", + "%s was squashed by a falling anvil whilst fighting %s", + "%s was slain by %s", + "%s was shot by %s", + "%s was fireballed by %s", + "%s was killed trying to hurt %s", + "%s was blown up by %s", + "%s was squashed by %s" +] diff --git a/marriage.js b/marriage.js new file mode 100644 index 0000000..f4704b4 --- /dev/null +++ b/marriage.js @@ -0,0 +1,57 @@ +const common = require("./common.js") +const google_images = require("free-google-images") +let marriages = common.storageLoad("marriages") || {} + +module.exports = { + marry: common.requestCommand("marry another user", (msg, target) => { + const origin = msg.author.id + + if (marriages[origin]) + return `You are already married to <@!${marriages[origin]}>.` + else if (marriages[target]) + return `<@!${target}> is already married to <@!${marriages[target]}>.` + else + msg.channel.send(`<@!${target}>: <@!${origin}> is proposing to you. Type !accept to accept or !deny to deny.`) + }, (msg, origin) => { + const target = msg.author.id + + google_images.searchRandom("wedding") + .then(result => msg.reply(`Congratulations, <@!${target}> & <@!${origin}>, you are married. You may now kiss \\:)\n${result.image.url}`)) + + marriages[origin] = target + marriages[target] = origin + common.storageSave("marriages", marriages) + }), + divorce: { + func: msg => { + const user = msg.author.id + const partner = marriages[user] + + if (partner) { + delete marriages[user] + delete marriages[partner] + common.storageSave("marriages", marriages) + + msg.reply(`<@!${user}> divorced from <@!${partner}>.`) + } else { + msg.reply("You are not married.") + } + }, + }, + partner: { + func: (msg, [targetPing]) => { + const user = msg.author.id + const target = targetPing ? common.getPing(msg, targetPing, true) : user + + if (target) { + const partner = marriages[target] + const are = user == target ? "You are" : `<@!${target}> is` + + if (partner) + msg.reply(are + ` married to <@!${partner}>.`) + else + msg.reply(are + " not married.") + } + }, + }, +} diff --git a/nsfw.lua b/nsfw.lua new file mode 100644 index 0000000..1bbad7e --- /dev/null +++ b/nsfw.lua @@ -0,0 +1,61 @@ +local http, env, storage +local C = minetest.get_color_escape_sequence + +function furrybot.get_ascii_genitals(name, begin, middle, ending, seed) + return begin .. furrybot.repeat_string(middle, furrybot.strrandom(name, seed, 2, 10)) .. ending +end + +function furrybot.get_ascii_dick(name) + return minetest.rainbow(furrybot.get_ascii_genitals(name, "8", "=", "D", 31242)) +end + +function furrybot.get_ascii_boobs(name) + return furrybot.get_ascii_genitals(name, "E", "Ξ", "3", 31243) +end + +furrybot.commands.dicksize = { + params = "[]", + help = "Display the size of your own or another player's dick", + func = function(name, target) + target = target or name + furrybot.send(furrybot.get_ascii_dick(target) .. furrybot.colors.system .. " ← " .. furrybot.ping(target, furrybot.colors.system) .. "'s Dick", furrybot.colors.system) + end, +} + +furrybot.commands.boobsize = { + params = "[]", + help = "Display the size of your own or another player's boobs", + func = function(name, target) + target = target or name + furrybot.send(furrybot.get_ascii_boobs(target) .. furrybot.colors.system .. " ← " .. furrybot.ping(target, furrybot.colors.system) .. "'s Boobs", furrybot.colors.system) + end, +} + +furrybot.request_command("smellfeet", "smell another player's feet", function(name, target) + furrybot.ping_message(target, name .. " wants to smell your feet. Type !accept to accept or !deny to deny.", furrybot.colors.system) +end, function(name, target) + furrybot.ping_message(name, " you are smelling " .. target .. "'s feet. They are kinda stinky!", furrybot.colors.roleplay) +end) + +furrybot.request_command("blowjob", "suck another player's dick", function(name, target) + furrybot.ping_message(target, name .. " wants to suck your dick. Type !accept to accept or !deny to deny.", furrybot.colors.system) +end, function(name, target) + furrybot.send(name .. " is sucking " .. target .. "'s cock. " .. furrybot.get_ascii_dick(target) .. " ˣoˣ ", furrybot.colors.roleplay) +end) + +furrybot.request_command("sex", "have sex with another player", function(name, target) + furrybot.ping_message(target, name .. " wants to have sex with you. Type !accept to accept or !deny to deny.", furrybot.colors.system) +end, function(name, target) + furrybot.send(name .. " and " .. target .. " are having sex! OwO", furrybot.colors.roleplay) +end) + +furrybot.commands.cum = { + help = "Cum", + func = function(name) + furrybot.send(name .. " is cumming: " .. furrybot.get_ascii_dick(name) .. C("#FFFFFF") .. furrybot.repeat_string("~", math.random(1, 10)), furrybot.colors.roleplay) + end +} + +return function(_http, _env, _storage) + http, env, storage = _http, _env, _storage +end diff --git a/operator.lua b/operator.lua new file mode 100644 index 0000000..4503374 --- /dev/null +++ b/operator.lua @@ -0,0 +1,28 @@ +local http, env, storage +local C = minetest.get_color_escape_sequence + +furrybot.commands.reload = { + operator = true, + func = function() + furrybot.reload() + end, +} + +furrybot.commands.disconnect = { + operator = true, + func = function() + minetest.disconnect() + end, +} + +furrybot.list_change_command("op", "operators", "an operator", true) +furrybot.list_change_command("deop", "operators", "an operator", nil) +furrybot.list_command("oplist", "operators", "operators") + +furrybot.list_change_command("ignore", "ignored", "ignored", true) +furrybot.list_change_command("unignore", "ignored", "ignored", nil) +furrybot.list_command("ignorelist", "ignored", "ignored players") + +return function(_http, _env, _storage) + http, env, storage = _http, _env, _storage +end diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..dd2f9b8 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,833 @@ +{ + "name": "furrybot-discord", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "furrybot-discord", + "version": "1.0.0", + "license": "GPL-3.0-or-later", + "dependencies": { + "discord.js": "^14.0.0-dev.1646395406.6f7a366", + "free-google-images": "^1.0.4", + "node-fetch": "^2.0.0", + "pseudo-random": "^0.6.0" + } + }, + "node_modules/@discordjs/builders": { + "version": "0.13.0-dev.1646395406.6f7a366", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.13.0-dev.1646395406.6f7a366.tgz", + "integrity": "sha512-rkY2eSjQ/S257mx8TrHeT45urX6YtYOWLi8501oKz7Vy/VTclobIk26yJWpnRLsELllGMuE6I04ImL6+0Ge6hQ==", + "dependencies": { + "@sindresorhus/is": "^4.4.0", + "discord-api-types": "^0.27.3", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.0", + "tslib": "^2.3.1", + "zod": "^3.11.6" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/collection": { + "version": "0.6.0-dev.1646395404.6f7a366", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.6.0-dev.1646395404.6f7a366.tgz", + "integrity": "sha512-OMsu4nkraNAgJYGMmsSAnPtg5n+5mMb+Fywa/ZRAF+RyRd4g1qaUmRDi2haE/R0i55N0ltLqLbRFDWzMFOaPCA==", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/rest": { + "version": "0.4.0-dev.1646395403.6f7a366", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-0.4.0-dev.1646395403.6f7a366.tgz", + "integrity": "sha512-UKY7BSIJZhifmTN9z1Ujv3N3X6+h3S/orr2eEzeUuLYuJA6Teuc1RIt7uDlq9gEpwX4T5d/w4OD1tg/AZCO7pA==", + "dependencies": { + "@discordjs/collection": "^0.6.0-dev", + "@sapphire/async-queue": "^1.2.0", + "@sapphire/snowflake": "^3.1.0", + "@types/node-fetch": "^2.5.12", + "discord-api-types": "^0.27.0", + "form-data": "^4.0.0", + "node-fetch": "^2.6.7", + "tslib": "^2.3.1" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@sapphire/async-queue": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.2.0.tgz", + "integrity": "sha512-O5ND5Ljpef86X5oy8zXorQ754TMjWALcPSAgPBu4+76HLtDTrNoDyzU2uGE2G4A8Wv51u0MXHzGQ0WZ4GMtpIw==", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@sapphire/snowflake": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.1.0.tgz", + "integrity": "sha512-K+OiqXSx4clIaXcoaghrCV56zsm3bZZ5SBpgJkgvAKegFFdETMntHviUfypjt8xVleIuDaNyQA4APOIl3BMcxg==", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@types/node": { + "version": "17.0.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz", + "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==" + }, + "node_modules/@types/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA==", + "dependencies": { + "@types/node": "*", + "form-data": "^3.0.0" + } + }, + "node_modules/@types/node-fetch/node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@types/ws": { + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.2.tgz", + "integrity": "sha512-VXI82ykONr5tacHEojnErTQk+KQSoYbW1NB6iz6wUwrNd+BqfkfggQNoNdCqhJSzbNumShPERbM+Pc5zpfhlbw==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "node_modules/cheerio": { + "version": "1.0.0-rc.10", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", + "integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", + "dependencies": { + "cheerio-select": "^1.5.0", + "dom-serializer": "^1.3.2", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", + "integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", + "dependencies": { + "css-select": "^4.1.3", + "css-what": "^5.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.7.0" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/css-select": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz", + "integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^5.1.0", + "domhandler": "^4.3.0", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", + "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/discord-api-types": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.27.3.tgz", + "integrity": "sha512-HOG64DTpZ7CB5EU9eKbjHD50H5qG1pxKG8pmFfHUMKjKvEWeLBHfw0c9xF1cruiYLnBb3+n7m3jBWxZ3H1hcgQ==" + }, + "node_modules/discord.js": { + "version": "14.0.0-dev.1646395406.6f7a366", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.0.0-dev.1646395406.6f7a366.tgz", + "integrity": "sha512-2KxdaPb4frEtOmQQfBkfpsR0Q8/U2iLoA8es03rJFHwSaxO9tfNYEbrMaf2xDXiIVoB2LDwH3jeh097UfXh2gg==", + "dependencies": { + "@discordjs/builders": "^0.13.0-dev", + "@discordjs/collection": "^0.6.0-dev", + "@discordjs/rest": "^0.4.0-dev", + "@sapphire/snowflake": "^3.1.0", + "@types/ws": "^8.2.2", + "discord-api-types": "^0.27.3", + "lodash.snakecase": "^4.1.1", + "undici": "^4.14.1", + "ws": "^8.5.0" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/dom-serializer": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz", + "integrity": "sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/free-google-images": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/free-google-images/-/free-google-images-1.1.1.tgz", + "integrity": "sha512-tvMekRNXz8HZbOYO5YbmuVPWOTl2g7/njk24qziEZbXiH+Biy+WYpb+oEJLb7O+owkYPcIMSdL5i8i2Z0spshg==", + "dependencies": { + "cheerio": "^1.0.0-rc.10", + "jsonic": "^1.0.1", + "node-fetch": "^2.0.0" + } + }, + "node_modules/htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "node_modules/jsonic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/jsonic/-/jsonic-1.0.1.tgz", + "integrity": "sha512-6GitEN4plTuB/I1o9kDZl7Pgc+DvFG1BG88IqaUz4eQglCA1uAgxWdXhLNA6ffaYsmzPjOysDpp6CYTwRiuXLw==" + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40=" + }, + "node_modules/mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "dependencies": { + "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nth-check": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", + "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "dependencies": { + "parse5": "^6.0.1" + } + }, + "node_modules/pseudo-random": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pseudo-random/-/pseudo-random-0.6.0.tgz", + "integrity": "sha1-c9AAwgaN0sYTzA/CPQvRp4XVcDY=" + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "node_modules/ts-mixer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz", + "integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ==" + }, + "node_modules/tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, + "node_modules/undici": { + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-4.15.0.tgz", + "integrity": "sha512-kHppwh/y49FLEXl/zYCCbGB0D3nrcWNBczNYCsDdNYzWPs80aQgfKic1PVkJEIc2YlR7m0Lf5i559zbr0AA7FQ==", + "engines": { + "node": ">=12.18" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/zod": { + "version": "3.13.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.13.4.tgz", + "integrity": "sha512-LZRucWt4j/ru5azOkJxCfpR87IyFDn8h2UODdqvXzZLb3K7bb9chUrUIGTy3BPsr8XnbQYfQ5Md5Hu2OYIo1mg==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + }, + "dependencies": { + "@discordjs/builders": { + "version": "0.13.0-dev.1646395406.6f7a366", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.13.0-dev.1646395406.6f7a366.tgz", + "integrity": "sha512-rkY2eSjQ/S257mx8TrHeT45urX6YtYOWLi8501oKz7Vy/VTclobIk26yJWpnRLsELllGMuE6I04ImL6+0Ge6hQ==", + "requires": { + "@sindresorhus/is": "^4.4.0", + "discord-api-types": "^0.27.3", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.0", + "tslib": "^2.3.1", + "zod": "^3.11.6" + } + }, + "@discordjs/collection": { + "version": "0.6.0-dev.1646395404.6f7a366", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.6.0-dev.1646395404.6f7a366.tgz", + "integrity": "sha512-OMsu4nkraNAgJYGMmsSAnPtg5n+5mMb+Fywa/ZRAF+RyRd4g1qaUmRDi2haE/R0i55N0ltLqLbRFDWzMFOaPCA==" + }, + "@discordjs/rest": { + "version": "0.4.0-dev.1646395403.6f7a366", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-0.4.0-dev.1646395403.6f7a366.tgz", + "integrity": "sha512-UKY7BSIJZhifmTN9z1Ujv3N3X6+h3S/orr2eEzeUuLYuJA6Teuc1RIt7uDlq9gEpwX4T5d/w4OD1tg/AZCO7pA==", + "requires": { + "@discordjs/collection": "^0.6.0-dev", + "@sapphire/async-queue": "^1.2.0", + "@sapphire/snowflake": "^3.1.0", + "@types/node-fetch": "^2.5.12", + "discord-api-types": "^0.27.0", + "form-data": "^4.0.0", + "node-fetch": "^2.6.7", + "tslib": "^2.3.1" + } + }, + "@sapphire/async-queue": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.2.0.tgz", + "integrity": "sha512-O5ND5Ljpef86X5oy8zXorQ754TMjWALcPSAgPBu4+76HLtDTrNoDyzU2uGE2G4A8Wv51u0MXHzGQ0WZ4GMtpIw==" + }, + "@sapphire/snowflake": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.1.0.tgz", + "integrity": "sha512-K+OiqXSx4clIaXcoaghrCV56zsm3bZZ5SBpgJkgvAKegFFdETMntHviUfypjt8xVleIuDaNyQA4APOIl3BMcxg==" + }, + "@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" + }, + "@types/node": { + "version": "17.0.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz", + "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==" + }, + "@types/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA==", + "requires": { + "@types/node": "*", + "form-data": "^3.0.0" + }, + "dependencies": { + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + } + } + }, + "@types/ws": { + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.2.tgz", + "integrity": "sha512-VXI82ykONr5tacHEojnErTQk+KQSoYbW1NB6iz6wUwrNd+BqfkfggQNoNdCqhJSzbNumShPERbM+Pc5zpfhlbw==", + "requires": { + "@types/node": "*" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "cheerio": { + "version": "1.0.0-rc.10", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", + "integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", + "requires": { + "cheerio-select": "^1.5.0", + "dom-serializer": "^1.3.2", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + } + }, + "cheerio-select": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", + "integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", + "requires": { + "css-select": "^4.1.3", + "css-what": "^5.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.7.0" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "css-select": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz", + "integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==", + "requires": { + "boolbase": "^1.0.0", + "css-what": "^5.1.0", + "domhandler": "^4.3.0", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + } + }, + "css-what": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", + "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "discord-api-types": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.27.3.tgz", + "integrity": "sha512-HOG64DTpZ7CB5EU9eKbjHD50H5qG1pxKG8pmFfHUMKjKvEWeLBHfw0c9xF1cruiYLnBb3+n7m3jBWxZ3H1hcgQ==" + }, + "discord.js": { + "version": "14.0.0-dev.1646395406.6f7a366", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.0.0-dev.1646395406.6f7a366.tgz", + "integrity": "sha512-2KxdaPb4frEtOmQQfBkfpsR0Q8/U2iLoA8es03rJFHwSaxO9tfNYEbrMaf2xDXiIVoB2LDwH3jeh097UfXh2gg==", + "requires": { + "@discordjs/builders": "^0.13.0-dev", + "@discordjs/collection": "^0.6.0-dev", + "@discordjs/rest": "^0.4.0-dev", + "@sapphire/snowflake": "^3.1.0", + "@types/ws": "^8.2.2", + "discord-api-types": "^0.27.3", + "lodash.snakecase": "^4.1.1", + "undici": "^4.14.1", + "ws": "^8.5.0" + } + }, + "dom-serializer": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + } + }, + "domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" + }, + "domhandler": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz", + "integrity": "sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==", + "requires": { + "domelementtype": "^2.2.0" + } + }, + "domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + } + }, + "entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "free-google-images": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/free-google-images/-/free-google-images-1.1.1.tgz", + "integrity": "sha512-tvMekRNXz8HZbOYO5YbmuVPWOTl2g7/njk24qziEZbXiH+Biy+WYpb+oEJLb7O+owkYPcIMSdL5i8i2Z0spshg==", + "requires": { + "cheerio": "^1.0.0-rc.10", + "jsonic": "^1.0.1", + "node-fetch": "^2.0.0" + } + }, + "htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "jsonic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/jsonic/-/jsonic-1.0.1.tgz", + "integrity": "sha512-6GitEN4plTuB/I1o9kDZl7Pgc+DvFG1BG88IqaUz4eQglCA1uAgxWdXhLNA6ffaYsmzPjOysDpp6CYTwRiuXLw==" + }, + "lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40=" + }, + "mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==" + }, + "mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "requires": { + "mime-db": "1.51.0" + } + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "nth-check": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", + "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", + "requires": { + "boolbase": "^1.0.0" + } + }, + "parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "requires": { + "parse5": "^6.0.1" + } + }, + "pseudo-random": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pseudo-random/-/pseudo-random-0.6.0.tgz", + "integrity": "sha1-c9AAwgaN0sYTzA/CPQvRp4XVcDY=" + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "ts-mixer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz", + "integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ==" + }, + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, + "undici": { + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-4.15.0.tgz", + "integrity": "sha512-kHppwh/y49FLEXl/zYCCbGB0D3nrcWNBczNYCsDdNYzWPs80aQgfKic1PVkJEIc2YlR7m0Lf5i559zbr0AA7FQ==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "requires": {} + }, + "zod": { + "version": "3.13.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.13.4.tgz", + "integrity": "sha512-LZRucWt4j/ru5azOkJxCfpR87IyFDn8h2UODdqvXzZLb3K7bb9chUrUIGTy3BPsr8XnbQYfQ5Md5Hu2OYIo1mg==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..4146b41 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "furrybot-discord", + "version": "1.0.0", + "description": "Furrybot ported to discord.js", + "main": "init.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/EliasFleckenstein03/furrybot-discord.git" + }, + "author": "EliasFleckenstein03", + "license": "GPL-3.0-or-later", + "bugs": { + "url": "https://github.com/EliasFleckenstein03/furrybot-discord/issues" + }, + "homepage": "https://github.com/EliasFleckenstein03/furrybot-discord#readme", + "dependencies": { + "discord.js": "^14.0.0-dev.1646395406.6f7a366", + "free-google-images": "^1.0.4", + "node-fetch": "^2.0.0", + "pseudo-random": "^0.6.0" + } +} diff --git a/random.lua b/random.lua new file mode 100644 index 0000000..aad94eb --- /dev/null +++ b/random.lua @@ -0,0 +1,132 @@ +local http, env, storage +local C = minetest.get_color_escape_sequence + +furrybot.commands.rolldice = { + func = function(name) + furrybot.ping_message(name, "rolled a dice and got a " .. furrybot.random(1, 6, furrybot.colors.system) .. ".", furrybot.colors.system) + end, +} + +furrybot.commands.coinflip = { + func = function(name) + furrybot.ping_message(name, "flipped a coin and got " .. furrybot.choose({"Heads", "Tails"}, furrybot.colors.system) .. ".", furrybot.colors.system) + end, +} + +furrybot.commands.choose = { + func = function(name, ...) + local options = {...} + if #options > 1 then + furrybot.ping_message(name, "I choose " .. furrybot.choose(options, "", furrybot.colors.system) .. ".", furrybot.colors.system) + else + furrybot.error_message(name, "Not enough options") + end + end, +} + +furrybot.commands.uwu = { + func = function() + local msg = "" + + local m = math.random(10) + + for i = 1, m do + local u_list = {"u", "ü", "o", "ö"} + + local u = u_list[math.random(#u_list)] + local w = "w" + + if math.random() < 0.5 then + u = u:upper() + end + + if math.random() < 0.5 then + w = w:upper() + end + + msg = msg .. u .. w .. u + + if i ~= m then + msg = msg .. " " + end + end + + furrybot.send(msg, furrybot.colors.system) + end, +} + +furrybot.commands.extinct = { + func = function(name, species) + if species then + species = furrybot.uppercase(species .. (species:sub(#species, #species):lower() == "s" and "" or "s")) + furrybot.ping_message(name, species .. " are " .. (furrybot.strrandom(species, 420, 0, 1) == 0 and "not " or "") .. "extinct." , furrybot.colors.system) + else + furrybot.error_message(name, "You need to specify a species") + end + end, +} + +furrybot.commands.german = { + func = function(name) + local messages = { + "Schnauze!", + "Sprich Deutsch, du Hurensohn!", + "NEIN NEIN NEIN NEIN NEIN NEIN", + "Deine Mutter", + "Das war ein BEFEHL!", + "Das bleibt hier alles so wie das hier ist!", + "Scheißße", + "Digga was falsch bei dir", + "Lass mich deine Arschfalten sehen", + "Krieg mal deinen Ödipuskomplex unter Kontrolle", + "Meine Nudel ist 30cm lang und al dente", + "Wie die Nase eines Mannes, so auch sein Johannes.", + } + + local msg = messages[math.random(#messages)] + local stripe = math.floor(#msg / 3) + + furrybot.ping_message(name, msg:sub(1, stripe) .. C("red") .. msg:sub(stripe + 1, stripe * 2) .. C("yellow") .. msg:sub(stripe * 2 + 1, #msg), C("black")) + end, +} + +furrybot.commands.color = { + func = function(name) + local color = string.format("#%06x", math.random(16777216) - 1):upper() + + furrybot.ping_message(name, "Here's your color: " .. C(color) .. color, furrybot.colors.system) + end, +} + +furrybot.commands.book = { + func = function(name) + local books = { + "Johann Wolfgang von Goethe - Faust, Der Tragödie Erster Teil", + "Johann Wolfgang von Goethe - Faust, Der Tragödie Zweiter Teil", + "Karl Marx & Friedrich Engels - The Communist Manifesto", + "Brian Kernhigan & Dennis Ritchie - The C Programming Language", + "Heinrich Heine - Die Harzreise", + "Johann Wolfgang von Goethe - Die Leiden des jungen Werther", + "Friedrich Schiller - Die Jungfrau von Orleans", + "Theodor Fontane - Irrungen, Wirrungen", + "Friedrich Schiller - Die Räuber", + "Theodor Storm - Der Schimmelreiter", + "Josef von Eichendorff - Aus dem Leben eines Taugenichts", + "Richard Esplin - Advanced Linux Programming", + "Joey de Vries - Learn OpenGL", + "Gerard Beekmans - Linux From Scratch", + } + + furrybot.ping_message(name, books[math.random(#books)], furrybot.colors.system) + end, +} + +furrybot.commands.video = { + func = function(name) + furrybot.ping_message(name, "https://youtube.com/watch?v=dQw4w9WgXcQ", furrybot.colors.system) + end, +} + +return function(_http, _env, _storage) + http, env, storage = _http, _env, _storage +end diff --git a/roleplay.js b/roleplay.js new file mode 100644 index 0000000..cfa74fd --- /dev/null +++ b/roleplay.js @@ -0,0 +1,12 @@ +const common = require("./common.js") + +module.exports = { + cry: common.soloRoleplayCommand("Cry", "cries"), + laugh: common.soloRoleplayCommand("Laugh", "laughs"), + confused: common.soloRoleplayCommand("Be confused", "is confused"), + smile: common.soloRoleplayCommand("Smile", "smiles"), + hug: common.interactiveRoleplayCommand("Hug", "hugs"), + cuddle: common.interactiveRoleplayCommand("Cuddle", "cuddles"), + kiss: common.interactiveRoleplayCommand("Kiss", "kisses"), + slap: common.interactiveRoleplayCommand("Slap", "slaps"), +} diff --git a/storage/.gitkeep b/storage/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/utf8.lua b/utf8.lua new file mode 100644 index 0000000..db78306 --- /dev/null +++ b/utf8.lua @@ -0,0 +1,1049 @@ +-- $Id: utf8.lua 179 2009-04-03 18:10:03Z pasta $ +-- +-- Provides UTF-8 aware string functions implemented in pure lua: +-- * utf8len(s) +-- * utf8sub(s, i, j) +-- * utf8reverse(s) +-- * utf8char(unicode) +-- * utf8unicode(s, i, j) +-- * utf8gensub(s, sub_len) +-- * utf8find(str, regex, init, plain) +-- * utf8match(str, regex, init) +-- * utf8gmatch(str, regex, all) +-- * utf8gsub(str, regex, repl, limit) +-- +-- If utf8data.lua (containing the lower<->upper case mappings) is loaded, these +-- additional functions are available: +-- * utf8upper(s) +-- * utf8lower(s) +-- +-- All functions behave as their non UTF-8 aware counterparts with the exception +-- that UTF-8 characters are used instead of bytes for all units. + +--[[ +Copyright (c) 2006-2007, Kyle Smith +All rights reserved. + +Contributors: + Alimov Stepan + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the author nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--]] + +-- ABNF from RFC 3629 +-- +-- UTF8-octets = *( UTF8-char ) +-- UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 +-- UTF8-1 = %x00-7F +-- UTF8-2 = %xC2-DF UTF8-tail +-- UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / +-- %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) +-- UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / +-- %xF4 %x80-8F 2( UTF8-tail ) +-- UTF8-tail = %x80-BF +-- + +local byte = string.byte +local char = string.char +local dump = string.dump +local find = string.find +local format = string.format +local gmatch = string.gmatch +local gsub = string.gsub +local len = string.len +local lower = string.lower +local match = string.match +local rep = string.rep +local reverse = string.reverse +local sub = string.sub +local upper = string.upper + +-- returns the number of bytes used by the UTF-8 character at byte i in s +-- also doubles as a UTF-8 character validator +local function utf8charbytes (s, i) + -- argument defaults + i = i or 1 + + -- argument checking + if type(s) ~= "string" then + error("bad argument #1 to 'utf8charbytes' (string expected, got ".. type(s).. ")") + end + if type(i) ~= "number" then + error("bad argument #2 to 'utf8charbytes' (number expected, got ".. type(i).. ")") + end + + local c = byte(s, i) + + -- determine bytes needed for character, based on RFC 3629 + -- validate byte 1 + if c > 0 and c <= 127 then + -- UTF8-1 + return 1 + + elseif c >= 194 and c <= 223 then + -- UTF8-2 + local c2 = byte(s, i + 1) + + if not c2 then + error("UTF-8 string terminated early") + end + + -- validate byte 2 + if c2 < 128 or c2 > 191 then + error("Invalid UTF-8 character") + end + + return 2 + + elseif c >= 224 and c <= 239 then + -- UTF8-3 + local c2 = byte(s, i + 1) + local c3 = byte(s, i + 2) + + if not c2 or not c3 then + error("UTF-8 string terminated early") + end + + -- validate byte 2 + if c == 224 and (c2 < 160 or c2 > 191) then + error("Invalid UTF-8 character") + elseif c == 237 and (c2 < 128 or c2 > 159) then + error("Invalid UTF-8 character") + elseif c2 < 128 or c2 > 191 then + error("Invalid UTF-8 character") + end + + -- validate byte 3 + if c3 < 128 or c3 > 191 then + error("Invalid UTF-8 character") + end + + return 3 + + elseif c >= 240 and c <= 244 then + -- UTF8-4 + local c2 = byte(s, i + 1) + local c3 = byte(s, i + 2) + local c4 = byte(s, i + 3) + + if not c2 or not c3 or not c4 then + error("UTF-8 string terminated early") + end + + -- validate byte 2 + if c == 240 and (c2 < 144 or c2 > 191) then + error("Invalid UTF-8 character") + elseif c == 244 and (c2 < 128 or c2 > 143) then + error("Invalid UTF-8 character") + elseif c2 < 128 or c2 > 191 then + error("Invalid UTF-8 character") + end + + -- validate byte 3 + if c3 < 128 or c3 > 191 then + error("Invalid UTF-8 character") + end + + -- validate byte 4 + if c4 < 128 or c4 > 191 then + error("Invalid UTF-8 character") + end + + return 4 + + else + error("Invalid UTF-8 character") + end +end + +-- returns the number of characters in a UTF-8 string +local function utf8len (s) + -- argument checking + if type(s) ~= "string" then + for k,v in pairs(s) do print('"',tostring(k),'"',tostring(v),'"') end + error("bad argument #1 to 'utf8len' (string expected, got ".. type(s).. ")") + end + + local pos = 1 + local bytes = len(s) + local len = 0 + + while pos <= bytes do + len = len + 1 + pos = pos + utf8charbytes(s, pos) + end + + return len +end + +-- functions identically to string.sub except that i and j are UTF-8 characters +-- instead of bytes +local function utf8sub (s, i, j) + -- argument defaults + j = j or -1 + + local pos = 1 + local bytes = len(s) + local len = 0 + + -- only set l if i or j is negative + local l = (i >= 0 and j >= 0) or utf8len(s) + local startChar = (i >= 0) and i or l + i + 1 + local endChar = (j >= 0) and j or l + j + 1 + + -- can't have start before end! + if startChar > endChar then + return "" + end + + -- byte offsets to pass to string.sub + local startByte,endByte = 1,bytes + + while pos <= bytes do + len = len + 1 + + if len == startChar then + startByte = pos + end + + pos = pos + utf8charbytes(s, pos) + + if len == endChar then + endByte = pos - 1 + break + end + end + + if startChar > len then startByte = bytes+1 end + if endChar < 1 then endByte = 0 end + + return sub(s, startByte, endByte) +end + + +-- replace UTF-8 characters based on a mapping table +local function utf8replace (s, mapping) + -- argument checking + if type(s) ~= "string" then + error("bad argument #1 to 'utf8replace' (string expected, got ".. type(s).. ")") + end + if type(mapping) ~= "table" then + error("bad argument #2 to 'utf8replace' (table expected, got ".. type(mapping).. ")") + end + + local pos = 1 + local bytes = len(s) + local charbytes + local newstr = "" + + while pos <= bytes do + charbytes = utf8charbytes(s, pos) + local c = sub(s, pos, pos + charbytes - 1) + + newstr = newstr .. (mapping[c] or c) + + pos = pos + charbytes + end + + return newstr +end + + +-- identical to string.upper except it knows about unicode simple case conversions +local function utf8upper (s) + return utf8replace(s, utf8_lc_uc) +end + +-- identical to string.lower except it knows about unicode simple case conversions +local function utf8lower (s) + return utf8replace(s, utf8_uc_lc) +end + +-- identical to string.reverse except that it supports UTF-8 +local function utf8reverse (s) + -- argument checking + if type(s) ~= "string" then + error("bad argument #1 to 'utf8reverse' (string expected, got ".. type(s).. ")") + end + + local bytes = len(s) + local pos = bytes + local charbytes + local newstr = "" + + while pos > 0 do + c = byte(s, pos) + while c >= 128 and c <= 191 do + pos = pos - 1 + c = byte(s, pos) + end + + charbytes = utf8charbytes(s, pos) + + newstr = newstr .. sub(s, pos, pos + charbytes - 1) + + pos = pos - 1 + end + + return newstr +end + +-- http://en.wikipedia.org/wiki/Utf8 +-- http://developer.coronalabs.com/code/utf-8-conversion-utility +local function utf8char(unicode) + if unicode <= 0x7F then return char(unicode) end + + if (unicode <= 0x7FF) then + local Byte0 = 0xC0 + math.floor(unicode / 0x40); + local Byte1 = 0x80 + (unicode % 0x40); + return char(Byte0, Byte1); + end; + + if (unicode <= 0xFFFF) then + local Byte0 = 0xE0 + math.floor(unicode / 0x1000); + local Byte1 = 0x80 + (math.floor(unicode / 0x40) % 0x40); + local Byte2 = 0x80 + (unicode % 0x40); + return char(Byte0, Byte1, Byte2); + end; + + if (unicode <= 0x10FFFF) then + local code = unicode + local Byte3= 0x80 + (code % 0x40); + code = math.floor(code / 0x40) + local Byte2= 0x80 + (code % 0x40); + code = math.floor(code / 0x40) + local Byte1= 0x80 + (code % 0x40); + code = math.floor(code / 0x40) + local Byte0= 0xF0 + code; + + return char(Byte0, Byte1, Byte2, Byte3); + end; + + error 'Unicode cannot be greater than U+10FFFF!' +end + +local shift_6 = 2^6 +local shift_12 = 2^12 +local shift_18 = 2^18 + +local utf8unicode +utf8unicode = function(str, i, j, byte_pos) + i = i or 1 + j = j or i + + if i > j then return end + + local char,bytes + + if byte_pos then + bytes = utf8charbytes(str,byte_pos) + char = sub(str,byte_pos,byte_pos-1+bytes) + else + char,byte_pos = utf8sub(str,i,i), 0 + bytes = #char + end + + local unicode + + if bytes == 1 then unicode = byte(char) end + if bytes == 2 then + local byte0,byte1 = byte(char,1,2) + local code0,code1 = byte0-0xC0,byte1-0x80 + unicode = code0*shift_6 + code1 + end + if bytes == 3 then + local byte0,byte1,byte2 = byte(char,1,3) + local code0,code1,code2 = byte0-0xE0,byte1-0x80,byte2-0x80 + unicode = code0*shift_12 + code1*shift_6 + code2 + end + if bytes == 4 then + local byte0,byte1,byte2,byte3 = byte(char,1,4) + local code0,code1,code2,code3 = byte0-0xF0,byte1-0x80,byte2-0x80,byte3-0x80 + unicode = code0*shift_18 + code1*shift_12 + code2*shift_6 + code3 + end + + return unicode,utf8unicode(str, i+1, j, byte_pos+bytes) +end + +-- Returns an iterator which returns the next substring and its byte interval +local function utf8gensub(str, sub_len) + sub_len = sub_len or 1 + local byte_pos = 1 + local len = #str + return function(skip) + if skip then byte_pos = byte_pos + skip end + local char_count = 0 + local start = byte_pos + repeat + if byte_pos > len then return end + char_count = char_count + 1 + local bytes = utf8charbytes(str,byte_pos) + byte_pos = byte_pos+bytes + + until char_count == sub_len + + local last = byte_pos-1 + local sub = sub(str,start,last) + return sub, start, last + end +end + +local function binsearch(sortedTable, item, comp) + local head, tail = 1, #sortedTable + local mid = math.floor((head + tail)/2) + if not comp then + while (tail - head) > 1 do + if sortedTable[tonumber(mid)] > item then + tail = mid + else + head = mid + end + mid = math.floor((head + tail)/2) + end + else + end + if sortedTable[tonumber(head)] == item then + return true, tonumber(head) + elseif sortedTable[tonumber(tail)] == item then + return true, tonumber(tail) + else + return false + end +end +local function classMatchGenerator(class, plain) + local codes = {} + local ranges = {} + local ignore = false + local range = false + local firstletter = true + local unmatch = false + + local it = utf8gensub(class) + + local skip + for c,bs,be in it do + skip = be + if not ignore and not plain then + if c == "%" then + ignore = true + elseif c == "-" then + table.insert(codes, utf8unicode(c)) + range = true + elseif c == "^" then + if not firstletter then + error('!!!') + else + unmatch = true + end + elseif c == ']' then + break + else + if not range then + table.insert(codes, utf8unicode(c)) + else + table.remove(codes) -- removing '-' + table.insert(ranges, {table.remove(codes), utf8unicode(c)}) + range = false + end + end + elseif ignore and not plain then + if c == 'a' then -- %a: represents all letters. (ONLY ASCII) + table.insert(ranges, {65, 90}) -- A - Z + table.insert(ranges, {97, 122}) -- a - z + elseif c == 'c' then -- %c: represents all control characters. + table.insert(ranges, {0, 31}) + table.insert(codes, 127) + elseif c == 'd' then -- %d: represents all digits. + table.insert(ranges, {48, 57}) -- 0 - 9 + elseif c == 'g' then -- %g: represents all printable characters except space. + table.insert(ranges, {1, 8}) + table.insert(ranges, {14, 31}) + table.insert(ranges, {33, 132}) + table.insert(ranges, {134, 159}) + table.insert(ranges, {161, 5759}) + table.insert(ranges, {5761, 8191}) + table.insert(ranges, {8203, 8231}) + table.insert(ranges, {8234, 8238}) + table.insert(ranges, {8240, 8286}) + table.insert(ranges, {8288, 12287}) + elseif c == 'l' then -- %l: represents all lowercase letters. (ONLY ASCII) + table.insert(ranges, {97, 122}) -- a - z + elseif c == 'p' then -- %p: represents all punctuation characters. (ONLY ASCII) + table.insert(ranges, {33, 47}) + table.insert(ranges, {58, 64}) + table.insert(ranges, {91, 96}) + table.insert(ranges, {123, 126}) + elseif c == 's' then -- %s: represents all space characters. + table.insert(ranges, {9, 13}) + table.insert(codes, 32) + table.insert(codes, 133) + table.insert(codes, 160) + table.insert(codes, 5760) + table.insert(ranges, {8192, 8202}) + table.insert(codes, 8232) + table.insert(codes, 8233) + table.insert(codes, 8239) + table.insert(codes, 8287) + table.insert(codes, 12288) + elseif c == 'u' then -- %u: represents all uppercase letters. (ONLY ASCII) + table.insert(ranges, {65, 90}) -- A - Z + elseif c == 'w' then -- %w: represents all alphanumeric characters. (ONLY ASCII) + table.insert(ranges, {48, 57}) -- 0 - 9 + table.insert(ranges, {65, 90}) -- A - Z + table.insert(ranges, {97, 122}) -- a - z + elseif c == 'x' then -- %x: represents all hexadecimal digits. + table.insert(ranges, {48, 57}) -- 0 - 9 + table.insert(ranges, {65, 70}) -- A - F + table.insert(ranges, {97, 102}) -- a - f + else + if not range then + table.insert(codes, utf8unicode(c)) + else + table.remove(codes) -- removing '-' + table.insert(ranges, {table.remove(codes), utf8unicode(c)}) + range = false + end + end + ignore = false + else + if not range then + table.insert(codes, utf8unicode(c)) + else + table.remove(codes) -- removing '-' + table.insert(ranges, {table.remove(codes), utf8unicode(c)}) + range = false + end + ignore = false + end + + firstletter = false + end + + table.sort(codes) + + local function inRanges(charCode) + for _,r in ipairs(ranges) do + if r[1] <= charCode and charCode <= r[2] then + return true + end + end + return false + end + if not unmatch then + return function(charCode) + return binsearch(codes, charCode) or inRanges(charCode) + end, skip + else + return function(charCode) + return charCode ~= -1 and not (binsearch(codes, charCode) or inRanges(charCode)) + end, skip + end +end + +-- utf8sub with extra argument, and extra result value +local function utf8subWithBytes (s, i, j, sb) + -- argument defaults + j = j or -1 + + local pos = sb or 1 + local bytes = len(s) + local len = 0 + + -- only set l if i or j is negative + local l = (i >= 0 and j >= 0) or utf8len(s) + local startChar = (i >= 0) and i or l + i + 1 + local endChar = (j >= 0) and j or l + j + 1 + + -- can't have start before end! + if startChar > endChar then + return "" + end + + -- byte offsets to pass to string.sub + local startByte,endByte = 1,bytes + + while pos <= bytes do + len = len + 1 + + if len == startChar then + startByte = pos + end + + pos = pos + utf8charbytes(s, pos) + + if len == endChar then + endByte = pos - 1 + break + end + end + + if startChar > len then startByte = bytes+1 end + if endChar < 1 then endByte = 0 end + + return sub(s, startByte, endByte), endByte + 1 +end + +local cache = setmetatable({},{ + __mode = 'kv' +}) +local cachePlain = setmetatable({},{ + __mode = 'kv' +}) +local function matcherGenerator(regex, plain) + local matcher = { + functions = {}, + captures = {} + } + if not plain then + cache[regex] = matcher + else + cachePlain[regex] = matcher + end + local function simple(func) + return function(cC) + if func(cC) then + matcher:nextFunc() + matcher:nextStr() + else + matcher:reset() + end + end + end + local function star(func) + return function(cC) + if func(cC) then + matcher:fullResetOnNextFunc() + matcher:nextStr() + else + matcher:nextFunc() + end + end + end + local function minus(func) + return function(cC) + if func(cC) then + matcher:fullResetOnNextStr() + end + matcher:nextFunc() + end + end + local function question(func) + return function(cC) + if func(cC) then + matcher:fullResetOnNextFunc() + matcher:nextStr() + end + matcher:nextFunc() + end + end + + local function capture(id) + return function(cC) + local l = matcher.captures[id][2] - matcher.captures[id][1] + local captured = utf8sub(matcher.string, matcher.captures[id][1], matcher.captures[id][2]) + local check = utf8sub(matcher.string, matcher.str, matcher.str + l) + if captured == check then + for i = 0, l do + matcher:nextStr() + end + matcher:nextFunc() + else + matcher:reset() + end + end + end + local function captureStart(id) + return function(cC) + matcher.captures[id][1] = matcher.str + matcher:nextFunc() + end + end + local function captureStop(id) + return function(cC) + matcher.captures[id][2] = matcher.str - 1 + matcher:nextFunc() + end + end + + local function balancer(str) + local sum = 0 + local bc, ec = utf8sub(str, 1, 1), utf8sub(str, 2, 2) + local skip = len(bc) + len(ec) + bc, ec = utf8unicode(bc), utf8unicode(ec) + return function(cC) + if cC == ec and sum > 0 then + sum = sum - 1 + if sum == 0 then + matcher:nextFunc() + end + matcher:nextStr() + elseif cC == bc then + sum = sum + 1 + matcher:nextStr() + else + if sum == 0 or cC == -1 then + sum = 0 + matcher:reset() + else + matcher:nextStr() + end + end + end, skip + end + + matcher.functions[1] = function(cC) + matcher:fullResetOnNextStr() + matcher.seqStart = matcher.str + matcher:nextFunc() + if (matcher.str > matcher.startStr and matcher.fromStart) or matcher.str >= matcher.stringLen then + matcher.stop = true + matcher.seqStart = nil + end + end + + local lastFunc + local ignore = false + local skip = nil + local it = (function() + local gen = utf8gensub(regex) + return function() + return gen(skip) + end + end)() + local cs = {} + for c, bs, be in it do + skip = nil + if plain then + table.insert(matcher.functions, simple(classMatchGenerator(c, plain))) + else + if ignore then + if find('123456789', c, 1, true) then + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + lastFunc = nil + end + table.insert(matcher.functions, capture(tonumber(c))) + elseif c == 'b' then + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + lastFunc = nil + end + local b + b, skip = balancer(sub(regex, be + 1, be + 9)) + table.insert(matcher.functions, b) + else + lastFunc = classMatchGenerator('%' .. c) + end + ignore = false + else + if c == '*' then + if lastFunc then + table.insert(matcher.functions, star(lastFunc)) + lastFunc = nil + else + error('invalid regex after ' .. sub(regex, 1, bs)) + end + elseif c == '+' then + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + table.insert(matcher.functions, star(lastFunc)) + lastFunc = nil + else + error('invalid regex after ' .. sub(regex, 1, bs)) + end + elseif c == '-' then + if lastFunc then + table.insert(matcher.functions, minus(lastFunc)) + lastFunc = nil + else + error('invalid regex after ' .. sub(regex, 1, bs)) + end + elseif c == '?' then + if lastFunc then + table.insert(matcher.functions, question(lastFunc)) + lastFunc = nil + else + error('invalid regex after ' .. sub(regex, 1, bs)) + end + elseif c == '^' then + if bs == 1 then + matcher.fromStart = true + else + error('invalid regex after ' .. sub(regex, 1, bs)) + end + elseif c == '$' then + if be == len(regex) then + matcher.toEnd = true + else + error('invalid regex after ' .. sub(regex, 1, bs)) + end + elseif c == '[' then + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + end + lastFunc, skip = classMatchGenerator(sub(regex, be + 1)) + elseif c == '(' then + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + lastFunc = nil + end + table.insert(matcher.captures, {}) + table.insert(cs, #matcher.captures) + table.insert(matcher.functions, captureStart(cs[#cs])) + if sub(regex, be + 1, be + 1) == ')' then matcher.captures[#matcher.captures].empty = true end + elseif c == ')' then + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + lastFunc = nil + end + local cap = table.remove(cs) + if not cap then + error('invalid capture: "(" missing') + end + table.insert(matcher.functions, captureStop(cap)) + elseif c == '.' then + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + end + lastFunc = function(cC) return cC ~= -1 end + elseif c == '%' then + ignore = true + else + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + end + lastFunc = classMatchGenerator(c) + end + end + end + end + if #cs > 0 then + error('invalid capture: ")" missing') + end + if lastFunc then + table.insert(matcher.functions, simple(lastFunc)) + end + lastFunc = nil + ignore = nil + + table.insert(matcher.functions, function() + if matcher.toEnd and matcher.str ~= matcher.stringLen then + matcher:reset() + else + matcher.stop = true + end + end) + + matcher.nextFunc = function(self) + self.func = self.func + 1 + end + matcher.nextStr = function(self) + self.str = self.str + 1 + end + matcher.strReset = function(self) + local oldReset = self.reset + local str = self.str + self.reset = function(s) + s.str = str + s.reset = oldReset + end + end + matcher.fullResetOnNextFunc = function(self) + local oldReset = self.reset + local func = self.func +1 + local str = self.str + self.reset = function(s) + s.func = func + s.str = str + s.reset = oldReset + end + end + matcher.fullResetOnNextStr = function(self) + local oldReset = self.reset + local str = self.str + 1 + local func = self.func + self.reset = function(s) + s.func = func + s.str = str + s.reset = oldReset + end + end + + matcher.process = function(self, str, start) + + self.func = 1 + start = start or 1 + self.startStr = (start >= 0) and start or utf8len(str) + start + 1 + self.seqStart = self.startStr + self.str = self.startStr + self.stringLen = utf8len(str) + 1 + self.string = str + self.stop = false + + self.reset = function(s) + s.func = 1 + end + + local lastPos = self.str + local lastByte + local char + while not self.stop do + if self.str < self.stringLen then + --[[ if lastPos < self.str then + print('last byte', lastByte) + char, lastByte = utf8subWithBytes(str, 1, self.str - lastPos - 1, lastByte) + char, lastByte = utf8subWithBytes(str, 1, 1, lastByte) + lastByte = lastByte - 1 + else + char, lastByte = utf8subWithBytes(str, self.str, self.str) + end + lastPos = self.str ]] + char = utf8sub(str, self.str,self.str) + --print('char', char, utf8unicode(char)) + self.functions[self.func](utf8unicode(char)) + else + self.functions[self.func](-1) + end + end + + if self.seqStart then + local captures = {} + for _,pair in pairs(self.captures) do + if pair.empty then + table.insert(captures, pair[1]) + else + table.insert(captures, utf8sub(str, pair[1], pair[2])) + end + end + return self.seqStart, self.str - 1, unpack(captures) + end + end + + return matcher +end + +-- string.find +local function utf8find(str, regex, init, plain) + local matcher = cache[regex] or matcherGenerator(regex, plain) + return matcher:process(str, init) +end + +-- string.match +local function utf8match(str, regex, init) + init = init or 1 + local found = {utf8find(str, regex, init)} + if found[1] then + if found[3] then + return unpack(found, 3) + end + return utf8sub(str, found[1], found[2]) + end +end + +-- string.gmatch +local function utf8gmatch(str, regex, all) + regex = (utf8sub(regex,1,1) ~= '^') and regex or '%' .. regex + local lastChar = 1 + return function() + local found = {utf8find(str, regex, lastChar)} + if found[1] then + lastChar = found[2] + 1 + if found[all and 1 or 3] then + return unpack(found, all and 1 or 3) + end + return utf8sub(str, found[1], found[2]) + end + end +end + +local function replace(repl, args) + local ret = '' + if type(repl) == 'string' then + local ignore = false + local num = 0 + for c in utf8gensub(repl) do + if not ignore then + if c == '%' then + ignore = true + else + ret = ret .. c + end + else + num = tonumber(c) + if num then + ret = ret .. args[num] + else + ret = ret .. c + end + ignore = false + end + end + elseif type(repl) == 'table' then + ret = repl[args[1] or args[0]] or '' + elseif type(repl) == 'function' then + if #args > 0 then + ret = repl(unpack(args, 1)) or '' + else + ret = repl(args[0]) or '' + end + end + return ret +end +-- string.gsub +local function utf8gsub(str, regex, repl, limit) + limit = limit or -1 + local ret = '' + local prevEnd = 1 + local it = utf8gmatch(str, regex, true) + local found = {it()} + local n = 0 + while #found > 0 and limit ~= n do + local args = {[0] = utf8sub(str, found[1], found[2]), unpack(found, 3)} + ret = ret .. utf8sub(str, prevEnd, found[1] - 1) + .. replace(repl, args) + prevEnd = found[2] + 1 + n = n + 1 + found = {it()} + end + return ret .. utf8sub(str, prevEnd), n +end + +local utf8 = {} +utf8.len = utf8len +utf8.sub = utf8sub +utf8.reverse = utf8reverse +utf8.char = utf8char +utf8.unicode = utf8unicode +utf8.gensub = utf8gensub +utf8.byte = utf8unicode +utf8.find = utf8find +utf8.match = utf8match +utf8.gmatch = utf8gmatch +utf8.gsub = utf8gsub +utf8.dump = dump +utf8.format = format +utf8.lower = lower +utf8.upper = upper +utf8.rep = rep +return utf8 \ No newline at end of file diff --git a/waifu.js b/waifu.js new file mode 100644 index 0000000..306c716 --- /dev/null +++ b/waifu.js @@ -0,0 +1,120 @@ +const common = require("./common.js") +const pseudoRandom = require("pseudo-random") +const hiragana = require("./hiragana.json") +let hiraganaList = [] + +for (let k of Object.keys(hiragana)) + if (k.length == 1) + hiraganaList.push(k) + + +const waifuName = rng => { + let r = Math.floor(1 + + rng.random() + + rng.random() + + rng.random() + + rng.random() + + rng.random() + ) + + let jp = "" + + for (let i = 0; i < r; i++) + jp += common.choose(hiraganaList, rng) + + let en = "" + + for (let i = 0; i < r; i++) { + const combo = hiragana[jp.slice(i, i + 2)] + + if (combo) { + en += combo + i++ + } else { + en += hiragana[jp.slice(i, i + 1)] + } + } + + return `${jp} (${common.uppercase(en)})` +} + +const waifuSpecies = rng => common.chooseWeighted([ + [ null, 100], // Human + [ "Catgirl", 15], + [ "Foxgirl", 15], + [ "Wolfgirl", 15], + [ "Orc", 5], + [ "Elb", 5], + [ "Dwarf", 5], + [ "Femboy", 3], + ["Apache Helicopter", 1], + [ "C++ Programmer", 1], +], rng) + +const waifuGender = rng => common.chooseWeighted([ + [ "Male", 50], + [ "Female", 50], + [ "null", 1], + ["undefined", 1], + [ "Infinity", 1], + ["-Infinity", 1], + [ "NaN", 1], + [ "-NaN", 1], +], rng) + +const waifuHair = rng => common.chooseWeighted([ + [[ "Brown", "#DDAE92"], 25], + [[ "Black", "#433F3A"], 25], + [["Blonde", "#ECC87E"], 20], + [[ "Red", "#E2887F"], 10], +], rng) + +const waifuEyes = rng => common.chooseWeighted([ + [["Brown", "#463230"], 15], + [[ "Blue", "#97C6FE"], 10], + [["Green", "#36CC4E"], 5], +], rng) + +const waifuAge = rng => { + const tab = common.chooseWeighted([ + [[ 200, 600], 25], // deamon + [[1000, 2000], 5], // next level deamon + [[ 12, 16], 50], // teen loli + [[ 18, 19], 5], // legal loli + [[ 5, 9], 5], // true loli + [ null, 1], // unknown + ], rng) + + return tab ? tab[0] + Math.floor(rng.random() * (tab[1] - tab[0] + 1)) : null; +} + +const waifu = id => { + const rng = pseudoRandom(id = id || Math.floor(Math.random() * 32767)) + + return { + id, + name: waifuName(rng), + species: waifuSpecies(rng), + gender: waifuGender(rng), + hair: waifuHair(rng), + eyes: waifuEyes(rng), + age: waifuAge(rng), + } +} + +const formatWaifu = waifu => +`__**${waifu.name}**__ + **Age:** ${waifu.age || "Unknown"} + **Gender:** ${waifu.gender} + ${waifu.hair[0]} Hair + ${waifu.eyes[0]} Eyes + + #${waifu.id} +` + +module.exports = { + waifu: { + func: (msg, [id]) => + msg.reply(formatWaifu(waifu(parseInt(id)))) + } +} -- 2.44.0