forked from afspiegeling/NitoriBot
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a331466d9e | ||
|
|
4fb7099c0f | ||
|
|
89dbac9974 | ||
|
|
dc03b5157f | ||
|
|
4e2d737f9d | ||
|
|
16c92b075d | ||
|
|
6a26617c83 | ||
|
|
1a63807a7c | ||
|
|
9dce8155bd | ||
|
|
b0ce56d5c1 | ||
|
|
3c32ea5035 | ||
|
|
99e6a2b0e5 | ||
|
|
619f423574 | ||
|
|
f39660471d | ||
|
|
21cd397781 | ||
|
|
d5212e8e5c | ||
|
|
0f219ce5f6 | ||
|
|
24e981fc9e | ||
|
|
b3ba585f01 | ||
|
|
fde361b0fb | ||
|
|
fce93b87c8 | ||
|
|
b26ff81a1e | ||
|
|
5f2c3c533f | ||
|
|
89eacecf45 | ||
|
|
3317024e2d | ||
|
|
03514e4f57 | ||
|
|
b39148b53e | ||
|
|
288fbba036 | ||
|
|
9c230811b4 | ||
|
|
b17b363971 | ||
|
|
0661068e8f | ||
|
|
ec7e3fc5af | ||
|
|
23e738aa59 | ||
|
|
758d777439 | ||
|
|
38f91a0266 | ||
|
|
a0559985d8 | ||
|
|
48d0611194 | ||
|
|
bd60ff8325 | ||
|
|
c6c293348b | ||
|
|
5291ebced4 | ||
|
|
d2ee401e5d | ||
|
|
cf4560be24 | ||
|
|
58a020dfd4 | ||
|
|
b10e9bddf5 | ||
|
|
f788ae5df7 | ||
|
|
61c3a4adfc | ||
|
|
c059edeb4e | ||
|
|
27a6b07845 | ||
|
|
df0208d9e6 | ||
|
|
62e9b55e92 | ||
|
|
4df2a8e3f0 | ||
|
|
4aeda035f4 | ||
|
|
aee503525e | ||
|
|
83533cef46 |
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# https://help.github.com/articles/dealing-with-line-endings/
|
||||
#
|
||||
# Linux start script should use lf
|
||||
/gradlew text eol=lf
|
||||
|
||||
# These are Windows script files and should use crlf
|
||||
*.bat text eol=crlf
|
||||
|
||||
# Binary files should be left untouched
|
||||
*.jar binary
|
||||
|
||||
+14
-4
@@ -1,4 +1,14 @@
|
||||
node_modules
|
||||
config.js
|
||||
.git
|
||||
src/modules/exploits.js
|
||||
# Ignore Gradle project-specific cache directory
|
||||
.gradle
|
||||
|
||||
# Ignore Gradle build output directory
|
||||
build
|
||||
|
||||
# Ignore Kotlin plugin data
|
||||
.kotlin
|
||||
|
||||
# Ignore the bin folder vscode keeps creating
|
||||
bin
|
||||
|
||||
# Ignore the config
|
||||
config.yml
|
||||
|
||||
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
Generated
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="25" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT_FILES" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+17
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="25 (2)" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,java.net.http.HttpClient.Builder,build,java.lang.ClassLoader,getResourceAsStream" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
Generated
+27
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JsonSchemaMappingsProjectConfiguration">
|
||||
<state>
|
||||
<map>
|
||||
<entry key="No JSON schema">
|
||||
<value>
|
||||
<SchemaInfo>
|
||||
<option name="ignoredFile" value="true" />
|
||||
<option name="name" value="No JSON schema" />
|
||||
<option name="relativePathToSchema" value="" />
|
||||
<option name="applicationDefined" value="true" />
|
||||
<option name="patterns">
|
||||
<list>
|
||||
<Item>
|
||||
<option name="path" value="file://$PROJECT_DIR$/src/main/resources/info.json" />
|
||||
</Item>
|
||||
</list>
|
||||
</option>
|
||||
<option name="isIgnoredFile" value="true" />
|
||||
</SchemaInfo>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</state>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="externalSystemId" value="Gradle" />
|
||||
<option name="version" value="2.3.10" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="PrintToLogpointModuleInspectionState">
|
||||
<option name="disabledModuleNames">
|
||||
<set>
|
||||
<option value="NitoriBot.main" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_25" default="true" project-jdk-name="25 (4)" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
Generated
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/NitoriBot.main.iml" filepath="$PROJECT_DIR$/.idea/modules/NitoriBot.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/NitoriBot.test.iml" filepath="$PROJECT_DIR$/.idea/modules/NitoriBot.test.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>ADVENTURE</platformType>
|
||||
</autoDetectTypes>
|
||||
<projectReimportVersion>1</projectReimportVersion>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
||||
Generated
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>ADVENTURE</platformType>
|
||||
</autoDetectTypes>
|
||||
<projectReimportVersion>1</projectReimportVersion>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 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 Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are 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.
|
||||
|
||||
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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
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 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 work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
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 AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
@@ -1,17 +0,0 @@
|
||||
# FNFBoyfriendBot
|
||||
|
||||
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
|
||||
|
||||
|
||||
FNFBoyfriendBot is a minecraft java bot made for the server kaboom.pw
|
||||
|
||||
# Setup:
|
||||
1. make sure to have nodejs npm and git installed
|
||||
|
||||
2. run npm i
|
||||
|
||||
3. fix some modules and stuff
|
||||
|
||||
4. edit the config
|
||||
|
||||
5. node src
|
||||
@@ -1,17 +0,0 @@
|
||||
Note: each time changes are made push them to the dev branch in the bots repo
|
||||
1. Rewrite the version argument of the info command
|
||||
2. Fix arguments for discord
|
||||
3. Try adding a argument limit for commands maybe
|
||||
4. Use the nbt parser that chayapak wrote for the bot for 1.21.5 command block output
|
||||
5. Completely remove tptoggle selfcare since it’s no longer used
|
||||
- 6. Have the bot get output from the actual core instead of a command block it places
|
||||
- 7. Add support for 1.21 and 1.21.1 while keeping support for 1.19.3 to 1.20.2
|
||||
8. Add a server check
|
||||
9. Add source.sendfeedback back maybe
|
||||
10. Add a check to sendFeedback for discord to see if the message length is longer than discord’s max message limit to output it to a file and then reply with the file in discord
|
||||
11. Add a embed function for discord maybe
|
||||
12. Have the bot output errors to a seperate file to make debugging easier
|
||||
- 13. Revert class changes for usernameGen, loadModules, between, and ansi since it wouldn’t make much sense to make them classes instead of functions (chayapaks suggestion)
|
||||
- 14. Have the bot.js class extend the event emitter (chayapak suggestion)
|
||||
15. Maybe parse cspy in the chat module and emit it as a packet maybe
|
||||
16. For the owner check module have the bot send a message to the player username thats in the config if the 18. username name is online and if theres no reply back in discord within 10 seconds (10000 ms) to start deoping, muting, kicking, and changing their gamemode
|
||||
@@ -0,0 +1,80 @@
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.ZoneId
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
version = "v9.0.0-alpha"
|
||||
group = "nitoribot"
|
||||
description = "NitoriBot"
|
||||
plugins {
|
||||
kotlin("jvm") version "2.3.10"
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(25)
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.opencollab.dev/maven-releases/")
|
||||
maven("https://repo.opencollab.dev/maven-snapshots/")
|
||||
maven("https://jitpack.io/")
|
||||
maven("https://repo.opencollab.dev/main/")
|
||||
maven("https://maven.maxhenkel.de/repository/public/")
|
||||
maven("https://code.chipmunk.land/api/packages/kaboomstandardsorganization/maven/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.geysermc.mcprotocollib:protocol:26.2-SNAPSHOT")
|
||||
constraints {
|
||||
implementation("io.netty:netty-codec-dns:4.2.16.Final") {
|
||||
because("dos vulnerability!")
|
||||
}
|
||||
implementation("io.netty:netty-all:4.2.18.Final") {
|
||||
because("vulnerability")
|
||||
}
|
||||
}
|
||||
implementation("org.slf4j:slf4j-api:2.0.20")
|
||||
implementation("org.tinylog:slf4j-tinylog:2.8.1")
|
||||
implementation("org.tinylog:tinylog-impl:2.8.1")
|
||||
implementation("org.yaml:snakeyaml:2.7")
|
||||
implementation("net.kyori:adventure-text-serializer-ansi:5.2.0")
|
||||
implementation("net.kyori:adventure-text-serializer-plain:5.2.0")
|
||||
implementation("net.kyori:adventure-text-serializer-legacy:5.2.0")
|
||||
implementation("net.kyori:adventure-text-serializer-gson:5.2.0")
|
||||
implementation("net.kyori:adventure-text-minimessage:5.2.0")
|
||||
implementation("net.dv8tion:JDA:6.7.0")
|
||||
implementation("org.jline:jline:4.4.7")
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
val timeZone = ZoneId.of("America/Chicago");
|
||||
val zoneDate = ZonedDateTime.now(timeZone);
|
||||
val dateTimeFormatter = DateTimeFormatter.ofPattern("MMMM dd, yyyy hh:mm:ss a")
|
||||
val dateTimeInfo = zoneDate.toLocalDateTime();
|
||||
|
||||
manifest {
|
||||
attributes["Main-Class"] = "land.chipmunk.parker2991.nitoribot.Main"
|
||||
attributes("Build-Time" to dateTimeFormatter.format(dateTimeInfo))
|
||||
attributes("Enable-Native-Access" to "ALL-UNNAMED")
|
||||
}
|
||||
|
||||
archiveClassifier.set("all")
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
from(sourceSets.main.get().output)
|
||||
|
||||
dependsOn(configurations.runtimeClasspath)
|
||||
|
||||
from(
|
||||
{
|
||||
configurations.runtimeClasspath.get().filter {
|
||||
it.name.endsWith("jar")
|
||||
}.map {
|
||||
zipTree(it)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
java -jar build/libs/NitoriBot-v9.0.0-all.jar
|
||||
@@ -0,0 +1 @@
|
||||
sh ./framework/keepalive.sh
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
echo "starting reset process at $HOME/keepalive"
|
||||
|
||||
dtach -n $HOME/keepalive sh ./framework/reset.sh
|
||||
|
||||
while true; do
|
||||
sh ./framework/bot.sh
|
||||
sleep 5
|
||||
done
|
||||
@@ -0,0 +1,4 @@
|
||||
while true; do
|
||||
sleep 24h
|
||||
pkill -f "java"
|
||||
done
|
||||
@@ -0,0 +1,5 @@
|
||||
# This file was generated by the Gradle 'init' task.
|
||||
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# This file was generated by the Gradle 'init' task.
|
||||
# https://docs.gradle.org/current/userguide/version_catalogs.html#sec::toml-dependencies-format
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+93
@@ -0,0 +1,93 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
Generated
-1413
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"discord.js": "^14.22.1",
|
||||
"minecraft-data": "^3.99.1",
|
||||
"minecraft-protocol": "^1.62.0",
|
||||
"prismarine-chat": "^1.12.0",
|
||||
"prismarine-registry": "^1.11.0",
|
||||
"undici": "^7.16.0",
|
||||
"wikipedia": "^2.1.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/9.4.0/userguide/multi_project_builds.html in the Gradle documentation.
|
||||
*/
|
||||
|
||||
rootProject.name = "NitoriBot"
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const { EventEmitter } = require("events");
|
||||
const ChatMessage = require("prismarine-chat");
|
||||
const usernameGen = require("./util/usernameGen");
|
||||
let disconnectCount = 0;
|
||||
|
||||
EventEmitter.defaultMaxListeners = Infinity;
|
||||
|
||||
class Bot {
|
||||
constructor(options = {}, config) {
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
// Set some default values in options
|
||||
host: (options.host ??= "localhost"),
|
||||
username: (options.username ??= usernameGen()),
|
||||
version: (options.version ??= "1.21.8"),
|
||||
hideErrors: (options.hideErrors ??= true), // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
serverName: (options.serverName ??= "localhost"),
|
||||
private: (options.private ??= false),
|
||||
reconnectDelay: (options.reconnectDelay ??= 300),
|
||||
channelId: (options.channelId ??= "0000000000000000000"),
|
||||
logging: {
|
||||
file: (options.logging.file ??= false),
|
||||
console: (options.logging.console ??= false)
|
||||
},
|
||||
mode: (options.mode ??= "kaboom"),
|
||||
selfcareInterval: (options.selfcareInterval ??= 1000),
|
||||
itemRefill: (options.itemRefill ??= false),
|
||||
chatGamemodeChange: (options.chatGamemodeChange ??= false)
|
||||
};
|
||||
|
||||
bot.options = options;
|
||||
|
||||
// Create our client object, put it on the bot, and register some events
|
||||
bot.on("init_client", (client) => {
|
||||
client.on("packet", (data, meta) => {
|
||||
bot.emit("packet", data, meta);
|
||||
bot.emit("packet." + meta.name, data);
|
||||
});
|
||||
|
||||
client.once("login", (data) => {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
bot.loggedIn = true;
|
||||
disconnectCount = 0
|
||||
bot.reconnectDelay = options.reconnectDelay;
|
||||
});
|
||||
|
||||
client.on("disconnect", (data) => {
|
||||
try {
|
||||
if (
|
||||
JSON.parse(data.reason) ===
|
||||
"Wait 5 seconds before connecting, thanks! :)"
|
||||
)
|
||||
bot.reconnectDelay = 5000;
|
||||
bot.console.warn(
|
||||
`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`,
|
||||
);
|
||||
bot?.discord?.channel?.send(
|
||||
ChatMessage(bot._client.version).fromNotch(data.reason)?.toString(),
|
||||
);
|
||||
} catch {} // do nothing
|
||||
});
|
||||
|
||||
client.on("end", (reason) => {
|
||||
bot.emit("end", reason);
|
||||
bot.loggedIn = false;
|
||||
disconnectCount++;
|
||||
});
|
||||
|
||||
client.on("error", (error) => {
|
||||
try {
|
||||
if (disconnectCount === 10) {
|
||||
bot.console.info("stopped logging disconnect messages for now...");
|
||||
bot?.discord?.channel?.send(
|
||||
"stopped logging disconnect messages for now...",
|
||||
);
|
||||
return;
|
||||
} else if (disconnectCount > 10) {
|
||||
return;
|
||||
} else {
|
||||
bot.console.warn(
|
||||
ChatMessage(bot._client.version)
|
||||
.fromNotch(`§8[§bClient Reconnect§8]§r ${error.stack}`)
|
||||
?.toAnsi(),
|
||||
);
|
||||
bot?.discord?.channel?.send(error.toString());
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
client.on("kick_disconnect", (data) => {
|
||||
bot.console.warn(
|
||||
`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`,
|
||||
);
|
||||
bot?.discord?.channel?.send(
|
||||
ChatMessage(bot._client.version).fromNotch(data.reason)?.toString(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
//console.log('meow')
|
||||
console.warn(`${e.stack}`);
|
||||
});
|
||||
|
||||
|
||||
const client = options.client ?? new mc.createClient(bot.options);
|
||||
bot._client = client;
|
||||
bot.emit("init_client", client);
|
||||
bot.bots = options.bots ?? [bot];
|
||||
return bot;
|
||||
}
|
||||
}
|
||||
module.exports = Bot;
|
||||
@@ -1,43 +0,0 @@
|
||||
function chipmunkmod(message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
if (
|
||||
message.with?.length < 3 ||
|
||||
(message.translate !== "[%s] %s › %s" &&
|
||||
message.translate !== "%s %s › %s")
|
||||
)
|
||||
return;
|
||||
|
||||
const senderComponent = message.with[1];
|
||||
const contents = message.with[2];
|
||||
let sender;
|
||||
const hoverEvent = senderComponent.hover_event;
|
||||
// console.log(hoverEvent)
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const id = hoverEvent.uuid;
|
||||
|
||||
sender = data.players.find((player) => player.entityUuid[0] === id[0])//.entityUuid //=== hoverEvent.uuid)//.entityUuid;
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
?.toString();
|
||||
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
);
|
||||
}
|
||||
|
||||
if (!sender) return null;
|
||||
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
senderComponent,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
module.exports = chipmunkmod;
|
||||
@@ -1,26 +0,0 @@
|
||||
const ChatMessage = require("prismarine-chat")("1.20.2");
|
||||
const util = require("util");
|
||||
function parseMessage(messageobj, data) {
|
||||
try {
|
||||
let match;
|
||||
let sender;
|
||||
const stringify = (message) => new ChatMessage(message).toString();
|
||||
const message = stringify(messageobj);
|
||||
const playerWithPrefix = /^(.*?) (\S*?) » (.*?)$/;
|
||||
const playerWithoutPrefix = /^(\S*?) » (.*?)$/;
|
||||
if (playerWithPrefix.test(message)) {
|
||||
match = message.match(playerWithPrefix);
|
||||
|
||||
sender = data.players.find((player) => player.profile.name === match[2]);
|
||||
return {
|
||||
sender,
|
||||
contents: match[3],
|
||||
type: "minecraft:chat",
|
||||
chatType: data.chatType
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
}
|
||||
module.exports = parseMessage;
|
||||
@@ -1,43 +0,0 @@
|
||||
const util = require('util')
|
||||
|
||||
function kaboom (message, data) {
|
||||
if (message === null || typeof message !== 'object') return
|
||||
|
||||
if (message.text !== '' || !Array.isArray(message.extra) || message.extra.length < 3) return
|
||||
|
||||
const children = message.extra
|
||||
|
||||
const prefix = children[0]
|
||||
let displayName = data.senderName ?? { text: '' }
|
||||
let contents = { text: '' }
|
||||
|
||||
if (isSeparatorAt(children, 1)) { // Missing/blank display name
|
||||
if (children.length > 3) contents = children[3]
|
||||
} else if (isSeparatorAt(children, 2)) {
|
||||
displayName = children[1]
|
||||
if (children.length > 4) contents = children[4]
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
|
||||
let sender
|
||||
|
||||
if (data.senderUuid) {
|
||||
sender = data.players.find(player => player.uuid === data.senderUuid)
|
||||
} else {
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
|
||||
}
|
||||
|
||||
if (!sender) return undefined
|
||||
|
||||
return { sender, contents, type: "minecraft:chat", displayName, chatType: data.chatType }
|
||||
}
|
||||
|
||||
function isSeparatorAt (children, start) {
|
||||
return (children[start]?.text === ':' || children[start]?.text === '\xa7f:') && children[start + 1]?.text === ' '
|
||||
}
|
||||
|
||||
module.exports = kaboom
|
||||
@@ -1,31 +0,0 @@
|
||||
function me (message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
|
||||
if (message.with?.length > 2 || message.translate !== "chat.type.announcement") return;
|
||||
|
||||
const component = message.with[0];
|
||||
const contents = message.with[1];
|
||||
let sender;
|
||||
const hoverEvent = component.hover_event
|
||||
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const name = hoverEvent.name;
|
||||
sender = data.players.find((player) => player.profile.name === name)
|
||||
}
|
||||
|
||||
if (!sender) return;
|
||||
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
component,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = me;
|
||||
@@ -1,5 +0,0 @@
|
||||
function say (message, data) {
|
||||
|
||||
}
|
||||
|
||||
module.exports = say;
|
||||
@@ -1,37 +0,0 @@
|
||||
function vanilla(message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
|
||||
if (
|
||||
message.with?.length < 2 ||
|
||||
(message.translate !== "chat.type.text" && message.translate !== "%s %s")
|
||||
)
|
||||
return;
|
||||
const senderComponent = message.with[0];
|
||||
const contents = message.with[1];
|
||||
let sender;
|
||||
const hoverEvent = senderComponent.hoverEvent;
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const id = hoverEvent.contents.id;
|
||||
sender = data.players.find((player) => player.uuid === id);
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
.toString();
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
);
|
||||
}
|
||||
if (!sender) return;
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
senderComponent,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(`${e.stack}`);
|
||||
}
|
||||
}
|
||||
module.exports = vanilla;
|
||||
@@ -1,38 +0,0 @@
|
||||
const CommandError = require('./CommandError');
|
||||
const translations = require('../data/translations.json');
|
||||
|
||||
class CommandArguments {
|
||||
static getInteger (integer) {
|
||||
if (isNaN(integer)) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${integer}` }
|
||||
]
|
||||
})
|
||||
else return String(Number(integer))
|
||||
}
|
||||
|
||||
static getJson (json) {
|
||||
|
||||
}
|
||||
|
||||
static getArguments () {
|
||||
|
||||
}
|
||||
|
||||
static getMaxArguments (commandArgs, args) {
|
||||
if (commandArgs < args) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.max_exceeded",
|
||||
fallback: translations["fnfboyfriendbot.arguments.max_exceeded"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${commandArgs}` },
|
||||
{ text: `${args}` }
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommandArguments;
|
||||
@@ -1,12 +0,0 @@
|
||||
class CommandContext {
|
||||
constructor(name, aliases, description, trustLevel, usages, playerChatOnly) {
|
||||
this.data = {};
|
||||
this.data.name = name;
|
||||
this.data.aliases = aliases;
|
||||
this.data.description = description;
|
||||
this.data.trustLevel = trustLevel;
|
||||
this.data.usages = usages;
|
||||
this.data.playerChatOnly = playerChatOnly
|
||||
}
|
||||
}
|
||||
module.exports = CommandContext;
|
||||
@@ -1,15 +0,0 @@
|
||||
const ChatMessage = require("prismarine-chat")("1.21.8");
|
||||
const stringify = (message) => new ChatMessage(message)?.toString();
|
||||
|
||||
class CommandError extends Error {
|
||||
constructor(message, filename, lineError) {
|
||||
super(stringify(message), filename, lineError);
|
||||
this.name = "CommandError";
|
||||
this._message = message;
|
||||
}
|
||||
|
||||
get message() {
|
||||
return stringify(this._message);
|
||||
}
|
||||
}
|
||||
module.exports = CommandError;
|
||||
@@ -1,9 +0,0 @@
|
||||
class CommandSource {
|
||||
constructor(player, sources, ChatType) {
|
||||
this.player = player;
|
||||
this.sources = sources;
|
||||
this.ChatType = ChatType;
|
||||
this.player.trustLevel = 0;
|
||||
}
|
||||
}
|
||||
module.exports = CommandSource;
|
||||
@@ -1,10 +0,0 @@
|
||||
class CommandTrustLevel {
|
||||
static public = 0;
|
||||
static trusted = 1;
|
||||
static admin = 2;
|
||||
static owner = 3;
|
||||
static console = 4;
|
||||
static disabled = 5;
|
||||
}
|
||||
|
||||
module.exports = CommandTrustLevel;
|
||||
@@ -1,155 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class CoresettingsCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("coresettings", ["cbsettings"], "change the bots core settings", 2, [
|
||||
"useplacedcommandblock <on/off/true/false/enable/disable>",
|
||||
"area start <positions>",
|
||||
"area end <positions>",
|
||||
"refillmethod/rcmethod <item/chat>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "useplacedcommandblock":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "true":
|
||||
case "enable":
|
||||
bot.core.usePlacedCommandBlock = true;
|
||||
component.push({
|
||||
text: "now using the placed command block",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
case "off":
|
||||
case "false":
|
||||
case "disable":
|
||||
bot.core.usePlacedCommandBlock = false;
|
||||
component.push({
|
||||
text: "no longer using the placed command block",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
component.push({
|
||||
text: "the bot is currently using the placed command block to run its commands",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
text: "the bot is currently using its command block core to run its commands",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "area":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "start":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.start = config.core.area.start;
|
||||
component.push({
|
||||
text: "arguments were NaN, defaulting to config core start coords",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
bot.core.area.start = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5]),
|
||||
};
|
||||
component.push({
|
||||
text: `setting core start pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "end":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.end = config.core.area.end;
|
||||
throw new CommandError(
|
||||
"arguments were NaN, defaulting to config core end coords",
|
||||
);
|
||||
} else {
|
||||
bot.core.area.end = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5]),
|
||||
};
|
||||
|
||||
component.push({
|
||||
text: `setting core end pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
component.push({
|
||||
text: `core start pos: x: ${bot.core.area.start.x}, y: ${bot.core.area.start.y}, z: ${bot.core.area.start.z}, and end pos: x: ${bot.core.area.end.x}, y: ${bot.core.area.end.y}, z: ${bot.core.area.end.z}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "refillmethod":
|
||||
case "rcmethod":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "item":
|
||||
config.core.itemRefill = true;
|
||||
component.push({
|
||||
text: "now refilling via item",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
case "chat":
|
||||
config.core.itemRefill = false;
|
||||
component.push({
|
||||
text: "now refilling via chat",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
if (config.core.itemRefill) {
|
||||
component.push({
|
||||
text: "currently filling core via item",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
text: "currently filling core via chat",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CoresettingsCommand;
|
||||
@@ -1,37 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KickCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kick", [], "kick a player from the server", 2, [
|
||||
"invalidstring",
|
||||
"item",
|
||||
"te",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args[2]);
|
||||
bot.tellraw("@a", `crashing ${args[2]}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = KickCommand;
|
||||
@@ -1,13 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ReconnectCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("reconnect", ["end"], "reconnects the bot", 2, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end();
|
||||
bot.chat.message("reconnecting");
|
||||
}
|
||||
}
|
||||
module.exports = ReconnectCommand;
|
||||
@@ -1,118 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
|
||||
class ConsoleCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("console", ["c"], "runs commands made for the bots console", 4, [
|
||||
"server/srv <all/servername>",
|
||||
"customchat <on/true/enable/off/false/disable>",
|
||||
"say <message>",
|
||||
"validate/validation/val <owner/o/admin/a/trusted/t>",
|
||||
"logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map((eachBot) => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(" ").toLowerCase() === "all") {
|
||||
eachBot.console.server = "all";
|
||||
bot.console.info("Set the console server to all");
|
||||
continue;
|
||||
}
|
||||
const server = servers.find((server) =>
|
||||
server.toLowerCase().includes(args[1]),
|
||||
);
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return;
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break;
|
||||
case "say":
|
||||
bot.chat.send(args.slice(1).join(" "));
|
||||
break;
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "admin":
|
||||
case "a":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "trusted":
|
||||
case "t":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "logging":
|
||||
case "togglelogging":
|
||||
case "logtoconsole":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "enabled":
|
||||
case "true":
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already enabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now enabled`,
|
||||
);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "disabled":
|
||||
case "false":
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already disabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now disabled`,
|
||||
);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConsoleCommand;
|
||||
@@ -1,12 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KillCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kill", ["suicide", "quit"], "kill the bots process", 3, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = KillCommand;
|
||||
@@ -1,42 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { stylize } = require("../../util/stylizeEval");
|
||||
const util = require("util");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ServerevalCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("servereval", ["se"], "run code unisolated", 4, ["<code>"]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(" ");
|
||||
const { MessageBuilder } = require("prismarine-chat")(bot.options.version);
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(
|
||||
bot
|
||||
.getMessageAsPrismarine({
|
||||
text: util.inspect(eval(args.join(" ")), { stylize }),
|
||||
})
|
||||
?.toAnsi(),
|
||||
);
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(
|
||||
`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
|
||||
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ServerevalCommand;
|
||||
@@ -1,36 +0,0 @@
|
||||
const sleep = require("../../util/sleep");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super("core", ["cb", "cbrun", "corerun"], "run commands in core", 0, [
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args.includes("$username") || args.includes("$uuid")) {
|
||||
bot.players.forEach((eachPlayer) => {
|
||||
bot.core.runTracked(
|
||||
args
|
||||
.join(" ")
|
||||
.replaceAll("$username", eachPlayer.profile.name)
|
||||
.replaceAll("$uuid", eachPlayer.uuid),
|
||||
source,
|
||||
);
|
||||
// await sleep(1000)
|
||||
});
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(" "));
|
||||
} else {
|
||||
bot.core.runTracked(args.join(" "), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
@@ -1,18 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class EchoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("echo", ["say", "botsay"], "make me say something!", 0, [
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
bot.chat.send(`${args.join(" ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EchoCommand;
|
||||
@@ -1,446 +0,0 @@
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class HelpCommand extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
["heko", "?", "cmds", "commands", "hell"],
|
||||
"see a list of commands",
|
||||
0,
|
||||
["<command>"],
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let Public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
|
||||
let cat = {
|
||||
translate: "(%s | %s | %s | %s)",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Public", color: config.colors.help.public },
|
||||
{ text: "Trusted", color: config.colors.help.trusted },
|
||||
{ text: "Admin", color: config.colors.help.admin },
|
||||
{ text: "Owner", color: config.colors.help.owner },
|
||||
],
|
||||
};
|
||||
|
||||
component.push({
|
||||
translate: "%s: (%s) %s \u203a\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Commands", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${bot.commandManager.commandlist.length}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
cat,
|
||||
],
|
||||
});
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
Public.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.public,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
trusted.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.trusted,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
admin.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.admin,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
owner.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.owner,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
Console.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.console,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(
|
||||
`fuck you ${commands.data.name} has a invalid trust level`,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
args[0]?.toLowerCase() === commands.data.name?.toLowerCase() ||
|
||||
commands.data.aliases.find(
|
||||
(e) => e?.toLowerCase() === args[0]?.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
for (const usages of commands.data.usages) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{
|
||||
text: `${config.prefixes[0]}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${usages}`, color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
|
||||
usagesComponent.push("\n");
|
||||
}
|
||||
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases.toString().replaceAll(",", " ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
],
|
||||
});
|
||||
|
||||
infoComponent.push(usagesComponent);
|
||||
|
||||
if (source?.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(infoComponent)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a`, infoComponent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Public.length > 0) {
|
||||
component.push(Public);
|
||||
if (trusted.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
if (admin.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
if (owner.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
if (source.sources.console && Console.length > 0) {
|
||||
component.push(Console);
|
||||
}
|
||||
|
||||
if (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HelpCommand;
|
||||
@@ -1,608 +0,0 @@
|
||||
const os = require("os");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fs = require("fs");
|
||||
const botInfo = require("../../data/info.json");
|
||||
const fixansi = require("../../util/ansi.js");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
pad(`${seconds} Seconds`)
|
||||
);
|
||||
}
|
||||
|
||||
class InfoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("info", ["information"], "check the bots info", 0, [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.buildstring.url}`,
|
||||
color: `${config.colors.commands.primary}`,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to view bots source code",
|
||||
color: `${config.colors.commands.primary}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${botInfo.buildstring.url}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "config":
|
||||
if (bot.options.isKaboom) {
|
||||
mode = "Kaboom";
|
||||
}
|
||||
if (bot.options.useChat && bot.options.isKaboom) {
|
||||
mode = "Kaboom/Coreless";
|
||||
}
|
||||
if (bot.options.isSavage) {
|
||||
mode = "Savage";
|
||||
}
|
||||
if (bot.options.isCreayun) {
|
||||
mode = "Creayun";
|
||||
}
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "client":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Minecraft Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
if (!config.discord.enabled || discordClient.user === null) {
|
||||
throw new CommandError(
|
||||
"Token is incorrect or discord isnt enabled!",
|
||||
);
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Discord Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${discordClient.user.tag}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Channel",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.discord?.channel?.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "options":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${config.prefixes.map((e) => e + " ").join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.mode}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate:
|
||||
"%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Minecraft Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.version}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${discordClient.user?.tag}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Channel",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.discord.channel?.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${config.prefixes.map((e) => e + " ").join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.mode}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Parker", color: "dark_red" },
|
||||
{ text: "2991", color: "black" },
|
||||
{ text: "Owner" },
|
||||
{ text: "Contributors" },
|
||||
{ text: "_ChipMC_", color: "dark_blue" },
|
||||
{ text: "chayapak", color: "yellow" },
|
||||
{ text: "_yfd", color: "light_purple" },
|
||||
{ text: "aaa", color: "gold" },
|
||||
{ text: "Morgan", color: "green" },
|
||||
{ text: "Ankan", color: "dark_green" },
|
||||
{ text: "TurtleKid", color: "green" },
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
color: config.colors.commands.primary,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${config.discord.invite}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s %s\n%s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${bot.commandManager.commandlist.length}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Commands", color: config.colors.commands.primary },
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer },
|
||||
{ text: "Modules", color: config.colors.commands.primary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "usages":
|
||||
case "usage":
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "uptimes":
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${format(process.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Uptime",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${format(os.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${format(process.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Server Uptime",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${format(os.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate:
|
||||
"%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Hostname", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.hostname()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "User", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.userInfo().username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Working Directory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${require.main.path}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Arch", color: config.colors.commands.primary },
|
||||
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS", color: config.colors.commands.primary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.version()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Kernel Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.release()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "CPU", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.cpus()[0].model}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "CPU cores", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer },
|
||||
{ text: "Processes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("ps aux | wc -l").toString().replace("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${process.version}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "NPM Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("npm -v").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "version":
|
||||
case "ver":
|
||||
if (botInfo.buildstring.codename.length > 0) {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
botInfo.buildstring.codename,
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${botInfo.buildstring.build}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Version Release Date",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${botInfo.buildstring.build}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Version Release Date",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
|
||||
if (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InfoCommand;
|
||||
@@ -1,54 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ListCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("list", ["pl", "playerlist"], "check whos online on the server", 0, [
|
||||
"",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let playerCount = [];
|
||||
|
||||
playerCount.push({
|
||||
translate: "%s: (%s)\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Players", color: config.colors.commands.primary },
|
||||
{ text: `${bot.players.length}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
component.push({
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{ text: `${player.uuid}`, color: config.colors.commands.primary },
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
component.push("\n");
|
||||
}
|
||||
component.pop();
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ListCommand;
|
||||
@@ -1,52 +0,0 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const util = require("util");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
class McserverCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("mcserver", ["pingserver"], "pings minecraft servers", 0, ["<ip>"]);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const [host, port] = args[0].split(":");
|
||||
const source = context.source;
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) });
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "ip", color: config.colors.commands.primary },
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Number(port ?? 25565)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "players", color: config.colors.commands.primary },
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer },
|
||||
{ text: "server version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${server.version.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
server.description,
|
||||
],
|
||||
});
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = McserverCommand;
|
||||
@@ -1,65 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class NetmsgCommand extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"netmsg",
|
||||
["networkmessage", "netmessage"],
|
||||
"send a message to other servers",
|
||||
0,
|
||||
["<message>"],
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
|
||||
if (bot.options.private === true) {
|
||||
component.push({
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
source?.player?.displayName ?? source?.player?.profile?.name,
|
||||
{
|
||||
text: `${args.join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "[%s:%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.port}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{
|
||||
text: `${args.join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = NetmsgCommand;
|
||||
@@ -1,14 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class RefillcoreCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("refillcore", ["rc", "refill"], "refill the bots core", 0, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.core.move(bot.position);
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
}
|
||||
}
|
||||
module.exports = RefillcoreCommand;
|
||||
@@ -1,121 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const fixansi = require("../../util/ansi");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { AttachmentBuilder } = require("discord.js");
|
||||
|
||||
class UrbanCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("urban", ["urbandictionary"], "urban dictionary", 0, [
|
||||
"<definition>",
|
||||
]);
|
||||
}
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const prefix = [
|
||||
{ text: "[", color: "dark_gray" },
|
||||
{ text: "Urban", color: "#B72A00" },
|
||||
{ text: "] ", color: "dark_gray" },
|
||||
];
|
||||
let component = [];
|
||||
let term = `${args.join(" ")}`;
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(
|
||||
`https://api.urbandictionary.com/v0/define?${query}`,
|
||||
);
|
||||
const { list } = await dictResult.body.json();
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.chat.message(
|
||||
"this command is disabled for this server for right now sorry!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!list.length) {
|
||||
bot.tellraw("@a", { text: "No results found", color: "dark_red" });
|
||||
}
|
||||
|
||||
for (const definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll("\r", "").replaceAll("[", "\xa71\xa7n\xa7o").replaceAll("]", "\xa7r\xa77")}\n`,
|
||||
color: "gray",
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: "gray",
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${definitions.permalink}`,
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
const discordOutput = fixansi(
|
||||
bot.getMessageAsPrismarine(component)?.toAnsi(),
|
||||
);
|
||||
|
||||
if (discordOutput.length > 2000) {
|
||||
const output = fs.writeFileSync(
|
||||
path.join(__dirname, "../../output.txt"),
|
||||
JSON.stringify(bot.getMessageAsPrismarine(component)?.toString()),
|
||||
);
|
||||
|
||||
const file = new AttachmentBuilder(
|
||||
path.join(__dirname, "../../output.txt"),
|
||||
);
|
||||
|
||||
bot.discord.message.reply("output", {
|
||||
files: [file],
|
||||
});
|
||||
// bot.discord.message.reply('meow') //[{
|
||||
// files: path.join(__dirname, '../../output.txt')
|
||||
// }])
|
||||
|
||||
// fs.unlinkSync(path.join(__dirname, '../../output.txt'))
|
||||
} else {
|
||||
bot.discord.message.reply(`\`\`\`ansi\n${discordOutput}\`\`\``);
|
||||
}
|
||||
// console.log(discordOutput.length)
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`);
|
||||
} else {
|
||||
bot.tellraw(`@a`, component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UrbanCommand;
|
||||
@@ -1,122 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class WeatherCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("weather", [], "check the weather in locations", 0, [
|
||||
"<weather/zip code>",
|
||||
]);
|
||||
}
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const url = await request(
|
||||
`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(" ").replaceAll(" ", "%20")}`,
|
||||
);
|
||||
const info = await url.body.json();
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "%s: %s, %s %s",
|
||||
with: [
|
||||
{ text: "Location", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${info.location.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.region}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.country}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "Coords", color: config.colors.commands.primary },
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer },
|
||||
{ text: "Time", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.tz_id}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
translate: "%s: %s (%s), %s (%s)",
|
||||
with: [
|
||||
{ text: "Temp", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_c)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "\u00b0C", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_f)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "\u00b0F", color: config.colors.commands.secondary },
|
||||
],
|
||||
},
|
||||
{
|
||||
translate: "%s: %s (%s, %s), %s (%s, %s)",
|
||||
with: [
|
||||
{ text: "Wind Speed", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_kph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "kph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_mph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "mph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "Condition", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${info.current.condition.text}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Humidity", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${Math.floor(info.current.humidity)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.chat.message(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WeatherCommand;
|
||||
@@ -1,45 +0,0 @@
|
||||
const wiki = require("wikipedia");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class WikiCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("wiki", ["wikipedia"], "wikipedia", 0, ["<article>"]);
|
||||
}
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(" "));
|
||||
const summary = await page.intro();
|
||||
|
||||
component.push({ text: summary, color: config.colors.commands.primary });
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${new fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()).ansi}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
if (
|
||||
e.toString() ===
|
||||
"pageError: TypeError: Cannot read properties of undefined (reading 'pages')"
|
||||
) {
|
||||
bot.tellraw("@a", { text: "no article found!", color: "red" });
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WikiCommand;
|
||||
@@ -1,108 +0,0 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fixAnsi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class CloopCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("cloop", ["commandloop", "loop"], "loops commands", 1, [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"list",
|
||||
"clear",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let args;
|
||||
let component = [];
|
||||
|
||||
if (!source.sources.console && !source.sources.discord) {
|
||||
args = context.arguments.slice(16);
|
||||
} else {
|
||||
args = context.arguments;
|
||||
}
|
||||
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "add":
|
||||
if (isNaN(args[1])) throw new CommandError("invalid interval");
|
||||
|
||||
const interval = parseInt(args[1]);
|
||||
const command = args.slice(2).join(" ");
|
||||
bot.cloop.add(command, interval);
|
||||
|
||||
component.push(
|
||||
`added ${command} to the cloops with the interval ${interval}`,
|
||||
);
|
||||
break;
|
||||
case "clear":
|
||||
bot.cloop.clear();
|
||||
component.push("cleared the cloops");
|
||||
break;
|
||||
case "remove":
|
||||
if (isNaN(args[1]))
|
||||
throw new CommandError("argument must be an integer!");
|
||||
|
||||
const index = parseInt(args[1]);
|
||||
bot.cloop.remove(index);
|
||||
|
||||
component.push(`removed ${index} from cloops`);
|
||||
break;
|
||||
case "list":
|
||||
let listComponent = [];
|
||||
let i = 0;
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: "%s \u203a %s (%s)",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${i}`, color: config.colors.integer },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
listComponent.push("\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
listComponent.pop();
|
||||
|
||||
component.push({
|
||||
translate: "Cloops (%s):",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
component.push("\n");
|
||||
|
||||
if (bot.cloop.list.length > 0) {
|
||||
component.push(listComponent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
|
||||
if (source.sources.discord) {
|
||||
} else if (source.sources.console) {
|
||||
bot.console.info(component);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CloopCommand;
|
||||
@@ -1,24 +0,0 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ValidateCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("validate", ["val"], "validate through the bot", 1, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args[0] === bot.validation.trusted) {
|
||||
bot.chat.message("&2Valid Trusted hash");
|
||||
}
|
||||
if (args[0] === bot.validation.admin) {
|
||||
bot.chat.message("&2Valid Admin hash");
|
||||
}
|
||||
if (args[0] === bot.validation.owner) {
|
||||
bot.chat.message("&2Valid Owner hash");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ValidateCommand;
|
||||
@@ -1,41 +0,0 @@
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class kick extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"kick",
|
||||
[],
|
||||
"kick a player from the server",
|
||||
trustLevel.admin,
|
||||
["invalidstring", "item", "te"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args[2]);
|
||||
bot.tellraw("@a", `crashing ${args[2]}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = kick;
|
||||
@@ -1,126 +0,0 @@
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class console extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"console",
|
||||
["c"],
|
||||
"runs commands made for the bots console",
|
||||
trustLevel.console,
|
||||
[
|
||||
"server/srv <all/servername>",
|
||||
"customchat <on/true/enable/off/false/disable>",
|
||||
"say <message>",
|
||||
"validate/validation/val <owner/o/admin/a/trusted/t>",
|
||||
"logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>",
|
||||
],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map((eachBot) => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(" ").toLowerCase() === "all") {
|
||||
eachBot.console.server = "all";
|
||||
bot.console.info("Set the console server to all");
|
||||
continue;
|
||||
}
|
||||
const server = servers.find((server) =>
|
||||
server.toLowerCase().includes(args[1]),
|
||||
);
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return;
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break;
|
||||
case "say":
|
||||
bot.chat.send(args.slice(1).join(" "));
|
||||
break;
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "admin":
|
||||
case "a":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "trusted":
|
||||
case "t":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "logging":
|
||||
case "togglelogging":
|
||||
case "logtoconsole":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "enabled":
|
||||
case "true":
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already enabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now enabled`,
|
||||
);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "disabled":
|
||||
case "false":
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already disabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now disabled`,
|
||||
);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = console;
|
||||
@@ -1,24 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class kill extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"kill",
|
||||
[
|
||||
"suicide",
|
||||
"quit"
|
||||
],
|
||||
"kill the bots process",
|
||||
trustLevel.owner,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = kill;
|
||||
@@ -1,46 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"core",
|
||||
[
|
||||
"cb",
|
||||
"cbrun",
|
||||
"corerun"
|
||||
],
|
||||
"run commands in core",
|
||||
trustLevel.public,
|
||||
[
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>"
|
||||
],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args.includes("$username") || args.includes("$uuid")) {
|
||||
bot.players.forEach((eachPlayer) => {
|
||||
bot.core.runTracked(
|
||||
args
|
||||
.join(" ")
|
||||
.replaceAll("$username", eachPlayer.profile.name)
|
||||
.replaceAll("$uuid", eachPlayer.uuid),
|
||||
source,
|
||||
);
|
||||
});
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(" "));
|
||||
} else {
|
||||
bot.core.runTracked(args.join(" "), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
@@ -1,26 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class echo extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"echo",
|
||||
[
|
||||
"say",
|
||||
"botsay"
|
||||
],
|
||||
"make me say something!",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.chat.send(`${args.join(" ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = echo;
|
||||
@@ -1,57 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class extras extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"extras",
|
||||
[],
|
||||
"send messages via the extras channel",
|
||||
trustLevel.public,
|
||||
[
|
||||
"send",
|
||||
"register",
|
||||
"unregister",
|
||||
"unregisterall"
|
||||
],
|
||||
true,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
if (
|
||||
!args
|
||||
&&
|
||||
!args[0]
|
||||
&&
|
||||
!args[1]
|
||||
&&
|
||||
!args[2]
|
||||
) return;
|
||||
|
||||
switch (args[0]) {
|
||||
case "send":
|
||||
bot.extras.send(args[1], args.slice(2).join(" "))
|
||||
source.sendFeedback(`sent ${args.slice(2).join(" ")} to channel ${args[1]}`)
|
||||
break
|
||||
case "register":
|
||||
bot.extras.register(args[1])
|
||||
source.sendFeedback(`registered ${args[1]} channel`)
|
||||
break
|
||||
case "unregister":
|
||||
bot.extras.unregister(args[1])
|
||||
source.sendFeedback(`unregistered from ${args[1]} channel`)
|
||||
console.log(bot.extras.channels)
|
||||
break
|
||||
case "unregisterall":
|
||||
bot.extras.unregisterAll();
|
||||
source.sendFeedback("unregistered all channels")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = extras;
|
||||
@@ -1,229 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class help extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
[
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"commands",
|
||||
"hell"
|
||||
],
|
||||
"see a list of commands",
|
||||
trustLevel.public,
|
||||
["<command>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let Public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
|
||||
component.push({
|
||||
translate: "%s %s \u203a\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.command_layout",
|
||||
fallback: translations["fnfboyfriendbot.command.help.command_layout"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ':', color: config.colors.commands.tertiary },
|
||||
{ text: '(', color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
|
||||
{ text: ')', color: config.colors.commands.tertiary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.category",
|
||||
fallback: translations["fnfboyfriendbot.command.help.category"],
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.public",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.public"],
|
||||
color: config.colors.help.public
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.trusted",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.trusted"],
|
||||
color: config.colors.help.trusted
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.admin",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.admin"],
|
||||
color: config.colors.help.admin
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.owner",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.owner"],
|
||||
color: config.colors.help.owner
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
Public.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.public,
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
trusted.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.trusted,
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
admin.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.admin,
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
owner.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.owner,
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
Console.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.console,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if (
|
||||
args[0]?.toLowerCase() === commands.data.name?.toLowerCase() ||
|
||||
commands.data.aliases.find(
|
||||
(e) => e?.toLowerCase() === args[0]?.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
for (const usages of commands.data.usages) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{
|
||||
text: `${config.prefixes[0]}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${usages}`, color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
|
||||
usagesComponent.push("\n");
|
||||
}
|
||||
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.command",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.command"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.name,
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.alias",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.alias"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.aliases.toString().replaceAll(',',' ')
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.description",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.description"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.description
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.trust_level",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.trust_level"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.usages",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.usages"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
usagesComponent
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
})
|
||||
source.sendFeedback(infoComponent)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Public.length > 0) {
|
||||
component.push(Public);
|
||||
if (trusted.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
if (admin.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
if (owner.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
if (source.sources.console && Console.length > 0) {
|
||||
component.push(Console);
|
||||
}
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = help;
|
||||
@@ -1,457 +0,0 @@
|
||||
const os = require("os");
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const botInfo = require("../../data/info.json");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
pad(`${seconds} Seconds`)
|
||||
);
|
||||
}
|
||||
|
||||
class info extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"info",
|
||||
["information"],
|
||||
"check the bots info",
|
||||
trustLevel.public,
|
||||
[
|
||||
"about",
|
||||
"config",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages ",
|
||||
"uptimes",
|
||||
"server",
|
||||
"version",
|
||||
],
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
let component = [];
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.info.about",
|
||||
fallback: translations["fnfboyfriendbot.command.info.about"],
|
||||
color: config.colors.commands.primary,
|
||||
})
|
||||
break;
|
||||
case "config":
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.name",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.name"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
bot.options.serverName
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.version}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${discordClient?.user?.tag}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.channel",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.channel"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.count",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.count"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.prefixes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.prefixes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.mode",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.mode"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Parker", color: "dark_red" },
|
||||
{ text: "2991", color: "black" },
|
||||
{ text: "Owner" },
|
||||
{ text: "Contributors" },
|
||||
{ text: "_ChipMC_", color: "dark_blue" },
|
||||
{ text: "chayapak", color: "yellow" },
|
||||
{ text: "_yfd", color: "light_purple" },
|
||||
{ text: "aaa/ImFloriz", color: "gold" },
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
{ text: "TurtleKid", color: "green" }
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.info.discord",
|
||||
fallback: translations["fnfboyfriendbot.command.info.discord"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${config.discord.invite}`, color: config.colors.commands.secondary }
|
||||
],
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: `${config.colors.commands.primary}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
click_event: {
|
||||
action: "open_url",
|
||||
url: `${config.discord.invite}`,
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.loaded.commands",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.commands"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer}
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.loaded.modules",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.modules"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.hostname",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.hostname"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.user",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.user"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.directory",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.directory"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${require.main.path}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.arch",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.arch"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.arch}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.primary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.version()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.kernel_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.kernel_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.release()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu.cores",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu.cores"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.processes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.processes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("ps aux | wc -l").toString().replace("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.node_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.node_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${process.version}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.npm_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.npm_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("npm -v").toString().replaceAll("\n", "")}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "usages":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.usages.botmem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.botmem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.usages.servermem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.servermem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
break;
|
||||
case "uptimes":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.bot",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.bot"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(process.uptime())}`}
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.server",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.server"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "version":
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s\n%s\n%s\n%s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
botInfo.buildstring.codename || '',
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.repo_build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.repo_build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.version_release_date",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.version_release_date"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.commit",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.commit"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
|
||||
source.sendFeedback(component);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = info;
|
||||
@@ -1,57 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class list extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"list",
|
||||
[
|
||||
"pl",
|
||||
"playerlist"
|
||||
],
|
||||
"check whos online on the server",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
let playerCount = [];
|
||||
|
||||
playerCount.push({
|
||||
translate: "%s: (%s)\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Players", color: config.colors.commands.primary },
|
||||
{ text: `${bot.players.length}`, color: config.colors.integer },
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
component.push({
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{ text: `${player.uuid}`, color: config.colors.commands.primary },
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer }
|
||||
]
|
||||
})
|
||||
component.push("\n");
|
||||
}
|
||||
component.pop();
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = list;
|
||||
@@ -1,87 +0,0 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class mcserver extends CommandContext {
|
||||
constructor() {
|
||||
super("mcserver",
|
||||
["pingserver"],
|
||||
"pings minecraft servers",
|
||||
trustLevel.public,
|
||||
["<ip>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const translations = bot.translations
|
||||
const [host, port] = args[0].split(':')
|
||||
|
||||
let component = [];
|
||||
if (isNaN(port) && port) {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: "Port" }
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.log(error)
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.unknown",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.unknown"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${host}` },
|
||||
{ text: `${Number(port ?? 25565)}` }
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) })
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s",
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${Number(port ?? 25565)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.players",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.players"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.version",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.version.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
server.description
|
||||
]
|
||||
})
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
module.exports = mcserver;
|
||||
@@ -1,54 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class netmsg extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"netmsg",
|
||||
[
|
||||
"networkmessage",
|
||||
],
|
||||
"send a message to other servers that the bot is connected to",
|
||||
trustLevel.public,
|
||||
["<message>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
if (bot.options.private === true) {
|
||||
component.push({
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
|
||||
source?.player?.displayName ?? source?.player?.profile?.name,
|
||||
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
} else {
|
||||
component.push({
|
||||
translate: "[%s:%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.commands.primary },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.tellraw("@a", component)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = netmsg;
|
||||
@@ -1,32 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class refillcore extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"rc",
|
||||
[
|
||||
"refill",
|
||||
"refillcore"
|
||||
],
|
||||
"refill the bots core",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
bot.core.move(bot.position);
|
||||
|
||||
source.sendFeedback({
|
||||
translation: "command.core.refill",
|
||||
}) // most likely wont be seen most of the time
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = refillcore;
|
||||
@@ -1,49 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const between = require('../../util/between');
|
||||
|
||||
class rtp extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"rtp",
|
||||
[
|
||||
"randomtp",
|
||||
"tpr",
|
||||
"tprandom"
|
||||
],
|
||||
"teleport to a random place. This was ported from FNFBoyfriendBot v4.x",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
const x = between(-1_000_000, 1_000_000);
|
||||
const y = 100;
|
||||
const z = between(-1_000_000, 1_000_000);
|
||||
let component = [];
|
||||
|
||||
bot.core.run(`essentials:tp ${source.player.uuid} ${x} ${y} ${z}`)
|
||||
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.rtp",
|
||||
fallback: translations["fnfboyfriendbot.command.rtp"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${source.player.profile.name}`, color: config.colors.commands.secondary },
|
||||
{ text: `${x}`, color: config.colors.integer },
|
||||
{ text: `${y}`, color: config.colors.integer },
|
||||
{ text: `${z}`, color: config.colors.integer }
|
||||
]
|
||||
})
|
||||
|
||||
bot.tellraw('@a', component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rtp
|
||||
@@ -1,25 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class test extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"test",
|
||||
[],
|
||||
"testing stuff",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
bot.chat.message('meow')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = test;
|
||||
@@ -1,126 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const { request } = require('undici');
|
||||
|
||||
class urban extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"urban",
|
||||
[
|
||||
"urbandictionary"
|
||||
],
|
||||
"look up definitions on urban dictionary",
|
||||
trustLevel.public,
|
||||
["<definition>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
let term = args.join(' ');
|
||||
|
||||
try {
|
||||
const prefix = {
|
||||
translate: "[%s] ",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.urban.text",
|
||||
fallback: translations["fnfboyfriendbot.command.urban.text"],
|
||||
color: "#B72A00"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
let component = [];
|
||||
|
||||
for (const definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: ""
|
||||
}
|
||||
])
|
||||
}
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
bot.console.error(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = urban;
|
||||
|
||||
/*
|
||||
const prefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
]
|
||||
let component = [];
|
||||
let term = `${args.join(' ')}`
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.chat.message('this command is disabled for this server for right now sorry!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!list.length) {
|
||||
bot.tellraw("@a", { text: "No results found", color: "dark_red" });
|
||||
}
|
||||
|
||||
|
||||
for (definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: "",
|
||||
hover_event: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
||||
color: 'gray'
|
||||
}
|
||||
]
|
||||
},
|
||||
click_event: {
|
||||
action: 'open_url',
|
||||
value: `${definitions.permalink}`
|
||||
}
|
||||
},
|
||||
])
|
||||
*/
|
||||
@@ -1,158 +0,0 @@
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class weather extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"weather",
|
||||
[],
|
||||
"check the weather in locations",
|
||||
trustLevel.public,
|
||||
["<weather/zip code>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const url = await request(
|
||||
`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(" ").replaceAll(" ", "%20")}`,
|
||||
);
|
||||
const info = await url.body.json();
|
||||
|
||||
if (info.error) source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.weather.unknown_location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.unknown_location"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${args.join(' ')}`}
|
||||
]
|
||||
})
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.location"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.location.region}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.country}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.coords",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.coords"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.time",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.time"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.tz_id}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.temp",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.temp"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_c)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_f)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.wind_speed",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.wind_speed"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_kph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "kph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_mph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "mph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.condition",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.condition"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${info.current.condition.text}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.humidity",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.humidity"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.humidity)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')") return
|
||||
else source.sendFeedback(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = weather;
|
||||
@@ -1,46 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const wikipedia = require('wikipedia');
|
||||
|
||||
class wiki extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"wiki",
|
||||
[
|
||||
"wikipedia"
|
||||
],
|
||||
"look up articles on wikipedia",
|
||||
trustLevel.public,
|
||||
["<article>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
let component = [];
|
||||
try {
|
||||
const page = await wikipedia.page(args.join(' '));
|
||||
const summary = await page.intro();
|
||||
component.push({ text: summary, color: config.colors.commands.primary })
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
if (e.toString().startsWith('pageError: pageError: No page with given title exists :')) {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.wiki.article_not_found",
|
||||
fallback: translations["fnfboyfriendbot.command.wiki.article_not_found"],
|
||||
color: "red"
|
||||
})
|
||||
} else {
|
||||
source.sendFeedback(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = wiki;
|
||||
@@ -1,107 +0,0 @@
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class cloop extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"cloop",
|
||||
[
|
||||
"commandloop",
|
||||
"loop"
|
||||
],
|
||||
"loops commands",
|
||||
trustLevel.trusted,
|
||||
[
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"list",
|
||||
"clear"
|
||||
],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
let component = [];
|
||||
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
|
||||
switch (args[0]) {
|
||||
case "add":
|
||||
if (isNaN(args[1])) throw new CommandError("invalid interval");
|
||||
|
||||
const interval = parseInt(args[1]);
|
||||
const command = args.slice(2).join(" ");
|
||||
bot.cloop.add(command, interval);
|
||||
|
||||
component.push(
|
||||
`added ${command} to the cloops with the interval ${interval}`,
|
||||
);
|
||||
break;
|
||||
case "clear":
|
||||
bot.cloop.clear();
|
||||
component.push("cleared the cloops");
|
||||
break;
|
||||
case "remove":
|
||||
if (isNaN(args[1]))
|
||||
throw new CommandError("argument must be an integer!");
|
||||
|
||||
const index = parseInt(args[1]);
|
||||
bot.cloop.remove(index);
|
||||
|
||||
component.push(`removed ${index} from cloops`);
|
||||
break;
|
||||
case "list":
|
||||
let listComponent = [];
|
||||
let i = 0;
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: "%s \u203a %s (%s)",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${i}`, color: config.colors.integer },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
listComponent.push("\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
listComponent.pop();
|
||||
|
||||
component.push({
|
||||
translate: "Cloops (%s):",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
component.push("\n");
|
||||
|
||||
if (bot.cloop.list.length > 0) {
|
||||
component.push(listComponent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
|
||||
source.sendFeedback(component);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cloop;
|
||||
@@ -1,25 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class reconnect extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"reconnect",
|
||||
["end"],
|
||||
"reconnect the bot",
|
||||
trustLevel.trusted,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
|
||||
bot._client.end();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = reconnect;
|
||||
@@ -1,43 +0,0 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class validate extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"validate",
|
||||
["val"],
|
||||
"validate through the bot",
|
||||
trustLevel.trusted,
|
||||
[""],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
let component = []
|
||||
|
||||
if (source.player.trustLevel === 1)
|
||||
component.push({
|
||||
text: "Valid Trusted Hash",
|
||||
color: config.colors.help.trusted
|
||||
})
|
||||
|
||||
else if (source.player.trustLevel === 2)
|
||||
component.push({
|
||||
text: "Valid Admin Hash",
|
||||
color: config.colors.help.admin
|
||||
})
|
||||
else if (source.player.trustLevel === 3)
|
||||
component.push({
|
||||
text: "Valid Owner Hash",
|
||||
color: config.colors.help.owner
|
||||
})
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = validate;
|
||||
@@ -1,135 +0,0 @@
|
||||
module.exports = {
|
||||
prefixes: ["!"],
|
||||
|
||||
discord: {
|
||||
token: "discord token here",
|
||||
prefix: "!",
|
||||
invite: "discord invite here",
|
||||
enabled: true,
|
||||
serverID: 'server id here',
|
||||
presence: {
|
||||
name: "amogus",
|
||||
status: "dnd",
|
||||
},
|
||||
|
||||
roles: {
|
||||
trusted: "trusted",
|
||||
admin: "admin",
|
||||
fullAccess: "full access",
|
||||
owner: "FNFBoyfriendBot Owner",
|
||||
},
|
||||
},
|
||||
|
||||
core: {
|
||||
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" },
|
||||
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" },
|
||||
refillInterval: 300000,
|
||||
// refilling core via item is buggy rn i recommend setting itemRefill to false for now
|
||||
area: {
|
||||
start: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
},
|
||||
end: {
|
||||
x: 15,
|
||||
y: 0,
|
||||
z: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
weatherApiKey: "weather api token here",
|
||||
|
||||
ratelimit: {
|
||||
console: 20,
|
||||
commands: 3
|
||||
},
|
||||
|
||||
debug: {
|
||||
commandSetMessage: false,
|
||||
},
|
||||
|
||||
keys: {
|
||||
trusted: "trusted key here",
|
||||
admin: "admin key here",
|
||||
owner: "owner key here",
|
||||
},
|
||||
|
||||
colors: {
|
||||
integer: "gold",
|
||||
discord: {
|
||||
embed: "#000000",
|
||||
error: "#FF0000",
|
||||
},
|
||||
|
||||
commands: {
|
||||
primary: "blue",
|
||||
secondary: "aqua",
|
||||
tertiary: "gray",
|
||||
},
|
||||
|
||||
help: {
|
||||
public: "blue",
|
||||
trusted: "dark_aqua",
|
||||
admin: "aqua",
|
||||
owner: "light_purple",
|
||||
console: "dark_purple",
|
||||
},
|
||||
},
|
||||
|
||||
console: {
|
||||
prefix: "c.",
|
||||
},
|
||||
|
||||
logsFolder: {
|
||||
path: "../../../",
|
||||
// this is being loaded from the modules so make sure it starts with ../../
|
||||
name: "fnfboyfriendbot-logs",
|
||||
},
|
||||
|
||||
skibot: {
|
||||
password: "<password>",
|
||||
player: "<username>",
|
||||
channel: "fnfboyfriendbot",
|
||||
enabled: false
|
||||
},
|
||||
|
||||
|
||||
bots: [
|
||||
// usernameGen is for a random username
|
||||
// if private is set to true then the server ip for the server will be hidden
|
||||
// channelId is for discord logging
|
||||
// logging is for console logging
|
||||
// reconnectDelay is for the delay for reconnecting to a server
|
||||
/*
|
||||
logging options
|
||||
console true or false
|
||||
file true or false
|
||||
*/
|
||||
// modes:
|
||||
// kaboom: for the server kaboom.pw
|
||||
// savageFriends: for the server savage Friends
|
||||
// creayun for the server creayun
|
||||
// version: 1.21.8
|
||||
// port: a number lmao
|
||||
// itemRefill: for refilling the core via chat or a command block
|
||||
{
|
||||
host: "localhost",
|
||||
username: "FNFBoyfriendBot",
|
||||
usernameGen: true,
|
||||
version: "1.20.2",
|
||||
serverName: "localhost",
|
||||
private: false,
|
||||
reconnectDelay: 6000,
|
||||
channelId: "discord channel ip here",
|
||||
logging: {
|
||||
file: false,
|
||||
console: true
|
||||
},
|
||||
mode: "kaboom",
|
||||
selfcareInterval: 300,
|
||||
itemRefill: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"buildstring": {
|
||||
"build": "3355",
|
||||
"codename": "§4Reignite",
|
||||
"version": "v8.0.0"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,127 +0,0 @@
|
||||
{
|
||||
"fnfboyfriendbot.arguments": "Expected %s Arguments, recieved %s",
|
||||
"fnfboyfriendbot.arguments.invalid_integer": "Expected %s to be an Integer",
|
||||
"fnfboyfriendbot.arguments.max_exceeded": "Expected %s Arguments not %s",
|
||||
"fnfboyfriendbot.arguments.no_args": "Expected no Arguments",
|
||||
"fnfboyfriendbot.arguments.not_enough_args": "Expected more than 0 Arguments",
|
||||
"fnfboyfriendbot.command.arguments.unknown": "Invalid Argument",
|
||||
|
||||
"fnfboyfriendbot.command.auth.as": "Authed as %s",
|
||||
"fnfboyfriendbot.command.auth.exists": "You are already authed with the trust level: %s",
|
||||
|
||||
"fnfboyfriendbot.command.cloop.list.text": "Cloops (%s):",
|
||||
"fnfboyfriendbot.command.cloop.remove": "Removed %s from the cloops",
|
||||
"fnfboyfriendbot.command.cloop.clear": "Cleared the cloops",
|
||||
"fnfboyfriendbot.command.cloop.not_an_integer": "Interval must be an Integer!",
|
||||
"fnfboyfriendbot.command.cloop.add": "Added %s to the cloops with the interval %s",
|
||||
|
||||
"fnfboyfriendbot.command.core.refill": "Refilling core",
|
||||
|
||||
"fnfboyfriendbot.command.extras.send": "Sent %s to Channel %s",
|
||||
"fnfboyfriendbot.command.extras.register": "Registered %s Channel",
|
||||
"fnfboyfriendbot.command.extras.unregister": "Unregistered from %s Channel",
|
||||
"fnfboyfriendbot.command.extras.unregisterAll": "Unregistered from all channels",
|
||||
|
||||
"fnfboyfriendbot.command.help.category": "(%s | %s | %s | %s)",
|
||||
"fnfboyfriendbot.command.help.command_layout": "Commands%s %s%s%s",
|
||||
"fnfboyfriendbot.command.help.info.alias": "Aliases%s %s",
|
||||
"fnfboyfriendbot.command.help.info.command": "Command%s %s",
|
||||
"fnfboyfriendbot.command.help.info.description": "Descripton%s %s",
|
||||
"fnfboyfriendbot.command.help.info.trust_level": "Trust Level%s %s",
|
||||
"fnfboyfriendbot.command.help.info.usages": "Usages%s\n%s",
|
||||
"fnfboyfriendbot.command.help.trust_level.public": "Public",
|
||||
"fnfboyfriendbot.command.help.trust_level.trusted": "Trusted",
|
||||
"fnfboyfriendbot.command.help.trust_level.admin": "Admin",
|
||||
"fnfboyfriendbot.command.help.trust_level.owner": "Owner",
|
||||
|
||||
"fnfboyfriendbot.command.info.about": "FNFBoyfriendBot is a kaboom bot created by Parker2991",
|
||||
|
||||
"fnfboyfriendbot.command.info.config.discord.channel": "Discord Channel%s %s",
|
||||
"fnfboyfriendbot.command.info.config.discord.username": "Discord Username%s %s",
|
||||
"fnfboyfriendbot.command.info.config.minecraft.username": "Minecraft Username%s %s",
|
||||
"fnfboyfriendbot.command.info.config.minecraft.version": "Minecraft Version%s %s",
|
||||
"fnfboyfriendbot.command.info.config.mode": "Mode%s %s",
|
||||
"fnfboyfriendbot.command.info.config.prefixes": "Prefixes%s %s",
|
||||
"fnfboyfriendbot.command.info.config.server.ip": "Server%s %s%s%s",
|
||||
"fnfboyfriendbot.command.info.config.server.name": "Server Name%s %s",
|
||||
"fnfboyfriendbot.command.info.config.server.count": "Server Count%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.discord": "the discord server invite is %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.loaded.commands": "%s Commands",
|
||||
"fnfboyfriendbot.command.info.loaded.modules": "%s Modules",
|
||||
|
||||
"fnfboyfriendbot.command.info.server.arch": "Arch%s %s",
|
||||
"fnfboyfriendbot.command.info.server.cpu": "CPU%s %s",
|
||||
"fnfboyfriendbot.command.info.server.cpu.cores": "CPU Cores%s %s",
|
||||
"fnfboyfriendbot.command.info.server.directory": "Directory%s %s",
|
||||
"fnfboyfriendbot.command.info.server.hostname": "Hostname%s %s",
|
||||
"fnfboyfriendbot.command.info.server.kernel_version": "Kernel Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.os": "OS%s %s",
|
||||
"fnfboyfriendbot.command.info.server.os.version": "OS Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.processes": "Processes%s %s",
|
||||
"fnfboyfriendbot.command.info.server.node_version": "Node Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.npm_version": "NPM Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.user": "Username%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.uptimes.bot": "Bot Uptime%s %s",
|
||||
"fnfboyfriendbot.command.info.uptimes.server": "Server Uptime%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.usages.botmem": "Bot Memory%s %s MB / %s MB",
|
||||
"fnfboyfriendbot.command.info.usages.servermem": "Server Memory%s %s MB / %s MB",
|
||||
|
||||
"fnfboyfriendbot.command.info.version.build": "Build%s %s",
|
||||
"fnfboyfriendbot.command.info.version.commit": "Commit%s %s",
|
||||
"fnfboyfriendbot.command.info.version.repo_build": "Repo Build%s %s",
|
||||
"fnfboyfriendbot.command.info.version.version_release_date": "Version Release Date%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.list.latency": "Latency: %s",
|
||||
"fnfboyfriendbot.command.list.gamemode": "Gamemode: %s",
|
||||
|
||||
"fnfboyfriendbot.command.list.text": "Players: (%s)\n",
|
||||
|
||||
"fnfboyfriendbot.command.mcserver.ip": "Ip: %s:%s",
|
||||
"fnfboyfriendbot.command.mcserver.players": "Players: %s/%s",
|
||||
"fnfboyfriendbot.command.mcserver.server.unknown": "could not ping %s:%s",
|
||||
"fnfboyfriendbot.command.mcserver.server.version": "Server Version: %s",
|
||||
|
||||
"fnfboyfriendbot.command.rps.draw": "You chose %s and the bot chose %s so its a draw",
|
||||
"fnfboyfriendbot.command.rps.lose": "You lose! You chose %s and the bot chose %s",
|
||||
"fnfboyfriendbot.command.rps.win": "You win! You chose %s and the bot chose %s",
|
||||
"fnfboyfriendbot.command.rps.invalid_choice": "%s is not a valid option please pick rock paper or scissors",
|
||||
|
||||
"fnfboyfriendbot.command.rtp": "Telporting Player %s to X: %s, Y: %s, Z: %s",
|
||||
"fnfboyfriendbot.command.urban.definition_not_found": "%s Definition not found!",
|
||||
"fnfboyfriendbot.command.urban.text": "Urban",
|
||||
|
||||
"fnfboyfriendbot.command.validate.owner": "Validated as Owner",
|
||||
"fnfboyfriendbot.command.validate.admin": "Validated as Admin",
|
||||
"fnfboyfriendbot.command.validate.trusted": "Validated as Trusted",
|
||||
|
||||
"fnfboyfriendbot.command.weather.condition": "Condition: %s",
|
||||
"fnfboyfriendbot.command.weather.coords": "Coords: %s, %s",
|
||||
"fnfboyfriendbot.command.weather.humidity": "Humidity: %s",
|
||||
"fnfboyfriendbot.command.weather.location": "Location: %s %s, %s %s",
|
||||
"fnfboyfriendbot.command.weather.time": "Time: %s (%s)",
|
||||
"fnfboyfriendbot.command.weather.temp": "Temp: %s (\u00b0C), %s (\u00b0F)",
|
||||
"fnfboyfriendbot.command.weather.unknown_location": "%s is not a valid location!",
|
||||
"fnfboyfriendbot.command.weather.wind_speed": "Wind Speed: %s (%s, %s), %s (%s, %s)",
|
||||
|
||||
"fnfboyfriendbot.command.wiki.article_not_found": "Wiki Article not found!",
|
||||
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_admin_hash": "Invalid Admin Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_hash": "Invalid Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_owner_hash": "Invalid Owner Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_trusted_hash": "Invalid Trusted Hash",
|
||||
"fnfboyfriendbot.command_manager.validation.invalid_role": "Invalid Role",
|
||||
"fnfboyfriendbot.command_manager.trust_level.console_only": "This command can only be ran via console!",
|
||||
|
||||
"fnfboyfriendbot.https_requesting.status.forbidden": "",
|
||||
"fnfboyfriendbot.https_requesting.": "",
|
||||
|
||||
"fnfboyfriendbot.json.parse_invalid": "invalid json component to parse",
|
||||
"fnfboyfriendbot.json.stringify.invalid": "invalid json component to stringify",
|
||||
"fnfboyfriendbot.json.too_long": "Stringified JSON exceeds the max command block character limit",
|
||||
|
||||
"fnfboyfriendbot.reconnect.stop_logging": "stopped logging disconnect messages for now"
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
const createBot = require("./bot.js");
|
||||
const readline = require("readline");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const loadModules = require("./util/loadModules");
|
||||
const { Client, GatewayIntentBits, Partials } = require("discord.js");
|
||||
const { MessageContent, GuildMessages, Guilds, DirectMessages } =
|
||||
GatewayIntentBits;
|
||||
|
||||
const discordClient = new Client({
|
||||
intents: [
|
||||
Guilds,
|
||||
GuildMessages,
|
||||
MessageContent,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
],
|
||||
partials: [Partials.Channel],
|
||||
});
|
||||
|
||||
console.log("Starting FNFBoyfriendBot");
|
||||
|
||||
if (!fs.existsSync(path.join(__dirname, "../config.js"))) {
|
||||
console.warn("Config not found creating config from the default config");
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "./data/default_config.js"),
|
||||
path.join(__dirname, "../config.js"),
|
||||
);
|
||||
}
|
||||
|
||||
const config = require("../config.js");
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
if (config.discord.enabled) discordClient.login(config.discord.token);
|
||||
|
||||
const bots = [];
|
||||
let options;
|
||||
let bot;
|
||||
|
||||
for (const botOptions of config.bots) {
|
||||
options = botOptions;
|
||||
bot = new createBot(options, config);
|
||||
bot.translations = require('./data/translations.json')
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
loadModules(bot, options, config, discordClient);
|
||||
bot.console.readlineInterface(rl);
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package land.chipmunk.parker2991.nitoribot;
|
||||
|
||||
import land.chipmunk.parker2991.nitoribot.boot.GetProxiesList;
|
||||
import land.chipmunk.parker2991.nitoribot.data.buildstring.BotBuildInfo;
|
||||
import land.chipmunk.parker2991.nitoribot.data.buildstring.RepoCommitInfo;
|
||||
import land.chipmunk.parker2991.nitoribot.listeners.Listener;
|
||||
import land.chipmunk.parker2991.nitoribot.listeners.ListenerManager;
|
||||
import land.chipmunk.parker2991.nitoribot.logger.Logger;
|
||||
import land.chipmunk.parker2991.nitoribot.modules.*;
|
||||
import land.chipmunk.parker2991.nitoribot.util.ComponentUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.geysermc.mcprotocollib.auth.GameProfile;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.DisconnectedEvent;
|
||||
import org.geysermc.mcprotocollib.network.event.session.DisconnectingEvent;
|
||||
import org.geysermc.mcprotocollib.network.event.session.PacketErrorEvent;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.network.factory.ClientNetworkSessionFactory;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.session.ClientNetworkSession;
|
||||
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundPlayerLoadedPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.clientbound.ClientboundLoginFinishedPacket;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class Bot extends SessionAdapter {
|
||||
public final ListenerManager listenerManager = new ListenerManager();
|
||||
public final ScheduledExecutorService executor = Main.executor;
|
||||
public final ExecutorService executorService = Main.executorService;
|
||||
public final ConcurrentMap<String, Future<?>> services = Main.services;
|
||||
public final BotBuildInfo botBuildInfo = Main.botBuildInfo;
|
||||
public final RepoCommitInfo repoCommitInfo = Main.repoCommitInfo;
|
||||
public final @NotNull Config config;
|
||||
public final Config.Options options;
|
||||
public final List<Bot> bots;
|
||||
public final ChatModule chat;
|
||||
public final PositionModule position;
|
||||
public final CommandCoreModule core;
|
||||
public final PlayerListModule players;
|
||||
public final RegistryModule registry;
|
||||
public boolean loggedIn = false;
|
||||
public int entityId;
|
||||
public ClientNetworkSession session;
|
||||
public GameProfile profile;
|
||||
public CommandManagerModule commandManager;
|
||||
public MCServerModule mcServer;
|
||||
public WorldModule world;
|
||||
public List<?> modules;
|
||||
|
||||
public Bot (Config.Options options, List<Bot> bots, @NotNull Config config) throws IOException {
|
||||
this.options = options;
|
||||
this.bots = bots;
|
||||
this.config = config;
|
||||
|
||||
this.modules = List.of(
|
||||
this.chat = new ChatModule(this),
|
||||
new SelfcareModule(this),
|
||||
this.position = new PositionModule(this),
|
||||
this.core = new CommandCoreModule(this),
|
||||
this.registry = new RegistryModule(this),
|
||||
this.players = new PlayerListModule(this),
|
||||
new LoggingModule(this),
|
||||
new ChatCommandHandlerModule(this),
|
||||
this.commandManager = new CommandManagerModule(this),
|
||||
new TextDisplayModule(this),
|
||||
this.mcServer = new MCServerModule(this),
|
||||
new CommandSpyModule(this),
|
||||
this.world = new WorldModule(this)
|
||||
);
|
||||
|
||||
try {
|
||||
connect();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
public void connect () throws IOException {
|
||||
final MinecraftProtocol protocol = new MinecraftProtocol(options.username);
|
||||
|
||||
if (options.useProxy) session = ClientNetworkSessionFactory.factory().setAddress(
|
||||
options.host,
|
||||
options.port
|
||||
).setProxy(new GetProxiesList().randomProxyIp()).setProtocol(protocol).create();
|
||||
|
||||
else session = ClientNetworkSessionFactory.factory().setAddress(
|
||||
options.host,
|
||||
options.port
|
||||
).setProtocol(protocol).create();
|
||||
session.addListener(this);
|
||||
session.connect(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnecting (DisconnectingEvent event) {
|
||||
Component component = event.getReason();
|
||||
session.disconnect(component);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void packetSent (Session session, Packet packet) {
|
||||
for (Listener listener : listenerManager.listeners) {
|
||||
listener.packetSent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void packetError (PacketErrorEvent error) {
|
||||
error.setSuppress(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void packetReceived (Session session, Packet packet) {
|
||||
try {
|
||||
if (packet instanceof ClientboundLoginPacket) this.session.send(ServerboundPlayerLoadedPacket.INSTANCE);
|
||||
|
||||
if (packet instanceof ServerboundPlayerLoadedPacket) {
|
||||
System.out.println(packet);
|
||||
}
|
||||
|
||||
for (Listener listener : listenerManager.listeners) {
|
||||
listener.packetReceived(packet);
|
||||
}
|
||||
|
||||
if (packet instanceof ClientboundLoginFinishedPacket) getProfile((ClientboundLoginFinishedPacket) packet);
|
||||
else if (packet instanceof ClientboundLoginPacket) getEntityId((ClientboundLoginPacket) packet);
|
||||
} catch (Exception _) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void getProfile (ClientboundLoginFinishedPacket packet) {
|
||||
profile = packet.getProfile();
|
||||
|
||||
loggedIn = true;
|
||||
}
|
||||
|
||||
public void getEntityId (ClientboundLoginPacket packet) {
|
||||
entityId = packet.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected (DisconnectedEvent event) {
|
||||
loggedIn = false;
|
||||
Component component = event.getReason();
|
||||
String reason = ComponentUtil.componentToAnsi(component);
|
||||
|
||||
Logger.RECONNECT(this, reason);
|
||||
|
||||
if (services.get("reconnect") != null) services.get("reconnect").cancel(true);
|
||||
|
||||
services.put(
|
||||
"reconnect", executor.schedule(
|
||||
() -> {
|
||||
try {
|
||||
connect();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}, options.reconnectDelay, TimeUnit.MILLISECONDS
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package land.chipmunk.parker2991.nitoribot;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Config {
|
||||
public final Colors colors = new Colors();
|
||||
public final Core core = new Core();
|
||||
public final Console console = new Console();
|
||||
public final Options[] bots = new Options[]{};
|
||||
public List<String> prefixes;
|
||||
|
||||
public static class Core {
|
||||
public final Area area = new Area();
|
||||
public String coreName;
|
||||
}
|
||||
|
||||
public static class Area {
|
||||
public final Position start = new Position();
|
||||
public final Position end = new Position();
|
||||
}
|
||||
|
||||
public static class Position {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
}
|
||||
|
||||
public static class CommandColors {
|
||||
public String primary;
|
||||
public String secondary;
|
||||
public String tertiary;
|
||||
}
|
||||
|
||||
public static class HelpCommandColors {
|
||||
public String Public;
|
||||
public String trusted;
|
||||
public String admin;
|
||||
public String owner;
|
||||
public String console;
|
||||
}
|
||||
|
||||
public static class Console {
|
||||
public String prefix;
|
||||
}
|
||||
|
||||
public static class Colors {
|
||||
public final CommandColors commands = new CommandColors();
|
||||
public final HelpCommandColors help = new HelpCommandColors();
|
||||
public String integer;
|
||||
}
|
||||
|
||||
public static class Options {
|
||||
public String host;
|
||||
public int port;
|
||||
public boolean useProxy;
|
||||
public String serverName;
|
||||
public String username;
|
||||
public int reconnectDelay;
|
||||
public int selfcareInterval;
|
||||
public String mode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package land.chipmunk.parker2991.nitoribot;
|
||||
|
||||
import land.chipmunk.parker2991.nitoribot.boot.GetBotBuildInfo;
|
||||
import land.chipmunk.parker2991.nitoribot.boot.GetRepoInfo;
|
||||
import land.chipmunk.parker2991.nitoribot.boot.LoadConfig;
|
||||
import land.chipmunk.parker2991.nitoribot.data.buildstring.BotBuildInfo;
|
||||
import land.chipmunk.parker2991.nitoribot.data.buildstring.RepoCommitInfo;
|
||||
import land.chipmunk.parker2991.nitoribot.modules.ConsoleModule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class Main {
|
||||
public static final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
public static final ExecutorService virtualThreads = Executors.newVirtualThreadPerTaskExecutor();
|
||||
|
||||
public static final ScheduledExecutorService executor = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
public static final ConcurrentMap<String, Future<?>> services = new ConcurrentHashMap<>();
|
||||
public static final List<Bot> Bots = new ArrayList<>();
|
||||
public static RepoCommitInfo repoCommitInfo = null;
|
||||
public static BotBuildInfo botBuildInfo = null;
|
||||
public static ConsoleModule console;
|
||||
public Config config;
|
||||
|
||||
void main () {
|
||||
try {
|
||||
config = new LoadConfig().loadConfig();
|
||||
Config.Options[] bots = config.bots;
|
||||
console = new ConsoleModule();
|
||||
repoCommitInfo = new GetRepoInfo().getRepoInfo();
|
||||
botBuildInfo = new GetBotBuildInfo().getBuildInfo();
|
||||
|
||||
for (Config.Options options : bots) {
|
||||
final Bot bot = new Bot(options, Bots, config);
|
||||
Bots.add(bot);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package land.chipmunk.parker2991.nitoribot.boot;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import land.chipmunk.parker2991.nitoribot.Main;
|
||||
import land.chipmunk.parker2991.nitoribot.data.buildstring.BotBuildInfo;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.util.Objects;
|
||||
|
||||
public class GetBotBuildInfo {
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
public BotBuildInfo getBuildInfo () {
|
||||
Reader reader = new InputStreamReader(Objects.requireNonNull(Main.class.getResourceAsStream("/info.json")));
|
||||
|
||||
return GSON.fromJson(reader, BotBuildInfo.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package land.chipmunk.parker2991.nitoribot.boot;
|
||||
|
||||
import org.geysermc.mcprotocollib.network.ProxyInfo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class GetProxiesList {
|
||||
public ProxyInfo randomProxyIp () throws IOException {
|
||||
Path proxiesPath = Paths.get("proxies.txt");
|
||||
|
||||
int countLines = Math.round(Files.lines(proxiesPath).count());
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
int randomIndex = random.nextInt(countLines);
|
||||
|
||||
List<String> lines = Files.lines(proxiesPath).toList();
|
||||
|
||||
String[] ip = lines.stream().skip(randomIndex).findAny().get().split(":");
|
||||
|
||||
InetSocketAddress address = new InetSocketAddress(ip[0], Integer.parseInt(ip[1]));
|
||||
|
||||
return new ProxyInfo(ProxyInfo.Type.SOCKS5, address);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package land.chipmunk.parker2991.nitoribot.boot;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import land.chipmunk.parker2991.nitoribot.data.buildstring.RepoCommitInfo;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
|
||||
public class GetRepoInfo {
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
public RepoCommitInfo getRepoInfo () {
|
||||
final String repo = "https://code.chipmunk.land/api/v1/repos/Parker2991/NitoriBot/commits?sha=main";
|
||||
HttpClient client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).connectTimeout(Duration.ofSeconds(
|
||||
10)).build();
|
||||
|
||||
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(repo)).timeout(Duration.ofSeconds(20)).header(
|
||||
"accept",
|
||||
"application/json"
|
||||
).build();
|
||||
|
||||
RepoCommitInfo info = null;
|
||||
try {
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
String body = response.body();
|
||||
JsonElement e = JsonParser.parseString(response.body());
|
||||
|
||||
info = GSON.fromJson(e.getAsJsonArray().get(0), RepoCommitInfo.class);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package land.chipmunk.parker2991.nitoribot.boot;
|
||||
|
||||
import land.chipmunk.parker2991.nitoribot.Config;
|
||||
import land.chipmunk.parker2991.nitoribot.Main;
|
||||
import land.chipmunk.parker2991.nitoribot.logger.Logger;
|
||||
import org.yaml.snakeyaml.LoaderOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.constructor.Constructor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class LoadConfig {
|
||||
private static final String XDG_CONFIG_HOME = System.getenv("XDG_CONFIG_HOME");
|
||||
private final Constructor yamlConfig = new Constructor(Config.class, new LoaderOptions());
|
||||
private final Yaml yaml = new Yaml(yamlConfig);
|
||||
private final String homeDirectory = System.getProperty("user.home");
|
||||
|
||||
public Config loadConfig () throws IOException {
|
||||
Path configDirectory;
|
||||
|
||||
if (XDG_CONFIG_HOME == null) configDirectory = Path.of(homeDirectory, ".config/NitoriBot");
|
||||
else configDirectory = Path.of(XDG_CONFIG_HOME, "NitoriBot");
|
||||
|
||||
final Path configPath = Path.of(String.valueOf(configDirectory), "config.yml");
|
||||
if (!Files.exists(configPath)) {
|
||||
Logger.INFO(null, "config not found, creating config in " + configPath);
|
||||
|
||||
if (!Files.exists(configDirectory)) Files.createDirectory(configDirectory);
|
||||
|
||||
InputStream defaultConfig = Main.class.getClassLoader().getResourceAsStream("default_config.yml");
|
||||
if (defaultConfig != null) {
|
||||
Files.copy(defaultConfig, configPath);
|
||||
}
|
||||
}
|
||||
|
||||
InputStream configFile = Files.newInputStream(configPath);
|
||||
|
||||
return yaml.load(configFile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package land.chipmunk.parker2991.nitoribot.chatparsers;
|
||||
|
||||
import land.chipmunk.parker2991.nitoribot.Bot;
|
||||
import land.chipmunk.parker2991.nitoribot.data.PlayerProfileData;
|
||||
import land.chipmunk.parker2991.nitoribot.data.chat.ParseChatData;
|
||||
import land.chipmunk.parker2991.nitoribot.data.chat.PlayerMessageData;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class KaboomChatParser implements ParseChatData {
|
||||
private static final Component SEPERATOR_COLON = Component.text(":");
|
||||
private static final Component SEPERATOR_COLON_RACCOON = Component.text("§f:"); // https://github.com/raccoonserver/extras/commit/315f704075db2f00e3e1bfbf55f858469c22880f
|
||||
private static final Component SEPERATOR_SPACE = Component.space();
|
||||
private final Bot bot;
|
||||
|
||||
public KaboomChatParser (Bot bot) {
|
||||
this.bot = bot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerMessageData parse (Component message) {
|
||||
if (message instanceof TextComponent) return parse((TextComponent) message);
|
||||
return null;
|
||||
}
|
||||
|
||||
public PlayerMessageData parse (TextComponent message) {
|
||||
List<Component> children = message.children();
|
||||
|
||||
if (!message.content().isEmpty() || !message.style().isEmpty() || children.size() < 3) return null;
|
||||
|
||||
final Component prefix = children.getFirst();
|
||||
Component displayName = Component.empty();
|
||||
Component contents = Component.empty();
|
||||
|
||||
if (isSeperatorAt(children, 1)) { // Missing/blank display name
|
||||
if (children.size() > 3) contents = children.get(3);
|
||||
} else if (isSeperatorAt(children, 2)) {
|
||||
displayName = children.get(1);
|
||||
if (children.size() > 4) contents = children.get(4);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlayerProfileData sender = bot.players.getDisplayName(Component.empty().append(prefix).append(displayName));
|
||||
return new PlayerMessageData(sender, contents, "minecraft:chat", displayName);
|
||||
}
|
||||
|
||||
private boolean isSeperatorAt (List<Component> children, int start) {
|
||||
return (children.get(start).equals(SEPERATOR_COLON) || children.get(start).equals(SEPERATOR_COLON_RACCOON)) && children.get(
|
||||
start + 1).equals(SEPERATOR_SPACE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package land.chipmunk.parker2991.nitoribot.command;
|
||||
|
||||
import land.chipmunk.parker2991.nitoribot.Bot;
|
||||
|
||||
public record CommandContext(Bot bot, String[] args, CommandSource source) {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package land.chipmunk.parker2991.nitoribot.command;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class CommandError extends Exception {
|
||||
public final Component message;
|
||||
|
||||
public CommandError (Component message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Component message () {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user