Compare commits
No commits in common. "docs" and "main" have entirely different histories.
93 changed files with 2867 additions and 2765 deletions
14
.github/Changelog.md
vendored
Normal file
14
.github/Changelog.md
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
<h1 align="center">Changelog</h1>
|
||||
|
||||
> This does not include dev releases yet
|
||||
|
||||
# Release v1.2.0
|
||||
## Added
|
||||
|
||||
|
||||
# Release v1.1.0
|
||||
## Added
|
||||
|
||||
|
||||
# Release v1.0.0
|
||||
Initial Release
|
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [night0721, ThunderE75] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: cathteam
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
33
.github/workflows/npm-publish.yml
vendored
Normal file
33
.github/workflows/npm-publish.yml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
||||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
||||
|
||||
name: Node.js Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
|
||||
publish-npm:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
dist/
|
||||
node_modules/
|
||||
package-lock.json
|
||||
test.js
|
||||
docs/
|
|
@ -1 +0,0 @@
|
|||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
11
.npmignore
Normal file
11
.npmignore
Normal file
|
@ -0,0 +1,11 @@
|
|||
src
|
||||
tsconfig.json
|
||||
node_modules
|
||||
package-lock.json
|
||||
.gitignore
|
||||
LICENSE
|
||||
.github
|
||||
docs
|
||||
test.js
|
||||
vercel.json
|
||||
README.md
|
1
CNAME
1
CNAME
|
@ -1 +0,0 @@
|
|||
cath.js.org
|
674
LICENSE
Normal file
674
LICENSE
Normal file
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
59
README.md
59
README.md
|
@ -1,5 +1,56 @@
|
|||
# cath
|
||||
# Cath
|
||||
|
||||
[![Banner](https://media.discordapp.net/attachments/842014909264953354/867806346593042483/Cath-temp-banner.png?width=1244&height=415)]()
|
||||
[![Version](https://img.shields.io/github/package-json/v/night0721/cath?style=for-the-badge&color=555555&labelColor=02023a)]()
|
||||
[![Download](https://img.shields.io/npm/dt/cath?style=for-the-badge&color=02023a)]()
|
||||
[![Kofi](https://img.shields.io/static/v1?label=Support%20Us&message=KO.FI&color=ff5e5b&logo=kofi&logoColor=white&style=for-the-badge&scale=1.4)]()
|
||||
|
||||
**Cath** is a powerful [npm](https://nodejs.org) module that can easily interact and get data from NYX API
|
||||
If you like this package, feel free to <img src = "https://discord.com/assets/141d49436743034a59dec6bd5618675d.svg" width = "16"> **Star** and **fork** this repository.<br><br>
|
||||
|
||||
# Install the package ✔
|
||||
|
||||
Download from npm
|
||||
|
||||
```powershell
|
||||
npm install cath
|
||||
```
|
||||
|
||||
Download from yarn
|
||||
|
||||
```powershell
|
||||
yarn add cath
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Launch of the module
|
||||
|
||||
```js
|
||||
const cath = require("cath")l
|
||||
const redditdata = await cath.getreddit("meme");
|
||||
console.log(redditdata); // returns a object
|
||||
|
||||
const answer = await cath.random8ball();
|
||||
console.log(answer); // a random answer from 8ball
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
cath is licensed under the GNU Public License v3.0. See [LICENSE](https://github.com/night0721/cath/blob/master/LICENSE) for more information.
|
||||
|
||||
# Support, Feature Request & Bug Reports
|
||||
|
||||
## <img src = "https://cdn.discordapp.com/emojis/867093614403256350.png?v=1" width = 18> Support & Feature Request
|
||||
|
||||
Join the official [Support Server](https://discord.gg/SbQHChmGcp) on Discord & we will be happy to assist you. <br>
|
||||
To Request new features contact us on Discord using the support server.
|
||||
|
||||
## <img src = "https://cdn.discordapp.com/emojis/867093601962950666.png?v=1" width = "18"> Report Bugs
|
||||
|
||||
You can report bugs or issues by opening a issue in this repository. Alternatevely you can also contact us on Discord using the support server.
|
||||
|
||||
<p align = "center">
|
||||
<a href="https://rebrand.ly/cathSupport" target="_blank"><img src="https://discordapp.com/api/guilds/718762019586572341/widget.png?style=banner1"></a>
|
||||
</p>
|
||||
|
||||
Documentation for [cath](https://www.npmjs.com/package/cath)
|
||||
[![NPM](https://nodei.co/npm/cath.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/cath)
|
||||
[![Download](https://img.shields.io/npm/dt/cath?style=for-the-badge&color=02023a)](https://www.npmjs.com/package/cath) [![Version](https://img.shields.io/github/package-json/v/night0721/cath?style=for-the-badge&color=555555&labelColor=02023a)](https://www.npmjs.com/package/cath) [![License](https://img.shields.io/npm/l/cath?color=02023a&style=for-the-badge)](https://www.npmjs.com/package/cath) [![Stars](https://img.shields.io/github/stars/night0721/cath?logo=github&color=555555&labelColor=02023a&style=for-the-badge)](https://github.com/night0721/cath) [![Kofi](https://img.shields.io/static/v1?label=Support%20Us&message=KO.FI&color=ff5e5b&logo=kofi&logoColor=white&style=for-the-badge&scale=1.4)](https://ko-fi.com/cathteam)
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
:root {
|
||||
--light-hl-0: #000000;
|
||||
--dark-hl-0: #D4D4D4;
|
||||
--light-hl-1: #0000FF;
|
||||
--dark-hl-1: #569CD6;
|
||||
--light-hl-2: #0070C1;
|
||||
--dark-hl-2: #4FC1FF;
|
||||
--light-hl-3: #795E26;
|
||||
--dark-hl-3: #DCDCAA;
|
||||
--light-hl-4: #A31515;
|
||||
--dark-hl-4: #CE9178;
|
||||
--light-hl-5: #AF00DB;
|
||||
--dark-hl-5: #C586C0;
|
||||
--light-hl-6: #001080;
|
||||
--dark-hl-6: #9CDCFE;
|
||||
--light-hl-7: #008000;
|
||||
--dark-hl-7: #6A9955;
|
||||
--light-code-background: #F5F5F5;
|
||||
--dark-code-background: #1E1E1E;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) { :root {
|
||||
--hl-0: var(--light-hl-0);
|
||||
--hl-1: var(--light-hl-1);
|
||||
--hl-2: var(--light-hl-2);
|
||||
--hl-3: var(--light-hl-3);
|
||||
--hl-4: var(--light-hl-4);
|
||||
--hl-5: var(--light-hl-5);
|
||||
--hl-6: var(--light-hl-6);
|
||||
--hl-7: var(--light-hl-7);
|
||||
--code-background: var(--light-code-background);
|
||||
} }
|
||||
|
||||
@media (prefers-color-scheme: dark) { :root {
|
||||
--hl-0: var(--dark-hl-0);
|
||||
--hl-1: var(--dark-hl-1);
|
||||
--hl-2: var(--dark-hl-2);
|
||||
--hl-3: var(--dark-hl-3);
|
||||
--hl-4: var(--dark-hl-4);
|
||||
--hl-5: var(--dark-hl-5);
|
||||
--hl-6: var(--dark-hl-6);
|
||||
--hl-7: var(--dark-hl-7);
|
||||
--code-background: var(--dark-code-background);
|
||||
} }
|
||||
|
||||
body.light {
|
||||
--hl-0: var(--light-hl-0);
|
||||
--hl-1: var(--light-hl-1);
|
||||
--hl-2: var(--light-hl-2);
|
||||
--hl-3: var(--light-hl-3);
|
||||
--hl-4: var(--light-hl-4);
|
||||
--hl-5: var(--light-hl-5);
|
||||
--hl-6: var(--light-hl-6);
|
||||
--hl-7: var(--light-hl-7);
|
||||
--code-background: var(--light-code-background);
|
||||
}
|
||||
|
||||
body.dark {
|
||||
--hl-0: var(--dark-hl-0);
|
||||
--hl-1: var(--dark-hl-1);
|
||||
--hl-2: var(--dark-hl-2);
|
||||
--hl-3: var(--dark-hl-3);
|
||||
--hl-4: var(--dark-hl-4);
|
||||
--hl-5: var(--dark-hl-5);
|
||||
--hl-6: var(--dark-hl-6);
|
||||
--hl-7: var(--dark-hl-7);
|
||||
--code-background: var(--dark-code-background);
|
||||
}
|
||||
|
||||
.hl-0 { color: var(--hl-0); }
|
||||
.hl-1 { color: var(--hl-1); }
|
||||
.hl-2 { color: var(--hl-2); }
|
||||
.hl-3 { color: var(--hl-3); }
|
||||
.hl-4 { color: var(--hl-4); }
|
||||
.hl-5 { color: var(--hl-5); }
|
||||
.hl-6 { color: var(--hl-6); }
|
||||
.hl-7 { color: var(--hl-7); }
|
||||
pre, code { background: var(--code-background); }
|
1043
assets/icons.css
1043
assets/icons.css
File diff suppressed because it is too large
Load diff
BIN
assets/icons.png
BIN
assets/icons.png
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1414
assets/style.css
1414
assets/style.css
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 480 B |
Binary file not shown.
Before Width: | Height: | Size: 855 B |
File diff suppressed because one or more lines are too long
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>CodeClient | cath</title><meta name="description" content="Documentation for cath"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">cath</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">cath</a></li><li><a href="CodeClient.html">CodeClient</a></li></ul><h1>Class CodeClient </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><dl class="tsd-comment-tags"><dt>name</dt><dd><p>CodeClient</p>
|
||||
</dd><dt>kind</dt><dd><p>constructor</p>
|
||||
</dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">CodeClient</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="CodeClient.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="CodeClient.html#createBin" class="tsd-kind-icon">create<wbr/>Bin</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link">constructor<a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Code<wbr/>Client<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="CodeClient.html" class="tsd-signature-type" data-tsd-kind="Class">CodeClient</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in CodeClient/codeclient.ts:10</li></ul></aside><h4 class="tsd-returns-title">Returns <a href="CodeClient.html" class="tsd-signature-type" data-tsd-kind="Class">CodeClient</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="createBin" class="tsd-anchor"></a><h3 class="tsd-anchor-link">create<wbr/>Bin<a href="#createBin" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">create<wbr/>Bin<span class="tsd-signature-symbol">(</span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">String</span>, code<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">String</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CodeData.html" class="tsd-signature-type" data-tsd-kind="Interface">CodeData</a><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in CodeClient/codeclient.ts:17</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Sends the link of the code</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type">String</span></h5></li><li><h5>code: <span class="tsd-signature-type">String</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CodeData.html" class="tsd-signature-type" data-tsd-kind="Interface">CodeData</a><span class="tsd-signature-symbol">></span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="CodeClient.html" class="tsd-kind-icon">Code<wbr/>Client</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="CodeClient.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CodeClient.html#createBin" class="tsd-kind-icon">create<wbr/>Bin</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>URLClient | cath</title><meta name="description" content="Documentation for cath"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">cath</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">cath</a></li><li><a href="URLClient.html">URLClient</a></li></ul><h1>Class URLClient </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><dl class="tsd-comment-tags"><dt>name</dt><dd><p>URLClient</p>
|
||||
</dd><dt>kind</dt><dd><p>constructor</p>
|
||||
</dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">URLClient</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="URLClient.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="URLClient.html#createShortURL" class="tsd-kind-icon">create<wbr/>ShortURL</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link">constructor<a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new URLClient<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="URLClient.html" class="tsd-signature-type" data-tsd-kind="Class">URLClient</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in URLClient/urlclient.ts:10</li></ul></aside><h4 class="tsd-returns-title">Returns <a href="URLClient.html" class="tsd-signature-type" data-tsd-kind="Class">URLClient</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="createShortURL" class="tsd-anchor"></a><h3 class="tsd-anchor-link">create<wbr/>ShortURL<a href="#createShortURL" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">create<wbr/>ShortURL<span class="tsd-signature-symbol">(</span>shortName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, targetURL<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/URLData.html" class="tsd-signature-type" data-tsd-kind="Interface">URLData</a><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in URLClient/urlclient.ts:17</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Sends the link of the URL</p>
|
||||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>shortName: <span class="tsd-signature-type">string</span></h5></li><li><h5>targetURL: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/URLData.html" class="tsd-signature-type" data-tsd-kind="Interface">URLData</a><span class="tsd-signature-symbol">></span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="URLClient.html" class="tsd-kind-icon">URLClient</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="URLClient.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="URLClient.html#createShortURL" class="tsd-kind-icon">create<wbr/>ShortURL</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
57
index.html
57
index.html
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +0,0 @@
|
|||
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>CODMClientOptions | cath</title><meta name="description" content="Documentation for cath"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">cath</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">cath</a></li><li><a href="CODMClientOptions.html">CODMClientOptions</a></li></ul><h1>Interface CODMClientOptions </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">CODMClientOptions</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CODMClientOptions.html#key" class="tsd-kind-icon">key</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="key" class="tsd-anchor"></a><h3 class="tsd-anchor-link">key<a href="#key" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in CODMClient/codmclient.interface.ts:5</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Authorisation key for the API</p>
|
||||
</div></div></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="CODMClientOptions.html" class="tsd-kind-icon">CODMClient<wbr/>Options</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CODMClientOptions.html#key" class="tsd-kind-icon">key</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GiveawaysClientOptions | cath</title><meta name="description" content="Documentation for cath"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">cath</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">cath</a></li><li><a href="GiveawaysClientOptions.html">GiveawaysClientOptions</a></li></ul><h1>Interface GiveawaysClientOptions </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">GiveawaysClientOptions</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GiveawaysClientOptions.html#GiveawayMessages" class="tsd-kind-icon">Giveaway<wbr/>Messages</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GiveawaysClientOptions.html#MongooseConnectionURI" class="tsd-kind-icon">Mongoose<wbr/>ConnectionURI</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GiveawaysClientOptions.html#client" class="tsd-kind-icon">client</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="GiveawayMessages" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Giveaway<wbr/>Messages<a href="#GiveawayMessages" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Giveaway<wbr/>Messages<span class="tsd-signature-symbol">:</span> <a href="DefaultGiveawayMessages.html" class="tsd-signature-type" data-tsd-kind="Interface">DefaultGiveawayMessages</a></div><aside class="tsd-sources"><ul><li>Defined in GiveawaysClient/giveaway.interface.ts:40</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Customizable messages for the giveaway embed</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="MongooseConnectionURI" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Mongoose<wbr/>ConnectionURI<a href="#MongooseConnectionURI" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Mongoose<wbr/>ConnectionURI<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in GiveawaysClient/giveaway.interface.ts:36</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Connection URI for the MongoDB</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="client" class="tsd-anchor"></a><h3 class="tsd-anchor-link">client<a href="#client" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">client<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Client</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in GiveawaysClient/giveaway.interface.ts:32</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Discord Client</p>
|
||||
</div></div></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="GiveawaysClientOptions.html" class="tsd-kind-icon">Giveaways<wbr/>Client<wbr/>Options</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GiveawaysClientOptions.html#GiveawayMessages" class="tsd-kind-icon">Giveaway<wbr/>Messages</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GiveawaysClientOptions.html#MongooseConnectionURI" class="tsd-kind-icon">Mongoose<wbr/>ConnectionURI</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="GiveawaysClientOptions.html#client" class="tsd-kind-icon">client</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>StarboardClientOptions | cath</title><meta name="description" content="Documentation for cath"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">cath</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">cath</a></li><li><a href="StarboardClientOptions.html">StarboardClientOptions</a></li></ul><h1>Interface StarboardClientOptions </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">StarboardClientOptions</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardClientOptions.html#Guilds" class="tsd-kind-icon">Guilds</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardClientOptions.html#client" class="tsd-kind-icon">client</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardClientOptions.html#color" class="tsd-kind-icon">color</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="Guilds" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> Guilds<a href="#Guilds" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Guilds<span class="tsd-signature-symbol">?:</span> <a href="StarboardGuild.html" class="tsd-signature-type" data-tsd-kind="Interface">StarboardGuild</a><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in StarboardClient/starboard.interface.ts:15</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Preload data</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="client" class="tsd-anchor"></a><h3 class="tsd-anchor-link">client<a href="#client" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">client<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Client</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in StarboardClient/starboard.interface.ts:7</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Discord Client</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="color" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> color<a href="#color" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">color<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">ColorResolvable</span></div><aside class="tsd-sources"><ul><li>Defined in StarboardClient/starboard.interface.ts:11</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Color of Embed</p>
|
||||
</div></div></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="StarboardClientOptions.html" class="tsd-kind-icon">Starboard<wbr/>Client<wbr/>Options</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardClientOptions.html#Guilds" class="tsd-kind-icon">Guilds</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardClientOptions.html#client" class="tsd-kind-icon">client</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardClientOptions.html#color" class="tsd-kind-icon">color</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>StarboardGuildOptions | cath</title><meta name="description" content="Documentation for cath"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">cath</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">cath</a></li><li><a href="StarboardGuildOptions.html">StarboardGuildOptions</a></li></ul><h1>Interface StarboardGuildOptions </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">StarboardGuildOptions</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardGuildOptions.html#starCount" class="tsd-kind-icon">star<wbr/>Count</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardGuildOptions.html#starboardChannel" class="tsd-kind-icon">starboard<wbr/>Channel</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="starCount" class="tsd-anchor"></a><h3 class="tsd-anchor-link">star<wbr/>Count<a href="#starCount" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">star<wbr/>Count<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in StarboardClient/starboard.interface.ts:27</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Amount of stars required in order to be registered as a starred channel</p>
|
||||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="starboardChannel" class="tsd-anchor"></a><h3 class="tsd-anchor-link">starboard<wbr/>Channel<a href="#starboardChannel" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">starboard<wbr/>Channel<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in StarboardClient/starboard.interface.ts:32</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||||
<p>Channel to send starred messages</p>
|
||||
</div></div></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="StarboardGuildOptions.html" class="tsd-kind-icon">Starboard<wbr/>Guild<wbr/>Options</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardGuildOptions.html#starCount" class="tsd-kind-icon">star<wbr/>Count</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="StarboardGuildOptions.html#starboardChannel" class="tsd-kind-icon">starboard<wbr/>Channel</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
51
modules.html
51
modules.html
File diff suppressed because one or more lines are too long
43
package.json
Normal file
43
package.json
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "cath",
|
||||
"version": "2.0.2",
|
||||
"description": "A powerful package that can interact with Cath API",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "node .",
|
||||
"docs": "npx typedoc src/index.ts"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/night0721/cath"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://codeberg.org/night0721/cath/issues"
|
||||
},
|
||||
"homepage": "https://cath.js.org",
|
||||
"keywords": [
|
||||
"cath",
|
||||
"cath.exe",
|
||||
"cat",
|
||||
"api",
|
||||
"discord",
|
||||
"codm"
|
||||
],
|
||||
"author": "night0721",
|
||||
"license": "GPL-3.0",
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://ko-fi.com/cathteam"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.25.0",
|
||||
"discord.js": "^13.6.0",
|
||||
"mongoose": "^5.13.10",
|
||||
"typedoc": "^0.22.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.4.3"
|
||||
}
|
||||
}
|
22
src/CODMClient/codmclient.interface.ts
Normal file
22
src/CODMClient/codmclient.interface.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
export interface CODMClientOptions {
|
||||
/**
|
||||
* Authorisation key for the API
|
||||
*/
|
||||
key: string;
|
||||
}
|
||||
export interface PerkData {
|
||||
name: string;
|
||||
perk: string;
|
||||
effects: string;
|
||||
type: string;
|
||||
}
|
||||
export interface ScorestreakData {
|
||||
name: string;
|
||||
description: string;
|
||||
special: string;
|
||||
cost: number;
|
||||
type: string;
|
||||
manual: boolean;
|
||||
preview: string;
|
||||
preview_video: string;
|
||||
}
|
47
src/CODMClient/codmclient.ts
Normal file
47
src/CODMClient/codmclient.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import { config } from "../";
|
||||
import { PerkData, ScorestreakData } from "./codmclient.interface";
|
||||
/**
|
||||
* @name APIClient
|
||||
* @kind constructor
|
||||
* @param {String} key Authorization Key for API (Only for CODM commands)
|
||||
*/
|
||||
export class CODMClient {
|
||||
constructor(public key: string) {
|
||||
if (!key) throw new CathError("Missing 'key' property");
|
||||
if (key && typeof key !== "string")
|
||||
throw new CathError("API key must be a string");
|
||||
}
|
||||
/**
|
||||
* Sends a CODM perk object
|
||||
* @return {Promise<PerkData>}
|
||||
* @param {String} name
|
||||
*/
|
||||
public async getperk(name: string): Promise<PerkData> {
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/codm/perk?name=${name}`, {
|
||||
headers: {
|
||||
Authorization: this.key,
|
||||
},
|
||||
})
|
||||
.then(res => res.data)
|
||||
.catch(err => {
|
||||
throw new CathError(`Unauthorized to use`);
|
||||
});
|
||||
return data;
|
||||
}
|
||||
public async getscorestreak(name: string): Promise<ScorestreakData> {
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/codm/scorestreak?name=${name}`, {
|
||||
headers: {
|
||||
Authorization: this.key,
|
||||
},
|
||||
})
|
||||
.then(res => res.data)
|
||||
.catch(err => {
|
||||
throw new CathError(`Unauthorized to use`);
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
6
src/CODMClient/index.ts
Normal file
6
src/CODMClient/index.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export {
|
||||
CODMClientOptions,
|
||||
PerkData,
|
||||
ScorestreakData,
|
||||
} from "./codmclient.interface";
|
||||
export { CODMClient } from "./codmclient";
|
3
src/CodeClient/codeclient.interface.ts
Normal file
3
src/CodeClient/codeclient.interface.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export interface CodeData {
|
||||
id: string;
|
||||
}
|
32
src/CodeClient/codeclient.ts
Normal file
32
src/CodeClient/codeclient.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import axios from "axios";
|
||||
import { config } from "../";
|
||||
import { CodeData } from "./codeclient.interface";
|
||||
import { CathError } from "../Error/CathError";
|
||||
/**
|
||||
* @name CodeClient
|
||||
* @kind constructor
|
||||
*/
|
||||
export class CodeClient {
|
||||
constructor() {}
|
||||
/**
|
||||
* Sends the link of the code
|
||||
* @return {Promise<CodeData>}
|
||||
* @param {String} key
|
||||
* @param {String} code
|
||||
*/
|
||||
public async createBin(key: String, code: String): Promise<CodeData> {
|
||||
if (!key) throw new CathError("Missing 'key' property");
|
||||
if (!code) throw new CathError("Missing 'code' property");
|
||||
const data = await axios
|
||||
.post(config.code, {
|
||||
key,
|
||||
value: code,
|
||||
})
|
||||
.then(res => res.data);
|
||||
if (data?.url) {
|
||||
return data?.url;
|
||||
} else {
|
||||
throw new CathError(`Code already exist`);
|
||||
}
|
||||
}
|
||||
}
|
2
src/CodeClient/index.ts
Normal file
2
src/CodeClient/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { CodeData } from "./codeclient.interface";
|
||||
export { CodeClient } from "./codeclient";
|
6
src/Error/CathError.ts
Normal file
6
src/Error/CathError.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export class CathError extends Error {
|
||||
constructor(err: string) {
|
||||
super(err);
|
||||
console.log(`Cath Error: ${err}`);
|
||||
}
|
||||
}
|
60
src/GiveawaysClient/giveaway.interface.ts
Normal file
60
src/GiveawaysClient/giveaway.interface.ts
Normal file
|
@ -0,0 +1,60 @@
|
|||
import { Client } from "discord.js";
|
||||
export interface GiveawaySchema {
|
||||
Guild: string;
|
||||
Channel: string;
|
||||
Message: string;
|
||||
HostBy: string;
|
||||
End: number;
|
||||
Start: number;
|
||||
Award: string;
|
||||
Winners: number;
|
||||
Ended: boolean;
|
||||
Invites: number;
|
||||
Requirements: { Enabled: boolean; Roles?: [string] };
|
||||
Clickers: [string];
|
||||
}
|
||||
export interface InviteSchema {
|
||||
User: string;
|
||||
Invites: [
|
||||
object: {
|
||||
Guild: string;
|
||||
Invite: string;
|
||||
Invited: string;
|
||||
Inviter: string;
|
||||
Uses: number;
|
||||
}
|
||||
];
|
||||
}
|
||||
export interface GiveawaysClientOptions {
|
||||
/**
|
||||
* Discord Client
|
||||
*/
|
||||
client: Client;
|
||||
/**
|
||||
* Connection URI for the MongoDB
|
||||
*/
|
||||
MongooseConnectionURI: string;
|
||||
/**
|
||||
* Customizable messages for the giveaway embed
|
||||
*/
|
||||
GiveawayMessages: DefaultGiveawayMessages;
|
||||
}
|
||||
export interface DefaultGiveawayMessages {
|
||||
dmWinner: true;
|
||||
giveaway: "🎉🎉 **GIVEAWAY!** 🎉🎉";
|
||||
giveawayDescription: "🎁 Award: **{award}**\n🎊 Hosted by: {hostedBy}\n⏲️ Winner(s): `{winners}` \n🙏 Entrants: {totalParticipants} \n\n**Requirements:** {requirements}\n**Required Invites:** {invites}";
|
||||
giveawayFooterImage: "https://emoji.gg/assets/emoji/3461-giveaway.gif";
|
||||
winMessage: "congratulations {winners}! You have won **{prize}** from total `{totalParticipants}` entrants!";
|
||||
rerolledMessage: "Rerolled! {winner} is the new winner of the giveaway!"; // only {winner} placeholder
|
||||
toParticipate: "**Click the `Enter` button to enter the giveaway!**";
|
||||
newParticipant: "You have successfully entered for this giveaway! There are total `{totalParticipants}` entrants"; // no placeholders | ephemeral
|
||||
alreadyParticipated: "**You have already participated in this giveaway!**"; // no placeholders | ephemeral
|
||||
noParticipants: "There isn't enough entrant in this giveaway!"; // no placeholders
|
||||
dmMessage: "You have won a giveaway in **{guildName}**!\nPrize: [{prize}]({giveawayURL})";
|
||||
noWinner: "There isn't any winner in this giveaway due to not enough entrants"; // no {winner} placerholder
|
||||
alreadyEnded: "The giveaway had already ended!"; // no {winner} placeholder
|
||||
noWeeklyExp: "you dont have the required minimum weekly xp to join this giveaway";
|
||||
noLevel: "You dont have the minimum required level to join this giveaway";
|
||||
nonoRole: "You don't the required role(s)\n{requiredRoles} role(s) to join the giveaway";
|
||||
editParticipants: true;
|
||||
}
|
756
src/GiveawaysClient/giveaway.ts
Normal file
756
src/GiveawaysClient/giveaway.ts
Normal file
|
@ -0,0 +1,756 @@
|
|||
import mongoose, { Schema, model } from "mongoose";
|
||||
import {
|
||||
Client,
|
||||
Snowflake,
|
||||
Message,
|
||||
MessageActionRow,
|
||||
MessageButton,
|
||||
MessageEmbed,
|
||||
TextChannel,
|
||||
GuildMember,
|
||||
ButtonInteraction,
|
||||
} from "discord.js";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import {
|
||||
GiveawaySchema,
|
||||
GiveawaysClientOptions,
|
||||
DefaultGiveawayMessages,
|
||||
InviteSchema,
|
||||
} from "./giveaway.interface";
|
||||
import { parseString } from "../functions/ms";
|
||||
export class GiveawaysClient {
|
||||
public inviteschema = model<InviteSchema>(
|
||||
"cath-invite",
|
||||
new Schema({
|
||||
User: { type: String, required: true },
|
||||
Invites: { type: Object, required: true },
|
||||
})
|
||||
);
|
||||
public schema = model<GiveawaySchema>(
|
||||
"cath-giveaways",
|
||||
new Schema({
|
||||
Guild: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
Channel: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
Message: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
HostBy: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
End: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
Start: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
Award: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
Winners: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
Ended: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
Invites: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 0,
|
||||
},
|
||||
Requirements: {
|
||||
type: Object,
|
||||
default: { Enabled: Boolean, Roles: [] },
|
||||
},
|
||||
Clickers: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
})
|
||||
);
|
||||
public client: Client;
|
||||
public GiveawayMessages: DefaultGiveawayMessages;
|
||||
public MongooseConnectionURI: string;
|
||||
/**
|
||||
* @name GiveawaysClient
|
||||
* @kind constructor
|
||||
* @param {GiveawaysClientOptions}options
|
||||
*/
|
||||
|
||||
constructor(options: GiveawaysClientOptions) {
|
||||
this.GiveawayMessages = options.GiveawayMessages || this.GiveawayMessages;
|
||||
this.client = options.client;
|
||||
this.MongooseConnectionURI = options.MongooseConnectionURI;
|
||||
mongoose
|
||||
.connect(this.MongooseConnectionURI, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
})
|
||||
.then(() => console.log("Connected to Giveaway Database"))
|
||||
.catch(e => {
|
||||
throw new CathError(e);
|
||||
});
|
||||
this.client.on("interactionCreate", async interaction => {
|
||||
if (interaction.isButton()) {
|
||||
let win = "" || [];
|
||||
let L = 0;
|
||||
let no = false;
|
||||
if (!interaction.guild) return;
|
||||
await (interaction.member as GuildMember).fetch();
|
||||
const id = interaction.customId;
|
||||
if (id.startsWith("g")) {
|
||||
const tag = id.split("_");
|
||||
if (tag[0] === "genter") {
|
||||
const data = await this.schema.findOne({
|
||||
Message: interaction.message.id,
|
||||
});
|
||||
if (data.Invites > 0) {
|
||||
const invitedata = await this.inviteschema.findOne({
|
||||
User: (interaction.member as GuildMember).id,
|
||||
});
|
||||
if (!invitedata) {
|
||||
await interaction.reply({
|
||||
content: "You have no invites, you can't enter",
|
||||
ephemeral: true,
|
||||
});
|
||||
} else {
|
||||
L = invitedata.Invites.map(o => o.Uses).reduce((acc, cur) => {
|
||||
return acc + cur;
|
||||
});
|
||||
if (data.Invites >= L) {
|
||||
await interaction.reply({
|
||||
content: "You have not enough invites, you can't enter",
|
||||
ephemeral: true,
|
||||
});
|
||||
no = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data.Requirements.Enabled) {
|
||||
if (data.Requirements.Roles.length) {
|
||||
const roles = data.Requirements.Roles.map(x =>
|
||||
(interaction.message as Message).guild.members.cache
|
||||
.get(interaction.user.id)
|
||||
.roles.cache.get(x)
|
||||
);
|
||||
if (!roles[0]) {
|
||||
const requiredRoles = (
|
||||
interaction.message as Message
|
||||
).guild.roles.cache
|
||||
.filter(x => data.Requirements.Roles.includes(x.id))
|
||||
.filter(
|
||||
x =>
|
||||
!(interaction.message as Message).guild.members.cache
|
||||
.get(interaction.user.id)
|
||||
.roles.cache.get(x.id)
|
||||
)
|
||||
.map(x => `\`${x.name}\``)
|
||||
.join(", ");
|
||||
try {
|
||||
await interaction.reply({
|
||||
content: this.GiveawayMessages.nonoRole.replace(
|
||||
/{requiredRoles}/g,
|
||||
requiredRoles
|
||||
),
|
||||
});
|
||||
} catch (e) {
|
||||
await interaction.followUp({
|
||||
content: this.GiveawayMessages.nonoRole.replace(
|
||||
/{requiredRoles}/g,
|
||||
requiredRoles
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!data.Clickers.includes(interaction.user.id) && !no) {
|
||||
data.Clickers.push(interaction.user.id);
|
||||
data.save();
|
||||
try {
|
||||
await interaction.reply({
|
||||
content: this.GiveawayMessages.newParticipant.replace(
|
||||
/{totalParticipants}/g,
|
||||
data.Clickers.length.toString()
|
||||
),
|
||||
});
|
||||
} catch (e) {
|
||||
await interaction.followUp({
|
||||
content: this.GiveawayMessages.newParticipant.replace(
|
||||
/{totalParticipants}/g,
|
||||
data.Clickers.length.toString()
|
||||
),
|
||||
});
|
||||
}
|
||||
} else if (data.Clickers.includes(interaction.user.id) && !no) {
|
||||
await interaction.followUp({
|
||||
content: this.GiveawayMessages.alreadyParticipated,
|
||||
});
|
||||
} else if (!data.Clickers.includes(interaction.user.id) && no) {
|
||||
} else if (data.Clickers.includes(interaction.user.id) && no) {
|
||||
}
|
||||
}
|
||||
if (tag[0] === "greroll") {
|
||||
if (interaction.user.id !== tag[1])
|
||||
await interaction.reply({
|
||||
content: "Only the host can reroll the giveaway",
|
||||
});
|
||||
try {
|
||||
win = await this.reroll(
|
||||
this.client,
|
||||
interaction.message.id,
|
||||
interaction.message as Message
|
||||
);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
await interaction.reply({
|
||||
content: "⚠️ **Unable To Find That Giveaway**",
|
||||
});
|
||||
}
|
||||
if (!win.length)
|
||||
interaction.channel.send(this.GiveawayMessages.noParticipants);
|
||||
else {
|
||||
await interaction.reply({
|
||||
content: "Rerolled",
|
||||
ephemeral: true,
|
||||
});
|
||||
interaction.channel.send({
|
||||
content: this.GiveawayMessages.rerolledMessage.replace(
|
||||
/{winner}/g,
|
||||
`<@${win}>`
|
||||
),
|
||||
components: [
|
||||
new MessageActionRow().addComponents([
|
||||
new MessageButton()
|
||||
.setLabel("Giveaway")
|
||||
.setURL(
|
||||
`https://discord.com/channels/${interaction.guild.id}/${interaction.channel.id}/${interaction.message.id}`
|
||||
)
|
||||
.setStyle("LINK"),
|
||||
]),
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
if (tag[0] === "gend") {
|
||||
if (interaction.user.id !== tag[1])
|
||||
await interaction.reply({
|
||||
content: "You Cannot End This Giveaway, Only The Host Can",
|
||||
});
|
||||
await interaction.reply({ content: "Ended", ephemeral: true });
|
||||
await this.endByButton(
|
||||
this.client,
|
||||
interaction.message.id,
|
||||
interaction
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getButtons(host: string) {
|
||||
const reroll = new MessageButton()
|
||||
.setLabel("Reroll")
|
||||
.setStyle("SECONDARY")
|
||||
.setCustomId(`greroll_${host}`)
|
||||
.setDisabled(true);
|
||||
|
||||
const end = new MessageButton()
|
||||
.setLabel("End")
|
||||
.setStyle("DANGER")
|
||||
.setCustomId(`gend_${host}`);
|
||||
|
||||
const enter = new MessageButton()
|
||||
.setLabel("Enter")
|
||||
.setStyle("SUCCESS")
|
||||
.setCustomId(`genter_${host}`);
|
||||
|
||||
const b = [enter, end, reroll];
|
||||
return b;
|
||||
}
|
||||
|
||||
private async choose(winners: number, msgid: Snowflake, message: Message) {
|
||||
const data = await this.getByMessage(msgid);
|
||||
const final = [];
|
||||
if (data.Requirements.Enabled && data.Invites == 0) {
|
||||
const c = data.Clickers.filter(x =>
|
||||
this.checkRoles(x, data.Requirements.Roles, message)
|
||||
);
|
||||
for (let i = 0; i < winners; i++) {
|
||||
if (!c.length) return final[0] ? final : [];
|
||||
const win = c[Math.floor(Math.random() * c.length)];
|
||||
if (final.includes(win)) break;
|
||||
if (!win) return final[0] ? final : [];
|
||||
final.push(win);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < winners; i++) {
|
||||
if (!data.Clickers.length) return final[0] ? final : [];
|
||||
const win =
|
||||
data.Clickers[Math.floor(Math.random() * data.Clickers.length)];
|
||||
if (final.includes(win)) break;
|
||||
if (!win) return final[0] ? final : [];
|
||||
final.push(win);
|
||||
}
|
||||
}
|
||||
return final[0] ? final : [];
|
||||
}
|
||||
|
||||
private checkRoles(
|
||||
userID: Snowflake,
|
||||
roleIDs: Snowflake[],
|
||||
message: Message
|
||||
): Boolean {
|
||||
let res = null;
|
||||
roleIDs.forEach(roleID => {
|
||||
const role = message.guild.roles.cache.get(roleID);
|
||||
if (!message.guild.members.cache.get(userID).roles.cache.get(role.id))
|
||||
res = false;
|
||||
});
|
||||
if (res == false) return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
private async editButtons(client: Client, data: GiveawaySchema) {
|
||||
const m = await (
|
||||
client.guilds.cache
|
||||
.get(data.Guild)
|
||||
.channels.cache.get(data.Channel) as TextChannel
|
||||
).messages.fetch(data.Message);
|
||||
const bs = await this.getButtons(data.HostBy);
|
||||
bs.find(x => x.label == "Enter")
|
||||
.setDisabled()
|
||||
.setStyle("SECONDARY");
|
||||
bs.find(x => x.label == "End")
|
||||
.setDisabled()
|
||||
.setStyle("SECONDARY");
|
||||
bs.find(x => x.label == "Reroll")
|
||||
.setDisabled(false)
|
||||
.setStyle("SUCCESS");
|
||||
const row = new MessageActionRow().addComponents(bs);
|
||||
m.edit({
|
||||
components: [row],
|
||||
embeds: m.embeds,
|
||||
}).catch(e => {
|
||||
throw new CathError(e);
|
||||
});
|
||||
}
|
||||
|
||||
private async giveawayEmbed(
|
||||
client: Client,
|
||||
status: string,
|
||||
{ host, prize, endAfter, invites, winners, requirements }
|
||||
) {
|
||||
const hostedBy =
|
||||
client.users.cache.get(host) ||
|
||||
(await client.users.fetch(host).catch(() => null));
|
||||
let req = "";
|
||||
if (requirements.Roles)
|
||||
req += `\n Role(s): ${requirements.Roles.map(x => `<@&${x}>`).join(
|
||||
", "
|
||||
)}`;
|
||||
if (requirements.weeklyamari)
|
||||
req += `\n Weekly Amari: \`${requirements.weeklyamari}\``;
|
||||
if (requirements.amarilevel)
|
||||
req += `\n Amari Level: \`${requirements.amarilevel}\``;
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle(`Status: ${status}! 🎉`)
|
||||
.setDescription(
|
||||
`${
|
||||
this.GiveawayMessages.toParticipate
|
||||
}\n${this.GiveawayMessages.giveawayDescription
|
||||
.replace(/{invites}/g, invites ? invites : "0")
|
||||
.replace(/{requirements}/g, req)
|
||||
.replace(/{hostedBy}/g, hostedBy || "Can't find the user")
|
||||
.replace(/{award}/g, prize)
|
||||
.replace(/{winners}/g, winners)
|
||||
.replace(/{totalParticipants}/g, "0")}`
|
||||
)
|
||||
.setColor("RANDOM")
|
||||
.setFooter({
|
||||
text: "Ends",
|
||||
iconURL: this.GiveawayMessages.giveawayFooterImage,
|
||||
})
|
||||
.setTimestamp(Date.now() + parseString(endAfter));
|
||||
return embed;
|
||||
}
|
||||
|
||||
public async create(
|
||||
client: Client,
|
||||
{ prize, host, winners, endAfter, invites, requirements, Channel }
|
||||
) {
|
||||
if (!client)
|
||||
throw new CathError("client wasnt provided while creating giveaway!");
|
||||
if (!prize)
|
||||
throw new CathError("prize wasnt provided while creating giveaway!");
|
||||
if (typeof prize !== "string")
|
||||
throw new TypeError("prize should be a string");
|
||||
if (!host)
|
||||
throw new CathError("host wasnt provided while creating giveaway");
|
||||
if (!winners)
|
||||
throw new CathError(
|
||||
"winner count wasnt provided while creating giveaway"
|
||||
);
|
||||
if (isNaN(winners)) throw new TypeError("winners should be a Number");
|
||||
if (!endAfter)
|
||||
throw new CathError("time wasnt provided while creating giveaway");
|
||||
if (typeof endAfter !== "string")
|
||||
throw new TypeError("endAfter should be a string");
|
||||
if (
|
||||
invites < 0 &&
|
||||
invites == null &&
|
||||
invites == undefined &&
|
||||
typeof invites !== "number"
|
||||
) {
|
||||
throw new CathError("invites wasnt provided while creating giveaway");
|
||||
}
|
||||
if (!Channel)
|
||||
throw new CathError("channel ID wasnt provided while creating giveaway");
|
||||
const status = "In Progress";
|
||||
const msg = await (client.channels.cache.get(Channel) as TextChannel).send({
|
||||
content: this.GiveawayMessages.giveaway,
|
||||
components: [new MessageActionRow().addComponents(this.getButtons(host))],
|
||||
embeds: [
|
||||
await this.giveawayEmbed(client, status, {
|
||||
host,
|
||||
prize,
|
||||
endAfter,
|
||||
invites,
|
||||
winners,
|
||||
requirements,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const data = await new this.schema({
|
||||
Message: msg.id,
|
||||
Channel: Channel,
|
||||
Guild: msg.guild.id,
|
||||
HostBy: host,
|
||||
Winners: winners,
|
||||
Award: prize,
|
||||
Start: Date.now(),
|
||||
End: Date.now() + parseString(endAfter),
|
||||
Invites: invites,
|
||||
Requirements: requirements,
|
||||
}).save();
|
||||
await this.startTimer(msg, data);
|
||||
}
|
||||
|
||||
private async startTimer(message: Message, data, instant = false) {
|
||||
if (!message) throw new CathError("Missing 'message'");
|
||||
if (!data) throw new CathError("Missing 'data'");
|
||||
const msg = await (
|
||||
message.guild.channels.cache.get(data.Channel) as TextChannel
|
||||
).messages.fetch(data.Message);
|
||||
await msg.fetch();
|
||||
const time = instant ? 0 : data.End - Date.now();
|
||||
setTimeout(async () => {
|
||||
const winners = await this.choose(data.winners, data.Message, message);
|
||||
if (!winners) {
|
||||
msg.channel.send({
|
||||
content: this.replacePlaceholders(
|
||||
this.GiveawayMessages.noWinner,
|
||||
data,
|
||||
msg
|
||||
),
|
||||
});
|
||||
data.Ended = true;
|
||||
data.save();
|
||||
const embed = msg.embeds[0];
|
||||
embed.description = this.replacePlaceholders(
|
||||
this.GiveawayMessages.giveawayDescription,
|
||||
data,
|
||||
msg
|
||||
);
|
||||
msg.edit({ embeds: [embed] });
|
||||
this.editButtons(message.client, data);
|
||||
return "NO_WINNERS";
|
||||
}
|
||||
message.channel.send({
|
||||
content: this.replacePlaceholders(
|
||||
this.GiveawayMessages.winMessage,
|
||||
await this.getByMessage(data.Message),
|
||||
msg,
|
||||
winners as []
|
||||
),
|
||||
});
|
||||
|
||||
if (this.GiveawayMessages.dmWinner) {
|
||||
const dmEmbed = new MessageEmbed()
|
||||
.setTitle("You Won!")
|
||||
.setDescription(
|
||||
this.replacePlaceholders(
|
||||
this.GiveawayMessages.dmMessage,
|
||||
data,
|
||||
msg,
|
||||
winners as []
|
||||
)
|
||||
)
|
||||
.setColor("RANDOM")
|
||||
.setTimestamp()
|
||||
.setThumbnail(msg.guild.iconURL({ dynamic: true }))
|
||||
.setFooter({ text: "Made by Cath Team" });
|
||||
(winners as []).forEach(user => {
|
||||
message.guild.members.cache.get(user).send({ embeds: [dmEmbed] });
|
||||
});
|
||||
}
|
||||
|
||||
const embed = msg.embeds[0];
|
||||
embed.description = this.replacePlaceholders(
|
||||
this.GiveawayMessages.giveawayDescription,
|
||||
data,
|
||||
msg,
|
||||
winners as []
|
||||
);
|
||||
msg.edit({ embeds: [embed] }).catch(err => console.log(err));
|
||||
data.Ended = true;
|
||||
data.save().catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
this.editButtons(message.client, data);
|
||||
}, time);
|
||||
}
|
||||
private gotoGiveaway(data) {
|
||||
if (!data) throw new CathError("Missing 'data'");
|
||||
const link = `https://discord.com/channels/${data.Guild}/${data.Channel}/${data.Message}`;
|
||||
const button = new MessageButton()
|
||||
.setLabel("Giveaway")
|
||||
.setStyle("LINK")
|
||||
.setURL(link);
|
||||
return button;
|
||||
}
|
||||
private async endByButton(
|
||||
client: Client,
|
||||
Message: Snowflake,
|
||||
button: ButtonInteraction
|
||||
) {
|
||||
if (!client) throw new CathError("Missing 'client'");
|
||||
if (!Message) throw new CathError("Missing 'Message'");
|
||||
if (!button) throw new CathError("Missing 'button'");
|
||||
const data = await this.getByMessage(Message);
|
||||
const msg = await (
|
||||
client.guilds.cache
|
||||
.get(data.Guild)
|
||||
.channels.cache.get(data.Channel) as TextChannel
|
||||
).messages.fetch(Message);
|
||||
const res = await this.end(msg, data, msg);
|
||||
if (res == "ENDED")
|
||||
await button.followUp({
|
||||
content: this.replacePlaceholders(
|
||||
this.GiveawayMessages.alreadyEnded,
|
||||
data,
|
||||
msg
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
public async end(message: Message, data, giveawaymsg: Message) {
|
||||
if (!message) throw new CathError("Missing 'Message'");
|
||||
if (!data) throw new CathError("Missing 'data'");
|
||||
if (!giveawaymsg) throw new CathError("Missing 'Message'");
|
||||
const newData = await this.getByMessage(data.Message);
|
||||
if (newData.Ended) return "ENDED";
|
||||
const winners = await this.choose(data.Winners, message.id, message);
|
||||
const msg = await (
|
||||
message.client.guilds.cache
|
||||
.get(data.Guild)
|
||||
.channels.cache.get(data.Channel) as TextChannel
|
||||
).messages.fetch(data.Message);
|
||||
|
||||
if (!winners) {
|
||||
message.channel.send(
|
||||
this.replacePlaceholders(this.GiveawayMessages.noWinner, newData, msg)
|
||||
);
|
||||
data.Ended = true;
|
||||
await data.save();
|
||||
const embed = giveawaymsg.embeds[0];
|
||||
embed.description = this.replacePlaceholders(
|
||||
this.GiveawayMessages.giveawayDescription,
|
||||
newData,
|
||||
msg
|
||||
);
|
||||
embed.title = "Status: Ended! 🎉";
|
||||
giveawaymsg.edit({ embeds: [embed] }).catch(err => console.log(err));
|
||||
this.editButtons(message.client, data);
|
||||
return "NO_WINNERS";
|
||||
}
|
||||
message.channel.send(
|
||||
this.replacePlaceholders(
|
||||
this.GiveawayMessages.winMessage,
|
||||
newData,
|
||||
msg,
|
||||
winners as []
|
||||
)
|
||||
);
|
||||
if (this.GiveawayMessages.dmWinner) {
|
||||
const dmEmbed = new MessageEmbed()
|
||||
.setTitle("You Won!")
|
||||
.setDescription(
|
||||
this.replacePlaceholders(
|
||||
this.GiveawayMessages.dmMessage,
|
||||
newData,
|
||||
msg,
|
||||
winners as []
|
||||
)
|
||||
)
|
||||
.setColor("RANDOM")
|
||||
.setTimestamp()
|
||||
.setThumbnail(msg.guild.iconURL({ dynamic: true }))
|
||||
.setFooter({ text: "Made by Cath Team" });
|
||||
(winners as []).forEach(user => {
|
||||
message.guild.members.cache
|
||||
.get(user)
|
||||
.send({ embeds: [dmEmbed] })
|
||||
.catch();
|
||||
});
|
||||
}
|
||||
|
||||
const embed = giveawaymsg.embeds[0];
|
||||
embed.description = this.replacePlaceholders(
|
||||
this.GiveawayMessages.giveawayDescription,
|
||||
data,
|
||||
msg,
|
||||
winners as []
|
||||
);
|
||||
embed.title = "Status: Ended! 🎉";
|
||||
giveawaymsg.edit({ embeds: [embed] }).catch(err => console.log(err));
|
||||
data.Ended = true;
|
||||
data.save().catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
this.editButtons(message.client, data);
|
||||
}
|
||||
public async reroll(client: Client, Message: Snowflake, message: Message) {
|
||||
if (!client) throw new CathError("Missing 'client'");
|
||||
if (!Message) throw new CathError("Missing 'Message'");
|
||||
const data = await this.getByMessage(Message);
|
||||
const msg = await (
|
||||
client.guilds.cache
|
||||
.get(data.Guild)
|
||||
.channels.cache.get(data.Channel) as TextChannel
|
||||
).messages.fetch(Message);
|
||||
const embed = message.embeds[0];
|
||||
embed.title = "Status: Rerolled! 🎉";
|
||||
message.edit({ embeds: [embed] }).catch(err => console.log(err));
|
||||
const chosen = await this.choose(1, Message, message);
|
||||
if (!chosen) return [];
|
||||
const dmEmbed = new MessageEmbed()
|
||||
.setTitle("You Won!")
|
||||
.setDescription(
|
||||
this.replacePlaceholders(
|
||||
this.GiveawayMessages.dmMessage,
|
||||
data,
|
||||
msg,
|
||||
chosen as []
|
||||
)
|
||||
)
|
||||
.setColor("RANDOM")
|
||||
.setTimestamp()
|
||||
.setThumbnail(msg.guild.iconURL({ dynamic: true }))
|
||||
.setFooter({ text: "Made by Cath Team" });
|
||||
(chosen as []).forEach(user => {
|
||||
client.users.cache.get(user).send({ embeds: [dmEmbed] });
|
||||
});
|
||||
return chosen;
|
||||
}
|
||||
public async getByMessage(Message: Snowflake) {
|
||||
const doc = await this.schema.findOne({ Message: Message });
|
||||
if (!doc) return;
|
||||
return doc;
|
||||
}
|
||||
public async start(client: Client) {
|
||||
await this.schema.find({ Ended: false }).then(data => {
|
||||
setTimeout(async () => {
|
||||
data.forEach(async e => {
|
||||
const guild = await client.guilds.fetch(e.Guild);
|
||||
if (!guild) await e.delete();
|
||||
const channel = guild.channels.cache.get(e.Channel) as TextChannel;
|
||||
if (!channel) await e.delete();
|
||||
const msg = await channel.messages.fetch(e.Message).catch();
|
||||
if (!msg) await e.delete();
|
||||
this.startTimer(msg, e);
|
||||
});
|
||||
}, 10000);
|
||||
});
|
||||
if (this.GiveawayMessages.editParticipants) {
|
||||
setInterval(async () => {
|
||||
const docs = await this.schema.find({ Ended: false });
|
||||
for (let i = 0; i < docs.length; i++) {
|
||||
const guild = client.guilds.cache.get(docs[i].Guild);
|
||||
if (!guild) return;
|
||||
const channel = (await guild.channels.fetch(
|
||||
docs[i].Channel
|
||||
)) as TextChannel;
|
||||
if (!channel) return;
|
||||
const msg = await channel.messages.fetch(docs[i].Message);
|
||||
if (!msg) return;
|
||||
const embed = msg.embeds[0];
|
||||
const req = docs[i].Requirements.Enabled
|
||||
? docs[i].Requirements.Roles.map(x => `<@&${x}>`).join(", ")
|
||||
: "None!";
|
||||
embed.description = `${
|
||||
this.GiveawayMessages.toParticipate
|
||||
}\n${this.GiveawayMessages.giveawayDescription
|
||||
.replace(/{invites}/g, docs[i].Invites.toString())
|
||||
.replace(/{requirements}/g, req)
|
||||
.replace(/{hostedBy}/g, `<@!${docs[i].HostBy}>`)
|
||||
.replace(/{award}/g, docs[i].Award)
|
||||
.replace(/{winners}/g, docs[i].Winners.toString())
|
||||
.replace(
|
||||
/{totalParticipants}/g,
|
||||
docs[i].Clickers.length.toString()
|
||||
)}`;
|
||||
msg.edit({ embeds: [embed] });
|
||||
}
|
||||
}, 10 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private replacePlaceholders(
|
||||
string: string,
|
||||
data: GiveawaySchema,
|
||||
msg: Message,
|
||||
winners = []
|
||||
) {
|
||||
const newString = string
|
||||
.replace(/{invites}/g, data.Invites.toString())
|
||||
.replace(
|
||||
/{requirements}/g,
|
||||
data.Requirements.Enabled
|
||||
? data.Requirements.Roles.map(x => `<@&${x}>`).join(", ")
|
||||
: "None!"
|
||||
)
|
||||
.replace(/{guildName}/g, msg.guild.name)
|
||||
.replace(/{totalParticipants}/g, data.Clickers.length.toString())
|
||||
.replace(/{award}/g, data.Award)
|
||||
.replace(
|
||||
/{giveawayURL}/g,
|
||||
`https://discord.com/channels/${msg.guild.id}/${msg.channel.id}/${data.Message}`
|
||||
)
|
||||
.replace(
|
||||
/{hostedBy}/g,
|
||||
msg.guild.members.cache.get(data.HostBy).toString()
|
||||
)
|
||||
.replace(
|
||||
/{winners}/g,
|
||||
winners.length > 0
|
||||
? winners.map(winner => `<@${winner}>`).join(", ")
|
||||
: "None" || "None"
|
||||
);
|
||||
return newString;
|
||||
}
|
||||
}
|
6
src/GiveawaysClient/index.ts
Normal file
6
src/GiveawaysClient/index.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export { GiveawaysClient } from "./giveaway";
|
||||
export {
|
||||
GiveawaySchema,
|
||||
GiveawaysClientOptions,
|
||||
DefaultGiveawayMessages,
|
||||
} from "./giveaway.interface";
|
67
src/ImageClient/image.ts
Normal file
67
src/ImageClient/image.ts
Normal file
|
@ -0,0 +1,67 @@
|
|||
import { config } from "../";
|
||||
/**
|
||||
* @name ImageClient
|
||||
* @kind constructor
|
||||
*/
|
||||
export class ImageClient {
|
||||
constructor() {}
|
||||
private endpoint(end: string, ava: string, ava1?: string, ava2?: string) {
|
||||
if (ava && ava1 && !ava2)
|
||||
return `${config.api}/api/v1/image/${end}?image=${ava}&image2=${ava1}`;
|
||||
else if (ava && ava1 && ava2)
|
||||
return `${config.api}/api/v1/image/${end}?image=${ava}&image2=${ava1}&image3=${ava2}`;
|
||||
else return `${config.api}/api/v1/image/${end}?image=${ava}`;
|
||||
}
|
||||
public busted(AvatarURL: string) {
|
||||
return this.endpoint("busted", AvatarURL);
|
||||
}
|
||||
public communism(AvatarURL: string) {
|
||||
return this.endpoint("communism", AvatarURL);
|
||||
}
|
||||
public gun(AvatarURL: string) {
|
||||
return this.endpoint("gun", AvatarURL);
|
||||
}
|
||||
public mask(AvatarURL: string) {
|
||||
return this.endpoint("mask", AvatarURL);
|
||||
}
|
||||
public whodidthis(AvatarURL: string) {
|
||||
return this.endpoint("whodidthis", AvatarURL);
|
||||
}
|
||||
public pray(AvatarURL: string) {
|
||||
return this.endpoint("pray", AvatarURL);
|
||||
}
|
||||
public pressplay(AvatarURL: string) {
|
||||
return this.endpoint("pressplay", AvatarURL);
|
||||
}
|
||||
public vr(AvatarURL: string) {
|
||||
return this.endpoint("vr", AvatarURL);
|
||||
}
|
||||
public rifleshoot(AvatarURL: string) {
|
||||
return this.endpoint("rifleshoot", AvatarURL);
|
||||
}
|
||||
public bestmeme(AvatarURL: string) {
|
||||
return this.endpoint("bestmeme", AvatarURL);
|
||||
}
|
||||
public robert(AvatarURL: string) {
|
||||
return this.endpoint("robert", AvatarURL);
|
||||
}
|
||||
public saveonlyone(
|
||||
AvatarURL1: string,
|
||||
AvatarURL2: string,
|
||||
AvatarURL3: string
|
||||
) {
|
||||
return this.endpoint("saveonlyone", AvatarURL1, AvatarURL2, AvatarURL3);
|
||||
}
|
||||
public alone(AvatarURL: string) {
|
||||
return this.endpoint("alone", AvatarURL);
|
||||
}
|
||||
public toilet(AvatarURL: string) {
|
||||
return this.endpoint("toilet", AvatarURL);
|
||||
}
|
||||
public moment(AvatarURL: string) {
|
||||
return this.endpoint("moment", AvatarURL);
|
||||
}
|
||||
public awesome(AvatarURL: string) {
|
||||
return this.endpoint("awesome", AvatarURL);
|
||||
}
|
||||
}
|
1
src/ImageClient/index.ts
Normal file
1
src/ImageClient/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export { ImageClient } from "./image";
|
7
src/StarboardClient/index.ts
Normal file
7
src/StarboardClient/index.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export { StarboardClient } from "./starboard";
|
||||
export {
|
||||
StarboardClientOptions,
|
||||
StarboardGuild,
|
||||
StarboardGuildOptions,
|
||||
starMessageData,
|
||||
} from "./starboard.interface";
|
38
src/StarboardClient/starboard.interface.ts
Normal file
38
src/StarboardClient/starboard.interface.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { Client, Snowflake, ColorResolvable } from "discord.js";
|
||||
|
||||
export interface StarboardClientOptions {
|
||||
/**
|
||||
* Discord Client
|
||||
*/
|
||||
client: Client;
|
||||
/**
|
||||
* Color of Embed
|
||||
*/
|
||||
color?: ColorResolvable;
|
||||
/**
|
||||
* Preload data
|
||||
*/
|
||||
Guilds?: StarboardGuild[];
|
||||
}
|
||||
|
||||
export interface StarboardGuild {
|
||||
id: Snowflake;
|
||||
options: StarboardGuildOptions;
|
||||
}
|
||||
|
||||
export interface StarboardGuildOptions {
|
||||
/**
|
||||
* Amount of stars required in order to be registered as a starred channel
|
||||
*/
|
||||
starCount: number;
|
||||
|
||||
/**
|
||||
* Channel to send starred messages
|
||||
*/
|
||||
starboardChannel: Snowflake;
|
||||
}
|
||||
|
||||
export interface starMessageData {
|
||||
origin: Snowflake;
|
||||
id: Snowflake;
|
||||
}
|
143
src/StarboardClient/starboard.ts
Normal file
143
src/StarboardClient/starboard.ts
Normal file
|
@ -0,0 +1,143 @@
|
|||
import {
|
||||
Client,
|
||||
MessageReaction,
|
||||
Collection,
|
||||
Snowflake,
|
||||
TextChannel,
|
||||
Message,
|
||||
MessageEmbed,
|
||||
MessageOptions,
|
||||
ColorResolvable,
|
||||
MessageEditOptions,
|
||||
} from "discord.js";
|
||||
import {
|
||||
starMessageData,
|
||||
StarboardClientOptions,
|
||||
StarboardGuild,
|
||||
} from "./starboard.interface";
|
||||
|
||||
export class StarboardClient {
|
||||
public client: Client;
|
||||
public color: ColorResolvable;
|
||||
public guilds: StarboardGuild[];
|
||||
public cache: Collection<Snowflake, starMessageData[]> = new Collection();
|
||||
|
||||
constructor(options: StarboardClientOptions) {
|
||||
this.client = options.client;
|
||||
this.color = options.color || "RANDOM";
|
||||
this.guilds = options.Guilds || [];
|
||||
this.client.on("ready", () => this.cacheData());
|
||||
}
|
||||
public config = {
|
||||
guilds: {
|
||||
set: (StarboardGuilds: StarboardGuild[]) => {
|
||||
this.guilds = StarboardGuilds;
|
||||
this.cacheData();
|
||||
},
|
||||
add: (StarboardGuild: StarboardGuild) => {
|
||||
const filtered = (this.guilds || []).filter(
|
||||
x => x.id === StarboardGuild.id
|
||||
);
|
||||
|
||||
this.guilds = [...filtered, StarboardGuild];
|
||||
this.cacheData();
|
||||
},
|
||||
},
|
||||
};
|
||||
private cacheData() {
|
||||
this.guilds.forEach(async guild => {
|
||||
const channel = this.client.channels.cache.get(
|
||||
guild.options.starboardChannel
|
||||
) as TextChannel;
|
||||
if (!channel) return;
|
||||
const messages = await channel.messages.fetch({ limit: 100 });
|
||||
if (!messages) return;
|
||||
const value = messages.reduce(
|
||||
(accumulator: starMessageData[], message) => {
|
||||
if (message.author.id !== this.client.user.id) return accumulator;
|
||||
const starCount = message.content.match(/(?<=\*\*)\d*(?=\*\*)/)?.[0];
|
||||
const origin = message.embeds?.[0]?.footer?.text.match(/\d*/)?.[0];
|
||||
if (!starCount || !origin) return accumulator;
|
||||
const data: starMessageData = {
|
||||
id: message.id,
|
||||
origin,
|
||||
};
|
||||
return [...accumulator, data];
|
||||
},
|
||||
[]
|
||||
);
|
||||
this.cache.set(guild.id, value);
|
||||
});
|
||||
}
|
||||
private validGuild(guild: Snowflake): Boolean {
|
||||
return this.guilds.some(x => x.id === guild);
|
||||
}
|
||||
private getData(guildId: Snowflake): StarboardGuild {
|
||||
return this.guilds.find(x => x.id === guildId);
|
||||
}
|
||||
private generateEdit(starCount: number, message: Message): MessageOptions {
|
||||
return {
|
||||
content: `⭐ **${starCount}** ${message.channel}`,
|
||||
embeds: [
|
||||
new MessageEmbed()
|
||||
.setAuthor(
|
||||
message.author.tag,
|
||||
message.author.displayAvatarURL({ dynamic: true })
|
||||
)
|
||||
.setColor(this.color)
|
||||
.setDescription(
|
||||
`Content: ${message.content ? message.content : "None"}`
|
||||
)
|
||||
.setThumbnail(message.author.displayAvatarURL({ dynamic: true }))
|
||||
.addField("Message", `[Jump!](${message.url})`)
|
||||
.setImage(message.attachments.first()?.url || null)
|
||||
.setTimestamp(message.createdTimestamp)
|
||||
.setFooter(message.id),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
public async listener(reaction: MessageReaction) {
|
||||
if (!this.validGuild) return;
|
||||
if (reaction.message.partial) await reaction.message.fetch();
|
||||
if (reaction.partial) await reaction.fetch();
|
||||
const { guildId, id } = reaction.message;
|
||||
if (reaction.emoji.name !== "⭐") return;
|
||||
const data = this.cache.get(guildId) || [];
|
||||
const starboardChannel = this.client.channels.cache.get(
|
||||
this.guilds.find(x => x.id === guildId)?.options.starboardChannel
|
||||
) as TextChannel;
|
||||
const getMessage = data.find(x => x.origin === id);
|
||||
|
||||
const generateEdit = this.generateEdit(
|
||||
reaction.count,
|
||||
reaction.message as Message
|
||||
);
|
||||
const sendMessage = () => {
|
||||
starboardChannel?.send(generateEdit).then(m => {
|
||||
this.cache.set(reaction.message.guildId, [
|
||||
...data,
|
||||
{ id: m.id, origin: reaction.message.id },
|
||||
]);
|
||||
});
|
||||
};
|
||||
if (getMessage) {
|
||||
if (reaction.count === 0) {
|
||||
setTimeout(
|
||||
() =>
|
||||
starboardChannel.messages
|
||||
.fetch(getMessage.id)
|
||||
.then(async r => await r.delete()),
|
||||
10000
|
||||
);
|
||||
} else {
|
||||
starboardChannel.messages
|
||||
.fetch(getMessage.id)
|
||||
.then(publishedMessage => {
|
||||
publishedMessage.edit(generateEdit as MessageEditOptions);
|
||||
})
|
||||
.catch(sendMessage);
|
||||
}
|
||||
} else sendMessage();
|
||||
}
|
||||
}
|
2
src/URLClient/index.ts
Normal file
2
src/URLClient/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { URLClient } from "./urlclient";
|
||||
export { URLData } from "./urlclient.interface";
|
3
src/URLClient/urlclient.interface.ts
Normal file
3
src/URLClient/urlclient.interface.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export interface URLData {
|
||||
url: String;
|
||||
}
|
33
src/URLClient/urlclient.ts
Normal file
33
src/URLClient/urlclient.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import axios from "axios";
|
||||
import { config } from "../";
|
||||
import { URLData } from "./urlclient.interface";
|
||||
import { CathError } from "../Error/CathError";
|
||||
/**
|
||||
* @name URLClient
|
||||
* @kind constructor
|
||||
*/
|
||||
export class URLClient {
|
||||
constructor() {}
|
||||
/**
|
||||
* Sends the link of the URL
|
||||
* @return {Promise<URLData>}
|
||||
* @param {String} shortName
|
||||
* @param {String} targetURL
|
||||
*/
|
||||
public async createShortURL(
|
||||
shortName: string,
|
||||
targetURL: string
|
||||
): Promise<URLData> {
|
||||
if (!shortName) throw new CathError("Missing 'shortName' property");
|
||||
if (!targetURL) throw new CathError("Missing 'targetURL' property");
|
||||
const data = await axios
|
||||
.post(`${config.url}`, {
|
||||
shortUrl: shortName,
|
||||
fullUrl: targetURL,
|
||||
})
|
||||
.then(res => res.data);
|
||||
if (data?.name) {
|
||||
return data?.name;
|
||||
}
|
||||
}
|
||||
}
|
12
src/config.ts
Normal file
12
src/config.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
const config: ConfigURLS = {
|
||||
api: "https://api.night0721.me",
|
||||
code: "https://cdn.night0721.me/api/paste",
|
||||
url: "https://cdn.night0721.me/api/url",
|
||||
};
|
||||
|
||||
interface ConfigURLS {
|
||||
api: string;
|
||||
code: string;
|
||||
url: string;
|
||||
}
|
||||
export { config, ConfigURLS };
|
11
src/functions/8ball.ts
Normal file
11
src/functions/8ball.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import axios from "axios";
|
||||
import { config } from "../";
|
||||
/**
|
||||
* Sends a 8ball response
|
||||
*/
|
||||
export async function random8ball(): Promise<string> {
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/fun/8ball`)
|
||||
.then(res => res.data);
|
||||
return data.answer;
|
||||
}
|
21
src/functions/HHMMSS.ts
Normal file
21
src/functions/HHMMSS.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
/**
|
||||
* Returns a string(00:00:00)
|
||||
*/
|
||||
export function HHMMSS(str: string) {
|
||||
if (!str) throw new CathError("Missing 'str'");
|
||||
var sec_num = parseInt(str, 10);
|
||||
var hours = Math.floor(sec_num / 3600);
|
||||
var minutes = Math.floor((sec_num - hours * 3600) / 60);
|
||||
var seconds = sec_num - hours * 3600 - minutes * 60;
|
||||
if (hours < 10) {
|
||||
hours = 0 + hours;
|
||||
}
|
||||
if (minutes < 10) {
|
||||
minutes = 0 + minutes;
|
||||
}
|
||||
if (seconds < 10) {
|
||||
seconds = 0 + seconds;
|
||||
}
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
}
|
8
src/functions/bool.ts
Normal file
8
src/functions/bool.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Returns true/false
|
||||
*/
|
||||
export function bool() {
|
||||
const arr = [true, false];
|
||||
const num = arr[Math.floor(Math.random() * arr.length)];
|
||||
return num;
|
||||
}
|
12
src/functions/cleanText.ts
Normal file
12
src/functions/cleanText.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Returns a string without " ` " or " @ "
|
||||
*/
|
||||
export function cleanText(text: string): string {
|
||||
if (typeof text === "string") {
|
||||
return text
|
||||
.replace(/`/g, "`" + String.fromCharCode(8203))
|
||||
.replace(/@/g, "@" + String.fromCharCode(8203));
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
19
src/functions/confirmation.ts
Normal file
19
src/functions/confirmation.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { Message } from "discord.js";
|
||||
export async function confirmation(
|
||||
message: Message,
|
||||
author,
|
||||
validReactions = [],
|
||||
time = 60000
|
||||
) {
|
||||
try {
|
||||
for (const reaction of validReactions) await message.react(reaction);
|
||||
const filter = (reaction, user) =>
|
||||
validReactions.includes(reaction.emoji.name) && user.id === author.id;
|
||||
|
||||
return message
|
||||
.awaitReactions({ filter, max: 1, time: time })
|
||||
.then(collected => collected.first() && collected.first().emoji.name);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
9
src/functions/daysAgo.ts
Normal file
9
src/functions/daysAgo.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
|
||||
export function daysAgo(date: Date) {
|
||||
if (!date) throw new CathError("Missing 'date'");
|
||||
let now = new Date();
|
||||
let diff = now.getTime() - date.getTime();
|
||||
let days = Math.floor(diff / 86400000);
|
||||
return days + (days == 1 ? " day" : " days") + " ago";
|
||||
}
|
80
src/functions/discord-activity.ts
Normal file
80
src/functions/discord-activity.ts
Normal file
|
@ -0,0 +1,80 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
import axios from "axios";
|
||||
/**
|
||||
* Start a Discord Activity session
|
||||
* @example
|
||||
* const Cath = require("cath")
|
||||
* const client = new Client()
|
||||
* const d = await Cath.DiscordActivity({
|
||||
application: "youtube",
|
||||
channel_id: "901542111005012099",
|
||||
token: client.token,
|
||||
});
|
||||
message.channel.send({ content: d });
|
||||
*/
|
||||
export async function DiscordActivity(options: DiscordActivityOptions) {
|
||||
const all = {
|
||||
youtube: "880218394199220334",
|
||||
youtubedev: "880218832743055411",
|
||||
poker: "755827207812677713",
|
||||
betrayal: "773336526917861400",
|
||||
fishing: "814288819477020702",
|
||||
chess: "832012774040141894",
|
||||
chessdev: "832012586023256104",
|
||||
lettertile: "879863686565621790",
|
||||
wordsnack: "879863976006127627",
|
||||
doodlecrew: "878067389634314250",
|
||||
awkword: "879863881349087252",
|
||||
spellcast: "852509694341283871",
|
||||
};
|
||||
if (!all[options.application]) {
|
||||
throw new CathError(
|
||||
"Application ID is not valid, if you want to see the list of applications, check the docs at https://cath.js.org/interfaces/Applications.html"
|
||||
);
|
||||
}
|
||||
if (!options.token) {
|
||||
throw new CathError("Missing 'token'");
|
||||
}
|
||||
if (!options.channel_id) {
|
||||
throw new CathError("Missing 'Channel ID'");
|
||||
}
|
||||
const data = await axios
|
||||
.post(
|
||||
`https://discord.com/api/v9/channels/${options.channel_id}/invites`,
|
||||
{
|
||||
max_age: 86400,
|
||||
max_uses: 0,
|
||||
target_application_id: all[options.application],
|
||||
target_type: 2,
|
||||
temporary: false,
|
||||
validate: null,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bot ${options.token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
.then(res => res.data);
|
||||
return `https://discord.com/invite/${data.code}`;
|
||||
}
|
||||
export interface DiscordActivityOptions {
|
||||
application: string;
|
||||
token: string;
|
||||
channel_id: string;
|
||||
}
|
||||
export interface Applications {
|
||||
youtube: "880218394199220334";
|
||||
youtubedev: "880218832743055411";
|
||||
poker: "755827207812677713";
|
||||
betrayal: "773336526917861400";
|
||||
fishing: "814288819477020702";
|
||||
chess: "832012774040141894";
|
||||
chessdev: "832012586023256104";
|
||||
lettertile: "879863686565621790";
|
||||
wordsnack: "879863976006127627";
|
||||
doodlecrew: "878067389634314250";
|
||||
awkword: "879863881349087252";
|
||||
spellcast: "852509694341283871";
|
||||
}
|
16
src/functions/doublestruck.ts
Normal file
16
src/functions/doublestruck.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import { config } from "../";
|
||||
/**
|
||||
* Dobulestruck words
|
||||
*/
|
||||
export async function doublestruck(word: string): Promise<string> {
|
||||
if (!word) {
|
||||
throw new CathError("Missing 'word'");
|
||||
}
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/fun/doublestruck?text=${word}`)
|
||||
.then(res => res.data);
|
||||
console.log(data);
|
||||
return data.text;
|
||||
}
|
34
src/functions/emojify.ts
Normal file
34
src/functions/emojify.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Emoji-ify a string
|
||||
*/
|
||||
export function emojify(str: string): string {
|
||||
const s = {
|
||||
0: ":zero:",
|
||||
1: ":one:",
|
||||
2: ":two:",
|
||||
3: ":three:",
|
||||
4: ":four:",
|
||||
5: ":five:",
|
||||
6: ":six:",
|
||||
7: ":seven:",
|
||||
8: ":eight:",
|
||||
9: ":nine:",
|
||||
"#": ":hash:",
|
||||
"*": ":asterisk:",
|
||||
"!": ":grey_exclamation:",
|
||||
"?": ":grey_question:",
|
||||
" ": " ",
|
||||
};
|
||||
let ar = str
|
||||
.toLowerCase()
|
||||
.split("")
|
||||
.map(l => {
|
||||
if (/[a-z]/g.test(l)) {
|
||||
return `:regional_indicator_${l}:`;
|
||||
} else if (s[l]) {
|
||||
return `${s[l]}`;
|
||||
}
|
||||
})
|
||||
.join("");
|
||||
return ar;
|
||||
}
|
9
src/functions/formatUpper.ts
Normal file
9
src/functions/formatUpper.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
|
||||
/**
|
||||
* Edit the first letter of the string to uppercase
|
||||
*/
|
||||
export function formatUpper(str: string) {
|
||||
if (!str) throw new CathError("Missing 'str'");
|
||||
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
||||
}
|
16
src/functions/fractur.ts
Normal file
16
src/functions/fractur.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import { config } from "../";
|
||||
/**
|
||||
* Sends a 8ball response
|
||||
*/
|
||||
export async function fractur(word: string): Promise<string> {
|
||||
if (!word) {
|
||||
throw new CathError("Missing 'word'");
|
||||
}
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/fun/fractur?text=${word}`)
|
||||
.then(res => res.data);
|
||||
console.log(data);
|
||||
return data.text;
|
||||
}
|
35
src/functions/generatePassword.ts
Normal file
35
src/functions/generatePassword.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Generate a random password
|
||||
* @param length The length of the password
|
||||
* @param options The options for the password
|
||||
*/
|
||||
export function generatePassword(
|
||||
length: number,
|
||||
options: GeneratePasswordOptions
|
||||
) {
|
||||
const upper = options.upper || false;
|
||||
const lower = options.lower || false;
|
||||
const numbers = options.numbers || false;
|
||||
const special = options.special || false;
|
||||
const upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
const lowerChars = "abcdefghijklmnopqrstuvwxyz";
|
||||
const numberChars = "0123456789";
|
||||
const specialChars = "!@#$%^&*()_+-=[]{}|;':\",./<>?";
|
||||
let password = "";
|
||||
let chars = "";
|
||||
if (upper) chars += upperChars;
|
||||
if (lower) chars += lowerChars;
|
||||
if (numbers) chars += numberChars;
|
||||
if (special) chars += specialChars;
|
||||
for (let i = 0; i < length; i++) {
|
||||
password += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
}
|
||||
return password;
|
||||
}
|
||||
|
||||
export interface GeneratePasswordOptions {
|
||||
upper: boolean;
|
||||
lower: boolean;
|
||||
numbers: boolean;
|
||||
special: boolean;
|
||||
}
|
15
src/functions/getLilaseDownloads.ts
Normal file
15
src/functions/getLilaseDownloads.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
const axios = require("axios");
|
||||
/**
|
||||
* @name getLilaseDownloads
|
||||
* @description Get the number of downloads
|
||||
*/
|
||||
export async function getLilaseDownloads(): Promise<number> {
|
||||
const { data } = await axios.get(
|
||||
"https://api.github.com/repos/night0721/Lilase/releases"
|
||||
);
|
||||
let sum = 0;
|
||||
data.forEach(release => {
|
||||
sum += release.assets[0].download_count;
|
||||
});
|
||||
return sum;
|
||||
}
|
138
src/functions/ms.ts
Normal file
138
src/functions/ms.ts
Normal file
|
@ -0,0 +1,138 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var mn = d * 30;
|
||||
var w = d * 7;
|
||||
var y = d * 365.25;
|
||||
export function parseString(val: string) {
|
||||
var type = typeof val;
|
||||
if (type === "string" && val.length > 0) {
|
||||
return parse(val);
|
||||
}
|
||||
throw new CathError("Missing 'val' or type of 'val' isn't a string");
|
||||
}
|
||||
export function parseMS(val: number, options?: msOptions) {
|
||||
options = options || {};
|
||||
if (isFinite(val)) {
|
||||
return options?.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new CathError("Missing 'val' or type of 'val' isn't a number");
|
||||
}
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match =
|
||||
/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mths|mn|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || "ms").toLowerCase();
|
||||
switch (type) {
|
||||
case "years":
|
||||
case "year":
|
||||
case "yrs":
|
||||
case "yr":
|
||||
case "y":
|
||||
return n * y;
|
||||
case "month":
|
||||
case "months":
|
||||
case "mth":
|
||||
case "mths":
|
||||
return n * mn;
|
||||
case "weeks":
|
||||
case "week":
|
||||
case "w":
|
||||
return n * w;
|
||||
case "days":
|
||||
case "day":
|
||||
case "d":
|
||||
return n * d;
|
||||
case "hours":
|
||||
case "hour":
|
||||
case "hrs":
|
||||
case "hr":
|
||||
case "h":
|
||||
return n * h;
|
||||
case "minutes":
|
||||
case "minute":
|
||||
case "mins":
|
||||
case "min":
|
||||
case "m":
|
||||
return n * m;
|
||||
case "seconds":
|
||||
case "second":
|
||||
case "secs":
|
||||
case "sec":
|
||||
case "s":
|
||||
return n * s;
|
||||
case "milliseconds":
|
||||
case "millisecond":
|
||||
case "msecs":
|
||||
case "msec":
|
||||
case "ms":
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function fmtShort(ms: number): string {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= mn) {
|
||||
return Math.round(ms / mn) + "mo";
|
||||
}
|
||||
if (msAbs >= w) {
|
||||
return Math.round(ms / w) + "w";
|
||||
}
|
||||
if (msAbs >= d) {
|
||||
return Math.round(ms / d) + "d";
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return Math.round(ms / h) + "h";
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return Math.round(ms / m) + "m";
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return Math.round(ms / s) + "s";
|
||||
}
|
||||
return ms + "ms";
|
||||
}
|
||||
|
||||
function fmtLong(ms: number) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= mn) {
|
||||
return plural(ms, msAbs, mn, "month");
|
||||
}
|
||||
if (msAbs >= w) {
|
||||
return plural(ms, msAbs, w, "week");
|
||||
}
|
||||
if (msAbs >= d) {
|
||||
return plural(ms, msAbs, d, "day");
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return plural(ms, msAbs, h, "hour");
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return plural(ms, msAbs, m, "minute");
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return plural(ms, msAbs, s, "second");
|
||||
}
|
||||
return ms + " ms";
|
||||
}
|
||||
function plural(ms: number, msAbs: number, n: number, name: string) {
|
||||
var isPlural = msAbs >= n * 1.5;
|
||||
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
||||
}
|
||||
export interface msOptions {
|
||||
long?: boolean;
|
||||
short?: boolean;
|
||||
}
|
42
src/functions/obama.ts
Normal file
42
src/functions/obama.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Obama!
|
||||
*/
|
||||
export function obama() {
|
||||
const o = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠛⠛⠉⠉⠉⠋⠛⠛⠛⠻⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const b = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠛⠉⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠉⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const a = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const m = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠏⠄⠄⠄⠄⠄⠄⠄⠂⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠹⣿⣿⣿⣿⣿⣿⣿";
|
||||
const a2 = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⢻⣿⣿⣿⣿⣿";
|
||||
const aa = "⣿⣿⣿⣿⣿⣿⣿⣿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⠄⢠⠄⠄⡀⠄⠄⢀⠂⠄⠄⠄⠄⠄⠄⠄⠄⠄⡁⠄⠄⢛⣿⣿⣿⣿";
|
||||
const ab = "⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠐⡈⢔⠸⣐⢕⢕⢵⢰⢱⢰⢐⢤⡡⡢⣕⢄⢢⢠⠄⠄⠄⠄⠄⠄⠙⣿⣿⣿";
|
||||
const ac = "⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡁⠂⠅⢕⠌⡎⡎⣎⢎⢮⢮⣳⡳⣝⢮⢺⢜⢕⢕⢍⢎⠪⡐⠄⠁⠄⠸⣿⣿";
|
||||
const ad = "⣿⣿⣿⣿⣿⣿⠏⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠐⠄⠄⢅⠣⡡⡣⣣⡳⡵⣝⡮⣗⣗⡯⣗⣟⡮⡮⣳⣣⣳⢱⢱⠱⣐⠄⠂⠄⢿⣿";
|
||||
const ae = "⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠂⠄⠄⠄⠄⠄⠄⢂⢈⠢⡱⡱⡝⣮⣿⣟⣿⣽⣷⣿⣯⣿⣷⣿⣿⣿⣾⣯⣗⡕⡇⡇⠄⠂⡀⢹⣿";
|
||||
const af = "⣿⣿⣿⣿⣿⡟⠄⠄⠄⠄⠄⠄⠂⠄⠄⠄⠄⠄⠄⠐⢀⢂⢕⢸⢨⢪⢳⡫⣟⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡺⡮⡣⡣⠠⢂⠒⢸⣿";
|
||||
const ag = "⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠐⠄⡂⠆⡇⣗⣝⢮⢾⣻⣞⣿⣿⣿⣿⣿⣿⣿⣿⢿⣽⣯⡯⣺⢸⢘⠨⠔⡅⢨⣿";
|
||||
const ah = "⣿⣿⠋⠉⠙⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠄⡂⡪⡪⡪⡮⡮⡯⣻⣽⣾⣿⣿⣿⣟⣿⣿⣿⣽⣿⣿⡯⣯⡺⡸⡰⡱⢐⡅⣼⣿";
|
||||
const ai = "⣿⠡⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠈⠆⠱⠑⠝⠜⠕⡝⡝⣞⢯⢿⣿⣿⡿⣟⣿⣿⣿⡿⡿⣽⣷⣽⡸⡨⡪⣂⠊⣿⣿";
|
||||
const aj = "⣿⠡⠄⡨⣢⠐⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠐⠍⡓⣗⡽⣝⠽⠍⠅⠑⠁⠉⠘⠘⠘⠵⡑⢜⢀⢀⢉⢽";
|
||||
const ak = "⣿⠁⠠⢱⢘⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠈⠱⣁⠜⡘⠌⠄⠄⡪⣳⣟⡮⢅⠤⠠⠄⠄⣀⣀⡀⡀⠄⠈⡂⢲⡪⡠⣿";
|
||||
const al = "⣿⡇⠨⣺⢐⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡀⠄⠄⠄⠤⡠⡢⢒⠦⠠⠄⠄⠄⡸⢽⣟⢮⠢⡂⡐⠄⡈⡀⠤⡀⠄⠑⢄⠨⢸⡺⣐⣿";
|
||||
const am = "⣿⣿⠈⠕⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡂⡪⡐⡥⢤⣰⣰⣰⡴⡮⠢⠂⠄⠄⡊⢮⢺⢕⢵⢥⡬⣌⣒⡚⣔⢚⢌⢨⢚⠌⣾⡪⣾⣿";
|
||||
const an = "⣿⣿⣆⠄⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡑⢕⢕⡯⡷⣕⢧⢓⢭⠨⡀⠄⡂⠨⡨⣪⡳⣝⢝⡽⣻⣻⣞⢽⣲⢳⢱⢡⠱⠨⣟⢺⣿⣿";
|
||||
const ao = "⣿⣿⣿⡆⠄⡅⠇⡄⠄⠄⠄⠄⠄⠄⠄⠐⠨⢪⢹⢽⢽⣺⢝⠉⠁⠁⠄⠄⠄⢌⢎⡖⡯⡎⡗⢝⠜⣶⣯⣻⢮⡻⣟⣳⡕⠅⣷⣿⣿⣿";
|
||||
const ap = "⣿⣿⣿⣿⣶⣶⣿⣷⠄⠄⠄⠄⠄⠄⠄⠄⠈⠔⡑⠕⠝⠄⡀⠄⠄⠊⢆⠂⠨⡪⣺⣮⣿⡾⡜⣜⡜⣄⠙⢞⣿⢿⡿⣗⢝⢸⣾⣿⣿⣿";
|
||||
const aq = "⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⡀⠄⠄⠄⠄⢀⠄⠠⠄⠠⠄⠄⠄⠄⠄⠄⠊⠺⡹⠳⡙⡜⡓⡭⡺⡀⠄⠣⡻⡹⡸⠨⣣⣿⣿⣿⣿";
|
||||
const ar = "⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠠⠄⠄⣂⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢄⠤⡤⡄⡆⡯⡢⡣⡣⡓⢕⠽⣄⠄⠨⡂⢌⣼⣿⣿⣿⣿⣿";
|
||||
const a_ = "⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠈⠆⠄⠸⡂⠄⠄⠄⢀⠄⢀⠈⠄⠂⠁⠙⠝⠼⠭⠣⠣⠣⠑⠌⠢⠣⡣⡠⡘⣰⣱⣿⣿⣿⣿⣿⣿";
|
||||
const at = "⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⢑⠄⠈⡱⠄⢘⠄⡀⠨⢐⣧⣳⣷⣶⣦⣤⣴⣶⣶⣶⡶⠄⡠⡢⡕⣜⠎⡮⣣⣿⣿⣿⣿⣿⣿⣿";
|
||||
const au = "⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠢⠄⠨⠄⠄⠣⡀⠄⢀⢀⢙⠃⡿⢿⠿⡿⡿⢟⢋⢔⡱⣝⢜⡜⡪⡪⣵⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const av = "⣿⣿⣿⣿⣿⣿⣿⣿⡁⠄⠄⠄⠄⠄⠄⠄⠅⠄⠡⠄⠄⠡⢀⢂⠢⡡⠡⠣⡑⣏⢯⡻⡳⣹⡺⡪⢎⠎⡆⢣⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const aw = "⣿⣿⣿⣿⣿⣿⣿⣿⣇⠄⠄⠄⠄⠄⠄⠄⠐⠄⠄⠁⠄⢈⠄⢂⠕⡕⡝⢕⢎⢎⢮⢎⢯⢺⢸⢬⠣⢃⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const ax = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠠⠨⡐⠌⢆⢇⢧⢭⣣⡳⣵⢫⣳⢱⠱⢑⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const ay = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⡊⢌⢢⢡⢣⢪⡺⡪⡎⡎⡎⡚⣨⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const az = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠕⡅⢗⢕⡳⡭⣳⢕⠕⡱⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const ba = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠌⠄⠑⠩⢈⢂⣱⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const bb = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡀⢄⠄⣀⠄⡀⣀⢠⢄⣖⣖⣞⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
const bc = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣱⡐⡕⡕⡽⣝⣟⣮⣾⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿";
|
||||
console.log(
|
||||
`${o}\n${b}\n${a}\n${m}\n${a2}\n${aa}\n${ab}\n${ac}\n${ad}\n${ae}\n${af}\n${ag}\n${ah}\n${ai}\n${aj}\n${ak}\n${al}\n${am}\n${an}\n${ao}\n${ap}\n${aq}\n${ar}\n${a_}\n${at}\n${au}\n${av}\n${aw}\n${ax}\n${ay}\n${az}\n${ba}\n${bb}\n${bc}`
|
||||
);
|
||||
}
|
52
src/functions/pagination.ts
Normal file
52
src/functions/pagination.ts
Normal file
|
@ -0,0 +1,52 @@
|
|||
import { Message, MessageEmbed, User } from "discord.js";
|
||||
export class Pagination {
|
||||
constructor() {}
|
||||
public chunk(arr, size: number) {
|
||||
const temp = [];
|
||||
for (let i = 0; i < arr.length; i += size) {
|
||||
temp.push(arr.slice(i, i + size));
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
paginationEmojis = ["◀", "⛔", "▶"];
|
||||
|
||||
public async pagination(
|
||||
msg: Message,
|
||||
author: User,
|
||||
contents: MessageEmbed,
|
||||
init = true,
|
||||
currPage = 0
|
||||
) {
|
||||
if (init) for (const emoji of this.paginationEmojis) await msg.react(emoji);
|
||||
const filter = (reaction, user) => {
|
||||
return (
|
||||
this.paginationEmojis.includes(reaction.emoji.name) &&
|
||||
user.id === author.id
|
||||
);
|
||||
};
|
||||
const collector = msg.createReactionCollector({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 90000,
|
||||
});
|
||||
collector
|
||||
.on("collect", reaction => {
|
||||
reaction.users.remove(author);
|
||||
const emoji = reaction.emoji.name;
|
||||
if (emoji === this.paginationEmojis[0]) currPage--;
|
||||
if (emoji === this.paginationEmojis[1]) return collector.stop();
|
||||
if (emoji === this.paginationEmojis[2]) currPage++;
|
||||
currPage =
|
||||
((currPage % contents.length) + contents.length) % contents.length;
|
||||
const embed = msg.embeds[0]
|
||||
.setDescription(contents[currPage])
|
||||
.setFooter(`Page ${currPage + 1} of ${contents.length}`);
|
||||
msg.edit({ embeds: [embed] });
|
||||
this.pagination(msg, author, contents, false, currPage);
|
||||
})
|
||||
.on("end", (_, reason) => {
|
||||
if (["time", "user"].includes(reason)) msg.reactions.removeAll();
|
||||
});
|
||||
}
|
||||
}
|
8
src/functions/randint.ts
Normal file
8
src/functions/randint.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
/**
|
||||
* Returns a random number in range
|
||||
*/
|
||||
export function randint(max: number, min: number) {
|
||||
if (!max || !min) throw new CathError("Missing number");
|
||||
return Math.floor(Math.random() * (max - (min ? min : 0))) + (min ? min : 0);
|
||||
}
|
13
src/functions/randomID.ts
Normal file
13
src/functions/randomID.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
/**
|
||||
* Returns a random ID/String
|
||||
*/
|
||||
export function randomID(length: number) {
|
||||
if (!length) throw new CathError("Missing 'length'");
|
||||
var result = "";
|
||||
var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
for (var i = 0; i < length; i++) {
|
||||
result += c.charAt(Math.floor(Math.random() * c.length));
|
||||
}
|
||||
return result;
|
||||
}
|
31
src/functions/reddit.ts
Normal file
31
src/functions/reddit.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
/**
|
||||
* Sends an embed of reddit
|
||||
*/
|
||||
export async function getreddit(sub: string): Promise<RedditObject> {
|
||||
if (!sub) throw new CathError("Missing Subreddit");
|
||||
const content = await axios
|
||||
.get(`https://www.reddit.com/r/${sub}/random/.json`)
|
||||
.then(res => res.data);
|
||||
let permalink = content[0].data.children[0].data.permalink;
|
||||
let memeURL = `https://reddit.com${permalink}`;
|
||||
let memeImage = content[0].data.children[0].data.url;
|
||||
let memeTitle = content[0].data.children[0].data.title;
|
||||
let memeUpvotes = content[0].data.children[0].data.ups;
|
||||
let memeDownvotes = content[0].data.children[0].data.downs;
|
||||
let memeNumComments = content[0].data.children[0].data.num_comments;
|
||||
const obj: RedditObject = {
|
||||
title: memeTitle,
|
||||
url: memeURL,
|
||||
image: memeImage,
|
||||
footer: ` 👍 ${memeUpvotes} 💬 ${memeNumComments}`,
|
||||
};
|
||||
return obj;
|
||||
}
|
||||
export interface RedditObject {
|
||||
title: String;
|
||||
url: String;
|
||||
image: String;
|
||||
footer: String;
|
||||
}
|
6
src/functions/round.ts
Normal file
6
src/functions/round.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* Rounds a number to a specified number of decimal places.
|
||||
*/
|
||||
export function round(value: number, decimals: number) {
|
||||
return Number(Math.round(Number(value + "e" + decimals)) + "e-" + decimals);
|
||||
}
|
9
src/functions/selectRandom.ts
Normal file
9
src/functions/selectRandom.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
/**
|
||||
* Select a random element of the array
|
||||
*/
|
||||
export function selectRandom(array = []): any {
|
||||
if (!array) throw new CathError("Missing 'array'");
|
||||
if (!array.length) throw new CathError("array length can't be 0");
|
||||
return array[Math.floor(Math.random() * array.length)];
|
||||
}
|
9
src/functions/sleep.ts
Normal file
9
src/functions/sleep.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
export function sleep(ms: number) {
|
||||
if (!ms) throw new CathError("Missing 'ms'");
|
||||
let start = new Date().getTime();
|
||||
let end = start;
|
||||
while (end < start + ms) {
|
||||
end = new Date().getTime();
|
||||
}
|
||||
}
|
16
src/functions/superscript.ts
Normal file
16
src/functions/superscript.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import axios from "axios";
|
||||
import { CathError } from "../Error/CathError";
|
||||
import { config } from "../";
|
||||
/**
|
||||
* Sends a superscript-ed word
|
||||
*/
|
||||
export async function superscript(word: string): Promise<string> {
|
||||
if (!word) {
|
||||
throw new CathError("Missing 'word'");
|
||||
}
|
||||
const data = await axios
|
||||
.get(`${config.api}/api/v1/fun/superscript?text=${word}`)
|
||||
.then(res => res.data);
|
||||
console.log(data);
|
||||
return data.text;
|
||||
}
|
20
src/functions/timer.ts
Normal file
20
src/functions/timer.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
export function timer(timestamp: number) {
|
||||
if (!timestamp) throw new CathError("Missing 'timestamp");
|
||||
const timeLeft = timestamp;
|
||||
const days = Math.floor(timeLeft / 86400000);
|
||||
const hours = Math.floor(timeLeft / 3600000) - days * 24;
|
||||
const minutes = Math.floor(timeLeft / 60000) - days * 1440 - hours * 60;
|
||||
const seconds =
|
||||
Math.floor(timeLeft / 1000) - days * 86400 - hours * 3600 - minutes * 60;
|
||||
const mseconds = timeLeft / 1000 - days * 86400 - hours * 3600 - minutes * 60;
|
||||
let string = "";
|
||||
if (days) string = string + `${days} ${days == 1 ? "day " : "days "}`;
|
||||
if (hours) string = string + `${hours} ${hours == 1 ? "hour " : "hours "}`;
|
||||
if (minutes)
|
||||
string = string + `${minutes} ${minutes == 1 ? "minute " : "minutes "}`;
|
||||
if (seconds)
|
||||
string = string + `${seconds} ${seconds == 1 ? "second " : "seconds "}`;
|
||||
if (!string.length) string = `${mseconds.toFixed(1)} second`;
|
||||
return string;
|
||||
}
|
14
src/functions/trimArray.ts
Normal file
14
src/functions/trimArray.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { CathError } from "../Error/CathError";
|
||||
|
||||
/**
|
||||
* Trim an array from 10th elemnt
|
||||
*/
|
||||
export function trimArray(arr = []) {
|
||||
if (!arr) throw new CathError("Missing 'arr'");
|
||||
if (arr.length > 10) {
|
||||
const length = arr.length - 10;
|
||||
arr = arr.slice(0, 10);
|
||||
arr.push(`\n${length} more...`);
|
||||
}
|
||||
return arr.join(" **|** ");
|
||||
}
|
49
src/index.d.ts
vendored
Normal file
49
src/index.d.ts
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
export { CODMClient, CODMClientOptions, PerkData } from "./CODMClient";
|
||||
export {
|
||||
StarboardClient,
|
||||
StarboardClientOptions,
|
||||
StarboardGuild,
|
||||
StarboardGuildOptions,
|
||||
starMessageData,
|
||||
} from "./StarboardClient";
|
||||
export { CodeClient, CodeData } from "./CodeClient";
|
||||
export { URLClient, URLData } from "./URLClient";
|
||||
export {
|
||||
GiveawaysClient,
|
||||
GiveawaySchema,
|
||||
GiveawaysClientOptions,
|
||||
DefaultGiveawayMessages,
|
||||
} from "./GiveawaysClient";
|
||||
export { ImageClient } from "./ImageClient/index";
|
||||
export { random8ball } from "./functions/8ball";
|
||||
export { getreddit, RedditObject } from "./functions/reddit";
|
||||
export { Pagination } from "./functions/pagination";
|
||||
export { bool } from "./functions/bool";
|
||||
export { randint } from "./functions/randint";
|
||||
export { timer } from "./functions/timer";
|
||||
export { selectRandom } from "./functions/selectRandom";
|
||||
export { parseMS, parseString } from "./functions/ms";
|
||||
export { confirmation } from "./functions/confirmation";
|
||||
export { HHMMSS } from "./functions/HHMMSS";
|
||||
export { formatUpper } from "./functions/formatUpper";
|
||||
export { cleanText } from "./functions/cleanText";
|
||||
export { daysAgo } from "./functions/daysAgo";
|
||||
export { sleep } from "./functions/sleep";
|
||||
export { trimArray } from "./functions/trimArray";
|
||||
export { randomID } from "./functions/randomID";
|
||||
export {
|
||||
DiscordActivity,
|
||||
DiscordActivityOptions,
|
||||
Applications,
|
||||
} from "./functions/discord-activity";
|
||||
export { superscript } from "./functions/superscript";
|
||||
export { doublestruck } from "./functions/doublestruck";
|
||||
export { fractur } from "./functions/fractur";
|
||||
export { round } from "./functions/round";
|
||||
export {
|
||||
generatePassword,
|
||||
GeneratePasswordOptions,
|
||||
} from "./functions/generatePassword";
|
||||
export { getLilaseDownloads } from "./functions/getLilaseDownloads";
|
||||
export { emojify } from "./functions/emojify";
|
||||
export { obama } from "./functions/obama";
|
55
src/index.ts
Normal file
55
src/index.ts
Normal file
|
@ -0,0 +1,55 @@
|
|||
export {
|
||||
CODMClient,
|
||||
CODMClientOptions,
|
||||
PerkData,
|
||||
ScorestreakData,
|
||||
} from "./CODMClient";
|
||||
export {
|
||||
StarboardClient,
|
||||
StarboardClientOptions,
|
||||
StarboardGuild,
|
||||
StarboardGuildOptions,
|
||||
starMessageData,
|
||||
} from "./StarboardClient";
|
||||
export { CodeClient, CodeData } from "./CodeClient";
|
||||
export { URLClient, URLData } from "./URLClient";
|
||||
export {
|
||||
GiveawaysClient,
|
||||
GiveawaySchema,
|
||||
GiveawaysClientOptions,
|
||||
DefaultGiveawayMessages,
|
||||
} from "./GiveawaysClient";
|
||||
export { ImageClient } from "./ImageClient/index";
|
||||
export { random8ball } from "./functions/8ball";
|
||||
export { getreddit, RedditObject } from "./functions/reddit";
|
||||
export { Pagination } from "./functions/pagination";
|
||||
export { bool } from "./functions/bool";
|
||||
export { randint } from "./functions/randint";
|
||||
export { timer } from "./functions/timer";
|
||||
export { selectRandom } from "./functions/selectRandom";
|
||||
export { parseMS, parseString } from "./functions/ms";
|
||||
export { confirmation } from "./functions/confirmation";
|
||||
export { HHMMSS } from "./functions/HHMMSS";
|
||||
export { formatUpper } from "./functions/formatUpper";
|
||||
export {
|
||||
DiscordActivity,
|
||||
DiscordActivityOptions,
|
||||
Applications,
|
||||
} from "./functions/discord-activity";
|
||||
export { cleanText } from "./functions/cleanText";
|
||||
export { daysAgo } from "./functions/daysAgo";
|
||||
export { sleep } from "./functions/sleep";
|
||||
export { trimArray } from "./functions/trimArray";
|
||||
export { superscript } from "./functions/superscript";
|
||||
export { doublestruck } from "./functions/doublestruck";
|
||||
export { fractur } from "./functions/fractur";
|
||||
export { randomID } from "./functions/randomID";
|
||||
export { round } from "./functions/round";
|
||||
export {
|
||||
generatePassword,
|
||||
GeneratePasswordOptions,
|
||||
} from "./functions/generatePassword";
|
||||
export { getLilaseDownloads } from "./functions/getLilaseDownloads";
|
||||
export { emojify } from "./functions/emojify";
|
||||
export { obama } from "./functions/obama";
|
||||
export { ConfigURLS, config } from "./config";
|
20
tsconfig.json
Normal file
20
tsconfig.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext"],
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"target": "ESNext",
|
||||
"declaration": true,
|
||||
"outDir": "dist",
|
||||
"sourceMap": false,
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"skipLibCheck": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./src"],
|
||||
"exclude": ["./node_modules"]
|
||||
}
|
7
vercel.json
Normal file
7
vercel.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"git": {
|
||||
"deploymentEnabled": {
|
||||
"main": false
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue