Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
48c6dfc6f4 |
674
LICENSE
674
LICENSE
@@ -1,674 +0,0 @@
|
||||
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>.
|
191
README.md
191
README.md
@@ -1,191 +0,0 @@
|
||||
# 
|
||||
|
||||
ChatRD is a chat tool and/or overlay widget that unifies messages and events from **Twitch**, **YouTube**, **TikTok**, **Kick**, **Streamlabs**, **StreamElements**, **Patreon**, **TipeeeStream**, **Ko-Fi**, **Fourthwall** (and more to come).
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- 💬 **Multi-platform chat**
|
||||
- 💬 **Multi-language events**
|
||||
- 📊 **Events and Live stats**
|
||||
- 🎨 **Customizable**
|
||||
- 💾 **Saves your settings using localStorage and Streamer.Bot's Global Varaibles**
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Usage
|
||||
|
||||
Make sure your **Twitch** and **YouTube** accounts are connected on **Streamer.Bot** and you have **TikFinity Desktop App** installed and set up to your account on **TikTok**. **BOTH APPS NEED TO RUN ON THE SAME PC**.
|
||||
|
||||
### Streamer.Bot & TikFinity
|
||||
1. On **Streamer.Bot**, go to **Server/Clients → WebSocket Server** and make sure it is running
|
||||
2. Import the string inside the file [streamerbot-import.vortisrd](https://github.com/vortisrd/chatrd/blob/main/streamerbot-import.vortisrd) to your **Streamer.Bot** using the **Import** button at the top.
|
||||
3. Go to **Server/Clients → WebSocket Client** and make sure the *TikFinity* WebSocket is connected. If not, right-click on it and check *Auto-Connect* and *Reconnect* before clicking on *Connect*.
|
||||
4. Download [**TikFinity Desktop App**](https://tikfinity.zerody.one/) and make sure it's is opened and connected to your TikTok Account.
|
||||
5. Open the [Settings Page](https://vortisrd.github.io/chatrd) in your browser.
|
||||
6. Choose your desired options.
|
||||
7. Click **"Copy URL"**.
|
||||
8. Add the copied URL as a Browser Source in OBS. Or use it in your browser to read chat. 😊
|
||||
9. For **Streamlabs**, **StreamElements**, **Patreon**, **TipeeeStream**, **Ko-Fi** and **Fourthwall**, you need to connect them to your Streamer.Bot account to their website. Follow the tutorial links in each section presented in the [Settings Page](https://vortisrd.github.io/chatrd).
|
||||
|
||||
### TikTok Chat Setup
|
||||
To send messages to **TikTok** using the *Chat Field*, you need to the following on **TikFinity**:
|
||||
|
||||
1. Make sure you're connected to your TikTok Account on **TikFinity**. If you're not, go to **Setup → TikTok Login** and click on *Login to TikTok*.
|
||||
2. Go to **Setup → Streamer.Bot Connection** and type the IP and the PORT you're using on your **Streamer.Bot** and then click on *Test Connection*.
|
||||
|
||||

|
||||
|
||||
3. Go to **Chatbot → Streamer.Bot Messages** and enable *Allow Streamer.Bot to push messages to TikFinity*.
|
||||
|
||||

|
||||
|
||||
|
||||
### Kick.Bot installation on Streamer.Bot
|
||||
|
||||
1. First, [download Kick.Bot from Sehelitar's repo](https://github.com/Sehelitar/Kick.bot/releases/).
|
||||
2. Unzip and copy the DLLs from **Kick.Bot** to the *dlls folder* inside **Streamer.Bot**. If it's not there, create one (name it "dlls", lowercase).
|
||||
3. Import the action from *action.txt* file (inside the ZIP folder you just unzipped) to **Streamer.Bot**.
|
||||
4. Close **Streamer.Bot** and open it again. After a few seconds, a window will appear asking you to login on *Kick*.
|
||||
5. Done! 😊
|
||||
|
||||
If **Kick.Bot** stops sending events to ChatRD, delete it's dlls in the *dlls folder*, delete the imported **Kick.Bot** action and delete the *Streamer.bot.exe.WebView2* folder. After that, reinstall **Kick.Bot** using the above instructions.
|
||||
|
||||
|
||||
#### ⚠️ KICK IS A BETA FEATURE!
|
||||
Kick doesn't offer an API like Twitch does. It's not feasible for Streamer.Bot do it in an easy manner like Twitch, YouTube, Trovo, etc.
|
||||
|
||||
[Kick.Bot](https://github.com/Sehelitar/Kick.bot/releases/) does an excelent job but there is some information missing on the payload from Kick, like *avatars*, *badges (gift sub, community, etc), viewership, etc*. And there will be some errors or some misinformation being shown. I tried my best to emulate these.
|
||||
|
||||
I couldn't test every single outcome because it's not possible to simulate the events besides Chat. I followed [Kick.Bot's](https://github.com/Sehelitar/Kick.bot/releases/) documentation and hoped for the best. 🙏
|
||||
|
||||
Also, at any point either **Kick** or **Kick.Bot** might change their stuff, so please, **be patient!** 😊
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 🔊 How to set TTS with Speaker.Bot
|
||||
|
||||
### Speaker.Bot Setup
|
||||
1. Go to **Settings → WebSocket Server**, click on *Start Server*. Make sure to also tick the *Auto-Start* checkbox.
|
||||
2. Go to **Settings → Speech Engine** and add the TTS Service of your preference. (Sapi5 is the Windows default).
|
||||
3. Go to **Settings → Voice Aliases**, name the voice *SpeakerBot* and click **Add** right next to it.
|
||||
4. In the Left Column, click on the **SpeakerBot** you just added and on the **Speak!** section, select the voice you want to use and click **Add**. (If you're using Sapi5, I recommend using *Microsoft Zira Desktop* as a voice).
|
||||
|
||||
### Streamer.Bot Setup
|
||||
1. Import the [streamerbot-import.vortisrd](https://github.com/vortisrd/chatrd/blob/main/streamerbot-import.vortisrd) file to your **Streamer.Bot**. There's a new action that will handle the **Speaker.Bot** integration.
|
||||
2. Go to **Integrations → Speaker.Bot**, click on *Connect*. Make sure to also tick the *Auto-Start* and *Auto-Connect* checkboxes.
|
||||
|
||||
---
|
||||
|
||||
## 💻 Commands supported by the Chat Field
|
||||
|
||||
**Commands for Twitch**
|
||||
- /me (message)
|
||||
- /announce (message)
|
||||
- /clear
|
||||
- /slow (duration in seconds)
|
||||
- /slowoff
|
||||
- /subscribers
|
||||
- /subscribersoff
|
||||
- /commercial (duration in seconds)
|
||||
- /timeout (user) (duration) (reason)
|
||||
- /untimeout (user)
|
||||
- /ban (user) (reason)
|
||||
- /unban (user)
|
||||
- /mod (user)
|
||||
- /unmod (user)
|
||||
- /vip (user)
|
||||
- /unvip (user)
|
||||
- /shoutout (user)
|
||||
- /raid (user)
|
||||
- /unraid
|
||||
|
||||
**Commands for YouTube**
|
||||
- /yt/title (title)
|
||||
- /yt/description (description)
|
||||
- /yt/timeout (userID) (duration in seconds)
|
||||
- /yt/ban (userID)
|
||||
|
||||
**TikTok**
|
||||
- TikTok commands are not supported yet.
|
||||
|
||||
**Kick**
|
||||
- Kick commands are not supported yet.
|
||||
|
||||
---
|
||||
|
||||
## 📝 To-Do List
|
||||
|
||||
- Trovo
|
||||
- LivePix
|
||||
- Tipa.Ai
|
||||
|
||||
---
|
||||
|
||||
## ❓ Frequently Asked Questions
|
||||
**- Can I use it to read my chat?**
|
||||
R: Yes you can. You can open it on your browser, use it as a chat overlay and use it as a dock in OBS.
|
||||
|
||||
**- What about YouTube Members Emotes?**
|
||||
R: YouTube doesn't expose their Partner Emojis to Streamer.Bot. All you can do is add the emojis manually in ChatRD. Please [read this](https://github.com/vortisrd/chatrd#about-youtube-membership-emojis).
|
||||
|
||||
**- Can I set TTS to read only the events I want to read?**
|
||||
R: ChatRD only reads either chats, events or both. If you want to filter the events, [I suggest you setup Speaker.Bot separately](https://github.com/vortisrd/chatrd?tab=readme-ov-file#about-speakerbot-tts-customization).
|
||||
|
||||
**- TikTok events are not working anymore, what should I do?**
|
||||
R: Make sure your TikFinity is connected to your account and you are live. Also go to **Server/Clients → WebSocket Client** and make sure the TikFinity WebSocket is connected. [Instructions here](https://github.com/vortisrd/chatrd#streamerbot--tikfinity).
|
||||
|
||||
**- Kick events are not working anymore, what should I do?**
|
||||
R: Try reinstalling Kick.Bot [using the following methods](https://github.com/vortisrd/chatrd?tab=readme-ov-file#kickbot-installation-on-streamerbot).
|
||||
|
||||
**- Where are my Kick sub badges? And the X or Y badges?**
|
||||
R: At the moment of this post, the WebSocket I connect to show Kick's chat doesn't expose the Badges like Twitch does. Twitch mentions the badges and sends the URL, showing it [like this](https://i.imgur.com/xwg39hO.png). **Kick doesn't, showing on code [like this](https://i.imgur.com/OtMcDzI.png)**. You can see the person is subscribed and it's a sub gifter, but it doesn't show the specified badges. I did the best I could with the other badges. When Kick improves their API, I will revisit this later.
|
||||
|
||||
**- Can you add other streaming/payment platforms?**
|
||||
R: ChatRD uses Streamer.Bot to 95% of all platform iterations. *TikFinity* is perfectly integrated via WebSockets and *Kick.Bot* adds a decent integration. So if the platform has a decent WebSocket API (not WebHooks, those need a server to be usable) and/or has any integration with Streamer.Bot, please feel free to suggest it. Other than that, there are no plans to add more platforms.
|
||||
|
||||
**- Can I customize it?**
|
||||
R: If you mean visual styles, yes. [Read here](https://github.com/vortisrd/chatrd?tab=readme-ov-file#about-custom-styling).
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
## **⚠️ DISCLAIMERS ⚠️**
|
||||
|
||||
### About YouTube Membership Emojis
|
||||
I tried to add member emotes but **that is currently impossible due to YouTube's API not exposing Members Emotes and with that, Streamer.Bot won't be able to show them.**. So I've added a way for the users to add them manually at the overlay, with the data saved as a Streamer.Bot Global Variable.
|
||||
|
||||
What Casterlabs Caffeinated, Social Stream Ninja and Onecomme do to scrape the emotes won't work with the current way Streamer.Bot and my code works, so I had to choose between **making the user add them manually** or build a **server-sided executable (using NodeJS, Python or whatever) to read the chat as it's going or scrape the HTML code**. I don't want to add another executable on top of the user's flow, so it would be easier to use what it's currently available. **And no, I won't do any research based on what other tools do.** Tried to do that and wasted 1 week of my life doing it.
|
||||
|
||||
When YouTube decide to expose their Partner Emotes on their API, I'll come back to this.
|
||||
|
||||
### About Speaker.Bot TTS Customization
|
||||
If you want to customize what events the TTS reads, like "I want it to read sub notifications but I don't want it to read bits", it's possible. But doing that means adding an extra TTS switch for every single event for all platforms, making the setup page almost triplicate in size and bloat the code. **I won't do that**. I want to keep it simple and contained.
|
||||
|
||||
If you want to have TTS for events separately, I suggest you **Disable TTS Events** on ChatRD and setup Speaker.Bot with the things you want. 😊
|
||||
|
||||
### About Custom Styling
|
||||
The safest way to customize ChatRD is open either the Chat or the Config in your browser and use [it's Dev Tools](https://i.imgur.com/Nirwz5R.png) to look for the tags, their classes, identifiers and then style in the way you want. **You need basic CSS knowledge for that**.
|
||||
|
||||
After you finish it, paste the CSS inside the [Custom CSS field within Browser Source Property Window](https://i.imgur.com/BjvrV28.png).
|
||||
|
||||
### About Support on Changing the Javascript or other Core Files
|
||||
If you break it, you fix it. 😊
|
||||
|
||||
|
||||
---
|
||||
|
||||
## ✨ Credits
|
||||
|
||||
Made with ❤️ by **VortisRD**
|
||||
|
||||
🔗 [GitHub](https://github.com/vortisrd) • [Twitch](https://twitch.tv/vortisrd) • [YouTube](https://youtube.com/@vortisrd) • [TikTok](https://tiktok.com/@vortisrd) • [Kick](https://kick.com/vortisrd) • [Twitter / X](https://twitter.com/vortisrd)
|
||||
|
||||
Heavily inspired by [Nutty](https://nutty.gg)
|
||||
|
||||
🔗 [GitHub](https://github.com/nuttylmao) • [Twitch](https://twitch.tv/nutty) • [YouTube](https://youtube.com/@nuttylmao) • [TikTok](https://tiktok.com/@nuttylmao) • [Twitter / X](https://x.com/nuttylmao)
|
148
chat.html
148
chat.html
@@ -5,110 +5,132 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ChatRD</title>
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-notify@1.0.4/dist/simple-notify.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap">
|
||||
|
||||
<link rel="stylesheet" href="css/app.css?v=0.0.1">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@7.0.0/css/fontawesome.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-notify@1.0.4/dist/simple-notify.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css">
|
||||
|
||||
<link rel="stylesheet" href="css/chatrd.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="statistics">
|
||||
<div class="platform" id="twitch">
|
||||
<i class="fa-brands fa-twitch"></i>
|
||||
<img src="images/logo-twitch.svg" alt="">
|
||||
<span class="viewers"><i class="fa-solid fa-user"></i> <span>0</span></span>
|
||||
</div>
|
||||
|
||||
<div class="platform" id="youtube">
|
||||
<i class="fa-brands fa-youtube"></i>
|
||||
<img src="images/logo-youtube.svg" alt="">
|
||||
<span class="viewers"><i class="fa-solid fa-user"></i> <span>0</span></span>
|
||||
<span class="likes"><i class="fa-solid fa-thumbs-up"></i> <span>0</span></span>
|
||||
</div>
|
||||
|
||||
<div class="platform" id="tiktok">
|
||||
<i class="fa-brands fa-tiktok"></i>
|
||||
<img src="images/logo-tiktok.svg" alt="">
|
||||
<span class="viewers"><i class="fa-solid fa-user"></i> <span>0</span></span>
|
||||
<span class="likes"><i class="fa-solid fa-heart"></i> <span>0</span></span>
|
||||
</div>
|
||||
|
||||
<div class="platform" id="kick">
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 800 800">
|
||||
<polygon class="st0" points="336 111 336 239 401 239 401 175 465 175 465 111 657 111 657 303 593 303 593 367 529 367 529 432 593 432 593 496 657 496 657 689 465 689 465 624 401 624 401 560 336 560 336 689 143 689 143 111 336 111"/>
|
||||
</svg>
|
||||
|
||||
<img src="images/logo-kick.svg" alt="">
|
||||
<span class="viewers"><i class="fa-solid fa-user"></i> <span>0</span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="container">
|
||||
<div class="wrapper">
|
||||
<div id="chat">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="chat-input">
|
||||
<!--<div id="chat-input">
|
||||
<div id="chat-autocomplete-list"></div>
|
||||
|
||||
<div class="settings">
|
||||
<div class="chat-enabler" id="twitch">
|
||||
<img src="images/logo-twitch.svg" alt="">
|
||||
<label class="switch"><input type="checkbox" name="chatOnTwitch" checked><span class="slider"></span></label>
|
||||
</div>
|
||||
<div class="chat-enabler" id="youtube">
|
||||
<img src="images/logo-youtube.svg" alt="">
|
||||
<label class="switch"><input type="checkbox" name="chatOnYouTube" checked><span class="slider"></span></label>
|
||||
</div>
|
||||
<div class="chat-enabler" id="tiktok">
|
||||
<img src="images/logo-tiktok.svg" alt="">
|
||||
<label class="switch"><input type="checkbox" name="chatOnTiktok"><span class="slider"></span></label>
|
||||
<span class="hint"><a title="Chat only. Needs setup. Click here to know how." href="https://github.com/vortisrd/chatrd/tree/main?tab=readme-ov-file#tiktok-chat-setup" target="_blank"><i class="fa-solid fa-circle-info"></i></a></span>
|
||||
</div>
|
||||
<div class="chat-enabler" id="kick">
|
||||
<img src="images/logo-kick.svg" alt="">
|
||||
<label class="switch"><input type="checkbox" name="chatOnKick"><span class="slider"></span></label>
|
||||
<span class="hint"><a title="Chat only. Needs setup. Click here to know how." href="https://github.com/vortisrd/chatrd/tree/main?tab=readme-ov-file#kickbot-installation-on-streamerbot" target="_blank"><i class="fa-solid fa-circle-info"></i></a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form>
|
||||
<input type="text">
|
||||
</form>
|
||||
|
||||
<button id="chat-input-send"><i class="fa-solid fa-paper-plane"></i></button>
|
||||
<button id="chat-input-settings"><i class="fa-solid fa-gear"></i></button>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.1.5/dist/purify.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<template id="chat-message">
|
||||
|
||||
<div id="" data-user="" class="item">
|
||||
|
||||
<div class="header">
|
||||
<div class="first-message">✨</div>
|
||||
<div class="shared-chat"></div>
|
||||
</div>
|
||||
|
||||
<div class="body">
|
||||
<div class="profile">
|
||||
<img src="" alt="">
|
||||
</div>
|
||||
|
||||
<div class="message">
|
||||
<div class="info">
|
||||
<span class="time"></span>
|
||||
<span class="platform"></span>
|
||||
<span class="badges"></span>
|
||||
<span class="user"></span>
|
||||
</div>
|
||||
<div class="actual-message">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
<template id="event-message">
|
||||
|
||||
<div id="" data-user="" class="event">
|
||||
|
||||
<div class="header">
|
||||
<div class="image"></div>
|
||||
</div>
|
||||
|
||||
<div class="body">
|
||||
<div class="message">
|
||||
<div class="info">
|
||||
<span class="platform"></span>
|
||||
<span class="user"></span>
|
||||
<span class="action"></span>
|
||||
<span class="value"></span>
|
||||
</div>
|
||||
<div class="actual-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@7.0.0/js/fontawesome.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/simple-notify@1.0.4/dist/simple-notify.min.js"></script>
|
||||
<script src="https://unpkg.com/@streamerbot/client/dist/streamerbot-client.js"></script>
|
||||
|
||||
<script src="js/lang/ptbr.js"></script>
|
||||
<script src="js/lang/en.js"></script>
|
||||
<script src="js/lang/es.js"></script>
|
||||
|
||||
<script src="js/lang/lang.js"></script>
|
||||
|
||||
<script src="js/app-mockup.js?v=0.0.4"></script>
|
||||
<script src="js/app.js?v=0.0.4"></script>
|
||||
|
||||
<script src="js/twitch/module.js?v=0.0.4"></script>
|
||||
<script src="js/youtube/module.js"></script>
|
||||
<script src="js/tiktok/module.js"></script>
|
||||
<script src="js/kick/module.js"></script>
|
||||
<script src="js/patreon/module.js"></script>
|
||||
<script src="js/tipeeestream/module.js"></script>
|
||||
<script src="js/kofi/module.js"></script>
|
||||
<script src="js/fourthwall/module.js"></script>
|
||||
|
||||
<script src="js/streamlabs/module.js"></script>
|
||||
<script src="js/streamelements/module.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.2.6/dist/purify.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@streamerbot/client@1.12.1/dist/streamerbot-client.min.js"></script>
|
||||
|
||||
<script src="js/lang.js"></script>
|
||||
<script src="js/sb.js"></script>
|
||||
<script src="js/chatrd.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
871
css/app.css
871
css/app.css
@@ -1,871 +0,0 @@
|
||||
/* Basic reset and styling */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sn-notify-outline { --sn-notify-background-color: #27272a; }
|
||||
.sn-notify-outline .sn-notify-title { --sn-notify-title-color: #FFFFFF; }
|
||||
.sn-notify-outline .sn-notify-text { --sn-notify-text-color: rgba(255,255,255,0.5); }
|
||||
|
||||
/* Full-page container styling */
|
||||
html {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
font-family: "Inter", sans-serif;
|
||||
scroll-behavior: smooth;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
#container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
#chat {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column-reverse; /* conteúdo começa no fundo */
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
scrollbar-color: #555 #1e1e1e;
|
||||
}
|
||||
|
||||
#chat.noscrollbar {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
#chat::-webkit-scrollbar { width: 8px; }
|
||||
#chat::-webkit-scrollbar-track { background: #1e1e1e; }
|
||||
#chat::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; border: 2px solid #1e1e1e; }
|
||||
#chat::-webkit-scrollbar-thumb:hover { background-color: #777; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message {
|
||||
position: relative;
|
||||
color: #FFF;
|
||||
font-size: 18px;
|
||||
line-height: 150%;
|
||||
text-shadow: 2px 2px 2px rgba(0,0,0,0.75);
|
||||
transition: all ease-in-out 300ms;
|
||||
margin: 5px 0;
|
||||
padding-bottom: 4px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#chat .message:not(.event):hover {
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
#chat .message img {
|
||||
height: 22px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#chat .message.bigger-emojis img.emote {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
#chat .message .text img.gigantify {
|
||||
height: 84px !important;
|
||||
display: block;
|
||||
margin: 10px 0 5px 0;
|
||||
}
|
||||
|
||||
#chat .message .user { font-weight: bold; }
|
||||
|
||||
#chat .message .user .pronouns {
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 12px;
|
||||
color: #FFF;
|
||||
background: rgba(0,0,0,0.5);
|
||||
|
||||
|
||||
margin: 0 5px;
|
||||
padding: 5px 7px;
|
||||
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#chat .message .time {
|
||||
display: inline-block;
|
||||
background: rgba(0,0,0,0.5);
|
||||
font-size: 12px;
|
||||
padding: 0px 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#chat .message .avatar {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
margin: 2px 0px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
overflow: hidden;
|
||||
border-radius: 100px;
|
||||
transform: translateY(11px);
|
||||
}
|
||||
|
||||
#chat .message .avatar img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
#chat .message .platform {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.25));
|
||||
transform: translateY(6px);
|
||||
}
|
||||
|
||||
#chat .message .badges i {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: #000;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font-size: 12px;
|
||||
border-radius: 5px;
|
||||
margin: 0 5px 0 0;
|
||||
text-shadow: 2px 2px 2px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
#chat .message .reply {
|
||||
max-width: 100%;
|
||||
flex-basis: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
display: block;
|
||||
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#chat .message .reply i {
|
||||
transform: rotate(90deg);
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
|
||||
#chat .message .shared {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
display: block;
|
||||
text-shadow: none;
|
||||
font-size: 14px;
|
||||
margin: 10px 0 -5px 0;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#chat .message .shared i {
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
|
||||
#chat .message.event {
|
||||
text-shadow: 2px 2px 2px rgba(0,0,0,0.25);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
|
||||
#chat .message.event .platform {
|
||||
transform: translateY(0px);
|
||||
margin: 0px 5px 0 0;
|
||||
}
|
||||
|
||||
#chat .message.event > div {
|
||||
padding: 5px 15px 5px 5px;
|
||||
margin: 2px 0 0 0;
|
||||
border-radius: 5px;
|
||||
background: rgba(0,0,0,0.15);
|
||||
display: inline-flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
#chat .message:not(.event) > div {
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
|
||||
#chat .message.twitch .shared span {
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
padding: 2px 10px 2px 5px;
|
||||
background: rgba(169,112,255,0.85);
|
||||
background: linear-gradient(180deg, rgba(169,112,255,0.85) 0%, rgba(95,67,138,0.85) 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
#chat .message.twitch.first-message > div {
|
||||
background: rgba(18,18,18,0.5);
|
||||
background: linear-gradient(180deg, rgba(18,18,18,0.5) 1%, rgba(0,0,0,0.5) 100%);
|
||||
padding: 0px 15px 13px 15px;
|
||||
border-radius: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#chat .message.twitch.first-message > div .first-chatter {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
#chat .message.twitch .badges img { margin: 0 2px; }
|
||||
#chat .message.twitch.event > div {
|
||||
background: rgba(169,112,255,0.85);
|
||||
background: linear-gradient(180deg, rgba(169,112,255,0.85) 0%, rgba(95,67,138,0.85) 100%);
|
||||
}
|
||||
|
||||
#chat .message.twitch.announcement > div {
|
||||
padding: 10px 15px 13px 10px;
|
||||
display: inline-block;
|
||||
border-bottom: 2px solid #ffcc00;
|
||||
background: rgba(18,18,18,0.85);
|
||||
background: linear-gradient(180deg, rgba(18,18,18,0.85) 1%, rgba(0,0,0,0.85) 100%);
|
||||
}
|
||||
|
||||
#chat .message.twitch.announcement .reply {
|
||||
padding: 2px;
|
||||
color: #ffcc00;
|
||||
}
|
||||
|
||||
#chat .message.twitch.announcement .reply i {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
#chat .message.twitch.announcement .platform {
|
||||
transform: translateY(6px);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#chat .message.twitch.rewards-redemption > div {
|
||||
padding: 10px 15px 13px 10px;
|
||||
display: inline-block;
|
||||
border-bottom: 2px solid #ffcc00;
|
||||
background: rgba(18,18,18,0.85);
|
||||
background: linear-gradient(180deg, rgba(18,18,18,0.85) 1%, rgba(0,0,0,0.85) 100%);
|
||||
}
|
||||
#chat .message.twitch.rewards-redemption .reply {
|
||||
padding: 2px;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
#chat .message.twitch.rewards-redemption .reply i {
|
||||
transform: rotate(0deg);
|
||||
color: #ffcc00;
|
||||
}
|
||||
|
||||
#chat .message.twitch.rewards-redemption .platform {
|
||||
transform: translateY(6px);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.youtube.event .platform { color: #FFF; }
|
||||
#chat .message.youtube.event > div {
|
||||
background: rgba(255,0,0,0.85);
|
||||
background: linear-gradient(180deg, rgba(255,0,0,0.85) 1%, rgba(136,0,0,0.85) 100%);
|
||||
}
|
||||
|
||||
|
||||
#chat .message.youtube.owner .user {
|
||||
background: #ffd600;
|
||||
color: #121212 !important;
|
||||
border-radius: 5px;
|
||||
padding: 2px 5px;
|
||||
margin-right: 5px;
|
||||
text-shadow: 2px 2px 2px rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
#chat .message.youtube.owner .badges i.fa-solid.fa-video { background: #ff0000 }
|
||||
|
||||
#chat .message.youtube.mod .user { color: #5e84f1 !important; }
|
||||
#chat .message.youtube.mod .badges i.fa-solid.fa-wrench { background: #5e84f1 }
|
||||
|
||||
#chat .message.youtube.sub .user { color: #2ba640 !important; }
|
||||
#chat .message.youtube.sub .badges i.fa-solid.fa-star { background: #2ba640; }
|
||||
|
||||
#chat .message.youtube .badges i.fa-solid.fa-check { background: #999; }
|
||||
|
||||
|
||||
#chat .message.youtube.event.supersticker > div .platform { order: 1; }
|
||||
#chat .message.youtube.event.supersticker > div .sticker {
|
||||
order: 2;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
filter: drop-shadow(0px 0px 6px rgba(0,0,0,1));
|
||||
padding: 5px 10px 5px 0;
|
||||
}
|
||||
#chat .message.youtube.event.supersticker > div .sticker img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#chat .message.youtube.event.supersticker > div .info { order: 3; }
|
||||
#chat .message.youtube.event.supersticker.giantsupersticker > div {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
#chat .message.youtube.event.supersticker.giantsupersticker > div .platform { order: 2; }
|
||||
#chat .message.youtube.event.supersticker.giantsupersticker > div .sticker {
|
||||
order: 1;
|
||||
flex: 0 0 100%;
|
||||
height: 148px;
|
||||
text-align: center;
|
||||
margin: 10px 0;
|
||||
}
|
||||
#chat .message.youtube.event.supersticker.giantsupersticker > div .sticker img {
|
||||
width: 148px;
|
||||
height: 148px;
|
||||
}
|
||||
#chat .message.youtube.event.supersticker.giantsupersticker > div .info { order: 3; }
|
||||
|
||||
|
||||
|
||||
#chat .message.streamlabs.event > div {
|
||||
background: rgba(128,245,210,0.85);
|
||||
background: linear-gradient(180deg, rgba(128,245,210,0.85) 1%, rgba(8,108,78,0.85) 100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#chat .message.streamelements.event > div {
|
||||
background: rgba(39,0,255,0.85);
|
||||
background: linear-gradient(180deg, rgba(39,0,255,0.85) 1%, rgba(13,0,88,0.85) 100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.tiktok.event > div {
|
||||
background: rgba(255,0,80,0.85);
|
||||
background: linear-gradient(180deg, rgba(255,0,80,0.85) 1%, rgba(120,0,38,0.85) 100%);
|
||||
}
|
||||
|
||||
#chat .message.tiktok.mod .badges i.fa-solid.fa-wrench {
|
||||
background: #121212;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.kick .badges svg {
|
||||
width: 20px;
|
||||
transform: translateY(4px);
|
||||
}
|
||||
|
||||
#chat .message.kick .badges i.sub {
|
||||
margin: 0;
|
||||
color: #48d415;
|
||||
}
|
||||
|
||||
#chat .message.kick.event > div {
|
||||
background: #48d415;
|
||||
background: linear-gradient(180deg,rgba(72, 212, 21, 1) 0%, rgba(39, 145, 0, 1) 100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.patreon.event > div {
|
||||
background: #ff5900;
|
||||
background: linear-gradient(180deg,rgba(255, 89, 0, 1) 0%, rgba(199, 70, 0, 1) 100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.tipeeestream.event > div {
|
||||
background: #E02F44;
|
||||
background: linear-gradient(180deg,rgba(224, 47, 68, 1) 0%, rgba(140, 35, 47, 1) 100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.kofi.event > div {
|
||||
background: #72A5F2;
|
||||
background: linear-gradient(180deg,rgba(114, 165, 242, 1) 0%, rgba(81, 115, 166, 1) 100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.fourthwall.event.order > div .platform { order: 1; }
|
||||
#chat .message.fourthwall.event.order > div .image {
|
||||
order: 2;
|
||||
width: max-content;
|
||||
height: 72px;
|
||||
filter: drop-shadow(0px 0px 6px rgba(0,0,0,0.25));
|
||||
padding: 5px 10px 5px 0;
|
||||
}
|
||||
#chat .message.fourthwall.event.order > div .image img {
|
||||
width: max-content;
|
||||
height: 100%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
#chat .message.fourthwall.event.order > div .info { order: 3; }
|
||||
#chat .message.fourthwall.event.order.giantimage > div {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
#chat .message.fourthwall.event.order.giantimage > div .platform { order: 2; }
|
||||
#chat .message.fourthwall.event.order.giantimage > div .image {
|
||||
order: 1;
|
||||
flex: 0 0 100%;
|
||||
height: 202px;
|
||||
text-align: center;
|
||||
margin: 10px 0;
|
||||
}
|
||||
#chat .message.fourthwall.event.order.giantimage > div .image img {
|
||||
width: max-content;
|
||||
height: 192px;
|
||||
}
|
||||
#chat .message.fourthwall.event.order.giantimage > div .info { order: 3; }
|
||||
|
||||
#chat .message.fourthwall.event > div {
|
||||
background: #0044ff;
|
||||
background: linear-gradient(180deg,rgba(0, 68, 255, 1) 0%, rgba(0, 47, 176, 1) 100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.wrapper.horizontal {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.wrapper.horizontal #chat {
|
||||
flex-direction: row-reverse;
|
||||
align-items: flex-end;
|
||||
gap: 15px;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
.wrapper.horizontal #chat .message {
|
||||
width: 0;
|
||||
white-space: nowrap
|
||||
}
|
||||
|
||||
.wrapper.horizontal #chat .message > div {
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#chat .message.twitch:hover .chatmoderation.twitch {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#chat .message .chatmoderation {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 2px 3px;
|
||||
background: #262626;
|
||||
border-radius: 5px;
|
||||
transition: all ease-in-out 300ms;
|
||||
}
|
||||
|
||||
#chat .message .chatmoderation button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #FFF;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
padding: 5px;
|
||||
transition: all ease-in-out 300ms;
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
#chat .message .chatmoderation {
|
||||
color: #ffcc00;
|
||||
}
|
||||
|
||||
#chat .message.twitch:hover .chatmoderation.twitch {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#chat .message.youtube:hover .chatmoderation.youtube {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
#chat .message.streamer .chatmoderation button:nth-child(2),
|
||||
#chat .message.streamer .chatmoderation button:nth-child(3),
|
||||
#chat .message.owner .chatmoderation {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#chat-input {
|
||||
padding: 15px 10px;
|
||||
position: relative;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#chat-input.enabled {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#chat-input input[type=text] {
|
||||
font-family: "Inter", sans-serif;
|
||||
border: none;
|
||||
background: #222;
|
||||
color: #FFF;
|
||||
padding: 10px 90px 10px 15px;
|
||||
border-radius: 10px;
|
||||
outline: none;
|
||||
font-size: 16px;
|
||||
width: 100%;
|
||||
transition: all ease-in-out 300ms;
|
||||
}
|
||||
|
||||
#chat-input button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #FFF;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
padding: 5px;
|
||||
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
#chat-input button.active,
|
||||
#chat-input button:hover {
|
||||
color: #ffcc00;
|
||||
}
|
||||
|
||||
#chat-input #chat-input-settings i {
|
||||
transition: all ease-in-out 300ms;
|
||||
}
|
||||
|
||||
#chat-input #chat-input-send {
|
||||
right: 60px;
|
||||
}
|
||||
|
||||
#chat-input #chat-input-settings {
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
#chat-input #chat-input-settings.active i {
|
||||
transform: rotate(60deg);
|
||||
}
|
||||
|
||||
#chat-input .settings {
|
||||
display: none;
|
||||
background: #0c0c0c;
|
||||
padding: 5px 10px;
|
||||
border-radius: 100px;
|
||||
|
||||
position: absolute;
|
||||
top: -40px;
|
||||
right: 0px;
|
||||
z-index: 11;
|
||||
|
||||
box-shadow: 0 0 10px rgba(255,255,255,0.05)
|
||||
}
|
||||
|
||||
#chat-input .settings.active {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#chat-input .settings::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -10px; /* posiciona fora do balão */
|
||||
right: 25px; /* onde a pontinha aparece horizontalmente */
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 10px solid transparent;
|
||||
border-right: 10px solid transparent;
|
||||
border-top: 10px solid #0c0c0c; /* mesma cor do balão */
|
||||
}
|
||||
|
||||
#chat-input .settings img {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
|
||||
#chat-input .chat-enabler {
|
||||
display: inline-flex;
|
||||
padding: 5px;
|
||||
gap: 5px;
|
||||
color: #FFF;
|
||||
font-size: 14px;
|
||||
align-items: center;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#chat-input .settings .switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#chat-input .settings .hint {
|
||||
color: #FFF;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
#chat-input .settings .hint a {
|
||||
color: #ffcc00;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Hide default HTML checkbox */
|
||||
#chat-input .settings .switch input[type=checkbox] {
|
||||
opacity: 1;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* The slider */
|
||||
#chat-input .settings .slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #CCC;
|
||||
transition: .4s;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
#chat-input .settings .slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 16px;
|
||||
left: 3px;
|
||||
top: 2px;
|
||||
bottom: 0;
|
||||
background-color: white;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
#chat-input .settings input[type=checkbox]:checked + .slider:before {
|
||||
transform: translateX(19px);
|
||||
}
|
||||
|
||||
#chat-input #twitch input[type=checkbox]:checked + .slider {
|
||||
background-color: #a970ff;
|
||||
}
|
||||
#chat-input #youtube input[type=checkbox]:checked + .slider {
|
||||
background-color: #FF0000;
|
||||
}
|
||||
#chat-input #tiktok input[type=checkbox]:checked + .slider {
|
||||
background-color: #ff0050;
|
||||
}
|
||||
#chat-input #kick input[type=checkbox]:checked + .slider {
|
||||
background-color: #48d415;
|
||||
}
|
||||
|
||||
|
||||
#chat-input .settings input[type=checkbox]:checked + .slider {
|
||||
background-color: #03c4de;
|
||||
}
|
||||
#chat-input .setting input[type=checkbox]:disabled + .slider {
|
||||
background-color: #000 !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#chat-autocomplete-list {
|
||||
position: absolute;
|
||||
bottom: 65px;
|
||||
left: 10px;
|
||||
width: calc(100% - 40px);
|
||||
border-radius: 10px;
|
||||
background: #222;
|
||||
color: #FFF;
|
||||
|
||||
max-height: 300px;
|
||||
overflow: hidden;
|
||||
overflow-y: visible;
|
||||
|
||||
font-size: 14px;;
|
||||
|
||||
color: #696969;
|
||||
}
|
||||
|
||||
#chat-autocomplete-list::-webkit-scrollbar { width: 10px; }
|
||||
#chat-autocomplete-list::-webkit-scrollbar-track { background: #1e1e1e; }
|
||||
#chat-autocomplete-list::-webkit-scrollbar-thumb { background-color: #555; border-radius: 10px; border: 2px solid #1e1e1e; }
|
||||
#chat-autocomplete-list::-webkit-scrollbar-thumb:hover { background-color: #777; }
|
||||
|
||||
#chat-autocomplete-list div {
|
||||
margin: 5px 10px;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#chat-autocomplete-list div.autocomplete-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#chat-autocomplete-list div:not(.autocomplete-item) {
|
||||
background: #191919;
|
||||
color: #FFF;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#chat-autocomplete-list .autocomplete-item strong {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#chat-autocomplete-list .autocomplete-item:hover,
|
||||
#chat-autocomplete-list .autocomplete-item.active {
|
||||
color: #FFF;
|
||||
background: #292929;
|
||||
}
|
||||
|
||||
#chat-autocomplete-list .autocomplete-item small {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
|
||||
#statistics {
|
||||
position: fixed;
|
||||
z-index: 11;
|
||||
width: 100%;
|
||||
top: 0; left: 0;
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
justify-content: flex-end;
|
||||
backdrop-filter: blur(5px);
|
||||
font-weight: bold;
|
||||
-webkit-mask-image: linear-gradient(to top, transparent, black 40%);
|
||||
mask-image: linear-gradient(to top, transparent, black 40%);
|
||||
text-shadow: 2px 2px 2px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
|
||||
#statistics .platform {
|
||||
background: #000;
|
||||
color: #FFF;
|
||||
padding: 5px 10px;
|
||||
border-radius: 100px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
#statistics .platform i.fa-brands {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#statistics .platform > span {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
#statistics .platform#twitch {
|
||||
background: #a970ff;
|
||||
}
|
||||
|
||||
#statistics .platform#youtube {
|
||||
background: #FF0000;
|
||||
}
|
||||
|
||||
#statistics .platform#tiktok {
|
||||
background: #ff0050;
|
||||
}
|
||||
|
||||
#statistics .platform#kick {
|
||||
background: #48d415;
|
||||
}
|
||||
|
||||
#statistics .platform#kick svg {
|
||||
width: 24px;
|
||||
fill: #FFF;
|
||||
filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.25));
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
#statistics {
|
||||
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
gap: 5px;
|
||||
text-shadow: 2px 2px 2px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
#statistics .platform {
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
#statistics .platform#kick svg {
|
||||
width: 18px;
|
||||
filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.5));
|
||||
}
|
||||
}
|
61
css/chatrd.css
Normal file
61
css/chatrd.css
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Basic reset and styling */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sn-notify-outline { --sn-notify-background-color: #27272a; }
|
||||
.sn-notify-outline .sn-notify-title { --sn-notify-title-color: #FFFFFF; }
|
||||
.sn-notify-outline .sn-notify-text { --sn-notify-text-color: rgba(255,255,255,0.5); }
|
||||
|
||||
.sn-notify-outline { --sn-notify-background-color: #27272a; }
|
||||
.sn-notify-outline .sn-notify-title { --sn-notify-title-color: #FFFFFF; }
|
||||
.sn-notify-outline .sn-notify-text { --sn-notify-text-color: rgba(255,255,255,0.5); }
|
||||
|
||||
/* Full-page container styling */
|
||||
html {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
font-family: "Inter", sans-serif;
|
||||
scroll-behavior: smooth;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
#container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#container .wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#chat {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
scrollbar-color: #555 #1e1e1e;
|
||||
}
|
||||
|
||||
#chat.noscrollbar {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
#chat::-webkit-scrollbar { width: 8px; }
|
||||
#chat::-webkit-scrollbar-track { background: #1e1e1e; }
|
||||
#chat::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; border: 2px solid #1e1e1e; }
|
||||
#chat::-webkit-scrollbar-thumb:hover { background-color: #777; }
|
580
css/settings.css
580
css/settings.css
@@ -1,580 +0,0 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Inter", sans-serif;
|
||||
scroll-behavior: smooth;
|
||||
overflow-wrap: break-word;
|
||||
background-color: #121212;
|
||||
color: #FFF;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
a { color: #ffcc00; }
|
||||
|
||||
hr {
|
||||
border: 1px solid #222;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 20px;
|
||||
padding: 15px 30px;
|
||||
border-bottom: 1px solid #222;
|
||||
margin: 15px 0 0 0;
|
||||
text-align: left;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
h2 i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
h2 svg {
|
||||
width: 26px;
|
||||
vertical-align: bottom;
|
||||
fill: #FFF;
|
||||
}
|
||||
|
||||
h2 img {
|
||||
width: 26px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
h2 button {
|
||||
display: none;
|
||||
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
transform: translateY(-50%);
|
||||
|
||||
border: none;
|
||||
background: black;
|
||||
text-align: center;
|
||||
color: #FFF;
|
||||
cursor: pointer;
|
||||
|
||||
font-size: 16px;
|
||||
padding: 10px;
|
||||
border-radius: 100px;
|
||||
}
|
||||
|
||||
h2 button i {
|
||||
margin: 0;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
|
||||
.accordion-container {
|
||||
/*max-height: 0;
|
||||
overflow: hidden;*/
|
||||
transition: max-height 0.4s ease;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#chat-divided {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
gap: 30px;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
#chat-settings { width: 640px; }
|
||||
#chat-preview { width: calc(100% - 640px); }
|
||||
|
||||
#chat-settings h1 {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
background: url('../images/logo-chatrd.png') center center no-repeat;
|
||||
background-size: cover;
|
||||
margin: auto;
|
||||
text-indent: -9999px;
|
||||
}
|
||||
|
||||
#chat-preview iframe {
|
||||
position: sticky;
|
||||
top: 30px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: calc(100vh - 60px);
|
||||
}
|
||||
|
||||
.url-bar {
|
||||
margin: 0 0 20px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.url-bar input[type=text] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.url-bar button {
|
||||
font-family: "Inter", sans-serif;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
padding: 15px 30px;
|
||||
margin-top: 10px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
background: #252525;
|
||||
color: #FFF;
|
||||
transition: .4s;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.url-bar button:hover {
|
||||
background: #292929;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
border-radius: 0 0 20px 20px;
|
||||
background: #171717;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
margin: 0 0 30px 0;
|
||||
}
|
||||
|
||||
.tab-content .wrapper {
|
||||
padding: 20px 30px;
|
||||
}
|
||||
|
||||
/* When visible */
|
||||
.tab-content.open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.tab-content .setting {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 5px 0px;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tab-content .setting.column {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tab-content .setting.column label {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tab-content .setting.column .emote-list {
|
||||
width:100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap; /* allow items to wrap */
|
||||
gap: 10px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.tab-content .setting.column .emote-list .emote-item {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
background: #222;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.tab-content .setting.column .emote-list .emote-item button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
transition: .4s;
|
||||
|
||||
text-align: center;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tab-content .setting.column .emote-list .emote-item button.add {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
right: unset;
|
||||
|
||||
transform: translate(-50%,-50%);
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
.tab-content .setting.column .emote-list .emote-item button.add:hover {
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
.tab-content .setting.column .emote-list .emote-item button.add i {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
.tab-content .setting.column .emote-list .emote-item em {
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.tab-content .setting.column .emote-list .emote-item img {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
|
||||
.tab-content .setting i {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.tab-content .setting i.fa-arrow-turn-up {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
|
||||
.tab-content .setting small { color: #777; }
|
||||
|
||||
.tab-content .setting input[type=text],
|
||||
.tab-content .setting input[type=number],
|
||||
.tab-content .setting textarea {
|
||||
font-family: "Inter", sans-serif;
|
||||
border: none;
|
||||
background:#222;
|
||||
color: #FFF;
|
||||
padding: 10px 20px;
|
||||
border-radius: 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.tab-content .setting textarea {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.tab-content .setting.select select {
|
||||
font-family: "Inter", sans-serif;
|
||||
border: none;
|
||||
background:#222;
|
||||
color: #FFF;
|
||||
padding: 10px 20px 10px 10px;
|
||||
border-radius: 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.tab-content .setting .switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 50px;
|
||||
height: 27px;
|
||||
}
|
||||
|
||||
/* Hide default HTML checkbox */
|
||||
.tab-content .setting .switch input[type=checkbox] {
|
||||
opacity: 1;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* The slider */
|
||||
.tab-content .setting .slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #CCC;
|
||||
transition: .4s;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
.tab-content .setting .slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 1.3em;
|
||||
width: 1.2em;
|
||||
border-radius: 16px;
|
||||
left: 5px;
|
||||
top: 3px;
|
||||
bottom: 0;
|
||||
background-color: white;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.tab-content .setting input[type=color] {
|
||||
background: #111;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.tab-content .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #03c4de;
|
||||
}
|
||||
|
||||
.tab-content .setting input[type=checkbox]:checked + .slider:before {
|
||||
transform: translateX(1.4em);
|
||||
}
|
||||
|
||||
.tab-content#twitch .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #a970ff;
|
||||
}
|
||||
.tab-content#youtube .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #FF0000;
|
||||
}
|
||||
.tab-content#tiktok .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #ff0050;
|
||||
}
|
||||
|
||||
.tab-content#kick .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #48d415;
|
||||
}
|
||||
|
||||
.tab-content#extras .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #00dd63;
|
||||
}
|
||||
|
||||
.tab-content#patreon .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #ff5900;
|
||||
}
|
||||
|
||||
.tab-content#tipeee .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #e02f44;
|
||||
}
|
||||
|
||||
.tab-content#kofi .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #72a5f2;
|
||||
}
|
||||
|
||||
.tab-content#fourthwall .setting input[type=checkbox]:checked + .slider {
|
||||
background-color: #0042ff;
|
||||
}
|
||||
|
||||
.tab-content .setting input[type=checkbox]:disabled + .slider {
|
||||
background-color: #000 !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.slider-value {
|
||||
display: inline-block;
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
background: #121212;
|
||||
text-align: center;
|
||||
border-radius: 100px;
|
||||
}
|
||||
|
||||
|
||||
footer {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
padding: 20px;
|
||||
background: rgba(18,18,18,0.5);
|
||||
backdrop-filter: blur(10px);
|
||||
margin-top: 80px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
footer a {
|
||||
display: inline-block;
|
||||
margin: 10px 5px;
|
||||
font-size: 20px;
|
||||
color: #ffcc00;
|
||||
}
|
||||
|
||||
footer a svg {
|
||||
width: 24px;
|
||||
vertical-align: bottom;
|
||||
fill: #ffcc00;
|
||||
}
|
||||
|
||||
footer a img {
|
||||
width: 24px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
footer .nav-bar {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
footer .nav-bar a {
|
||||
display: inline-block;
|
||||
border-radius: 100px;
|
||||
padding: 10px 15px;
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
transition: all ease-in-out 300ms;
|
||||
}
|
||||
|
||||
footer .nav-bar a:hover {
|
||||
color: #ffcc00;
|
||||
background: rgba(0,0,0,0.40);
|
||||
}
|
||||
|
||||
footer .nav-bar a svg {
|
||||
width: 20px;
|
||||
fill: #FFF;
|
||||
transition: all ease-in-out 300ms;
|
||||
}
|
||||
|
||||
footer .nav-bar a:hover svg {
|
||||
fill: #ffcc00;
|
||||
}
|
||||
|
||||
|
||||
footer .nav-bar a.active {
|
||||
color: #ffcc00;
|
||||
background: rgba(0,0,0,0.20);
|
||||
}
|
||||
|
||||
footer .nav-bar a.active svg {
|
||||
fill: #ffcc00;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 768px) {
|
||||
|
||||
#chat-divided {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#chat-settings {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#chat-settings .field {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#chat-settings .field input {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
#chat-preview {
|
||||
display: none;
|
||||
}
|
||||
|
||||
footer { font-size: 12px; }
|
||||
}
|
||||
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 0; left: 0;
|
||||
width: 100%; height: 100%;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.modal.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: #121212;
|
||||
padding: 1.5em;
|
||||
border-radius: 1em;
|
||||
width: 640px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
|
||||
.modal-content input[type=text],
|
||||
.modal-content input[type=number],
|
||||
.modal-content textarea {
|
||||
font-family: "Inter", sans-serif;
|
||||
border: none;
|
||||
background:#222;
|
||||
color: #FFF;
|
||||
padding: 10px 20px;
|
||||
border-radius: 10px;
|
||||
outline: none;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
.modal-content button {
|
||||
font-family: "Inter", sans-serif;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
padding: 15px 30px;
|
||||
margin-top: 10px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
background: #252525;
|
||||
color: #FFF;
|
||||
transition: .4s;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.modal-content #confirmAddEmote {
|
||||
background: #00dd63;
|
||||
}
|
||||
|
||||
.modal-content #cancelAddEmote {
|
||||
background: #ff0000;
|
||||
}
|
||||
|
||||
.modal-content h3 {
|
||||
margin: 0 0 0.5em;
|
||||
}
|
||||
|
||||
.modal-content label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.modal-buttons {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
|
||||
#memberemotesbstatus.online i {
|
||||
color: #00dd63;
|
||||
text-shadow: 0 0 5px #00dd63;
|
||||
}
|
||||
#memberemotesbstatus.offline i {
|
||||
color: #ff0000;
|
||||
text-shadow: 0 0 5px #ff0000;
|
||||
}
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
417
index.html
417
index.html
@@ -1,417 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ChatRD - Config</title>
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-notify@1.0.4/dist/simple-notify.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
||||
|
||||
<link rel="stylesheet" href="css/settings.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="chat-divided">
|
||||
<div id="chat-settings">
|
||||
<h1>ChatRD - Setup</h1>
|
||||
|
||||
<h2><i class="fa-solid fa-screwdriver-wrench"></i> Config</h2>
|
||||
|
||||
<div class="tab-content" id="config">
|
||||
<div class="wrapper">
|
||||
<div class="setting">
|
||||
<small id="memberemotesbstatus" class="offline" style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;">
|
||||
<i class="fa-solid fa-power-off"></i>
|
||||
<span>Streamer.Bot is Offline!</span>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="setting field"><label>Streamer.bot WebSocket Server</label><input type="text" name="streamerBotServerAddress" value="127.0.0.1"></div>
|
||||
<div class="setting field"><label>Streamer.bot WebSocket Port</label><input type="text" name="streamerBotServerPort" value="8080"></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-volume-high"></i> Speaker.Bot is required for Text-to-Speech! <strong><a target="_blank" href="https://github.com/vortisrd/chatrd#-how-to-set-tts-with-speakerbot">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Text-to-Speech Chat<br><small>Enables TTS for Chat.</small></label><label class="switch"><input type="checkbox" name="ttsSpeakerBotChat"><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Text-to-Speech Events<br><small>Enables TTS for Events.</small></label><label class="switch"><input type="checkbox" name="ttsSpeakerBotEvents"><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><i class="fa-solid fa-gears"></i> General <button class="accordion" data-target="geral"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="geral">
|
||||
<div class="wrapper">
|
||||
<div class="setting select">
|
||||
<label>Language<br><small>Change the chat's events language.</small></label>
|
||||
<select name="language">
|
||||
<option value="ptbr">Brazilian Portuguese</option>
|
||||
<option value="en" selected>English</option>
|
||||
<option value="es">Spanish</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="setting slider">
|
||||
<label>Chat Font Size<br><small>Changes ChatRD's font size</small></label>
|
||||
<label>
|
||||
<input type="range" id="font-slider" name="chatFontSize" min="0.1" max="2" step="0.1" value="1">
|
||||
<br><em id="font-value" class="slider-value">100%</em>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="setting"><label>Scroll Bar<br><small>Adds a scrollbar.</small></label></label><label class="switch"><input type="checkbox" name="chatScrollBar"><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Bigger Emotes<br><small>Increases the emotes size from 22px to 32px.</small></label></label><label class="switch"><input type="checkbox" name="chatBiggerEmotes"><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-triangle-exclamation"></i> The Chat Field is a <strong>BETA</strong> feature!</small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Chat Field<br><small>Adds a chat field for you to type in your chat.</small></label></label><label class="switch"><input type="checkbox" name="chatField"><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> The Chat Field also accepts <strong>/commands</strong>. <strong><a target="_blank" href="https://github.com/vortisrd/chatrd/tree/main?tab=readme-ov-file#-commands-supported-by-the-chat-field">Commands Supported</a>.</strong></small></label></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-triangle-exclamation"></i> Moderation is a <strong>BETA</strong> feature!</small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Moderation Actions<br><small>Adds buttons when you hover the messages.</small></label></label><label class="switch"><input type="checkbox" name="chatModeration"><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> Moderation Actions follows the Commands suported. <strong><a target="_blank" href="https://github.com/vortisrd/chatrd/tree/main?tab=readme-ov-file#-commands-supported-by-the-chat-field">Read More</a>.</strong></small></label></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="setting">
|
||||
<label>Background Color<br><small>Changes ChatRD's background color</small></label>
|
||||
<label>
|
||||
<input type="color" name="chatBackground" value="#121212">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="setting slider">
|
||||
<label><i class="fa-solid fa-arrow-turn-up"></i> Background Opacity<br><small>Changes ChatRD's background color opacity</small></label>
|
||||
<label>
|
||||
<input type="range" id="bg-opacity-slider" name="chatBackgroundOpacity" min="0.0" max="1" step="0.1" value="1">
|
||||
<br><em id="bg-opacity-value" class="slider-value">1</em>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="setting"><label>Events Mockup<br><small>Will show random fake events when Streamer.bot is <strong><u>offline</u></strong>.</small></label></label><label class="switch"><input type="checkbox" name="eventsMockup" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Horizontal Direction<br><small>Chat/Events will be horizontal.</small></label></label><label class="switch"><input type="checkbox" name="chatHorizontal"><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Platforms<br><small>Shows the platforms icons.</small></label></label><label class="switch"><input type="checkbox" name="showPlatform" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Avatars</label><label class="switch"><input type="checkbox" name="showAvatar" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Timestamps</label><label class="switch"><input type="checkbox" name="showTimestamps" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> AM/PM</label><label class="switch"><input type="checkbox" name="ampmTimeStamps"><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Badges</label><label class="switch"><input type="checkbox" name="showBadges" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Platform Statistics<br><small>Shows all platform statistics.</small></label><label class="switch"><input type="checkbox" name="showPlatformStatistics" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Ignore Commands<br><small>Ignores texts starting with "!".</small></label><label class="switch"><input type="checkbox" name="excludeCommands" checked><span class="slider"></span></label></div>
|
||||
<div class="setting field"><label>Ignore Chatters<br><small>Separate their names by commas. eg.: StreamLabs,StreamElements</small></label><input type="text" name="ignoreChatters" value="Streamlabs,Streamelements"></div>
|
||||
<div class="setting field"><label>Hide Chat Msg<br><small>Hides a message after X seconds. (0 disables it)</small></label><input type="number" name="hideAfter" value="0"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><i class="fa-brands fa-twitch"></i> Twitch <button class="accordion" data-target="twitch"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="twitch">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><label>Chat<br><small>Reads Twitch chat.</small></label><label class="switch"><input type="checkbox" name="showTwitchMessages" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Followers</label><label class="switch"><input type="checkbox" name="showTwitchFollows" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Bits</label><label class="switch"><input type="checkbox" name="showTwitchBits" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Announcements</label><label class="switch"><input type="checkbox" name="showTwitchAnnouncements" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Subscriptions<br><small>Show Subscription events. <u><strong>Disabling this disables all sub events</strong></u>.</small></label><label class="switch"><input type="checkbox" name="showTwitchSubs" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Gifted Subs<br><small>When a user gifts another user a sub.</small></label><label class="switch"><input type="checkbox" name="showTwitchGiftedSubs" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Gifted Bomb<br><small>When a user gifts subs massively.</small></label><label class="switch"><input type="checkbox" name="showTwitchMassGiftedSubs" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Gifted Bomb Users Train<br><small>Shows all users that were gifted a sub on a Gifted Bomb.</small></label><label class="switch"><input type="checkbox" name="showTwitchGiftedSubsUserTrain" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Channel Point Rewards</label><label class="switch"><input type="checkbox" name="showTwitchRewardRedemptions" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Raids</label><label class="switch"><input type="checkbox" name="showTwitchRaids" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Shared Chat</label><label class="switch"><input type="checkbox" name="showTwitchSharedChat" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Pronouns<br><small>Shows Pronouns to those whom enabled them on Twitch chat.</small></label><label class="switch"><input type="checkbox" name="showTwitchPronouns"><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Statistics<br><small>Shows Twitch Viewers.</small></label><label class="switch"><input type="checkbox" name="showTwitchViewers" checked><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><i class="fa-brands fa-youtube"></i> YouTube <button class="accordion" data-target="youtube"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="youtube">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><label>Chat<br><small>Reads YouTube chat.</small></label><label class="switch"><input type="checkbox" name="showYouTubeMessages" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>SuperChat</label><label class="switch"><input type="checkbox" name="showYouTubeSuperChats" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Super Sticker</label><label class="switch"><input type="checkbox" name="showYouTubeSuperStickers" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Show Super Sticker GIF</label><label class="switch"><input type="checkbox" name="showYouTubeSuperStickerGif" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Full Size Super Sticker<br><small>Shows the sticker above the event in full.</small></label><label class="switch"><input type="checkbox" name="showYouTubeSuperStickerFullSize"><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Membership<br><small>Show Membership events. <u><strong>Disabling this disables all member events</strong></u>.</small></label><label class="switch"><input type="checkbox" name="showYouTubeMemberships" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Gifted Membership<br><small>Shows the person gifting members.</small></label><label class="switch"><input type="checkbox" name="showYouTubeGiftMemberships" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Gifted Membership Train<br><small>Shows all users that were gifted a membership on a massive gifting membership.</small></label><label class="switch"><input type="checkbox" name="showYouTubeMembershipsTrain" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Statistics<br><small>Shows YouTube Viewers and Likes.</small></label><label class="switch"><input type="checkbox" name="showYouTubeStatistics" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> YouTube API doesn't expose Member Emotes. <strong><a target="_blank" href="https://github.com/vortisrd/chatrd/tree/main?tab=readme-ov-file#about-youtube-membership-emojis">Read more</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
|
||||
<div class="setting column">
|
||||
<label>
|
||||
Members Only Emotes
|
||||
<br>
|
||||
<small>You have to add member emotes manually. <em>Really YouTube!?</em> 🤨
|
||||
</small>
|
||||
</label>
|
||||
<div class="emote-list">
|
||||
|
||||
<span class="emote-item">
|
||||
<button class="add"><i class="fa-solid fa-plus"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Textarea for debugging purposes -->
|
||||
<textarea name="youTubeCustomEmotes" style="display: none;">{}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><i class="fa-brands fa-tiktok"></i> TikTok <button class="accordion" data-target="tiktok"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="tiktok">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><label>Chat<br><small>Reads TikTok chat.</small></label><label class="switch"><input type="checkbox" name="showTikTokMessages" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Followers</label><label class="switch"><input type="checkbox" name="showTikTokFollows" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Likes<br><small>Show likes in <strong>15</strong> increments. Why? <em>Blame TikFinity!</em> 🤣</small></label><label class="switch"><input type="checkbox" name="showTikTokLikes" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Gifts</label><label class="switch"><input type="checkbox" name="showTikTokGifts" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Subscriptions</label><label class="switch"><input type="checkbox" name="showTikTokSubs" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Statistics<br><small>Shows TikTok Viewers and Likes.</small></label><label class="switch"><input type="checkbox" name="showTikTokStatistics" checked><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 800 800">
|
||||
<polygon class="st0" points="336 111 336 239 401 239 401 175 465 175 465 111 657 111 657 303 593 303 593 367 529 367 529 432 593 432 593 496 657 496 657 689 465 689 465 624 401 624 401 560 336 560 336 689 143 689 143 111 336 111"/>
|
||||
</svg>
|
||||
Kick <button class="accordion" data-target="kick"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="kick">
|
||||
<div class="wrapper">
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-triangle-exclamation"></i> Kick is a <strong>BETA</strong> feature! <strong><a href="https://github.com/vortisrd/chatrd/tree/main#%EF%B8%8F-kick-is-a-beta-feature" target="_blank">Read more</a></strong>.</small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting field"><label>Your Kick Username<br><small>Your user handle. It's on kick.com/<strong><u>username</u></strong></small></label><input type="text" name="kickUserName" value=""></div>
|
||||
|
||||
<div class="setting"><label>Chat<br><small>Reads Kick chat.</small></label><label class="switch"><input type="checkbox" name="showKickMessages" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Statistics<br><small>Show Kick Viewers. Self-updates each 15 seconds.</small></label><label class="switch"><input type="checkbox" name="showKickViewers" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> <strong><a href="https://github.com/Sehelitar/Kick.bot/" target="_blank">Kick.Bot</a></strong> is required for events. <strong><a target="_blank" href="https://github.com/vortisrd/chatrd/tree/main#kickbot-installation-on-streamerbot">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Followers</label><label class="switch"><input type="checkbox" name="showKickFollows" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Subscriptions<br><small>Show Subscription events. <u><strong>Disabling this disables all sub events</strong></u>.</small></label><label class="switch"><input type="checkbox" name="showKickSubs" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Gifted Subs<br><small>When a user gifts another user a sub.</small></label><label class="switch"><input type="checkbox" name="showKickGiftedSubs" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Gifted Bomb<br><small>When a user gifts subs massively.</small></label><label class="switch"><input type="checkbox" name="showKickMassGiftedSubs" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Raids</label><label class="switch"><input type="checkbox" name="showKickRaids" checked><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><i class="fa-solid fa-dollar-sign"></i> Donations <button class="accordion" data-target="extras"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="extras">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> You need to connect Streamlabs to Streamer.Bot. <strong><a target="_blank" href="https://docs.streamer.bot/guide/integrations/streamlabs">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> You need to connect StreamElements to Streamer.Bot. <strong><a target="_blank" href="https://docs.streamer.bot/guide/integrations/streamelements">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Streamlabs Tips</label><label class="switch"><input type="checkbox" name="showStreamlabsDonations" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>StreamElements Tips</label><label class="switch"><input type="checkbox" name="showStreamElementsTips" checked><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><i class="fa-brands fa-patreon"></i> Patreon <button class="accordion" data-target="patreon"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="patreon">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> You need to connect Patreon to Streamer.Bot. <strong><a target="_blank" href="https://docs.streamer.bot/guide/integrations/patreon">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Memberships</label><label class="switch"><input type="checkbox" name="showPatreonMemberships" checked><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><img src="images/logo-tipeeestream.svg" alt=""> TipeeeStream <button class="accordion" data-target="tipeee"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="tipeee">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> You need to connect TipeeeStream to Streamer.Bot. <strong><a target="_blank" href="https://docs.streamer.bot/guide/integrations/tipeee-stream">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Donations</label><label class="switch"><input type="checkbox" name="showTipeeeDonations" checked><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><img src="images/logo-kofi.svg" alt=""> Ko-Fi <button class="accordion" data-target="kofi"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="kofi">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> You need to connect Ko-Fi to Streamer.Bot. <strong><a target="_blank" href="https://docs.streamer.bot/guide/integrations/ko-fi">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Subscription</label><label class="switch"><input type="checkbox" name="showKofiSubscriptions" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Donations</label><label class="switch"><input type="checkbox" name="showKofiDonations" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label>Orders</label><label class="switch"><input type="checkbox" name="showKofiOrders" checked><span class="slider"></span></label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><img src="images/logo-fourthwall.svg" alt=""> Fourthwall <button class="accordion" data-target="fourthwall"><i class="fa-solid fa-chevron-down"></i></button></h2>
|
||||
<div class="tab-content accordion-container" id="fourthwall">
|
||||
<div class="wrapper">
|
||||
<div class="setting"><small style="display: inline-block; padding: 10px 20px 10px 10px; background-color: #232323; color: #FFF; border-radius: 10px;"><i class="fa-solid fa-circle-exclamation"></i> You need to connect Fourthwall to Streamer.Bot. <strong><a target="_blank" href="https://docs.streamer.bot/guide/integrations/fourthwall">Follow the tutorial</a>.</strong></small></label></div>
|
||||
|
||||
<div class="setting"></div>
|
||||
|
||||
<div class="setting"><label>Donations</label><label class="switch"><input type="checkbox" name="showFourthwallDonations" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Orders</label><label class="switch"><input type="checkbox" name="showFourthwallOrders" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Subscriptions</label><label class="switch"><input type="checkbox" name="showFourthwallSubscriptions" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Show Order Image</small></label><label class="switch"><input type="checkbox" name="showFourthwallShowImage" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Full Size Order Image<br><small>Shows the image above the event in full.</small></label><label class="switch"><input type="checkbox" name="showFourthwallBigImage" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Gift Purchase</label><label class="switch"><input type="checkbox" name="showFourthwallGiftPurchase" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Show Gift Image</label><label class="switch"><input type="checkbox" name="showFourthwallShowGiftImage" checked><span class="slider"></span></label></div>
|
||||
<div class="setting"><label><i class="fa-solid fa-arrow-turn-up"></i> Full Size Gift Image<br><small>Shows the image above the event in full.</small></label><label class="switch"><input type="checkbox" name="showFourthwallBigGiftImage" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting"><label>Gift Draw</label><label class="switch"><input type="checkbox" name="showFourthwallGiftDraw" checked><span class="slider"></span></label></div>
|
||||
|
||||
<div class="setting field"><label>Gift Command<br><small>Command used to join the Gift Draw. </small></label><input type="text" name="fourthWallGiftDrawCommand" value="!enter"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
|
||||
<div class="nav-bar">
|
||||
<a title="Config" href="#config" class="active"><i class="fa-solid fa-screwdriver-wrench"></i></a>
|
||||
<a title="General" href="#geral"><i class="fa-solid fa-gears"></i></a>
|
||||
<a title="Twitch" href="#twitch"><i class="fa-brands fa-twitch"></i></a>
|
||||
<a title="YouTube" href="#youtube"><i class="fa-brands fa-youtube"></i></a>
|
||||
<a title="TikTok" href="#tiktok"><i class="fa-brands fa-tiktok"></i></a>
|
||||
<a title="Kick" href="#kick">
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 800 800">
|
||||
<polygon class="st0" points="336 111 336 239 401 239 401 175 465 175 465 111 657 111 657 303 593 303 593 367 529 367 529 432 593 432 593 496 657 496 657 689 465 689 465 624 401 624 401 560 336 560 336 689 143 689 143 111 336 111"/>
|
||||
</svg>
|
||||
</a>
|
||||
<a title="Donations" href="#extras"><i class="fa-solid fa-dollar-sign"></i></a>
|
||||
<a title="Patreon" href="#patreon"><i class="fa-brands fa-patreon"></i></a>
|
||||
<a title="TipeeeStream" href="#tipeee"><img src="images/logo-tipeeestream.svg"></a>
|
||||
<a title="Ko-Fi" href="#kofi"><img src="images/logo-kofi.svg"></a>
|
||||
<a title="FourthWall" href="#fourthwall"><img src="images/logo-fourthwall.svg"></a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="url-bar">
|
||||
<input type="text" id="outputUrl" placeholder="URL Here..." readonly="">
|
||||
<button onclick="copyUrl()">Copy URL</button>
|
||||
</div>
|
||||
|
||||
<p>Made with ❤️ by <strong>VortisRD</strong></p>
|
||||
<p>
|
||||
<a target="_blank" href="https://twitch.com/vortisrd"><i class="fa-brands fa-twitch"></i></a>
|
||||
<a target="_blank" href="https://youtube.com/@vortisrd"><i class="fa-brands fa-youtube"></i></a>
|
||||
<a target="_blank" href="https://tiktok.com/@vortisrd"><i class="fa-brands fa-tiktok"></i></a>
|
||||
<a target="_blank" href="https://kick.com/vortisrd">
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 800 800">
|
||||
<polygon class="st0" points="336 111 336 239 401 239 401 175 465 175 465 111 657 111 657 303 593 303 593 367 529 367 529 432 593 432 593 496 657 496 657 689 465 689 465 624 401 624 401 560 336 560 336 689 143 689 143 111 336 111"/>
|
||||
</svg>
|
||||
</a>
|
||||
<a target="_blank" href="https://x.com/vortisrd"><i class="fa-brands fa-x-twitter"></i></a>
|
||||
<a target="_blank" href="https://github.com/vortisrd"><i class="fa-brands fa-github"></i></a>
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div id="chat-preview">
|
||||
<iframe src="" frameborder="0"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="addEmoteModal" class="modal hidden">
|
||||
<div class="modal-content">
|
||||
<h3>Add YouTube Custom Emote</h3>
|
||||
<label>
|
||||
Emote Name
|
||||
<input type="text" id="newEmoteName" placeholder="Use 'EmoteName', not ':EmoteName:'" class="avoid">
|
||||
</label>
|
||||
<label>
|
||||
Image URL
|
||||
<input type="text" id="newEmoteURL" placeholder="https://example.com/emote.png" class="avoid">
|
||||
</label>
|
||||
<div class="modal-buttons">
|
||||
<button id="confirmAddEmote">Add</button>
|
||||
<button id="cancelAddEmote">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://unpkg.com/@streamerbot/client/dist/streamerbot-client.js"></script>
|
||||
<script src="js/settings.js"></script>
|
||||
</body>
|
||||
</html>
|
1017
js/app-mockup.js
1017
js/app-mockup.js
File diff suppressed because it is too large
Load Diff
718
js/app.js
718
js/app.js
@@ -1,718 +0,0 @@
|
||||
/* ----------------------- */
|
||||
/* OPTIONS */
|
||||
/* ----------------------- */
|
||||
|
||||
const streamerBotServerAddress = getURLParam("streamerBotServerAddress", "127.0.0.1");
|
||||
const streamerBotServerPort = getURLParam("streamerBotServerPort", "8080");
|
||||
|
||||
const ttsSpeakerBotChat = getURLParam("ttsSpeakerBotChat", false);
|
||||
const ttsSpeakerBotEvents = getURLParam("ttsSpeakerBotEvents", false);
|
||||
|
||||
let streamerBotConnected = false;
|
||||
const chatThreshhold = 50;
|
||||
|
||||
const chatContainer = document.querySelector('#chat');
|
||||
const chatFontSize = getURLParam("chatFontSize", 1);
|
||||
const chatBackground = getURLParam("chatBackground", "#121212");
|
||||
const chatBackgroundOpacity = getURLParam("chatBackgroundOpacity", 1);
|
||||
const chatScrollBar = getURLParam("chatScrollBar", false);
|
||||
const chatBiggerEmotes = getURLParam("chatBiggerEmotes", false);
|
||||
const chatField = getURLParam("chatField", false);
|
||||
const chatModeration = getURLParam("chatModeration", false);
|
||||
|
||||
const currentLang = lang[getURLParam("language", 'ptbr')];
|
||||
const eventsMockup = getURLParam("eventsMockup", true);
|
||||
const chatHorizontal = getURLParam("chatHorizontal", false);
|
||||
const showPlatform = getURLParam("showPlatform", false);
|
||||
const showAvatar = getURLParam("showAvatar", false);
|
||||
const showTimestamps = getURLParam("showTimestamps", false);
|
||||
const ampmTimeStamps = getURLParam("ampmTimeStamps", false);
|
||||
const showBadges = getURLParam("showBadges", true);
|
||||
const showPlatformStatistics = getURLParam("showPlatformStatistics", false);
|
||||
const hideAfter = getURLParam("hideAfter", 0);
|
||||
const ignoreChatters = getURLParam("ignoreChatters", "");
|
||||
const excludeCommands = getURLParam("excludeCommands", true);
|
||||
|
||||
const userColors = new Map();
|
||||
|
||||
const ignoreUserList = ignoreChatters.split(',').map(item => item.trim().toLowerCase()) || [];
|
||||
|
||||
chatContainer.style.zoom = chatFontSize;
|
||||
if (chatScrollBar == false) { chatContainer.classList.add('noscrollbar'); }
|
||||
if (chatField == true) {
|
||||
const chatfieldelement = document.getElementById("chat-input");
|
||||
chatfieldelement.classList.add('enabled');
|
||||
chatfieldelement.querySelector('form input[type=text]').setAttribute('placeholder', currentLang.chatsendmessage);
|
||||
}
|
||||
|
||||
/* ----------------------- */
|
||||
/* START */
|
||||
/* ----------------------- */
|
||||
|
||||
document.body.style.backgroundColor = hexToRGBA(chatBackground,chatBackgroundOpacity);
|
||||
|
||||
if (showPlatformStatistics == false) { document.querySelector('#statistics').style.display = 'none'; }
|
||||
if (chatHorizontal == true) { chatContainer.parentElement.classList.add('horizontal'); }
|
||||
|
||||
/* ----------------------- */
|
||||
/* STREAMER.BOT CONNECTION */
|
||||
/* ----------------------- */
|
||||
|
||||
const streamerBotClient = new StreamerbotClient({
|
||||
host: streamerBotServerAddress,
|
||||
port: streamerBotServerPort,
|
||||
onConnect: (data) => {
|
||||
console.debug( currentLang.streamerbotconnected );
|
||||
console.debug(data);
|
||||
streamerBotConnected = true;
|
||||
notifySuccess({
|
||||
title: currentLang.streamerbotconnected,
|
||||
text: ``
|
||||
});
|
||||
if (eventsMockup == true) {
|
||||
chatContainer.innerHTML = '';
|
||||
stopMockupSystem();
|
||||
}
|
||||
},
|
||||
onDisconnect: () => {
|
||||
console.error(currentLang.streamerbotdisconnected);
|
||||
streamerBotConnected = false;
|
||||
if (eventsMockup == true) {
|
||||
startMockupSystem();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----------------------- */
|
||||
/* UTILITIES */
|
||||
/* ----------------------- */
|
||||
|
||||
|
||||
|
||||
async function addMessageToChat(userID, messageID, platform, data) {
|
||||
|
||||
if (ttsSpeakerBotChat == true) { ttsSpeakerBotSays(data.userName, currentLang.ttschat, data.message); }
|
||||
|
||||
let html = DOMPurify.sanitize(`
|
||||
<div id="${messageID}" data-user="${userID}" class="${platform} ${data.classes} ${chatBiggerEmotes == true ? 'bigger-emojis' : ''} message" style="" >
|
||||
<div class="animate__animated ${chatHorizontal == true ? 'animate__fadeIn' : 'animate__fadeInUp'} animate__faster">
|
||||
|
||||
${data.classes.includes("first-message") ? '<span class="first-chatter">✨</span>' : '' }
|
||||
|
||||
${!data.shared ? '' : data.shared}
|
||||
|
||||
${showTimestamps == true ? '<span class="time">'+whatTimeIsIt()+'</span>' : ''}
|
||||
|
||||
${showPlatform == true ? '<span class="platform"><img src="images/logo-'+platform+'.svg" ></span>' : '' }
|
||||
|
||||
${showAvatar == true ? (data.avatar ? '<span class="avatar"><img src="'+data.avatar+'"></span>' : '') : ''}
|
||||
|
||||
${showBadges == true ? '<span class="badges">'+data.badges+'</span>' : ''}
|
||||
|
||||
<span style="color: ${data.color}" class="user">${data.userName}:</span>
|
||||
|
||||
${!data.reply ? '' : data.reply}
|
||||
|
||||
<span class="text">${data.message}</span>
|
||||
</div>
|
||||
|
||||
${chatModeration == true && platform == 'twitch' ? `[CHATMODERATIONSNIPPETTWITCH]` : ''}
|
||||
${chatModeration == true && platform == 'youtube' ? `[CHATMODERATIONSNIPPETYOUTUBE]` : ''}
|
||||
|
||||
</div>
|
||||
`);
|
||||
|
||||
|
||||
let chatmodtwitch = `<span class="chatmoderation twitch">
|
||||
<button onclick="executeModCommand(event, '/deletemessage ${messageID}')" title="Remove Message"><i class="fa-solid fa-trash-can"></i></button>
|
||||
<button onclick="executeModCommand(event, '/timeout ${userID}')" title="Timeout User"><i class="fa-solid fa-stopwatch"></i></button>
|
||||
<button onclick="executeModCommand(event, '/ban ${userID}')" title="Ban User"><i class="fa-solid fa-gavel"></i></button>
|
||||
</span>`;
|
||||
|
||||
let chatmodyoutube = `<span class="chatmoderation youtube">
|
||||
<button onclick="executeModCommand(event, '/yt/timeout ${userID}')" title="Timeout User"><i class="fa-solid fa-stopwatch"></i></button>
|
||||
<button onclick="executeModCommand(event, '/yt/ban ${userID}')" title="Ban User"><i class="fa-solid fa-gavel"></i></button>
|
||||
</span>`;
|
||||
|
||||
html = html.replace('[CHATMODERATIONSNIPPETTWITCH]', chatmodtwitch);
|
||||
html = html.replace('[CHATMODERATIONSNIPPETYOUTUBE]', chatmodyoutube);
|
||||
|
||||
chatContainer.insertAdjacentHTML('afterbegin', html);
|
||||
|
||||
const messageElement = document.getElementById(messageID);
|
||||
|
||||
if (chatHorizontal == true) {
|
||||
await adjustMessagesHorizontal(messageElement);
|
||||
}
|
||||
|
||||
if (hideAfter > 0) {
|
||||
setTimeout(function () {
|
||||
messageElement.style.opacity = 0;
|
||||
setTimeout(function () {
|
||||
messageElement.remove();
|
||||
}, 1000);
|
||||
}, Math.floor(hideAfter * 1000));
|
||||
}
|
||||
|
||||
removeExtraChatMessages();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function addEventToChat(userID, messageID, platform, data) {
|
||||
|
||||
if (ttsSpeakerBotEvents == true) { ttsSpeakerBotSays(data.userName, '', data.message); }
|
||||
|
||||
const html = DOMPurify.sanitize(`
|
||||
<div id="${messageID}" data-user="${userID}" class="${platform} ${data.classes} message event" style="">
|
||||
<div class="animate__animated ${chatHorizontal == true ? 'animate__fadeIn' : 'animate__fadeInUp'} animate__faster">
|
||||
${!data.reply ? '' : data.reply}
|
||||
|
||||
${showPlatform == true ? '<span class="platform"><img src="images/logo-'+platform+'.svg" ></span>' : '' }
|
||||
|
||||
<span class="info">
|
||||
<span style="color: ${data.color}" class="user">${data.userName}</span>
|
||||
<span class="text">${data.message}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
chatContainer.insertAdjacentHTML('afterbegin', html);
|
||||
|
||||
const messageElement = document.getElementById(messageID);
|
||||
|
||||
if (chatHorizontal == true) {
|
||||
await adjustMessagesHorizontal(messageElement);
|
||||
}
|
||||
|
||||
if (hideAfter > 0) {
|
||||
setTimeout(function () {
|
||||
messageElement.style.opacity = 0;
|
||||
setTimeout(function () {
|
||||
messageElement.remove();
|
||||
}, 1000);
|
||||
}, Math.floor(hideAfter * 1000));
|
||||
}
|
||||
|
||||
removeExtraChatMessages();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async function adjustMessagesHorizontal(messageElement) {
|
||||
const container = messageElement.querySelector('.animate__animated');
|
||||
if (!container) return;
|
||||
|
||||
const images = container.querySelectorAll("img.emote");
|
||||
|
||||
function waitImageLoad(img) {
|
||||
return new Promise((resolve) => {
|
||||
if (img.complete) {
|
||||
adjustEmotesWidthInMessage(img);
|
||||
resolve();
|
||||
}
|
||||
else {
|
||||
img.addEventListener("load", () => {
|
||||
adjustEmotesWidthInMessage(img);
|
||||
resolve();
|
||||
});
|
||||
img.addEventListener("error", () => resolve());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
await Promise.all(Array.from(images).map(img => waitImageLoad(img)));
|
||||
|
||||
const messageElementWidth = Math.floor(container.offsetWidth + 10) + 'px';
|
||||
|
||||
Object.assign(messageElement.style, {
|
||||
width: messageElementWidth,
|
||||
overflow: "visible"
|
||||
});
|
||||
}
|
||||
|
||||
function adjustEmotesWidthInMessage(img) {
|
||||
const width = img.offsetWidth;
|
||||
img.style.width = width + "px";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const whatTimeIsIt = () => {
|
||||
const now = new Date();
|
||||
const hours24 = now.getHours();
|
||||
const minutes = now.getMinutes().toString().padStart(2, '0');
|
||||
const ampm = hours24 >= 12 ? 'PM' : 'AM';
|
||||
const hours12 = (hours24 % 12) || 12;
|
||||
|
||||
if (ampmTimeStamps == true) { return `${hours12}:${minutes} ${ampm}`; }
|
||||
else { return `${hours24}:${minutes}`; }
|
||||
};
|
||||
|
||||
|
||||
function removeExtraChatMessages() {
|
||||
const chatMessages = chatContainer.querySelectorAll('div.message');
|
||||
const total = chatMessages.length;
|
||||
|
||||
if (total >= chatThreshhold) {
|
||||
const toRemove = Math.floor(total * 0.25); // 25% do total
|
||||
for (let i = 0; i < toRemove; i++) {
|
||||
const last = chatContainer.lastElementChild;
|
||||
if (last) chatContainer.removeChild(last);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Function to format large numbers (e.g., 1000 => '1K')
|
||||
function formatNumber(num) {
|
||||
if (num >= 1000000) {
|
||||
let numStr = (num / 1000000).toFixed(1);
|
||||
if (numStr.endsWith('.0')) {
|
||||
numStr = numStr.slice(0, -2);
|
||||
}
|
||||
return numStr + 'M';
|
||||
}
|
||||
else if (num >= 1000) {
|
||||
let numStr = (num / 1000).toFixed(1);
|
||||
if (numStr.endsWith('.0')) {
|
||||
numStr = numStr.slice(0, -2);
|
||||
}
|
||||
return numStr + 'K';
|
||||
}
|
||||
return num.toString();
|
||||
}
|
||||
|
||||
|
||||
function formatCurrency(amount, currencyCode) {
|
||||
return new Intl.NumberFormat(undefined, {
|
||||
style: 'currency',
|
||||
currency: currencyCode,
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 2
|
||||
}).format(amount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function createRandomColor(platform, username) {
|
||||
if (userColors.get(platform).has(username)) {
|
||||
return userColors.get(platform).get(username);
|
||||
}
|
||||
else {
|
||||
const randomColor = "hsl(" + Math.random() * 360 + ", 100%, 75%)";
|
||||
userColors.get(platform).set(username, randomColor);
|
||||
return randomColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createRandomString(length) {
|
||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
let result = "";
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getURLParam(param, defaultValue) {
|
||||
const chatQueryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(chatQueryString);
|
||||
const paramVar = urlParams.get(param);
|
||||
|
||||
switch (paramVar) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case null:
|
||||
case undefined:
|
||||
return defaultValue;
|
||||
|
||||
default:
|
||||
return paramVar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const pushNotify = (data) => {
|
||||
|
||||
const SimpleNotify = {
|
||||
effect: 'fade',
|
||||
speed: 500,
|
||||
customClass: 'toasty',
|
||||
customIcon: '',
|
||||
showIcon: true,
|
||||
showCloseButton: true,
|
||||
autoclose: true,
|
||||
autotimeout: 5000,
|
||||
notificationsGap: null,
|
||||
notificationsPadding: null,
|
||||
type: 'outline',
|
||||
position: 'x-center bottom',
|
||||
customWrapper: '',
|
||||
};
|
||||
|
||||
const mergedData = {
|
||||
...SimpleNotify,
|
||||
...data
|
||||
}
|
||||
|
||||
new Notify (mergedData);
|
||||
}
|
||||
|
||||
const notifyError = (err) => {
|
||||
err.status = 'error';
|
||||
pushNotify(err);
|
||||
}
|
||||
|
||||
const notifyInfo = (info) => {
|
||||
info.status = 'info';
|
||||
pushNotify(info);
|
||||
}
|
||||
|
||||
const notifyWarning = (warn) => {
|
||||
warn.status = 'warning';
|
||||
pushNotify(warn);
|
||||
}
|
||||
|
||||
|
||||
const notifySuccess = (success) => {
|
||||
success.status = 'success';
|
||||
pushNotify(success);
|
||||
}
|
||||
|
||||
|
||||
function escapeRegex(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
|
||||
async function ttsSpeakerBotSays(user, action, message) {
|
||||
|
||||
if (streamerBotConnected == false) return;
|
||||
|
||||
const ttstext = await cleanStringOfHTMLButEmotes(message);
|
||||
const ttsmessage = user+' '+action+' '+ttstext;
|
||||
|
||||
streamerBotClient.doAction(
|
||||
{ name : "TTS Event" },
|
||||
{
|
||||
"ttsmessage": ttsmessage,
|
||||
}
|
||||
).then( (ttsstuff) => {
|
||||
console.debug('Sending TTS to Streamer.Bot', ttsstuff);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function cleanStringOfHTMLButEmotes(string) {
|
||||
// Cria um elemento DOM temporário
|
||||
const container = document.createElement('div');
|
||||
container.innerHTML = string;
|
||||
|
||||
// Substitui <img class="emote" alt="..."> por texto do alt
|
||||
const emotes = container.querySelectorAll('img.emote[alt]');
|
||||
emotes.forEach(img => {
|
||||
const altText = img.getAttribute('alt');
|
||||
const textNode = document.createTextNode(altText);
|
||||
img.replaceWith(textNode);
|
||||
});
|
||||
|
||||
// Remove todo o restante do HTML
|
||||
return container.textContent || "";
|
||||
}
|
||||
|
||||
|
||||
function stripStringFromHtml(html) {
|
||||
let doc = new DOMParser().parseFromString(html, 'text/html');
|
||||
return doc.body.textContent || "";
|
||||
}
|
||||
|
||||
|
||||
function hexToRGBA(hexadecimal,opacity) {
|
||||
const hex = hexadecimal;
|
||||
const alpha = parseFloat(opacity);
|
||||
|
||||
// Converter hex para RGB
|
||||
const r = parseInt(hex.substr(1, 2), 16);
|
||||
const g = parseInt(hex.substr(3, 2), 16);
|
||||
const b = parseInt(hex.substr(5, 2), 16);
|
||||
|
||||
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const chatInputSend = document.getElementById("chat-input-send");
|
||||
const chatInputForm = document.querySelector("#chat-input form");
|
||||
const chatInput = chatInputForm.querySelector("input[type=text]")
|
||||
const chatSettings = document.getElementById("chat-input-settings");
|
||||
|
||||
chatInputForm.addEventListener("submit", function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var chatSendPlatforms = [];
|
||||
|
||||
const chatOnTwitch = document.querySelector('#chat-input #twitch input[type=checkbox]').checked;
|
||||
const chatOnYoutube = document.querySelector('#chat-input #youtube input[type=checkbox]').checked;
|
||||
const chatOnTiktok = document.querySelector('#chat-input #tiktok input[type=checkbox]').checked;
|
||||
const chatOnKick = document.querySelector('#chat-input #kick input[type=checkbox]').checked;
|
||||
|
||||
if (chatOnTwitch == true) {
|
||||
chatSendPlatforms.push('twitch');
|
||||
}
|
||||
|
||||
if (chatOnYoutube == true) {
|
||||
chatSendPlatforms.push('youtube');
|
||||
}
|
||||
|
||||
if (chatOnTiktok == true) {
|
||||
chatSendPlatforms.push('tiktok');
|
||||
}
|
||||
|
||||
if (chatOnKick == true) {
|
||||
chatSendPlatforms.push('kick');
|
||||
}
|
||||
|
||||
chatSendPlatforms = chatSendPlatforms.join(',')
|
||||
|
||||
const chatInput = chatInputForm.querySelector("input[type=text]")
|
||||
const chatInputText = chatInput.value;
|
||||
|
||||
// Sends Message to Twitch and YouTube
|
||||
streamerBotClient.doAction(
|
||||
{ name : "ChatRD Messages and Commands" },
|
||||
{
|
||||
"type": "chat",
|
||||
"platforms": chatSendPlatforms,
|
||||
"message": chatInputText,
|
||||
}
|
||||
).then( (sendchatstuff) => {
|
||||
console.debug('Sending Chat to Streamer.Bot', sendchatstuff);
|
||||
});
|
||||
|
||||
// Sends Message to Kick that are not commands
|
||||
if (chatSendPlatforms.includes('kick')) {
|
||||
if (!chatInputText.startsWith('/')) {
|
||||
streamerBotClient.doAction(
|
||||
{ name : "ChatRD Kick Messages" },
|
||||
{
|
||||
"message": chatInputText,
|
||||
}
|
||||
).then( (sendchatstuff) => {
|
||||
console.debug('Sending Kick Chat to Streamer.Bot', sendchatstuff);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Sends Message to TikTok that are not commands
|
||||
if (chatSendPlatforms.includes('tiktok')) {
|
||||
if (!chatInputText.startsWith('/')) {
|
||||
streamerBotClient.doAction(
|
||||
{ name : "ChatRD TikTok Messages" },
|
||||
{
|
||||
"ttkmessage": chatInputText,
|
||||
}
|
||||
).then( (sendchatstuff) => {
|
||||
console.debug('Sending TikTok Chat to Streamer.Bot', sendchatstuff);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
chatInput.value = '';
|
||||
});
|
||||
|
||||
chatInputSend.addEventListener("click", function () {
|
||||
chatInputForm.requestSubmit();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
async function executeModCommand(event, command) {
|
||||
event.preventDefault();
|
||||
|
||||
if (streamerBotConnected == true) {
|
||||
chatInput.value = command;
|
||||
|
||||
chatInputForm.requestSubmit();
|
||||
}
|
||||
else {
|
||||
|
||||
notifyError({
|
||||
title: currentLang.streamerbotdisconnected,
|
||||
text: ``
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let chatcommands = {
|
||||
"Twitch" : [
|
||||
{ "name" : "/me", "usage" : "[message]" },
|
||||
{ "name" : "/announce", "usage" : "[message]" },
|
||||
{ "name" : "/clear", "usage" : "" },
|
||||
{ "name" : "/slow", "usage" : "[duration]" },
|
||||
{ "name" : "/slowoff", "usage" : "" },
|
||||
{ "name" : "/subscribers", "usage" : "" },
|
||||
{ "name" : "/subscribersoff", "usage" : "" },
|
||||
{ "name" : "/commercial", "usage" : "[duration]" },
|
||||
{ "name" : "/timeout", "usage" : "[user] [duration] [reason]" },
|
||||
{ "name" : "/untimeout", "usage" : "[user]" },
|
||||
{ "name" : "/ban", "usage" : "[user] [duration] [reason]" },
|
||||
{ "name" : "/unban", "usage" : "[user]" },
|
||||
{ "name" : "/mod", "usage" : "[user]" },
|
||||
{ "name" : "/unmod", "usage" : "[user]" },
|
||||
{ "name" : "/vip", "usage" : "[user]" },
|
||||
{ "name" : "/unvip", "usage" : "[user]" },
|
||||
{ "name" : "/shoutout", "usage" : "[user]" },
|
||||
{ "name" : "/raid", "usage" : "[user]" },
|
||||
{ "name" : "/unraid", "usage" : "" }
|
||||
],
|
||||
"YouTube" : [
|
||||
{ "name" : "/yt/title", "usage" : "[title]" },
|
||||
{ "name" : "/yt/description", "usage" : "[description]" },
|
||||
{ "name" : "/yt/timeout", "usage" : "[user] [duration]" },
|
||||
{ "name" : "/yt/ban", "usage" : "[user]" }
|
||||
]
|
||||
};
|
||||
|
||||
let chatcurrentFocus = -1;
|
||||
|
||||
const chatcommandslist = document.getElementById('chat-autocomplete-list');
|
||||
|
||||
chatInput.addEventListener('input', function () {
|
||||
const value = this.value.trim();
|
||||
chatcommandslist.innerHTML = '';
|
||||
chatcurrentFocus = -1;
|
||||
if (!value.startsWith('/')) return;
|
||||
Object.entries(chatcommands).forEach(([groupName, commands]) => {
|
||||
|
||||
const filtered = commands.filter(cmd => cmd.name.startsWith(value));
|
||||
|
||||
if (filtered.length === 0) return;
|
||||
|
||||
const groupTitle = document.createElement('div');
|
||||
groupTitle.textContent = groupName;
|
||||
chatcommandslist.appendChild(groupTitle);
|
||||
filtered.forEach(cmd => {
|
||||
const item = document.createElement('div');
|
||||
item.classList.add('autocomplete-item');
|
||||
item.innerHTML = `<strong>${cmd.name}</strong><small> ${cmd.usage}</small>`;
|
||||
item.addEventListener('click', () => {
|
||||
chatInput.value = cmd.name + ' ';
|
||||
chatcommandslist.innerHTML = '';
|
||||
});
|
||||
chatcommandslist.appendChild(item);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
chatInput.addEventListener('keydown', function (e) {
|
||||
const items = chatcommandslist.querySelectorAll('.autocomplete-item');
|
||||
|
||||
if (items.length === 0) return;
|
||||
|
||||
if (e.key === 'ArrowDown') {
|
||||
chatcurrentFocus++;
|
||||
highlightItem(items);
|
||||
}
|
||||
else if (e.key === 'ArrowUp') {
|
||||
chatcurrentFocus--;
|
||||
highlightItem(items);
|
||||
}
|
||||
|
||||
else if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
if (chatcurrentFocus > -1 && items[chatcurrentFocus]) {
|
||||
items[chatcurrentFocus].click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function highlightItem(items) {
|
||||
if (!items) return;
|
||||
|
||||
items.forEach(item => item.classList.remove('active'));
|
||||
|
||||
if (chatcurrentFocus >= items.length) chatcurrentFocus = 0;
|
||||
if (chatcurrentFocus < 0) chatcurrentFocus = items.length - 1;
|
||||
|
||||
items[chatcurrentFocus].classList.add('active');
|
||||
items[chatcurrentFocus].scrollIntoView({ block: "nearest" });
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
if (e.target !== chatcommandslist) {
|
||||
chatcommandslist.innerHTML = '';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
const settingsPanel = document.querySelector('#chat-input .settings');
|
||||
|
||||
chatSettings.addEventListener('click', function () {
|
||||
settingsPanel.classList.toggle('active');
|
||||
chatSettings.classList.toggle('active');
|
||||
});
|
||||
|
||||
|
||||
const checkboxNames = ["chatOnTwitch", "chatOnYouTube", "chatOnTiktok", "chatOnKick"];
|
||||
|
||||
// Restore checkbox states from localStorage
|
||||
checkboxNames.forEach(name => {
|
||||
const checkbox = document.querySelector(`input[name="${name}"]`);
|
||||
const savedValue = localStorage.getItem(name);
|
||||
if (checkbox && savedValue !== null) {
|
||||
checkbox.checked = savedValue === "true";
|
||||
}
|
||||
});
|
||||
|
||||
// Save state to localStorage on change
|
||||
checkboxNames.forEach(name => {
|
||||
const checkbox = document.querySelector(`input[name="${name}"]`);
|
||||
if (checkbox) {
|
||||
checkbox.addEventListener("change", function () {
|
||||
localStorage.setItem(name, checkbox.checked);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
0
js/chatrd.js
Normal file
0
js/chatrd.js
Normal file
@@ -1,322 +0,0 @@
|
||||
const showFourthwallDonations = getURLParam("showFourthwallDonations", true);
|
||||
|
||||
const showFourthwallOrders = getURLParam("showFourthwallOrders", true);
|
||||
const showFourthwallShowImage = getURLParam("showFourthwallShowImage", true);
|
||||
const showFourthwallBigImage = getURLParam("showFourthwallBigImage", true);
|
||||
|
||||
const showFourthwallSubscriptions = getURLParam("showFourthwallSubscriptions", true);
|
||||
|
||||
const showFourthwallGiftPurchase = getURLParam("showFourthwallGiftPurchase", true);
|
||||
const showFourthwallShowGiftImage = getURLParam("showFourthwallShowGiftImage", true);
|
||||
const showFourthwallBigGiftImage = getURLParam("showFourthwallBigGiftImage", true);
|
||||
|
||||
const showFourthwallGiftDraw = getURLParam("showFourthwallGiftDraw", true);
|
||||
const fourthWallGiftDrawCommand = getURLParam("fourthWallGiftDrawCommand", "!enter");
|
||||
|
||||
const fourthwallMessageHandlers = {
|
||||
'Fourthwall.Donation': (response) => {
|
||||
console.debug('Fourthwall Donation', response.data);
|
||||
fourthwallDonationMessage(response.data);
|
||||
},
|
||||
'Fourthwall.OrderPlaced': (response) => {
|
||||
console.debug('Fourthwall Order', response.data);
|
||||
fourthwallOrderMessage(response.data);
|
||||
},
|
||||
'Fourthwall.SubscriptionPurchased': (response) => {
|
||||
console.debug('Fourthwall Sub', response.data);
|
||||
fourthwallSubMessage(response.data);
|
||||
},
|
||||
'Fourthwall.GiftPurchase': (response) => {
|
||||
console.debug('Fourthwall Gift', response.data);
|
||||
fourthwallGiftMessage(response.data);
|
||||
},
|
||||
'Fourthwall.GiftDrawStarted': (response) => {
|
||||
console.debug('Fourthwall Gift Draw Start', response.data);
|
||||
fourthwallGiftDrawStartMessage(response.data);
|
||||
},
|
||||
'Fourthwall.GiftDrawEnded': (response) => {
|
||||
console.debug('Fourthwall Gift Draw Start', response.data);
|
||||
fourthwallGiftDrawEndMessage(response.data);
|
||||
},
|
||||
};
|
||||
|
||||
for (const [event, handler] of Object.entries(fourthwallMessageHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
|
||||
async function fourthwallDonationMessage(data) {
|
||||
|
||||
if (showFourthwallDonations == false) return;
|
||||
|
||||
const {
|
||||
username : userName,
|
||||
amount,
|
||||
currency,
|
||||
message: text
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var money = formatCurrency(amount,currency);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.fourthwall.donation({
|
||||
money: money,
|
||||
message: text
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'fourthwall', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function fourthwallOrderMessage(data) {
|
||||
|
||||
if (showFourthwallOrders == false) return;
|
||||
|
||||
const username = data.username;
|
||||
const total = data.total;
|
||||
const currency = data.currency;
|
||||
const item = data.variants[0].name;
|
||||
const itemsQuantity = data.variants.length;
|
||||
const text = stripStringFromHtml(data.statmessageus);
|
||||
const imageUrl = data.variants[0].image;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var userName = '';
|
||||
if (username == undefined) { userName = currentLang.fourthwall.someone(); }
|
||||
else { userName = username; }
|
||||
|
||||
var money = '';
|
||||
if (total == 0) { money = 0; }
|
||||
else { money = formatCurrency(total,currency); }
|
||||
|
||||
var fourthWallImage = '';
|
||||
if (showFourthwallShowImage == true) {
|
||||
fourthWallImage = imageUrl
|
||||
}
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.fourthwall.order({
|
||||
money: money,
|
||||
firstItem: item,
|
||||
items: itemsQuantity,
|
||||
message: text,
|
||||
image: fourthWallImage
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = ['order'];
|
||||
if (showFourthwallBigImage == true) {
|
||||
classes.push('giantimage');
|
||||
}
|
||||
|
||||
const messageData = {
|
||||
classes: classes.join(' '),
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'fourthwall', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function fourthwallSubMessage(data) {
|
||||
|
||||
if (showFourthwallSubscriptions == false) return;
|
||||
|
||||
const {
|
||||
nickname : userName,
|
||||
amount,
|
||||
currency
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var money = formatCurrency(amount,currency);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.fourthwall.donation({
|
||||
money: money
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'fourthwall', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function fourthwallGiftMessage(data) {
|
||||
|
||||
if (showFourthwallGiftPurchase == false) return;
|
||||
|
||||
const userName = data.username;
|
||||
const total = data.total;
|
||||
const currency = data.currency;
|
||||
const gifts = data.gifts.length;
|
||||
const item = data.offer.name;
|
||||
const imageUrl = data.offer.imageUrl;
|
||||
const text = stripStringFromHtml(data.statmessageus);
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var money = '';
|
||||
if (total == 0) { money = 0; }
|
||||
else { money = formatCurrency(total,currency); }
|
||||
|
||||
var fourthWallImage = '';
|
||||
if (showFourthwallShowGiftImage == true) {
|
||||
fourthWallImage = imageUrl
|
||||
}
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.fourthwall.gift({
|
||||
money: money,
|
||||
firstItem: item,
|
||||
items: gifts,
|
||||
message: text,
|
||||
image: fourthWallImage
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = ['order'];
|
||||
if (showFourthwallBigGiftImage == true) {
|
||||
classes.push('giantimage');
|
||||
}
|
||||
|
||||
const messageData = {
|
||||
classes: classes.join(' '),
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'fourthwall', messageData);
|
||||
}
|
||||
|
||||
async function fourthwallGiftDrawStartMessage(data) {
|
||||
|
||||
if (showFourthwallGiftDraw == false) return;
|
||||
|
||||
const {
|
||||
offer: {
|
||||
name: itemName
|
||||
},
|
||||
durationSeconds
|
||||
} = data;
|
||||
|
||||
var userName = '';
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.fourthwall.drawstart({
|
||||
gift: itemName,
|
||||
command: fourthWallGiftDrawCommand,
|
||||
time: durationSeconds
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'fourthwall', messageData);
|
||||
}
|
||||
|
||||
async function fourthwallGiftDrawEndMessage(data) {
|
||||
|
||||
if (showFourthwallGiftDraw == false) return;
|
||||
|
||||
const {
|
||||
gifts
|
||||
} = data;
|
||||
|
||||
var userName = '';
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.fourthwall.drawend({
|
||||
winners: await getWinnersList(gifts)
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'fourthwall', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function getWinnersList(gifts) {
|
||||
const winners = gifts.map(gift => gift.winner).filter(Boolean); // Remove null/undefined
|
||||
|
||||
const numWinners = winners.length;
|
||||
|
||||
if (numWinners === 0) { return ""; }
|
||||
if (numWinners === 1) { return winners[0]; }
|
||||
if (numWinners === 2) { return `${winners[0]} and ${winners[1]}`; }
|
||||
|
||||
// For 3 or more, use the Oxford comma style: A, B, and C
|
||||
const allButLast = winners.slice(0, -1).join(", ");
|
||||
const lastWinner = winners[winners.length - 1];
|
||||
return `${allButLast}, and ${lastWinner}`;
|
||||
}
|
@@ -1,569 +0,0 @@
|
||||
const kickUserName = getURLParam("kickUserName", false);
|
||||
|
||||
const showKickMessages = getURLParam("showKickMessages", true);
|
||||
const showKickFollows = getURLParam("showKickFollows", true);
|
||||
const showKickSubs = getURLParam("showKickSubs", true);
|
||||
const showKickGiftedSubs = getURLParam("showKickGiftedSubs", true);
|
||||
const showKickMassGiftedSubs = getURLParam("showKickMassGiftedSubs", true);
|
||||
const showKickRaids = getURLParam("showKickRaids", true);
|
||||
const showKickViewers = getURLParam("showKickViewers", true);
|
||||
|
||||
const kickAvatars = new Map();
|
||||
const kick7TVEmojis = new Map();
|
||||
|
||||
if (showKickViewers == false) { document.querySelector('#statistics #kick').style.display = 'none'; }
|
||||
|
||||
if (kickUserName) {
|
||||
|
||||
const kickWebSocket = new WebSocket(
|
||||
`wss://ws-us2.pusher.com/app/32cbd69e4b950bf97679?protocol=7&client=js&version=8.4.0-rc2&flash=false`
|
||||
);
|
||||
|
||||
kickWebSocket.onerror = (error) => {
|
||||
console.error("Kick WebSocket Error: " + error);
|
||||
};
|
||||
|
||||
kickWebSocket.onopen = () => {
|
||||
|
||||
kickGetUserInfo(kickUserName)
|
||||
.then((userInfo) => {
|
||||
console.log('Got Kick User Info', userInfo);
|
||||
|
||||
(async () => {
|
||||
const kick7TVEmotes = await get7TVEmotes(userInfo.user_id);
|
||||
if (kick7TVEmotes != null) {
|
||||
console.debug("Getting all Kick's 7TV Emojis + Globals", kick7TVEmotes);
|
||||
|
||||
kick7TVEmotes.forEach(emote => {
|
||||
kick7TVEmojis.set(emote.name, emote.url);
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
kickWebSocket.send(
|
||||
JSON.stringify({
|
||||
event: "pusher:subscribe",
|
||||
data: {
|
||||
auth: null,
|
||||
channel: `chatrooms.${userInfo.chatroom.id}.v2`
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
kickWebSocket.send(
|
||||
JSON.stringify({
|
||||
event: "pusher:subscribe",
|
||||
data: {
|
||||
auth: null,
|
||||
channel: `channel.${userInfo.chatroom.channel_id}`
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
setInterval(() => {
|
||||
kickWebSocket.send(
|
||||
JSON.stringify({
|
||||
event: "pusher:ping",
|
||||
data: {},
|
||||
})
|
||||
);
|
||||
}, 60000);
|
||||
|
||||
kickUpdateStatistics(userInfo);
|
||||
setInterval(() => {
|
||||
kickGetUserInfo(kickUserName)
|
||||
.then((data) =>{
|
||||
kickUpdateStatistics(data);
|
||||
});
|
||||
}, 15000);
|
||||
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
kickWebSocket.onmessage = async ({ data }) => {
|
||||
const parsed = JSON.parse(data);
|
||||
const json = JSON.parse(parsed.data);
|
||||
|
||||
if (!parsed.event.includes("pusher")) {
|
||||
|
||||
switch (parsed.event) {
|
||||
case "App\\Events\\ChatMessageEvent":
|
||||
console.debug('Kick Chat', json);
|
||||
kickChatMessage(json);
|
||||
break;
|
||||
|
||||
case "App\\Events\\MessageDeletedEvent":
|
||||
kickChatMessageDeleted(json);
|
||||
break;
|
||||
|
||||
case "App\\Events\\UserBannedEvent":
|
||||
kickUserBanned(json);
|
||||
break;
|
||||
|
||||
case "App\\Events\\ChatroomClearEvent":
|
||||
kickChatClearMessages()
|
||||
break;
|
||||
|
||||
default:
|
||||
console.debug('Kick Event From WebSocket', parsed.event, json);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
else {
|
||||
console.debug('Kick User not set in ChatRD');
|
||||
}
|
||||
|
||||
|
||||
|
||||
streamerBotClient.on('General.Custom', (response) => {
|
||||
|
||||
|
||||
if (response.data.platform === 'Kick') {
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
switch (data.triggerCustomCodeEventName) {
|
||||
case "kickFollow" :
|
||||
console.debug('Kick Follow', data);
|
||||
kickFollowMessage(data);
|
||||
break;
|
||||
case "kickSub" :
|
||||
console.debug('Kick Sub', data);
|
||||
kickSubMessage(data);
|
||||
break;
|
||||
case "kickGift" :
|
||||
console.debug('Kick Sub Gift', data);
|
||||
kickGiftMessage(data);
|
||||
break;
|
||||
case "kickGifts" :
|
||||
console.debug('Kick Mass Sub Gift', data);
|
||||
kickGiftSubsMessage(data);
|
||||
break;
|
||||
case "kickIncomingRaid" :
|
||||
console.debug('Kick Raid', data);
|
||||
kickRaidMessage(data);
|
||||
break;
|
||||
default:
|
||||
//console.debug('Kick Event', response.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
async function kickChatMessage(data) {
|
||||
|
||||
if (showKickMessages == false) return;
|
||||
if (ignoreUserList.includes(data.sender.username.toLowerCase())) return;
|
||||
if (data.content.startsWith("!") && excludeCommands == true) return;
|
||||
|
||||
const {
|
||||
id: messageId,
|
||||
type,
|
||||
content: text,
|
||||
sender: {
|
||||
id: userID,
|
||||
slug: userSlug,
|
||||
username: userName,
|
||||
identity: {
|
||||
color,
|
||||
badges: badgesToParse
|
||||
}
|
||||
}
|
||||
|
||||
} = data;
|
||||
|
||||
const [avatar, message, badges] = await Promise.all([
|
||||
getKickAvatar(userSlug),
|
||||
getKickEmotes(text),
|
||||
getKickBadges(badgesToParse),
|
||||
]);
|
||||
|
||||
const replyHTML = (type == "reply" ?
|
||||
`<div class="reply"><i class="fa-solid fa-arrow-turn-up"></i> <strong>${data.metadata.original_sender.username}:</strong> ${await getKickEmotes(data.metadata.original_message.content)}</div>` : '');
|
||||
|
||||
const messageData = {
|
||||
classes: '',
|
||||
avatar,
|
||||
badges,
|
||||
userName,
|
||||
color,
|
||||
message,
|
||||
shared: '',
|
||||
reply: replyHTML,
|
||||
};
|
||||
|
||||
addMessageToChat(userSlug, messageId, 'kick', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async function kickFollowMessage(data) {
|
||||
|
||||
if (showKickFollows == false) return;
|
||||
|
||||
const {
|
||||
userName : userID,
|
||||
user : userName
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kick.follow(),
|
||||
]);
|
||||
|
||||
const classes = 'follow';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'kick', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function kickSubMessage(data) {
|
||||
|
||||
if (showKickSubs == false) return;
|
||||
|
||||
const {
|
||||
userName: userID,
|
||||
user: userName,
|
||||
tier,
|
||||
cumulative
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kick.sub({
|
||||
months : cumulative,
|
||||
tier : tier
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'sub';
|
||||
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'kick', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function kickGiftMessage(data) {
|
||||
|
||||
if (showKickSubs == false || showKickGiftedSubs == false) return;
|
||||
|
||||
const {
|
||||
user: userName,
|
||||
userName: userID,
|
||||
recipientUser: recipientName,
|
||||
tier,
|
||||
totalSubsGifted
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kick.gifted({
|
||||
gifted : recipientName,
|
||||
tier : tier,
|
||||
total : totalSubsGifted
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'sub';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'kick', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function kickGiftSubsMessage(data) {
|
||||
|
||||
if (showKickSubs == false || showKickMassGiftedSubs == false) return;
|
||||
|
||||
const {
|
||||
user: userName,
|
||||
userName: userID,
|
||||
tier,
|
||||
gifts
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kick.giftedbomb({
|
||||
count : gifts,
|
||||
tier : tier
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'sub';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'kick', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function kickRaidMessage(data) {
|
||||
|
||||
if (showKickRaids == false) return;
|
||||
|
||||
const {
|
||||
user: userName,
|
||||
viewers
|
||||
} = data;
|
||||
|
||||
const userID = userName.toLowerCase();
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kick.raid({ viewers : viewers })
|
||||
]);
|
||||
|
||||
const classes = 'raid';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'kick', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function kickChatMessageDeleted(data) {
|
||||
document.getElementById(data.message.id)?.remove();
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function kickUserBanned(data) {
|
||||
chatContainer.querySelectorAll(`[data-user="${data.user.slug}"]:not(.event)`).forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function kickChatClearMessages() {
|
||||
chatContainer.querySelectorAll(`.kick:not(.event)`).forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function kickUpdateStatistics(data) {
|
||||
|
||||
if (showPlatformStatistics == false || showKickViewers == false) return;
|
||||
|
||||
if (data.livestream == null) { }
|
||||
else {
|
||||
const viewers = DOMPurify.sanitize(data.livestream.viewer_count);
|
||||
document.querySelector('#statistics #kick .viewers span').textContent = formatNumber(viewers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function kickGetUserInfo(user) {
|
||||
const response = await fetch( `https://kick.com/api/v2/channels/${user}` );
|
||||
|
||||
if (response.status === 404) {
|
||||
console.error("Kick user was not found!");
|
||||
return 404;
|
||||
}
|
||||
else {
|
||||
const data = await response.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function getKickAvatar(user) {
|
||||
if (showAvatar == true) {
|
||||
if (kickAvatars.has(user)) {
|
||||
console.debug(`Kick avatar found for ${user}!`);
|
||||
return kickAvatars.get(user);
|
||||
}
|
||||
else {
|
||||
console.debug(`Kick avatar not found for ${user}! Trying to get it...`);
|
||||
|
||||
const response = await kickGetUserInfo(user);
|
||||
var newavatar = '';
|
||||
|
||||
if (response == 404) {
|
||||
newavatar = 'https://kick.com/img/default-profile-pictures/default2.jpeg';
|
||||
}
|
||||
else {
|
||||
if (response.user.profile_pic == null) {
|
||||
newavatar = 'https://kick.com/img/default-profile-pictures/default2.jpeg';
|
||||
}
|
||||
else {
|
||||
newavatar = response.user.profile_pic;
|
||||
newavatar = newavatar.replace(/fullsize(?=\.webp)/, "medium");
|
||||
}
|
||||
kickAvatars.set(user, newavatar);
|
||||
}
|
||||
|
||||
return newavatar;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function getKickEmotes(text) {
|
||||
var message = await parseKickEmojis(text);
|
||||
message = await parseKick7TVEmotes(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
async function parseKickEmojis(content) {
|
||||
const message = content;
|
||||
const messagewithemotes = message.replace(/\[emote:(\d+):([^\]]+)\]/g, (_, id, name) => {
|
||||
return `<img src="https://files.kick.com/emotes/${id}/fullsize" alt="${name}" class="emote" >`;
|
||||
});
|
||||
|
||||
return messagewithemotes;
|
||||
}
|
||||
|
||||
async function parseKick7TVEmotes(text) {
|
||||
const words = text.split(/\s+/);
|
||||
const parsedWords = words.map(word => {
|
||||
const clean = word.replace(/[^\w]/g, ''); // remove pontuação para comparar
|
||||
if (kick7TVEmojis.has(clean)) {
|
||||
const url = kick7TVEmojis.get(clean);
|
||||
return word.replace(clean, `<img src="${url}" alt="${clean}" class="emote" />`);
|
||||
}
|
||||
return word;
|
||||
});
|
||||
|
||||
return parsedWords.join(' ');
|
||||
}
|
||||
|
||||
async function get7TVEmotes(userid) {
|
||||
const userSet = await fetch(`https://7tv.io/v3/users/kick/${userid}`);
|
||||
|
||||
if (userSet.status === 404) {
|
||||
console.debug("7TV Profile based on this Kick user was not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
const userEmojis = await userSet.json();
|
||||
|
||||
const gettingAllKick7TVEmotes = userEmojis?.emote_set?.emotes?.map(emote => ({
|
||||
name: emote.name,
|
||||
id: emote.id,
|
||||
url: `https://cdn.7tv.app/emote/${emote.id}/1x.webp`
|
||||
})) || [];
|
||||
|
||||
const globalSet = await fetch(`https://7tv.io/v3/emote-sets/global`);
|
||||
const globalEmojis = await globalSet.json();
|
||||
|
||||
const gettingAllGlobal7TVEmotes = globalEmojis?.emotes?.map(emote => ({
|
||||
name: emote.name,
|
||||
id: emote.id,
|
||||
url: `https://cdn.7tv.app/emote/${emote.id}/1x.webp`
|
||||
})) || [];
|
||||
|
||||
const SevenTVEmotesFusion = [...gettingAllKick7TVEmotes, ...gettingAllGlobal7TVEmotes];
|
||||
return SevenTVEmotesFusion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function getKickBadges(badges) {
|
||||
const badgesArray = [];
|
||||
|
||||
badges.forEach(badge => {
|
||||
switch (badge.type) {
|
||||
case "broadcaster":
|
||||
badgesArray.push('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 32 32" class="size-[calc(1em*(18/13))]"><defs><linearGradient id="HostBadgeA" x1="16" x2="16" y1="-197.5" y2="118.7" gradientUnits="userSpaceOnUse"><stop stop-color="#FF1CD2"></stop><stop offset="1" stop-color="#B20DFF"></stop></linearGradient><linearGradient id="HostBadgeB" x1="16" x2="16" y1="0" y2="0" gradientUnits="userSpaceOnUse"><stop stop-color="#FF1CD2"></stop><stop offset="1" stop-color="#B20DFF"></stop></linearGradient><linearGradient id="HostBadgeC" x1="16" x2="16" y1="-64" y2="-64" gradientUnits="userSpaceOnUse"><stop stop-color="#FF1CD2"></stop><stop offset="1" stop-color="#B20DFF"></stop></linearGradient><linearGradient id="HostBadgeD" x1="16" x2="16" y1="-197.5" y2="118.7" gradientUnits="userSpaceOnUse"><stop stop-color="#FF1CD2"></stop><stop offset="1" stop-color="#B20DFF"></stop></linearGradient><linearGradient id="HostBadgeE" x1="16" x2="16" y1="-74.7" y2="-74.7" gradientUnits="userSpaceOnUse"><stop stop-color="#FF1CD2"></stop><stop offset="1" stop-color="#B20DFF"></stop></linearGradient><linearGradient id="HostBadgeF" x1="27.2" x2="27.2" y1="-.5" y2="31.1" gradientUnits="userSpaceOnUse"><stop stop-color="#FF1CD2"></stop><stop offset="1" stop-color="#B20DFF"></stop></linearGradient></defs><path fill="url(#HostBadgeA)" d="M9.6 19.2H6.4v3.2h3.2v-3.2Z"></path><path fill="url(#HostBadgeB)" d="M12.8 19.2h6.4V16h3.2V3.2h-3.2V0h-6.4v3.2H9.6V16h3.2v3.2Z"></path><path fill="url(#HostBadgeC)" d="M6.4 12.8H3.2v6.4h3.2v-6.4Z"></path><path fill="url(#HostBadgeD)" d="M25.6 19.2h-3.2v3.2h3.2v-3.2Z"></path><path fill="url(#HostBadgeE)" d="M9.6 22.4v3.2h3.2v3.2H9.6V32h12.8v-3.2h-3.2v-3.2h3.2v-3.2H9.6Z"></path><path fill="url(#HostBadgeF)" d="M25.6 12.8v6.4h3.2v-6.4h-3.2Z"></path></svg>');
|
||||
break;
|
||||
case "sidekick":
|
||||
badgesArray.push('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 32 32" class="size-[calc(1em*(18/13))]"><path fill="url(#SidekickBadgeA)" d="M0 5.5v11.3h2.3V20h2.3v3.2h2.2v3.2h6.9v-3.2h4.6v3.2H25v-3.2h2.3V20h2.3v-3.2H32V5.5h-9.2v3.2h-4.6V12h-4.5V8.7H9V5.5H0Zm13.7 13.7H7V16H4.6V9.6h2.3v3.2h4.5V16h2.3v3.2ZM27.4 16h-2.2v3.2h-6.9V16h2.3v-3.2h4.6V9.6h2.2V16Z"></path><defs><linearGradient id="SidekickBadgeA" x1="18.8" x2="11.7" y1="-2.7" y2="32.7" gradientUnits="userSpaceOnUse"><stop stop-color="#FF6A4A"></stop><stop offset="1" stop-color="#C70C00"></stop></linearGradient></defs></svg>');
|
||||
break;
|
||||
case "moderator":
|
||||
badgesArray.push('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 32 32" class="size-[calc(1em*(18/13))]"><path fill="#00C7FF" d="M23.5 2.5v3h-3v3h-3v3h-3v3h-3v-3h-6v6h3v3h-3v3h-3v6h6v-3h3v-3h3v3h6v-6h-3v-3h3v-3h3v-3h3v-3h3v-6h-6Z"></path></svg>');
|
||||
break;
|
||||
case "vip":
|
||||
badgesArray.push('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 32 32" class="size-[calc(1em*(18/13))]"><path fill="url(#VIPBadgeA)" d="M27.8 4.8V7h-2.5v4.5h-2.1v2.3h-2.3V9.3h-2.4V2.6h-5v6.7H11v4.5H8.8v-2.3H6.7V7H4.2V4.8H0v24.6h32V4.8h-4.2Z"></path><defs><linearGradient id="VIPBadgeA" x1="16" x2="16" y1="-1" y2="35.1" gradientUnits="userSpaceOnUse"><stop stop-color="#FFC900"></stop><stop offset="1" stop-color="#FF9500"></stop></linearGradient></defs></svg>');
|
||||
break;
|
||||
case "sub_gifter":
|
||||
badgesArray.push('<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" class="size-[calc(1em*(18/13))]"><g clip-path="url(#clip0_31_3197)"><path d="M22.34 9.5L26 4H18L16 7L14 4H6L9.66 9.5H4V15.1H28V9.5H22.34Z" fill="#2EFAD1"></path><path d="M26.08 19.1001H5.90002V28.5001H26.08V19.1001Z" fill="#2EFAD1"></path><path d="M26.08 15.1001H5.90002V19.1001H26.08V15.1001Z" fill="#00A18D"></path></g><defs><clipPath id="clip0_31_3197"><rect width="24" height="24.5" fill="white" transform="translate(4 4)"></rect></clipPath></defs></svg>');
|
||||
break;
|
||||
case "og":
|
||||
badgesArray.push('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 32 32" class="size-[calc(1em*(18/13))]"><g clip-path="url(#OGBadgeA)"><path fill="url(#OGBadgeB)" d="M32 32H18.3v-1.6h-1.5v-16h1.5v-1.6H32v6.4h-9v9.6h3v-3.2h-1.6v-3.2H32V32Z"></path><path fill="url(#OGBadgeC)" d="M13.6 17.6v1.6h-12v-1.6H0v-16h1.5V0h12.2v1.6h1.5v16h-1.6Zm-4.5-4.8V3.2H6v9.6h3Z"></path><path fill="#00FFF2" d="M13.6 30.4V32h-12v-1.6H0V17.6h1.5V16h12.2v1.6h1.5v12.8h-1.6Zm-4.5-1.6v-9.6H6v9.6h3ZM32 16H18.3v-1.6h-1.5V1.6h1.5V0H32v3.2h-9v9.6h3V9.6h-1.6V6.4H32V16Z"></path></g><defs><linearGradient id="OGBadgeB" x1="16" x2="16" y1="32" y2="2.5" gradientUnits="userSpaceOnUse"><stop stop-color="#00FFF2"></stop><stop offset="1" stop-color="#006399"></stop></linearGradient><linearGradient id="OGBadgeC" x1="15.5" x2="16.1" y1=".4" y2="31.7" gradientUnits="userSpaceOnUse"><stop stop-color="#00FFF2"></stop><stop offset="1" stop-color="#006399"></stop></linearGradient><clipPath id="OGBadgeA"><path fill="#fff" d="M0 0h32v32H0z"></path></clipPath></defs></svg>');
|
||||
break;
|
||||
case "founder":
|
||||
badgesArray.push('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 32 32" class="size-[calc(1em*(18/13))]"><g clip-path="url(#FounderBadgeA)"><path fill="url(#FounderBadgeB)" fill-rule="evenodd" d="M29.3 8V5.4h-2.7V2.7H24V0H8v2.7H5.4v2.7H2.6V8H0v16h2.6v2.6h2.8v2.7H8V32h16v-2.7h2.6v-2.7h2.7V24H32V8h-2.7Zm-9.5 17.7h-6.5V12.8H9v-2.4h2V8.2h2v-2h7v19.5Z" clip-rule="evenodd"></path></g><defs><linearGradient id="FounderBadgeB" x1="15.7" x2="16.3" y1="-4.5" y2="36.7" gradientUnits="userSpaceOnUse"><stop stop-color="#FFC900"></stop><stop offset="1" stop-color="#FF9500"></stop></linearGradient><clipPath id="FounderBadgeA"><path fill="#fff" d="M0 0h32v32H0z"></path></clipPath></defs></svg>');
|
||||
break;
|
||||
case "subscriber":
|
||||
badgesArray.push('<i class="fa-solid fa-star sub"></i>');
|
||||
break;
|
||||
case "verified":
|
||||
badgesArray.push('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="size-[calc(1em*(18/13))]"><path fill="#1EFF00" d="M16 6.83512L13.735 4.93512L13.22 2.02512H10.265L8 0.120117L5.735 2.02012H2.78L2.265 4.93012L0 6.83512L1.48 9.39512L0.965 12.3051L3.745 13.3151L5.225 15.8751L8.005 14.8651L10.785 15.8751L12.265 13.3151L15.045 12.3051L14.53 9.39512L16.01 6.83512H16ZM6.495 12.4051L2.79 8.69512L4.205 7.28012L6.495 9.57512L11.29 4.78012L12.705 6.19512L6.5 12.4001L6.495 12.4051Z"></path></svg>');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return badgesArray.join(' ');
|
||||
}
|
@@ -1,188 +0,0 @@
|
||||
const showKofiSubscriptions = getURLParam("showKofiSubscriptions", true);
|
||||
const showKofiDonations = getURLParam("showKofiDonations", true);
|
||||
const showKofiOrders = getURLParam("showKofiOrders", true);
|
||||
|
||||
const kofiMessageHandlers = {
|
||||
'Kofi.Donation': (response) => {
|
||||
console.debug('Kofi Donation', response.data);
|
||||
kofiDonationMessage(response.data);
|
||||
},
|
||||
'Kofi.Subscription': (response) => {
|
||||
console.debug('Kofi Sub', response.data);
|
||||
kofiSubMessage(response.data);
|
||||
},
|
||||
'Kofi.Resubscription': (response) => {
|
||||
console.debug('Kofi Resub', response.data);
|
||||
kofiReSubMessage(response.data);
|
||||
},
|
||||
'Kofi.ShopOrder': (response) => {
|
||||
console.debug('Kofi Order', response.data);
|
||||
kofiOrderMessage(response.data);
|
||||
},
|
||||
};
|
||||
|
||||
for (const [event, handler] of Object.entries(kofiMessageHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
|
||||
async function kofiDonationMessage(data) {
|
||||
|
||||
if (showKofiDonations == false) return;
|
||||
|
||||
const {
|
||||
from : userName,
|
||||
amount,
|
||||
currency,
|
||||
message: text
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var money = formatCurrency(amount,currency);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kofi.donation({
|
||||
money: money,
|
||||
message: text
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'kofi', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function kofiSubMessage(data) {
|
||||
|
||||
if (showKofiSubscriptions == false) return;
|
||||
|
||||
const {
|
||||
from : userName,
|
||||
amount,
|
||||
currency,
|
||||
message: text
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var money = formatCurrency(amount,currency);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kofi.sub({
|
||||
money: money,
|
||||
message: text
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'kofi', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function kofiReSubMessage(data) {
|
||||
|
||||
if (showKofiSubscriptions == false) return;
|
||||
|
||||
const {
|
||||
from : userName,
|
||||
amount,
|
||||
currency,
|
||||
tier,
|
||||
message: text
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var money = formatCurrency(amount,currency);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kofi.resub({
|
||||
money: money,
|
||||
tier: tier,
|
||||
message: text
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'kofi', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function kofiOrderMessage(data) {
|
||||
|
||||
if (showKofiOrders == false) return;
|
||||
const {
|
||||
from : userName,
|
||||
amount,
|
||||
currency,
|
||||
items
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
var money = '';
|
||||
|
||||
if (amount == 0) { money = 0; }
|
||||
else { money = formatCurrency(amount,currency); }
|
||||
|
||||
var itemsQuantity = items.length
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.kofi.order({
|
||||
money: money,
|
||||
items: itemsQuantity
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'kofi', messageData);
|
||||
}
|
0
js/lang.js
Normal file
0
js/lang.js
Normal file
166
js/lang/en.js
166
js/lang/en.js
@@ -1,166 +0,0 @@
|
||||
const en = {
|
||||
streamerbotconnected: 'Streamer.bot Online!',
|
||||
streamerbotdisconnected: 'Streamer.bot Disconnected!',
|
||||
|
||||
ttschat: 'said',
|
||||
|
||||
chatsendmessage: 'Send Message',
|
||||
|
||||
twitch : {
|
||||
firstMessage : () => `First chatter`,
|
||||
follow : () => ` followed the channel`,
|
||||
announcement : () => ` <div class="reply">📢 <strong>Announcement</strong></div>`,
|
||||
channelpoints : ({ title }) => ` <div class="reply"><i class="fa-solid fa-wand-magic-sparkles"></i> <strong>Channel Points - ${title}</strong></div>`,
|
||||
bits : ({ bits, message }) => ` cheered <i class="fa-regular fa-gem fall-and-bounce"></i> <strong>${bits} bits</strong>${message ? '<br>'+message : ''}`,
|
||||
|
||||
sub : ({ months, isPrime, tier }) => ` subscribed for
|
||||
${isPrime == true ? '<i class="fa-solid fa-crown"></i>' : '<i class="fa-solid fa-star"></i>'}
|
||||
<strong>${months || 1 } ${months == 1 ? 'month' : 'months'}
|
||||
(${isPrime == true ? 'Prime' : 'Tier '+tier.toString().charAt(0)})</strong>`,
|
||||
|
||||
resub : ({ months, isPrime, tier, message }) => ` subscribed for
|
||||
${isPrime == true ? '<i class="fa-solid fa-crown"></i>' : '<i class="fa-solid fa-star"></i>'}
|
||||
<strong>${months || 1 } ${months == 1 ? 'month' : 'months'}
|
||||
(${isPrime == true ? 'Prime' : 'Tier '+tier.toString().charAt(0)})</strong>
|
||||
${message ? '<br>'+message : '' }`,
|
||||
|
||||
gifted : ({ gifted, months, tier }) => ` gifted
|
||||
<strong>${months || 1 } ${months == 1 ? 'month' : 'months'}
|
||||
of Tier ${tier.toString().charAt(0)} ${months == 1 ? 'sub' : 'subs'}</strong>
|
||||
to <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
giftedbomb : ({ count, total, tier }) => ` gifted <i class="fa-solid fa-gift"></i> <strong>${count} subs (Tier ${tier.toString().charAt(0)})</strong> to the Community, <strong>${total || 1} ${total == 1 ? 'gift' : 'gifts'} in total</strong>`,
|
||||
|
||||
raid : ({ viewers }) => ` raided the channel with <i class="fa-solid fa-users"></i> <strong>${viewers} viewers</strong>`
|
||||
|
||||
},
|
||||
|
||||
|
||||
youtube : {
|
||||
superchat : ({ money, message }) => ` superchatted <i class="fa-solid fa-comments-dollar"></i> <strong>${money}</strong>
|
||||
${message ? '<br>'+message : ''}
|
||||
`,
|
||||
|
||||
supersticker : ({ money, sticker }) => `
|
||||
${sticker ? '<br>': ''}
|
||||
sent a supersticker of <i class="fa-solid fa-comments-dollar"></i> <strong>${money}</strong>
|
||||
${sticker ? '</span></span><span class="sticker"><img src="'+sticker+'"></span>': ''}
|
||||
`,
|
||||
|
||||
member : ({ months, tier, message }) => ` became a member for
|
||||
<i class="fa-solid fa-star"></i>
|
||||
<strong>${months || 1 } ${months && months > 1 ? 'months' : 'month'}
|
||||
(Tier ${tier})</strong>
|
||||
${message ? '<br>'+message : ''}`,
|
||||
|
||||
giftedmembers : ({ total, tier }) => ` gifted <i class="fa-solid fa-gift"></i> <strong>${total} ${total == 1 ? 'membership' : 'memberships'} (Tier ${tier}) to the channel</strong>`,
|
||||
|
||||
giftedtrainmembers : ({ gifted, tier }) => ` gifted a membership
|
||||
<strong>(${tier})</strong>
|
||||
to <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
},
|
||||
|
||||
|
||||
streamlabs : {
|
||||
tip : ({ money, message }) => ` donated 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
|
||||
streamelements : {
|
||||
tip : ({ money, message }) => ` donated 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
|
||||
tiktok : {
|
||||
follow : () => ` followed the channel`,
|
||||
likes : (likes) => `sent <strong><i class="fa-solid fa-heart"></i> <em class="likecount" style="font-style: normal;">${likes}</em> likes</strong>`,
|
||||
sub : ({ months }) => ` subscribed for <i class="fa-solid fa-star"></i> <strong>${months || 1 } ${(months && months > 1) ? 'months' : 'month'}</strong>`,
|
||||
gift : ({ gift, count, coins }) => ` gifted <strong>${gift} x${count}</strong> (🪙 <strong>${coins} ${(coins && coins > 1) ? 'coins' : 'coin'})</strong>`,
|
||||
|
||||
},
|
||||
|
||||
kick : {
|
||||
follow : () => ` followed the channel`,
|
||||
|
||||
sub : ({ months, tier }) => ` subscribed for
|
||||
<strong>${months || 1 } ${months == 1 ? 'month' : 'months'}
|
||||
(Tier ${tier})</strong>`,
|
||||
|
||||
gifted : ({ gifted, tier, total }) => ` gifted
|
||||
<strong>${total || 1 } ${total == 1 ? 'sub' : 'subs'}
|
||||
(Tier ${tier})</strong>
|
||||
to <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
giftedbomb : ({ count, tier }) => ` gifted <i class="fa-solid fa-gift"></i> <strong>${count} subs (Tier ${tier})</strong> to the Community`,
|
||||
|
||||
raid : ({ viewers }) => ` raided the channel with <i class="fa-solid fa-users"></i> <strong>${viewers} viewers</strong>`
|
||||
|
||||
},
|
||||
|
||||
patreon: {
|
||||
membership: ({ money }) => ` pledged a membership ($${money})`
|
||||
|
||||
},
|
||||
|
||||
tipeeestream : {
|
||||
tip : ({ money, message }) => ` donated 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
kofi : {
|
||||
donation : ({ money, message }) => ` donated 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
sub : ({ money, tier, message }) => ` subscribed <strong>(${money}) ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
|
||||
resub : ({ money, tier, message }) => ` resubscribed <strong>${money} ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
|
||||
order : ({ money, items }) => ` ordered <strong>${items} ${items == 1 ? 'item' : 'items'} (${money == 0 ? 'Free' : money})`,
|
||||
},
|
||||
|
||||
fourthwall : {
|
||||
someone : () => `Someone`,
|
||||
|
||||
donation : ({ money, message }) => ` donated 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
sub : ({ money }) => ` subscribed <strong>(${money})</strong>`,
|
||||
|
||||
order : ({
|
||||
money,
|
||||
firstItem,
|
||||
items,
|
||||
message,
|
||||
image,
|
||||
|
||||
}) => `
|
||||
${image ? '<br>': ''}
|
||||
ordered <strong>${firstItem}</strong> ${items > 1 ? 'and <strong>'+(items - 1)+' other '+((items - 1) == 1 ? 'item' : 'items')+'</strong>' : ''}
|
||||
(${money == 0 ? 'Free' : money})
|
||||
${message.trim() ? '<br>'+message : ''}
|
||||
${image ? '</span></span><span class="image"><img src="'+image+'"></span>': ''}
|
||||
`,
|
||||
|
||||
gift : ({
|
||||
money,
|
||||
firstItem,
|
||||
items,
|
||||
message,
|
||||
image,
|
||||
|
||||
}) => `
|
||||
${image ? '<br>': ''}
|
||||
gifted <strong>${items}x ${firstItem}</strong>
|
||||
(${money == 0 ? 'Free' : money})
|
||||
${message.trim() ? '<br>'+message : ''}
|
||||
${image ? '</span></span><span class="image"><img src="'+image+'"></span>': ''}
|
||||
`,
|
||||
|
||||
|
||||
|
||||
drawstart : ({ gift, command, time }) => `
|
||||
<strong><i class="fa-solid fa-gift"></i> Giveaway started!</strong>
|
||||
<br>Type <strong>${command}</strong> to have a chance to win <strong>${gift}</strong>. You have <strong>${time} seconds!</strong>`,
|
||||
|
||||
drawend : ({ winners }) => `
|
||||
<strong>🎉 Giveaway Ended!</strong>
|
||||
<br>Congratulations <strong>${winners}</strong>`,
|
||||
|
||||
|
||||
|
||||
},
|
||||
}
|
156
js/lang/es.js
156
js/lang/es.js
@@ -1,156 +0,0 @@
|
||||
const es = {
|
||||
streamerbotconnected: '¡Streamer.bot en línea!',
|
||||
streamerbotdisconnected: '¡Streamer.bot desconectado!',
|
||||
ttschat: 'dijo',
|
||||
|
||||
chatsendmessage: 'Enviar mensaje',
|
||||
|
||||
twitch : {
|
||||
firstMessage : () => `Primeira mensaje`,
|
||||
follow : () => ` siguió el canal`,
|
||||
announcement : () => ` <div class="reply">📢 <strong>Anuncio</strong></div>`,
|
||||
channelpoints : ({ title }) => ` <div class="reply"><i class="fa-solid fa-wand-magic-sparkles"></i> <strong>Puntos del canal - ${title}</strong></div>`,
|
||||
bits : ({ bits, message }) => ` envió <i class="fa-regular fa-gem fall-and-bounce"></i> <strong>${bits} bits</strong>${message ? '<br>'+message : ''}`,
|
||||
|
||||
sub : ({ months, isPrime, tier }) => ` se suscribió por
|
||||
${isPrime == true ? '<i class="fa-solid fa-crown"></i>' : '<i class="fa-solid fa-star"></i>'}
|
||||
<strong>${months || 1 } ${months == 1 ? 'mes' : 'meses'}
|
||||
(${isPrime == true ? 'Prime' : 'Tier '+tier.toString().charAt(0)})</strong>`,
|
||||
|
||||
resub : ({ months, isPrime, tier, message }) => ` se volvió a suscribir por
|
||||
${isPrime == true ? '<i class="fa-solid fa-crown"></i>' : '<i class="fa-solid fa-star"></i>'}
|
||||
<strong>${months || 1 } ${months == 1 ? 'mes' : 'meses'}
|
||||
(${isPrime == true ? 'Prime' : 'Tier '+tier.toString().charAt(0)})</strong>
|
||||
${message ? '<br>'+message : '' }`,
|
||||
|
||||
gifted : ({ gifted, months, tier }) => ` regaló
|
||||
<strong>${months || 1 } ${months == 1 ? 'mes' : 'meses'}
|
||||
de Tier ${tier.toString().charAt(0)} ${months == 1 ? 'suscripción' : 'suscripciones'}</strong>
|
||||
a <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
giftedbomb : ({ count, total, tier }) => ` regaló <i class="fa-solid fa-gift"></i> <strong>${count} suscripciones (Tier ${tier.toString().charAt(0)})</strong> a la comunidad, <strong>${total || 1} ${total == 1 ? 'regalo' : 'regalos'} en total</strong>`,
|
||||
|
||||
raid : ({ viewers }) => ` hizo una raid al canal con <i class="fa-solid fa-users"></i> <strong>${viewers} espectadores</strong>`
|
||||
},
|
||||
|
||||
youtube : {
|
||||
superchat : ({ money, message }) => ` envió un superchat <i class="fa-solid fa-comments-dollar"></i> <strong>${money}</strong>
|
||||
${message ? '<br>'+message : ''}
|
||||
`,
|
||||
|
||||
supersticker : ({ money, sticker }) => `
|
||||
${sticker ? '<br>': ''}
|
||||
envió un supersticker de <i class="fa-solid fa-comments-dollar"></i> <strong>${money}</strong>
|
||||
${sticker ? '</span></span><span class="sticker"><img src="'+sticker+'"></span>': ''}
|
||||
`,
|
||||
|
||||
member : ({ months, tier, message }) => ` se hizo miembro por
|
||||
<i class="fa-solid fa-star"></i>
|
||||
<strong>${months || 1 } ${months && months > 1 ? 'meses' : 'mes'}
|
||||
(Tier ${tier})</strong>
|
||||
${message ? '<br>'+message : ''}`,
|
||||
|
||||
giftedmembers : ({ total, tier }) => ` regaló <i class="fa-solid fa-gift"></i> <strong>${total} ${total == 1 ? 'membresía' : 'membresías'} (Tier ${tier}) al canal</strong>`,
|
||||
|
||||
giftedtrainmembers : ({ gifted, tier }) => ` regaló una membresía
|
||||
<strong>(Tier ${tier})</strong>
|
||||
a <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
},
|
||||
|
||||
streamlabs : {
|
||||
tip : ({ money, message }) => ` donó 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
streamelements : {
|
||||
tip : ({ money, message }) => ` donó 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
tiktok : {
|
||||
follow : () => ` siguió el canal`,
|
||||
likes : (likes) => `envió <strong><i class="fa-solid fa-heart"></i> <em class="likecount" style="font-style: normal;">${likes}</em> likes</strong>`,
|
||||
sub : ({ months }) => ` se suscribió por <i class="fa-solid fa-star"></i> <strong>${months || 1 } ${(months && months > 1) ? 'meses' : 'mes'}</strong>`,
|
||||
gift : ({ gift, count, coins }) => ` regaló <strong>${gift} x${count}</strong> (🪙 <strong>${coins} ${(coins && coins > 1) ? 'monedas' : 'moneda'})</strong>`,
|
||||
},
|
||||
|
||||
kick : {
|
||||
follow : () => ` siguió el canal`,
|
||||
|
||||
sub : ({ months, tier }) => ` se suscribió por
|
||||
<strong>${months || 1 } ${months == 1 ? 'mes' : 'meses'}
|
||||
(Tier ${tier})</strong>`,
|
||||
|
||||
gifted : ({ gifted, tier, total }) => ` regaló
|
||||
<strong>${total || 1 } ${total == 1 ? 'suscripción' : 'suscripciones'}
|
||||
(Tier ${tier})</strong>
|
||||
a <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
giftedbomb : ({ count, tier }) => ` regaló <i class="fa-solid fa-gift"></i> <strong>${count} suscripciones (Tier ${tier})</strong> a la comunidad`,
|
||||
|
||||
raid : ({ viewers }) => ` hizo una raid al canal con <i class="fa-solid fa-users"></i> <strong>${viewers} espectadores</strong>`
|
||||
|
||||
},
|
||||
|
||||
patreon: {
|
||||
membership: ({ money }) => ` apoyó con una membresía ($${money})`
|
||||
|
||||
},
|
||||
|
||||
tipeeestream : {
|
||||
tip : ({ money, message }) => ` donó 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
kofi : {
|
||||
donation : ({ money, message }) => ` donó 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
sub : ({ money, tier, message }) => ` se suscribió <strong>(${money}) ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
|
||||
resub : ({ money, tier, message }) => ` renovó la suscripción <strong>${money} ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
|
||||
order : ({ money, items }) => ` compró <strong>${items} ${items == 1 ? 'artículo' : 'artículos'} (${money == 0 ? 'Gratis' : money})`,
|
||||
},
|
||||
|
||||
fourthwall : {
|
||||
someone : () => `Alguien`,
|
||||
|
||||
donation : ({ money, message }) => ` donó 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
sub : ({ money }) => ` se suscribió <strong>(${money})</strong>`,
|
||||
|
||||
order : ({
|
||||
money,
|
||||
firstItem,
|
||||
items,
|
||||
message,
|
||||
image,
|
||||
|
||||
}) => `
|
||||
${image ? '<br>': ''}
|
||||
compró <strong>${firstItem}</strong> ${items > 1 ? 'y <strong>'+(items - 1)+' '+((items - 1) == 1 ? 'artículo' : 'artículos')+'</strong>' : ''}
|
||||
(${money == 0 ? 'Gratis' : money})
|
||||
${message.trim() ? '<br>'+message : ''}
|
||||
${image ? '</span></span><span class="image"><img src="'+image+'"></span>': ''}
|
||||
`,
|
||||
|
||||
gift : ({
|
||||
money,
|
||||
firstItem,
|
||||
items,
|
||||
message,
|
||||
image,
|
||||
|
||||
}) => `
|
||||
${image ? '<br>': ''}
|
||||
regaló <strong>${items}x ${firstItem}</strong>
|
||||
(${money == 0 ? 'Gratis' : money})
|
||||
${message.trim() ? '<br>'+message : ''}
|
||||
${image ? '</span></span><span class="image"><img src="'+image+'"></span>': ''}
|
||||
`,
|
||||
|
||||
|
||||
|
||||
drawstart : ({ gift, command, time }) => `
|
||||
<strong><i class="fa-solid fa-gift"></i> ¡Sorteo iniciado!</strong>
|
||||
<br>Escribe <strong>${command}</strong> para tener la oportunidad de ganar <strong>${gift}</strong>. ¡Tienes <strong>${time} segundos</strong>!`,
|
||||
|
||||
drawend : ({ winners }) => `
|
||||
<strong>🎉 ¡Sorteo finalizado!</strong>
|
||||
<br>Felicitaciones <strong>${winners}</strong>`,
|
||||
},
|
||||
}
|
||||
|
@@ -1,5 +0,0 @@
|
||||
const lang = {
|
||||
ptbr : ptbr,
|
||||
en : en,
|
||||
es: es
|
||||
}
|
162
js/lang/ptbr.js
162
js/lang/ptbr.js
@@ -1,162 +0,0 @@
|
||||
const ptbr = {
|
||||
streamerbotconnected: 'Streamer.bot Conectado!',
|
||||
streamerbotdisconnected: 'Streamer.bot Desconectado!',
|
||||
ttschat: 'disse',
|
||||
|
||||
chatsendmessage: 'Enviar mensagem',
|
||||
|
||||
twitch : {
|
||||
firstMessage : () => `Primeira mensagem`,
|
||||
follow : () => ` seguiu o canal`,
|
||||
announcement : () => ` <div class="reply">📢 <strong>Anúncio</strong></div>`,
|
||||
channelpoints : ({ title }) => ` <div class="reply"><i class="fa-solid fa-wand-magic-sparkles"></i> <strong>Pontos do Canal - ${title}</strong></div>`,
|
||||
bits : ({ bits, message }) => ` doou <i class="fa-regular fa-gem fall-and-bounce"></i> <strong>${bits} bits</strong>${message ? '<br>'+message : ''}`,
|
||||
|
||||
sub : ({ months, isPrime, tier }) => ` se inscreveu por
|
||||
${isPrime == true ? '<i class="fa-solid fa-crown"></i>' : '<i class="fa-solid fa-star"></i>'}
|
||||
<strong>${months || 1 } ${months == 1 ? 'mês' : 'meses'}
|
||||
(${isPrime == true ? 'Prime' : 'Tier '+tier.toString().charAt(0)})</strong>`,
|
||||
|
||||
resub : ({ months, isPrime, tier, message }) => ` se inscreveu por
|
||||
${isPrime == true ? '<i class="fa-solid fa-crown"></i>' : '<i class="fa-solid fa-star"></i>'}
|
||||
<strong>${months || 1 } ${months == 1 ? 'mês' : 'meses'}
|
||||
(${isPrime == true ? 'Prime' : 'Tier '+tier.toString().charAt(0)})</strong>
|
||||
${message ? '<br>'+message : '' }`,
|
||||
|
||||
gifted : ({ gifted, months, tier }) => ` doou
|
||||
<strong>${months || 1 } ${months == 1 ? 'mês' : 'meses'}
|
||||
de Tier ${tier.toString().charAt(0)}</strong>
|
||||
para <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
giftedbomb : ({ count, total, tier }) => ` doou <i class="fa-solid fa-gift"></i> <strong>${count} inscrições (Tier ${tier.toString().charAt(0)})</strong> para a Comunidade, totalizando <strong>${total || 1} ${total == 1 ? 'doação' : 'doações'}</strong>`,
|
||||
|
||||
raid : ({ viewers }) => ` raidou o canal com <i class="fa-solid fa-users"></i> <strong>${viewers} pessoas</strong>`
|
||||
|
||||
},
|
||||
|
||||
|
||||
youtube : {
|
||||
superchat : ({ money, message }) => ` fez um superchat de <i class="fa-solid fa-comments-dollar"></i> <strong>${money}</strong>
|
||||
${message ? '<br>'+message : ''}
|
||||
`,
|
||||
|
||||
supersticker : ({ money, sticker }) => `
|
||||
${sticker ? '<br>': ''}
|
||||
enviou um super sticker de <i class="fa-solid fa-comments-dollar"></i> <strong>${money}</strong>
|
||||
${sticker ? '</span></span><span class="sticker"><img src="'+sticker+'"></span>': ''}
|
||||
`,
|
||||
|
||||
member : ({ months, tier, message }) => ` se inscreveu por
|
||||
<i class="fa-solid fa-star"></i>
|
||||
<strong>${months || 1 } ${months && months > 1 ? 'meses' : 'mês'}
|
||||
(Tier ${tier})</strong>
|
||||
${message ? '<br>'+message : ''}`,
|
||||
|
||||
giftedmembers : ({ total, tier }) => ` doou <i class="fa-solid fa-gift"></i> <strong>${total} ${total == 1 ? 'inscrição' : 'inscrições'} (Tier ${tier}) para o canal</strong>`,
|
||||
|
||||
giftedtrainmembers : ({ gifted, tier }) => ` doou uma assinatura
|
||||
<strong>(${tier})</strong>
|
||||
para <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
},
|
||||
|
||||
|
||||
streamlabs : {
|
||||
tip : ({ money, message }) => ` doou 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
|
||||
streamelements : {
|
||||
tip : ({ money, message }) => ` doou 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
|
||||
tiktok : {
|
||||
follow : () => ` seguiu o canal`,
|
||||
likes : (likes) => `mandou <strong><i class="fa-solid fa-heart"></i> <em class="likecount" style="font-style: normal;">${likes}</em> likes</strong>`,
|
||||
sub : ({ months }) => ` se inscreveu por <i class="fa-solid fa-star"></i> <strong>${months || 1 } ${(months && months > 1) ? 'meses' : 'mês'}</strong>`,
|
||||
gift : ({ gift, count, coins }) => ` doou <strong>${gift} x${count}</strong> (🪙 <strong>${coins} ${(coins && coins > 1) ? 'moedas' : 'moeda'})</strong>`,
|
||||
|
||||
},
|
||||
|
||||
kick : {
|
||||
follow : () => ` seguiu o canal`,
|
||||
|
||||
sub : ({ months, tier }) => ` se inscreveu por
|
||||
<strong>${months || 1 } ${months == 1 ? 'mês' : 'meses'}
|
||||
(Tier ${tier})</strong>`,
|
||||
|
||||
gifted : ({ gifted, tier, total }) => ` doou
|
||||
<strong>${total || 1 } ${total == 1 ? 'inscrição' : 'inscrições'}
|
||||
(Tier ${tier})</strong>
|
||||
para <i class="fa-solid fa-gift"></i> <strong>${gifted}</strong>`,
|
||||
|
||||
giftedbomb : ({ count, tier }) => ` doou <i class="fa-solid fa-gift"></i> <strong>${count} inscrições (Tier ${tier})</strong> para a Comunidade`,
|
||||
|
||||
raid : ({ viewers }) => ` raidou o canal com <i class="fa-solid fa-users"></i> <strong>${viewers} pessoas</strong>`
|
||||
|
||||
},
|
||||
|
||||
patreon: {
|
||||
membership: ({ money }) => ` apoiou com uma assinatura ($${money})`
|
||||
|
||||
},
|
||||
|
||||
tipeeestream : {
|
||||
tip : ({ money, message }) => ` doou 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
},
|
||||
|
||||
kofi : {
|
||||
donation : ({ money, message }) => ` doou 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
sub : ({ money, tier, message }) => ` se inscreveu <strong>(${money}) ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
|
||||
resub : ({ money, tier, message }) => ` se reninscreveu <strong>${money} ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
|
||||
order : ({ money, items }) => ` comprou <strong>${items} ${items == 1 ? 'item' : 'itens'} (${money == 0 ? 'Grátis' : money})`,
|
||||
},
|
||||
|
||||
fourthwall : {
|
||||
someone : () => `Alguém`,
|
||||
|
||||
donation : ({ money, message }) => ` doou 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
|
||||
sub : ({ money }) => ` se inscreveu <strong>(${money})</strong>`,
|
||||
|
||||
order : ({
|
||||
money,
|
||||
firstItem,
|
||||
items,
|
||||
message,
|
||||
image,
|
||||
|
||||
}) => `
|
||||
${image ? '<br>': ''}
|
||||
comprou <strong>${firstItem}</strong> ${items > 1 ? 'e <strong>'+(items - 1)+' '+((items - 1) == 1 ? 'item' : 'items')+'</strong>' : ''}
|
||||
(${money == 0 ? 'Grátis' : money})
|
||||
${message.trim() ? '<br>'+message : ''}
|
||||
${image ? '</span></span><span class="image"><img src="'+image+'"></span>': ''}
|
||||
`,
|
||||
|
||||
gift : ({
|
||||
money,
|
||||
firstItem,
|
||||
items,
|
||||
message,
|
||||
image,
|
||||
|
||||
}) => `
|
||||
${image ? '<br>': ''}
|
||||
presenteou <strong>${items}x ${firstItem}</strong>
|
||||
(${money == 0 ? 'Grátis' : money})
|
||||
${message.trim() ? '<br>'+message : ''}
|
||||
${image ? '</span></span><span class="image"><img src="'+image+'"></span>': ''}
|
||||
`,
|
||||
|
||||
|
||||
|
||||
drawstart : ({ gift, command, time }) => `
|
||||
<strong><i class="fa-solid fa-gift"></i> Sorteio iniciado!</strong>
|
||||
<br>Digite <strong>${command}</strong> para concorrer a <strong>${gift}</strong>. Você tem <strong>${time} segundos!</strong>`,
|
||||
|
||||
drawend : ({ winners }) => `
|
||||
<strong>🎉 Sorteio Encerrado!</strong>
|
||||
<br>Parabéns <strong>${winners}</strong>`,
|
||||
},
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
const showPatreonMemberships = getURLParam("showPatreonMemberships", true);
|
||||
|
||||
const patreonHandlers = {
|
||||
'Patreon.PledgeCreated': (response) => {
|
||||
console.debug('Patreon Membership', response.data);
|
||||
patreonMemberships(response.data);
|
||||
},
|
||||
};
|
||||
for (const [event, handler] of Object.entries(patreonHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function patreonMemberships(data) {
|
||||
|
||||
if (showPatreonMemberships == false) return;
|
||||
|
||||
const {
|
||||
attributes: {
|
||||
full_name: userName,
|
||||
will_pay_amount_cents: money
|
||||
}
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.patreon.membership({
|
||||
money : (money / 100).toFixed(2)
|
||||
})
|
||||
]);
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'patreon', messageData);
|
||||
}
|
25
js/sb.js
Normal file
25
js/sb.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* ----------------------- */
|
||||
/* STREAMER.BOT CONNECTION */
|
||||
/* ----------------------- */
|
||||
|
||||
const streamerBotServerAddress = "127.0.0.1";
|
||||
const streamerBotServerPort = "8080";
|
||||
|
||||
const streamerBotClient = new StreamerbotClient({
|
||||
host: streamerBotServerAddress,
|
||||
port: streamerBotServerPort,
|
||||
|
||||
onConnect: (data) => {
|
||||
console.log(`Streamer.bot successfully connected!`)
|
||||
console.debug(data);
|
||||
|
||||
notifySuccess({
|
||||
title: 'Connected to Streamer.bot',
|
||||
text: ``
|
||||
});
|
||||
},
|
||||
|
||||
/*onDisconnect: () => {
|
||||
console.error(`Streamer.bot disconnected`);
|
||||
}*/
|
||||
});
|
452
js/settings.js
452
js/settings.js
@@ -1,452 +0,0 @@
|
||||
let streamerBotClient;
|
||||
let streamerBotConnected = false;
|
||||
|
||||
async function saveSettingsToLocalStorage() {
|
||||
const checkboxes = document.querySelectorAll("input[type=checkbox]:not(.avoid)");
|
||||
const textfields = document.querySelectorAll("input[type=text]:not(.avoid)");
|
||||
const numberfields = document.querySelectorAll("input[type=number]:not(.avoid)");
|
||||
const colorfields = document.querySelectorAll("input[type=color]:not(.avoid)");
|
||||
const selects = document.querySelectorAll("select:not(.avoid)");
|
||||
|
||||
const hiddenField = document.querySelector("textarea[name=youTubeCustomEmotes]:not(.avoid)");
|
||||
|
||||
const ranges = document.querySelectorAll("input[type=range]:not(.avoid)");
|
||||
|
||||
const settings = {};
|
||||
|
||||
checkboxes.forEach((checkbox) => {
|
||||
settings[checkbox.name] = checkbox.checked;
|
||||
});
|
||||
ranges.forEach((range) => {
|
||||
settings[range.name] = range.value;
|
||||
});
|
||||
textfields.forEach((textfield) => {
|
||||
settings[textfield.name] = textfield.value;
|
||||
});
|
||||
numberfields.forEach((numberfield) => {
|
||||
settings[numberfield.name] = numberfield.value;
|
||||
});
|
||||
colorfields.forEach((colorfield) => {
|
||||
settings[colorfield.name] = colorfield.value;
|
||||
});
|
||||
selects.forEach((select) => {
|
||||
settings[select.name] = select.value;
|
||||
});
|
||||
|
||||
localStorage.setItem("chatWidgetSettings", JSON.stringify(settings));
|
||||
|
||||
if (streamerBotConnected == true) {
|
||||
streamerBotClient.doAction(
|
||||
{ name : "YouTube Custom Emotes" },
|
||||
{
|
||||
"chatrdytcustomemotes": JSON.stringify(hiddenField.value.trim()),
|
||||
}
|
||||
).then( (setglobals) => {
|
||||
console.debug('Saving YouTube Emotes from Streamer.Bot', setglobals);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function loadSettingsFromLocalStorage() {
|
||||
const saved = localStorage.getItem("chatWidgetSettings");
|
||||
if (!saved) return;
|
||||
|
||||
const settings = JSON.parse(saved);
|
||||
console.log(settings);
|
||||
|
||||
Object.keys(settings).forEach((key) => {
|
||||
const input = document.querySelector(`[name="${key}"]`);
|
||||
if (input) {
|
||||
if (input.type === "checkbox") {
|
||||
input.checked = settings[key];
|
||||
}
|
||||
else {
|
||||
input.value = settings[key];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.querySelector('#font-value').textContent = Math.floor(document.querySelector('#font-slider').value * 100) + '%';
|
||||
|
||||
|
||||
var streamerBotServerAddress = document.querySelector('input[type=text][name=streamerBotServerAddress]').value;
|
||||
var streamerBotServerPort = document.querySelector('input[type=text][name=streamerBotServerPort]').value;
|
||||
|
||||
streamerBotClient = new StreamerbotClient({
|
||||
host: streamerBotServerAddress,
|
||||
port: streamerBotServerPort,
|
||||
onConnect: (data) => {
|
||||
streamerBotConnected = true;
|
||||
|
||||
document.querySelector('#memberemotesbstatus').classList.remove('offline');
|
||||
document.querySelector('#memberemotesbstatus').classList.add('online');
|
||||
document.querySelector('#memberemotesbstatus span').textContent = 'Streamer.Bot is Online!';
|
||||
|
||||
streamerBotClient.getGlobals().then( (getglobals) => {
|
||||
const settings = JSON.parse(getglobals.variables.chatrdytcustomemotes.value);
|
||||
console.debug('Getting YouTube Emotes from Streamer.Bot', settings);
|
||||
const textarea = document.querySelector("textarea[name=youTubeCustomEmotes]");
|
||||
textarea.value = settings;
|
||||
|
||||
populateEmoteList();
|
||||
});
|
||||
|
||||
},
|
||||
onDisconnect: () => {
|
||||
console.error('Streamer.bot Disconnected!');
|
||||
|
||||
streamerBotConnected = false;
|
||||
|
||||
document.querySelector('#memberemotesbstatus').classList.remove('online');
|
||||
document.querySelector('#memberemotesbstatus').classList.add('offline');
|
||||
document.querySelector('#memberemotesbstatus span').textContent = 'Streamer.Bot is Offline!';
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function pushChangeEvents() {
|
||||
const checkboxes = document.querySelectorAll("input[type=checkbox]:not(.avoid)");
|
||||
const textfields = document.querySelectorAll("input[type=text]:not(.avoid)");
|
||||
const numberfields = document.querySelectorAll("input[type=number]:not(.avoid)");
|
||||
const colorfields = document.querySelectorAll("input[type=color]:not(.avoid)");
|
||||
const selects = document.querySelectorAll("select:not(.avoid)");
|
||||
|
||||
const ranges = document.querySelectorAll("input[type=range]:not(.avoid)");
|
||||
|
||||
checkboxes.forEach((checkbox) => {
|
||||
checkbox.addEventListener('change', () => {
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
});
|
||||
});
|
||||
textfields.forEach((textfield) => {
|
||||
textfield.addEventListener('input', () => {
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
});
|
||||
});
|
||||
numberfields.forEach((numberfield) => {
|
||||
numberfield.addEventListener('input', () => {
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
});
|
||||
});
|
||||
colorfields.forEach((colorfield) => {
|
||||
colorfield.addEventListener('change', () => {
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
});
|
||||
});
|
||||
selects.forEach((select) => {
|
||||
select.addEventListener('change', () => {
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
});
|
||||
});
|
||||
textfields.forEach((textfield) => {
|
||||
textfield.addEventListener('input', () => {
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
});
|
||||
});
|
||||
|
||||
ranges.forEach((range) => {
|
||||
range.addEventListener('change', () => {
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector('#font-slider').addEventListener('input', function () {
|
||||
document.querySelector('#font-value').textContent = Math.floor(this.value * 100) + '%';
|
||||
});
|
||||
|
||||
document.querySelector('#bg-opacity-slider').addEventListener('input', function () {
|
||||
document.querySelector('#bg-opacity-value').textContent = this.value;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function generateUrl() {
|
||||
document.getElementById("outputUrl").value = '';
|
||||
|
||||
|
||||
var baseUrl = 'https://vortisrd.github.io/chatrd/chat.html';
|
||||
|
||||
const checkboxes = document.querySelectorAll("input[type=checkbox]:not(.avoid)");
|
||||
const textfields = document.querySelectorAll("input[type=text]:not(.avoid)");
|
||||
const numberfields = document.querySelectorAll("input[type=number]:not(.avoid)");
|
||||
const colorfields = document.querySelectorAll("input[type=color]:not(.avoid)");
|
||||
const selects = document.querySelectorAll("select:not(.avoid)");
|
||||
|
||||
const ranges = document.querySelectorAll("input[type=range]:not(.avoid)");
|
||||
|
||||
const params = new URLSearchParams();
|
||||
|
||||
selects.forEach((select) => {
|
||||
params.set(select.name, select.value);
|
||||
});
|
||||
ranges.forEach((range) => {
|
||||
params.set(range.name, range.value);
|
||||
});
|
||||
checkboxes.forEach((checkbox) => {
|
||||
params.set(checkbox.name, checkbox.checked);
|
||||
});
|
||||
colorfields.forEach((colorfield) => {
|
||||
params.set(colorfield.name, colorfield.value);
|
||||
});
|
||||
textfields.forEach((textfield) => {
|
||||
params.set(textfield.name, textfield.value);
|
||||
});
|
||||
numberfields.forEach((numberfield) => {
|
||||
params.set(numberfield.name, numberfield.value);
|
||||
});
|
||||
|
||||
document.getElementById("outputUrl").value = baseUrl + '?' + params.toString();
|
||||
document.querySelector('#chat-preview iframe').src = 'chat.html?'+params.toString();
|
||||
}
|
||||
|
||||
async function copyUrl() {
|
||||
|
||||
const output = document.getElementById("outputUrl")
|
||||
const value = output.value;
|
||||
|
||||
const button = document.querySelector('.url-bar button');
|
||||
const buttonDefaulText = 'Copy URL';
|
||||
|
||||
navigator.clipboard.writeText(value)
|
||||
.then(() => {
|
||||
|
||||
button.textContent = 'ChatRD URL Copied!';
|
||||
button.style.backgroundColor = "#00dd63";
|
||||
|
||||
setTimeout(() => {
|
||||
button.textContent = buttonDefaulText;
|
||||
button.removeAttribute('style');
|
||||
}, 3000);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Failed to copy: ", err);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function setupAddEmoteModal() {
|
||||
const modal = document.getElementById("addEmoteModal");
|
||||
const nameInput = document.getElementById("newEmoteName");
|
||||
const urlInput = document.getElementById("newEmoteURL");
|
||||
const confirmBtn = document.getElementById("confirmAddEmote");
|
||||
const cancelBtn = document.getElementById("cancelAddEmote");
|
||||
const addButton = document.querySelector("#youtube .emote-item:last-child .add");
|
||||
const textarea = document.querySelector("textarea[name=youTubeCustomEmotes]");
|
||||
|
||||
if (!modal || !addButton || !textarea) return;
|
||||
|
||||
// Show modal
|
||||
addButton.onclick = () => {
|
||||
if (streamerBotConnected == true) {
|
||||
nameInput.value = "";
|
||||
urlInput.value = "";
|
||||
modal.classList.remove("hidden");
|
||||
nameInput.focus();
|
||||
}
|
||||
else {
|
||||
alert("Streamer.bot is Offline!");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
// Cancel
|
||||
cancelBtn.onclick = () => {
|
||||
modal.classList.add("hidden");
|
||||
};
|
||||
|
||||
// Confirm
|
||||
confirmBtn.onclick = () => {
|
||||
const name = nameInput.value.trim();
|
||||
const url = urlInput.value.trim();
|
||||
|
||||
if (!name || !url) {
|
||||
alert("Both fields are required.");
|
||||
return;
|
||||
}
|
||||
|
||||
let emotes;
|
||||
try {
|
||||
emotes = JSON.parse(textarea.value);
|
||||
} catch (err) {
|
||||
console.error("Invalid JSON", err);
|
||||
alert("Emote data is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (emotes[name]) {
|
||||
alert(`Emote "${name}" already exists.`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Add and update
|
||||
emotes[name] = url;
|
||||
textarea.value = JSON.stringify(emotes, null, 4);
|
||||
modal.classList.add("hidden");
|
||||
populateEmoteList();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function populateEmoteList() {
|
||||
const textarea = document.querySelector("textarea[name=youTubeCustomEmotes]");
|
||||
const emoteList = document.querySelector("#youtube .emote-list");
|
||||
|
||||
if (!textarea || !emoteList) return;
|
||||
|
||||
const addButtonSpan = emoteList.querySelector(".emote-item:last-child");
|
||||
|
||||
// Remove all emote items except the add button
|
||||
emoteList.querySelectorAll(".emote-item").forEach(item => {
|
||||
if (item !== addButtonSpan) {
|
||||
item.remove();
|
||||
}
|
||||
});
|
||||
|
||||
let emotes;
|
||||
try {
|
||||
emotes = JSON.parse(textarea.value);
|
||||
} catch (e) {
|
||||
console.error("Invalid JSON in YouTube Emotes textarea", e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Recreate each emote item
|
||||
for (const [emoteName, emoteUrl] of Object.entries(emotes)) {
|
||||
const span = document.createElement("span");
|
||||
span.classList.add("emote-item");
|
||||
span.innerHTML = `
|
||||
<img data-emote="${emoteName}" src="${emoteUrl}" alt="">
|
||||
<em>${emoteName}</em>
|
||||
<button class="delete"><i class="fa-solid fa-trash-can"></i></button>
|
||||
`;
|
||||
|
||||
// Add delete handler directly to the button
|
||||
const deleteBtn = span.querySelector(".delete");
|
||||
deleteBtn.addEventListener("click", () => {
|
||||
if (confirm(`Are you sure you want to delete '${emoteName}'?`)) {
|
||||
delete emotes[emoteName];
|
||||
textarea.value = JSON.stringify(emotes, null, 4);
|
||||
populateEmoteList(); // Re-render everything
|
||||
}
|
||||
});
|
||||
|
||||
emoteList.insertBefore(span, addButtonSpan);
|
||||
}
|
||||
|
||||
setupAddEmoteModal();
|
||||
generateUrl();
|
||||
saveSettingsToLocalStorage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
const accordionButtons = document.querySelectorAll("button.accordion");
|
||||
|
||||
accordionButtons.forEach(button => {
|
||||
button.addEventListener("click", () => {
|
||||
const targetId = button.getAttribute("data-target");
|
||||
const target = document.getElementById(targetId);
|
||||
const icon = button.querySelector("i");
|
||||
|
||||
if (!target || !target.classList.contains("accordion-container")) return;
|
||||
|
||||
const isOpen = target.classList.contains("open");
|
||||
|
||||
// Fecha todos os outros accordions
|
||||
document.querySelectorAll(".accordion-container.open").forEach(container => {
|
||||
if (container !== target) {
|
||||
container.classList.remove("open");
|
||||
container.style.maxHeight = null;
|
||||
|
||||
const otherButton = document.querySelector(`button.accordion[data-target="${container.id}"]`);
|
||||
if (otherButton) {
|
||||
const otherIcon = otherButton.querySelector("i");
|
||||
if (otherIcon) otherIcon.className = "fa-solid fa-chevron-down";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Alterna o atual
|
||||
if (!isOpen) {
|
||||
target.classList.add("open");
|
||||
target.style.maxHeight = target.scrollHeight + "px";
|
||||
if (icon) icon.className = "fa-solid fa-chevron-up";
|
||||
|
||||
// Espera a animação terminar para scrollar
|
||||
target.addEventListener("transitionend", function handler(e) {
|
||||
if (e.propertyName === "max-height") {
|
||||
target.removeEventListener("transitionend", handler);
|
||||
|
||||
const offset = target.getBoundingClientRect().top + window.scrollY - 60;
|
||||
window.scrollTo({
|
||||
top: offset,
|
||||
behavior: "smooth"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
target.classList.remove("open");
|
||||
target.style.maxHeight = null;
|
||||
if (icon) icon.className = "fa-solid fa-chevron-down";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
loadSettingsFromLocalStorage();
|
||||
generateUrl();
|
||||
pushChangeEvents();
|
||||
populateEmoteList();
|
||||
|
||||
|
||||
document.querySelectorAll('.nav-bar a').forEach(anchor => {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Remove todas as classes dos links dentro da nav-bar
|
||||
document.querySelectorAll('.nav-bar a').forEach(link => {
|
||||
link.classList.remove('active');
|
||||
});
|
||||
|
||||
this.classList.add('active');
|
||||
|
||||
const targetId = this.getAttribute('href');
|
||||
const targetElement = document.querySelector(targetId);
|
||||
|
||||
if (targetElement) {
|
||||
|
||||
const offset = 60; // ajusta 20px acima
|
||||
const y = targetElement.getBoundingClientRect().top + window.scrollY - offset;
|
||||
|
||||
window.scrollTo({
|
||||
top: y,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
@@ -1,46 +0,0 @@
|
||||
const showStreamElementsTips = getURLParam("showStreamElementsTips", true);
|
||||
|
||||
const streamElementsHandlers = {
|
||||
'StreamElements.Tip': (response) => {
|
||||
console.debug('StreamElements Event', response.data);
|
||||
streamElementsEventMessage(response.data);
|
||||
},
|
||||
};
|
||||
for (const [event, handler] of Object.entries(streamElementsHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function streamElementsEventMessage(data) {
|
||||
|
||||
if (showStreamElementsTips == false) return;
|
||||
|
||||
const {
|
||||
username: userName,
|
||||
amount: moneyFromUser,
|
||||
currency: currencyFromUser,
|
||||
message: messageFromUser,
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.streamlabs.tip({
|
||||
money : formatCurrency(moneyFromUser,currencyFromUser),
|
||||
message : messageFromUser
|
||||
})
|
||||
]);
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'streamelements', messageData);
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
const showStreamlabsDonations = getURLParam("showStreamlabsDonations", true);
|
||||
|
||||
const streamLabsHandlers = {
|
||||
'Streamlabs.Donation': (response) => {
|
||||
console.debug('StreamLabs Event', response.data);
|
||||
streamLabsEventMessage(response.data);
|
||||
},
|
||||
};
|
||||
for (const [event, handler] of Object.entries(streamLabsHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
async function streamLabsEventMessage(data) {
|
||||
|
||||
if (showStreamlabsDonations == false) return;
|
||||
|
||||
const {
|
||||
from: userName,
|
||||
formattedAmount: moneyFromUser,
|
||||
currency: currencyFromUser,
|
||||
message: messageFromUser,
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.streamlabs.tip({
|
||||
money : formatCurrency(moneyFromUser,currencyFromUser),
|
||||
message : messageFromUser
|
||||
})
|
||||
]);
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'streamlabs', messageData);
|
||||
}
|
@@ -1,283 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------------------- */
|
||||
/* TikFinity >< Streamer.Bot */
|
||||
/* ----------------------------------------------------------------------------------------- */
|
||||
/* In Streamer.bot, go into Servers/Clients, then Websocket clients, */
|
||||
/* and add the server info for TikFinity Desktop App. */
|
||||
/* ----------------------------------------------------------------------------------------- */
|
||||
/* If it's also running on the same computer, the address will be: ws://127.0.0.1:21213/ */
|
||||
/* ----------------------------------------------------------------------------------------- */
|
||||
|
||||
const showTikTokMessages = getURLParam("showTikTokMessages", true);
|
||||
const showTikTokFollows = getURLParam("showTikTokFollows", true);
|
||||
const showTikTokLikes = getURLParam("showTikTokLikes", true);
|
||||
const showTikTokGifts = getURLParam("showTikTokGifts", true);
|
||||
const showTikTokSubs = getURLParam("showTikTokSubs", true);
|
||||
const showTikTokStatistics = getURLParam("showTikTokStatistics", true);
|
||||
|
||||
userColors.set('tiktok', new Map());
|
||||
|
||||
if (showTikTokStatistics == false) { document.querySelector('#statistics #tiktok').style.display = 'none'; }
|
||||
|
||||
|
||||
|
||||
streamerBotClient.on('General.Custom', (response) => {
|
||||
if (response.data.platform === 'TikTok') {
|
||||
|
||||
let json = response.data;
|
||||
let jsonData = json.data.data;
|
||||
|
||||
switch (json.data.event) {
|
||||
case 'roomUser' :
|
||||
tiktokUpdateStatistics(jsonData, 'viewers');
|
||||
break;
|
||||
case 'like' :
|
||||
tiktokUpdateStatistics(jsonData, 'likes');
|
||||
//console.log('TikTok Likes', jsonData);
|
||||
tiktokLikesMessage(jsonData);
|
||||
break;
|
||||
case 'chat' :
|
||||
console.log('TikTok Chat', jsonData);
|
||||
tiktokChatMessage(jsonData);
|
||||
break;
|
||||
case 'follow' :
|
||||
console.log('TikTok Follow', jsonData);
|
||||
tiktokFollowMessage(jsonData);
|
||||
break;
|
||||
case 'subscribe' :
|
||||
console.log('TikTok Sub', jsonData);
|
||||
tiktokSubMessage(jsonData);
|
||||
break;
|
||||
case 'gift' :
|
||||
console.log('TikTok Gift', jsonData);
|
||||
tiktokGiftMessage(jsonData);
|
||||
break;
|
||||
default:
|
||||
//console.debug(json);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
async function tiktokChatMessage(data) {
|
||||
|
||||
if (showTikTokMessages == false) return;
|
||||
if (ignoreUserList.includes(data.nickname.toLowerCase())) return;
|
||||
if (data.comment.startsWith("!") && excludeCommands == true) return;
|
||||
|
||||
|
||||
const {
|
||||
userId: userID,
|
||||
msgId: messageID,
|
||||
profilePictureUrl: avatar,
|
||||
comment: message,
|
||||
emotes,
|
||||
nickname: userName,
|
||||
isSubscriber,
|
||||
isModerator,
|
||||
} = data;
|
||||
|
||||
const badgesHTML = [
|
||||
isSubscriber && '<i class="fa-solid fa-star"></i>',
|
||||
isModerator && '<i class="fa-solid fa-user-gear"></i>',
|
||||
].filter(Boolean).join('');
|
||||
|
||||
const classes = [
|
||||
isSubscriber && 'sub',
|
||||
isModerator && 'mod',
|
||||
].filter(Boolean);
|
||||
|
||||
var fullmessage = message;
|
||||
|
||||
if (emotes.length > 0) {
|
||||
emotes.forEach(emote => {
|
||||
var emotetoadd = ` <img src="${emote.emoteImageUrl}" class="emote" data-emote-id="${emote.emoteId}"> `;
|
||||
var position = emote.placeInComment;
|
||||
fullmessage = [fullmessage.slice(0, position), emotetoadd, fullmessage.slice(position)].join('');
|
||||
});
|
||||
}
|
||||
|
||||
const messageData = {
|
||||
classes: classes.join(' '),
|
||||
avatar,
|
||||
badges: badgesHTML,
|
||||
userName,
|
||||
color: await createRandomColor('tiktok', userID),
|
||||
message: fullmessage,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addMessageToChat(userID, messageID, 'tiktok', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function tiktokFollowMessage(data) {
|
||||
|
||||
if (showTikTokFollows == false) return;
|
||||
|
||||
const {
|
||||
userId: userID,
|
||||
msgId: messageID,
|
||||
profilePictureUrl: avatar,
|
||||
nickname: userName,
|
||||
} = data;
|
||||
|
||||
const message = currentLang.tiktok.follow();
|
||||
const classes = 'follow'
|
||||
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'tiktok', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function tiktokLikesMessage(data) {
|
||||
|
||||
if (showTikTokLikes == false) return;
|
||||
|
||||
const {
|
||||
userId: userID,
|
||||
msgId: messageID,
|
||||
profilePictureUrl: avatar,
|
||||
nickname: userName,
|
||||
likeCount: likesSent
|
||||
} = data;
|
||||
|
||||
var likeCountTotal = parseInt(likesSent);
|
||||
|
||||
// Search for Previous Likes from the Same User
|
||||
const previousLikeContainer = chatContainer.querySelector(`div.message.likes[data-user="${userID}"]`);
|
||||
|
||||
// If found, fetches the previous likes, deletes the element
|
||||
// and then creates a new count with a sum of the like count
|
||||
if (previousLikeContainer) {
|
||||
const likeCountElem = previousLikeContainer.querySelector('.likecount');
|
||||
if (likeCountElem) {
|
||||
var likeCountPrev = parseInt(likeCountElem.textContent);
|
||||
likeCountTotal = Math.floor(likeCountPrev + likeCountTotal);
|
||||
previousLikeContainer.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const message = currentLang.tiktok.likes(likeCountTotal)
|
||||
const classes = 'likes'
|
||||
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'tiktok', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function tiktokSubMessage(data) {
|
||||
|
||||
if (showTikTokSubs == false) return;
|
||||
|
||||
const {
|
||||
userId: userID,
|
||||
msgId: messageID,
|
||||
profilePictureUrl: avatar,
|
||||
nickname: userName,
|
||||
} = data;
|
||||
|
||||
const message = currentLang.tiktok.sub({
|
||||
months : data.subMonth
|
||||
});
|
||||
|
||||
const classes = 'sub'
|
||||
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'tiktok', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function tiktokGiftMessage(data) {
|
||||
|
||||
if (showTikTokGifts == false) return;
|
||||
if (data.giftType === 1 && !data.repeatEnd) {}
|
||||
else {
|
||||
const {
|
||||
userId: userID,
|
||||
msgId: messageID,
|
||||
profilePictureUrl: avatar,
|
||||
nickname: userName,
|
||||
} = data;
|
||||
|
||||
var coins = Math.floor(data.repeatCount*data.diamondCount);
|
||||
|
||||
const message = currentLang.tiktok.gift({
|
||||
gift : data.giftName,
|
||||
count : data.repeatCount,
|
||||
coins : coins
|
||||
});
|
||||
|
||||
const classes = 'gift'
|
||||
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'tiktok', messageData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async function tiktokUpdateStatistics(data, type) {
|
||||
|
||||
if (showPlatformStatistics == false || showTikTokStatistics == false) return;
|
||||
|
||||
if (type == 'viewers') {
|
||||
const viewers = DOMPurify.sanitize(data.viewerCount);
|
||||
document.querySelector('#statistics #tiktok .viewers span').textContent = formatNumber(viewers);
|
||||
}
|
||||
|
||||
if (type == 'likes') {
|
||||
const likes = DOMPurify.sanitize(data.totalLikeCount);
|
||||
document.querySelector('#statistics #tiktok .likes span').textContent = formatNumber(likes);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
const showTipeeeDonations = getURLParam("showTipeeeDonations", true);
|
||||
|
||||
const tipeeeHandlers = {
|
||||
'TipeeeStream.Donation': (response) => {
|
||||
console.debug('TipeeeStream Donation', response.data);
|
||||
tipeeeStreamDonation(response.data);
|
||||
},
|
||||
};
|
||||
for (const [event, handler] of Object.entries(tipeeeHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function tipeeeStreamDonation(data) {
|
||||
|
||||
if (showTipeeeDonations == false) return;
|
||||
|
||||
const {
|
||||
user: userName,
|
||||
amount,
|
||||
currency,
|
||||
message: text
|
||||
} = data;
|
||||
|
||||
const userID = createRandomString(40);
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.tipeeestream.tip({
|
||||
money : formatCurrency(amount,currency),
|
||||
message: text
|
||||
})
|
||||
]);
|
||||
const classes = '';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'tipeeestream', messageData);
|
||||
}
|
@@ -1,640 +0,0 @@
|
||||
const showTwitchMessages = getURLParam("showTwitchMessages", true);
|
||||
const showTwitchFollows = getURLParam("showTwitchFollows", true);
|
||||
const showTwitchBits = getURLParam("showTwitchBits", true);
|
||||
const showTwitchAnnouncements = getURLParam("showTwitchAnnouncements", true);
|
||||
const showTwitchSubs = getURLParam("showTwitchSubs", true);
|
||||
const showTwitchGiftedSubs = getURLParam("showTwitchGiftedSubs", true);
|
||||
const showTwitchGiftedSubsUserTrain = getURLParam("showTwitchGiftedSubsUserTrain", true);
|
||||
const showTwitchMassGiftedSubs = getURLParam("showTwitchMassGiftedSubs", true);
|
||||
const showTwitchRewardRedemptions = getURLParam("showTwitchRewardRedemptions", true);
|
||||
const showTwitchRaids = getURLParam("showTwitchRaids", true);
|
||||
const showTwitchSharedChat = getURLParam("showTwitchSharedChat", true);
|
||||
const showTwitchPronouns = getURLParam("showTwitchPronouns", false);
|
||||
const showTwitchViewers = getURLParam("showTwitchViewers", true);
|
||||
|
||||
const avatars = new Map();
|
||||
const pronouns = new Map();
|
||||
|
||||
if (showTwitchViewers == false) { document.querySelector('#statistics #twitch').style.display = 'none'; }
|
||||
|
||||
const twitchMessageHandlers = {
|
||||
'Twitch.ChatMessage': (response) => {
|
||||
console.debug('Twitch Chat', response.data);
|
||||
twitchChatMessage(response.data);
|
||||
},
|
||||
'Twitch.Follow': (response) => {
|
||||
console.debug('Twitch Follow', response.data);
|
||||
twitchFollowMessage(response.data);
|
||||
},
|
||||
'Twitch.Announcement': (response) => {
|
||||
console.debug('Twitch Announcements', response.data);
|
||||
twitchAnnouncementMessage(response.data);
|
||||
},
|
||||
'Twitch.Cheer': (response) => {
|
||||
console.debug('Twitch Cheer/Bits', response.data);
|
||||
twitchBitsMessage(response.data);
|
||||
},
|
||||
'Twitch.AutomaticRewardRedemption': (response) => {
|
||||
console.debug('Twitch Auto Reward Redemption', response.data);
|
||||
twitchChatMessageGiantEmote(response.data);
|
||||
},
|
||||
'Twitch.RewardRedemption': (response) => {
|
||||
console.debug('Twitch Reward Redemption', response.data);
|
||||
twitchRewardRedemption(response.data);
|
||||
},
|
||||
'Twitch.Sub': (response) => {
|
||||
console.debug('Twitch Sub', response.data);
|
||||
twitchSubMessage(response.data);
|
||||
},
|
||||
'Twitch.ReSub': (response) => {
|
||||
console.debug('Twitch Resub', response.data);
|
||||
twitchReSubMessage(response.data);
|
||||
},
|
||||
'Twitch.GiftSub': (response) => {
|
||||
console.debug('Twitch Gift Sub', response.data);
|
||||
twitchGiftMessage(response.data);
|
||||
|
||||
},
|
||||
'Twitch.GiftBomb': (response) => {
|
||||
console.debug('Twitch Gift Bomb', response.data);
|
||||
twitchGiftSubsMessage(response.data);
|
||||
},
|
||||
'Twitch.Raid': (response) => {
|
||||
console.debug('Twitch Raid', response.data);
|
||||
twitchRaidMessage(response.data);
|
||||
},
|
||||
'Twitch.ChatMessageDeleted': (response) => {
|
||||
console.debug('Twitch Chat Deleted', response.data);
|
||||
twitchChatMessageDeleted(response.data);
|
||||
},
|
||||
'Twitch.UserBanned': (response) => {
|
||||
console.debug('Twitch Ban', response.data);
|
||||
twitchUserBanned(response.data);
|
||||
},
|
||||
'Twitch.UserTimedOut': (response) => {
|
||||
console.debug('Twitch Timeout', response.data);
|
||||
twitchUserBanned(response.data);
|
||||
},
|
||||
'Twitch.ViewerCountUpdate': (response) => {
|
||||
console.debug('Twitch View Count Update', response.data);
|
||||
twitchUpdateStatistics(response.data);
|
||||
},
|
||||
'Twitch.ChatCleared': (response) => {
|
||||
console.debug('Twitch Chat Clear', response.data);
|
||||
twitchChatClearMessages();
|
||||
}
|
||||
};
|
||||
|
||||
for (const [event, handler] of Object.entries(twitchMessageHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
|
||||
async function twitchChatMessage(data) {
|
||||
|
||||
if (showTwitchMessages == false) return;
|
||||
if (ignoreUserList.includes(data.message.username.toLowerCase())) return;
|
||||
if (data.message.message.startsWith("!") && excludeCommands == true) return;
|
||||
|
||||
const {
|
||||
message: {
|
||||
username: userID,
|
||||
color,
|
||||
displayName: fullUserName,
|
||||
message : text,
|
||||
firstMessage,
|
||||
isReply,
|
||||
reply: replyData,
|
||||
},
|
||||
isSharedChat,
|
||||
messageId,
|
||||
} = data;
|
||||
|
||||
const [avatar, message, badges] = await Promise.all([
|
||||
getTwitchAvatar(userID),
|
||||
getTwitchEmotes(data),
|
||||
getTwitchBadges(data),
|
||||
]);
|
||||
|
||||
const classes = firstMessage ? ['first-message'] : [];
|
||||
|
||||
if (data.user.role == 4) {
|
||||
classes.push('streamer');
|
||||
}
|
||||
|
||||
const replyHTML = isReply ?
|
||||
`<div class="reply"><i class="fa-solid fa-arrow-turn-up"></i> <strong>${replyData.userName}:</strong> ${replyData.msgBody}</div>` :
|
||||
'';
|
||||
|
||||
var sharedChat = '';
|
||||
if (isSharedChat) {
|
||||
if (showTwitchSharedChat == true) {
|
||||
if (!data.sharedChat.primarySource)
|
||||
{
|
||||
var sharedChat = `<div class="shared">
|
||||
<span><i class="fa-solid fa-comment-dots"></i> <strong>${data.sharedChat.sourceRoom.name}</strong></span>
|
||||
<i class="fa-solid fa-arrow-turn-down"></i>
|
||||
</div>`;
|
||||
}
|
||||
}
|
||||
else if (!data.sharedChat.primarySource && showTwitchSharedChat == false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let userName = fullUserName;
|
||||
|
||||
if (showTwitchPronouns == true) {
|
||||
let userPronouns = await getUserPronouns('twitch', data.message.username);
|
||||
userName = userPronouns + fullUserName;
|
||||
}
|
||||
|
||||
const messageData = {
|
||||
classes: classes.join(' '),
|
||||
avatar,
|
||||
badges,
|
||||
userName,
|
||||
color,
|
||||
message,
|
||||
shared: sharedChat,
|
||||
reply: replyHTML,
|
||||
};
|
||||
|
||||
addMessageToChat(userID, messageId, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function twitchChatMessageGiantEmote(data) {
|
||||
|
||||
if (showTwitchMessages == false) return;
|
||||
|
||||
const {
|
||||
user_login: userID,
|
||||
gigantified_emote: { id: emoteGigantify }
|
||||
} = data;
|
||||
const userMessages = chatContainer.querySelectorAll(`.twitch.message[data-user="${userID}"]`);
|
||||
|
||||
if (userMessages.length === 0) return;
|
||||
|
||||
const firstMessage = userMessages[0];
|
||||
const emoteImages = firstMessage.querySelectorAll(`img[data-emote-id="${emoteGigantify}"]`);
|
||||
|
||||
if (emoteImages.length === 0) return;
|
||||
|
||||
emoteImages.forEach(img => {
|
||||
img.classList.add("gigantify");
|
||||
if (img.src.endsWith("2.0")) {
|
||||
img.src = img.src.replace("2.0", "3.0");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function twitchFollowMessage(data) {
|
||||
|
||||
if (showTwitchFollows == false) return;
|
||||
|
||||
const {
|
||||
user_id : userID,
|
||||
user_name : userName
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.twitch.follow(),
|
||||
]);
|
||||
|
||||
const classes = 'follow';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function twitchBitsMessage(data) {
|
||||
|
||||
if (showTwitchBits == false) return;
|
||||
|
||||
const {
|
||||
messageId : messageID,
|
||||
user : {
|
||||
id : userID,
|
||||
name : userName
|
||||
}
|
||||
} = data;
|
||||
|
||||
data.message.message = data.message.message.replace(/\bCheer\d+\b/g, '').replace(/\s+/g, ' ').trim();
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.twitch.bits({
|
||||
bits: data.message.bits,
|
||||
message : await getTwitchEmotes(data)
|
||||
}),
|
||||
]);
|
||||
|
||||
const classes = 'bits';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function twitchAnnouncementMessage(data) {
|
||||
|
||||
if (showTwitchAnnouncements == false) return;
|
||||
|
||||
const {
|
||||
messageId : messageID,
|
||||
user : {
|
||||
id : userID,
|
||||
name : userName
|
||||
}
|
||||
} = data;
|
||||
|
||||
|
||||
data.message = {
|
||||
message: await getTwitchAnnouncementEmotes(data)
|
||||
};
|
||||
|
||||
|
||||
const replyHTML = currentLang.twitch.announcement();
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
` ${data.message.message}`
|
||||
]);
|
||||
|
||||
const classes = 'announcement';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: replyHTML,
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function twitchRewardRedemption(data) {
|
||||
|
||||
if (showTwitchRewardRedemptions == false) return;
|
||||
|
||||
const {
|
||||
user_id : userID,
|
||||
user_name : userName,
|
||||
} = data;
|
||||
const messageID = createRandomString(40);
|
||||
const replyHTML = currentLang.twitch.channelpoints({ title : data.reward.title });
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
` ${data.user_input}`
|
||||
]);
|
||||
const classes = 'rewards-redemption';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: replyHTML,
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function twitchSubMessage(data) {
|
||||
|
||||
if (showTwitchSubs == false) return;
|
||||
|
||||
const {
|
||||
user : {
|
||||
id : userID,
|
||||
name : userName
|
||||
}
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.twitch.sub({
|
||||
months : data.duration_months,
|
||||
isPrime : data.isPrime,
|
||||
tier : data.sub_tier
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'sub';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function twitchReSubMessage(data) {
|
||||
|
||||
if (showTwitchSubs == false) return;
|
||||
|
||||
const {
|
||||
user : {
|
||||
id : userID,
|
||||
name : userName
|
||||
},
|
||||
text
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
const messagetext = await getTwitchEmotesOnParts(data);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.twitch.resub({
|
||||
months : data.cumulativeMonths,
|
||||
isPrime : data.isPrime,
|
||||
tier : data.subTier,
|
||||
message : messagetext
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'sub';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function twitchGiftMessage(data) {
|
||||
|
||||
if (data.fromCommunitySubGift === false) {
|
||||
if (showTwitchSubs == false || showTwitchGiftedSubs == false) return;
|
||||
}
|
||||
else {
|
||||
if (showTwitchSubs == false || showTwitchGiftedSubsUserTrain == false) return;
|
||||
}
|
||||
|
||||
|
||||
const {
|
||||
user : {
|
||||
id : userID,
|
||||
name : userName
|
||||
}
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.twitch.gifted({
|
||||
gifted : data.recipient.name,
|
||||
months : data.durationMonths,
|
||||
tier : data.subTier,
|
||||
total : data.cumlativeTotal
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'sub';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function twitchGiftSubsMessage(data) {
|
||||
|
||||
if (showTwitchSubs == false || showTwitchMassGiftedSubs == false) return;
|
||||
|
||||
const {
|
||||
user : {
|
||||
id : userID,
|
||||
name : userName
|
||||
}
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.twitch.giftedbomb({
|
||||
count : data.total,
|
||||
tier : data.sub_tier,
|
||||
total : data.cumulative_total
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'sub';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function twitchRaidMessage(data) {
|
||||
|
||||
if (showTwitchRaids == false) return;
|
||||
|
||||
const {
|
||||
from_broadcaster_user_login: userID,
|
||||
from_broadcaster_user_name: userName
|
||||
} = data;
|
||||
|
||||
const messageID = createRandomString(40);
|
||||
const [avatar, message] = await Promise.all([
|
||||
'',
|
||||
currentLang.twitch.raid({ viewers : data.viewers })
|
||||
]);
|
||||
|
||||
const classes = 'raid';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
};
|
||||
|
||||
addEventToChat(userID, messageID, 'twitch', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function twitchChatMessageDeleted(data) {
|
||||
document.getElementById(data.messageId)?.remove();
|
||||
}
|
||||
|
||||
|
||||
async function twitchUserBanned(data) {
|
||||
chatContainer.querySelectorAll(`[data-user="${data.user_login}"]`).forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function twitchChatClearMessages() {
|
||||
chatContainer.querySelectorAll(`.twitch:not(.event)`).forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function twitchUpdateStatistics(data) {
|
||||
if (showPlatformStatistics == false || showTwitchViewers == false) return;
|
||||
|
||||
const viewers = DOMPurify.sanitize(data.viewerCount);
|
||||
document.querySelector('#statistics #twitch .viewers span').textContent = formatNumber(viewers);
|
||||
}
|
||||
|
||||
|
||||
async function getTwitchEmotes(data) {
|
||||
const message = data.message.message;
|
||||
const emotes = data.emotes;
|
||||
const words = message.split(" ");
|
||||
emotes.sort((a, b) => b.startIndex - a.startIndex);
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
emotes.forEach(emote => {
|
||||
if (words[i] === emote.name) {
|
||||
words[i] = `<img src="${emote.imageUrl}" data-emote-id="${emote.id}" alt="${emote.name}" class="emote">`;
|
||||
}
|
||||
});
|
||||
}
|
||||
return words.join(" ");
|
||||
}
|
||||
|
||||
|
||||
async function getTwitchAnnouncementEmotes(data) {
|
||||
const message = data.text;
|
||||
const emotes = data.parts;
|
||||
const words = message.split(" ");
|
||||
emotes.sort((a, b) => b.startIndex - a.startIndex);
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
emotes.forEach(emote => {
|
||||
if (words[i] === emote.text) {
|
||||
words[i] = `<img src="${emote.imageUrl}" alt="${emote.text}" class="emote">`;
|
||||
}
|
||||
});
|
||||
}
|
||||
return words.join(" ");
|
||||
}
|
||||
|
||||
async function getTwitchEmotesOnParts(data) {
|
||||
const parts = data?.parts;
|
||||
const message = data.text;
|
||||
|
||||
if (!Array.isArray(parts)) {
|
||||
return message;
|
||||
}
|
||||
|
||||
return parts.map(part => {
|
||||
if (part.type === 'text') {
|
||||
return message;
|
||||
} else if (part.type === 'emote') {
|
||||
return `<img src="${part.imageUrl}" alt="${part.text}" class="emote">`;
|
||||
}
|
||||
}).join('');
|
||||
}
|
||||
|
||||
async function getTwitchBadges(data) {
|
||||
const badges = data.message.badges;
|
||||
var htmlBadges = '';
|
||||
badges.forEach((badge) => {
|
||||
htmlBadges += `<img src="${badge.imageUrl}" class="badge">`;
|
||||
});
|
||||
return htmlBadges;
|
||||
}
|
||||
|
||||
|
||||
async function getTwitchAvatar(user) {
|
||||
if (showAvatar == true) {
|
||||
if (avatars.has(user)) {
|
||||
console.debug(`Twitch avatar found for ${user}!`);
|
||||
return avatars.get(user);
|
||||
}
|
||||
else {
|
||||
console.debug(`Twitch avatar not found for ${user}! Getting it from DECAPI!`);
|
||||
var decapi = await fetch('https://decapi.me/twitch/avatar/' + user);
|
||||
var newavatar = await decapi.text()
|
||||
|
||||
if (!newavatar) { newavatar = 'https://static-cdn.jtvnw.net/user-default-pictures-uv/cdd517fe-def4-11e9-948e-784f43822e80-profile_image-300x300.png'; }
|
||||
|
||||
avatars.set(user, newavatar);
|
||||
return newavatar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function getUserPronouns(platform, username) {
|
||||
if (pronouns.has(username)) {
|
||||
console.debug(`Pronouns found for ${username}. Getting it from Map...`)
|
||||
return pronouns.get(username);
|
||||
}
|
||||
else {
|
||||
console.debug(`Pronouns not found for ${username}. Retrieving...`)
|
||||
|
||||
const response = await streamerBotClient.getUserPronouns(platform, username);
|
||||
const pronoun = response.pronoun.userFound ? `<em class="pronouns">${response.pronoun.pronounSubject}/${response.pronoun.pronounObject}</em>` : '';
|
||||
|
||||
pronouns.set(username, pronoun);
|
||||
|
||||
return pronoun;
|
||||
}
|
||||
}
|
@@ -1,455 +0,0 @@
|
||||
const showYouTubeMessages = getURLParam("showYouTubeMessages", true);
|
||||
const showYouTubeSuperChats = getURLParam("showYouTubeSuperChats", true);
|
||||
const showYouTubeSuperStickers = getURLParam("showYouTubeSuperStickers", true);
|
||||
const showYouTubeSuperStickerGif = getURLParam("showYouTubeSuperStickerGif", true);
|
||||
const showYouTubeSuperStickerFullSize = getURLParam("showYouTubeSuperStickerFullSize", false);
|
||||
const showYouTubeMemberships = getURLParam("showYouTubeMemberships", true);
|
||||
const showYouTubeGiftMemberships = getURLParam("showYouTubeGiftMemberships", true);
|
||||
const showYouTubeMembershipsTrain = getURLParam("showYouTubeMembershipsTrain", true);
|
||||
const showYouTubeStatistics = getURLParam("showYouTubeStatistics", true);
|
||||
|
||||
let youTubeCustomEmotes = [];
|
||||
|
||||
let youTubeBTTVEmotes = [];
|
||||
|
||||
userColors.set('youtube', new Map());
|
||||
|
||||
if (showYouTubeStatistics == false) { document.querySelector('#statistics #youtube').style.display = 'none'; }
|
||||
|
||||
const youtubeMessageHandlers = {
|
||||
'YouTube.Message': (response) => {
|
||||
console.debug('YouTube Chat', response.data);
|
||||
youTubeChatMessage(response.data);
|
||||
},
|
||||
'YouTube.UserBanned': (response) => {
|
||||
console.debug('YouTube Timeout/Hide/Ban', response.data);
|
||||
youTubeUserBanned(response.data);
|
||||
},
|
||||
'YouTube.SuperChat': (response) => {
|
||||
console.debug('YouTube SuperChat', response.data);
|
||||
youTubeSuperChatMessage(response.data);
|
||||
},
|
||||
'YouTube.SuperSticker': (response) => {
|
||||
console.debug('YouTube Super Sticker', response.data);
|
||||
youTubeSuperStickerMessage(response.data);
|
||||
},
|
||||
'YouTube.NewSponsor': (response) => {
|
||||
console.debug('YouTube New Member', response.data);
|
||||
youTubeNewSponsorMessage(response.data);
|
||||
},
|
||||
'YouTube.MemberMileStone': (response) => {
|
||||
console.debug('YouTube Member Milestone', response.data);
|
||||
youTubeNewSponsorMessage(response.data);
|
||||
},
|
||||
'YouTube.MembershipGift': (response) => {
|
||||
console.debug('YouTube Gifted Membership', response.data);
|
||||
youTubeGiftedMembersMessage(response.data);
|
||||
},
|
||||
'YouTube.GiftMembershipReceived': (response) => {
|
||||
console.debug('YouTube Gifted Membership Bomb', response.data);
|
||||
YouTubeGiftReceivedMessage(response.data);
|
||||
},
|
||||
'YouTube.StatisticsUpdated': (response) => {
|
||||
console.debug(response.data);
|
||||
youTubeUpdateStatistics(response.data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
for (const [event, handler] of Object.entries(youtubeMessageHandlers)) {
|
||||
streamerBotClient.on(event, handler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function youTubeChatMessage(data) {
|
||||
|
||||
if (showYouTubeMessages == false) return;
|
||||
if (ignoreUserList.includes(data.user.name.toLowerCase())) return;
|
||||
if (data.message.startsWith("!") && excludeCommands == true) return;
|
||||
|
||||
if (streamerBotConnected == true) {
|
||||
if (youTubeCustomEmotes.length == 0) {
|
||||
streamerBotClient.getGlobals().then( (getglobals) => {
|
||||
youTubeCustomEmotes = JSON.parse(JSON.parse(getglobals.variables.chatrdytcustomemotes.value));
|
||||
console.debug('Getting YouTube Emotes from Streamer.Bot', youTubeCustomEmotes);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
user: {
|
||||
id: userID,
|
||||
profileImageUrl: avatar,
|
||||
name: userName,
|
||||
isVerified,
|
||||
isSponsor,
|
||||
isModerator,
|
||||
isOwner,
|
||||
},
|
||||
eventId: messageID,
|
||||
} = data;
|
||||
|
||||
var messageHTML = await getYouTubeEmotes(data);
|
||||
|
||||
const badgesHTML = [
|
||||
isVerified && '<i class="fa-solid fa-check"></i>',
|
||||
isSponsor && '<i class="fa-solid fa-star"></i>',
|
||||
isModerator && '<i class="fa-solid fa-wrench"></i>',
|
||||
isOwner && '<i class="fa-solid fa-video"></i>',
|
||||
].filter(Boolean).join('');
|
||||
|
||||
const classes = [
|
||||
isSponsor && 'sub',
|
||||
isModerator && 'mod',
|
||||
isOwner && 'owner',
|
||||
].filter(Boolean);
|
||||
|
||||
const messageData = {
|
||||
classes: classes.join(' '),
|
||||
avatar,
|
||||
badges: badgesHTML,
|
||||
userName,
|
||||
color: await createRandomColor('youtube', userID),
|
||||
message : messageHTML,
|
||||
reply: '',
|
||||
};
|
||||
addMessageToChat(userID, messageID, 'youtube', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function youTubeUserBanned(data) {
|
||||
chatContainer.querySelectorAll(`[data-user="${data.bannedUser.id}"]:not(.event)`).forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function youTubeSuperChatMessage(data) {
|
||||
|
||||
if (showYouTubeSuperChats == false) return;
|
||||
|
||||
const {
|
||||
user: {
|
||||
id: userID,
|
||||
name: userName,
|
||||
},
|
||||
eventId: messageID,
|
||||
amount,
|
||||
message : textmessage
|
||||
} = data;
|
||||
|
||||
var money = amount;
|
||||
var messagewithemotes = await getYouTubeEmotes(textmessage);
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
``,
|
||||
currentLang.youtube.superchat({
|
||||
money : money,
|
||||
message : messagewithemotes
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'superchat';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
}
|
||||
addEventToChat(userID, messageID, 'youtube', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function youTubeSuperStickerMessage(data) {
|
||||
|
||||
if (showYouTubeSuperStickers == false) return;
|
||||
|
||||
const {
|
||||
user: {
|
||||
id: userID,
|
||||
name: userName,
|
||||
},
|
||||
eventId: messageID,
|
||||
amount
|
||||
} = data;
|
||||
|
||||
var money = amount;
|
||||
var youtubeStickerUrl = '';
|
||||
|
||||
if (showYouTubeSuperStickerGif == true) {
|
||||
youtubeStickerUrl = await getYouTubeStickerImage(data);
|
||||
}
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
``,
|
||||
currentLang.youtube.supersticker({
|
||||
money : money,
|
||||
sticker : youtubeStickerUrl
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = ['supersticker'];
|
||||
if (showYouTubeSuperStickerFullSize == true) {
|
||||
classes.push('giantsupersticker');
|
||||
}
|
||||
|
||||
const messageData = {
|
||||
classes: classes.join(' '),
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
}
|
||||
addEventToChat(userID, messageID, 'youtube', messageData);
|
||||
}
|
||||
|
||||
async function youTubeNewSponsorMessage(data) {
|
||||
|
||||
if (showYouTubeMemberships == false) return;
|
||||
|
||||
const {
|
||||
user: {
|
||||
id: userID,
|
||||
name: userName,
|
||||
},
|
||||
eventId: messageID,
|
||||
levelName,
|
||||
months,
|
||||
message: messagetext,
|
||||
} = data;
|
||||
|
||||
var messagewithemotes = '';
|
||||
|
||||
if (messagetext) {
|
||||
messagewithemotes = await getYouTubeEmotes(messagetext);
|
||||
}
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
``,
|
||||
currentLang.youtube.member({
|
||||
months : months,
|
||||
tier : levelName,
|
||||
message: messagewithemotes
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'member';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
}
|
||||
addEventToChat(userID, messageID, 'youtube', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function youTubeGiftedMembersMessage(data) {
|
||||
|
||||
if (showYouTubeGiftMemberships == false) return;
|
||||
|
||||
const {
|
||||
user: {
|
||||
id: userID,
|
||||
name: userName,
|
||||
},
|
||||
eventId: messageID,
|
||||
tier,
|
||||
count
|
||||
} = data;
|
||||
const [avatar, message] = await Promise.all([
|
||||
``,
|
||||
currentLang.youtube.giftedmembers({
|
||||
total : count,
|
||||
tier : tier
|
||||
})
|
||||
]);
|
||||
const classes = 'giftedmembers';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
}
|
||||
addEventToChat(userID, messageID, 'youtube', messageData);
|
||||
}
|
||||
|
||||
async function YouTubeGiftReceivedMessage(data) {
|
||||
|
||||
if (showYouTubeMembershipsTrain == false) return;
|
||||
|
||||
const {
|
||||
user: {
|
||||
id: userID,
|
||||
name: userName,
|
||||
},
|
||||
gifter: {
|
||||
id : gifterUserId,
|
||||
name: gifterUserName
|
||||
},
|
||||
eventId: messageID,
|
||||
tier
|
||||
} = data;
|
||||
|
||||
const [avatar, message] = await Promise.all([
|
||||
``,
|
||||
currentLang.youtube.giftedmembers({
|
||||
gifted : gifterUserName,
|
||||
tier : tier
|
||||
})
|
||||
]);
|
||||
|
||||
const classes = 'giftedtrainmembers';
|
||||
const messageData = {
|
||||
classes: classes,
|
||||
avatar,
|
||||
badges: '',
|
||||
userName,
|
||||
color: '#FFF',
|
||||
message,
|
||||
reply: '',
|
||||
}
|
||||
addEventToChat(gifterUserId, messageID, 'youtube', messageData);
|
||||
}
|
||||
|
||||
|
||||
async function youTubeUpdateStatistics(data) {
|
||||
|
||||
if (showYouTubeStatistics == false) return;
|
||||
|
||||
const viewers = DOMPurify.sanitize(data.concurrentViewers);
|
||||
const likes = DOMPurify.sanitize(data.likeCount);
|
||||
document.querySelector('#statistics #youtube .viewers span').textContent = formatNumber(viewers);
|
||||
document.querySelector('#statistics #youtube .likes span').textContent = formatNumber(likes);
|
||||
}
|
||||
|
||||
|
||||
async function getYouTubeEmotes(data) {
|
||||
let message = data.message;
|
||||
const channelId = data.broadcast?.channelId;
|
||||
if (!channelId) return message;
|
||||
|
||||
// Carrega os emotes do canal BTTV se ainda não estiverem carregados
|
||||
if (youTubeBTTVEmotes.length === 0) {
|
||||
try {
|
||||
const res = await fetch(`https://api.betterttv.net/3/cached/users/youtube/${channelId}`);
|
||||
const emoteData = await res.json();
|
||||
console.debug('Getting YouTube BTTV Channel Emojis', `https://api.betterttv.net/3/cached/users/youtube/${channelId}`, emoteData);
|
||||
youTubeBTTVEmotes = [
|
||||
...(emoteData.sharedEmotes || []),
|
||||
...(emoteData.channelEmotes || [])
|
||||
];
|
||||
} catch (err) {
|
||||
console.warn("Failed to load BTTV emotes:", err);
|
||||
}
|
||||
}
|
||||
|
||||
// Cria o mapa de emotes
|
||||
const emoteMap = new Map();
|
||||
|
||||
// BTTV emotes
|
||||
for (const emote of youTubeBTTVEmotes) {
|
||||
const imageUrl = `https://cdn.betterttv.net/emote/${emote.id}/1x`;
|
||||
const emoteElement = `<img src="${imageUrl}" class="emote" alt="${emote.code}">`;
|
||||
emoteMap.set(emote.code, { html: emoteElement, raw: emote.code });
|
||||
}
|
||||
|
||||
// YouTube emotes (ex: :hand-pink-waving:)
|
||||
if (data.emotes) {
|
||||
for (const emote of data.emotes) {
|
||||
const emoteElement = `<img src="${emote.imageUrl}" class="emote" alt="${emote.name}">`;
|
||||
emoteMap.set(emote.name, { html: emoteElement, raw: emote.name });
|
||||
}
|
||||
}
|
||||
|
||||
// Custom Member Emotes (também com dois-pontos)
|
||||
if (data.user.isSponsor === true || data.user.isOwner === true) {
|
||||
for (const [name, url] of Object.entries(youTubeCustomEmotes)) {
|
||||
const emoteElement = `<img src="${url}" class="emote" alt="${name}">`;
|
||||
emoteMap.set(`:${name}:`, { html: emoteElement, raw: `:${name}:` });
|
||||
}
|
||||
}
|
||||
|
||||
// Usa DOMParser para substituir apenas nós de texto
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(`<div>${message}</div>`, 'text/html');
|
||||
const container = doc.body.firstChild;
|
||||
|
||||
function escapeRegex(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
function replaceEmotesInText(text) {
|
||||
// Ordena por tamanho decrescente pra evitar conflitos entre nomes parecidos
|
||||
const sorted = Array.from(emoteMap.values()).sort((a, b) => b.raw.length - a.raw.length);
|
||||
|
||||
for (const { raw, html } of sorted) {
|
||||
const escaped = escapeRegex(raw);
|
||||
|
||||
// Emotes com dois-pontos: :emote: → permitem colados
|
||||
const isDelimited = raw.startsWith(':') && raw.endsWith(':');
|
||||
const regex = isDelimited
|
||||
? new RegExp(escaped, 'g')
|
||||
: new RegExp(`(?<!\\S)${escaped}(?!\\S)`, 'g');
|
||||
|
||||
text = text.replace(regex, html);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function walk(node) {
|
||||
if (node.nodeType === Node.TEXT_NODE) {
|
||||
const replaced = replaceEmotesInText(node.nodeValue);
|
||||
if (replaced !== node.nodeValue) {
|
||||
const span = doc.createElement('span');
|
||||
span.innerHTML = replaced;
|
||||
node.replaceWith(...span.childNodes);
|
||||
}
|
||||
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
||||
for (const child of Array.from(node.childNodes)) {
|
||||
walk(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
walk(container);
|
||||
|
||||
return container.innerHTML;
|
||||
}
|
||||
|
||||
|
||||
// ChatGPT created this. :)
|
||||
async function getYouTubeStickerImage(data) {
|
||||
const stack = [data];
|
||||
|
||||
while (stack.length) {
|
||||
const current = stack.pop();
|
||||
|
||||
if (current && typeof current === 'object') {
|
||||
if ('imageUrl' in current && typeof current.imageUrl === 'string') {
|
||||
return current.imageUrl;
|
||||
}
|
||||
|
||||
for (const key in current) {
|
||||
if (Object.hasOwn(current, key)) {
|
||||
stack.push(current[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user