Compare commits
No commits in common. "master" and "v0.1-beta" have entirely different histories.
172 changed files with 5398 additions and 9855 deletions
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,5 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: BBN Holding Discord Support
|
||||
url: https://discord.gg/nPwjaJk
|
||||
about: Please ask questions here.
|
||||
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
name: "💡 Feature request"
|
||||
about: Submit your idea for a change in the codebase.
|
||||
---
|
||||
|
||||
# Feature request
|
||||
|
||||
<!--
|
||||
This issue should serve for you to present or pitch an idea to the maintainers - but remember that it would be better if you were to submit a PR instead 🤗
|
||||
-->
|
||||
|
||||
## Why it is needed
|
||||
|
||||
<!--
|
||||
Please tell us a bit more of why you want this feature to be added, what's its origin.
|
||||
-->
|
||||
|
||||
## Possible implementation
|
||||
|
||||
<!--
|
||||
It really helps if you could describe from a technical POV how this new feature would work, which code it rely on, etc.
|
||||
-->
|
||||
|
||||
### Code sample
|
||||
|
||||
<!--
|
||||
Please show how the new code could work, if doable.
|
||||
-->
|
||||
13
.github/dependabot.yml
vendored
13
.github/dependabot.yml
vendored
|
|
@ -1,13 +0,0 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: maven
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "13:00"
|
||||
open-pull-requests-limit: 99
|
||||
target-branch: greg-dev
|
||||
assignees:
|
||||
- GregTCLTK
|
||||
labels:
|
||||
- pending-deploy
|
||||
37
.github/workflows/maven.yml
vendored
37
.github/workflows/maven.yml
vendored
|
|
@ -3,36 +3,35 @@ name: Hadder
|
|||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: Set up JDK 15
|
||||
uses: actions/setup-java@v1.4.3
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 1.13
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '15'
|
||||
java-version: 1.13
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: Set up JDK 15
|
||||
uses: actions/setup-java@v1.4.3
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 1.13
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '15'
|
||||
java-version: 1.13
|
||||
- name: Build Final Jar
|
||||
run: mvn clean compile assembly:single
|
||||
- name: Copy folder content recursively to remote
|
||||
uses: garygrossgarten/github-action-scp@release
|
||||
with:
|
||||
local: ./target/Hadder-Build.jar
|
||||
remote: /root/bots/Hadder/Hadder-Build.jar
|
||||
remote: /home/Bots/Hadder-Build.jar
|
||||
host: ${{ secrets.HOST }}
|
||||
port: ${{ secrets.PORT }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
- name: executing remote ssh commands using password
|
||||
|
|
@ -42,7 +41,7 @@ jobs:
|
|||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
port: ${{ secrets.PORT }}
|
||||
script: /root/bots/Hadder/deploy.sh
|
||||
script: /home/Bots/deploy.sh
|
||||
- name: Send Webhook Notification
|
||||
if: always()
|
||||
env:
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ If a community member engages in unacceptable behavior, the community organizers
|
|||
|
||||
## 7. Reporting Guidelines
|
||||
|
||||
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. admin@bbn.one.
|
||||
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. admin@bigbotnetwork.com.
|
||||
|
||||
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ Additionally, community organizers are available to help community members engag
|
|||
|
||||
## 8. Addressing Grievances
|
||||
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify BBN with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify BigBotNetwork with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
|
||||
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ This code of conduct and its related procedures also applies to unacceptable beh
|
|||
|
||||
## 10. Contact info
|
||||
|
||||
admin@bbn.one
|
||||
admin@bigbotnetwork.com
|
||||
|
||||
## 11. License and attribution
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ further defined and clarified by project maintainers.
|
|||
### Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team on [Discord](https://discordapp.com/invite/nPwjaJk). All
|
||||
reported by contacting the project team on [Discord](https://discordapp.com/invite/Vf4zCYn). All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
FROM debian:buster
|
||||
WORKDIR /home/Hadder
|
||||
682
LICENSE
682
LICENSE
|
|
@ -1,661 +1,21 @@
|
|||
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/>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Big Bot Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
|
|||
60
README.md
60
README.md
|
|
@ -2,60 +2,22 @@
|
|||
|
||||
Hadder Discord is a multi-purpose Discord bot with 100% uptime.
|
||||
|
||||
<a href="https://discord.gg/nPwjaJk"><img src="https://discord.com/api/guilds/757966278936756345/embed.png"/></a>
|
||||
[](https://github.com/BBN-Holding/Hadder)
|
||||
[](https://www.codacy.com/gh/BBN-Holding/Hadder?utm_source=github.com&utm_medium=referral&utm_content=BBN-Holding/Hadder&utm_campaign=Badge_Grade)
|
||||
<a href="https://discord.gg/58My2dM"><img src="https://discordapp.com/api/guilds/448554629282922527/embed.png"/></a>
|
||||
[](https://github.com/BigBotNetwork/Hadder)
|
||||
[](https://www.codacy.com/gh/BigBotNetwork/Hadder?utm_source=github.com&utm_medium=referral&utm_content=BigBotNetwork/Hadder&utm_campaign=Badge_Grade)
|
||||
[](https://www.codefactor.io/repository/github/bigbotnetwork/hadder)
|
||||
[](https://bbn.crowdin.com/hadder)
|
||||
[](https://github.com/BBN-Holding/Hadder/issues)
|
||||
[](https://github.com/BBN-Holding/Hadder/blob/master/LICENSE)
|
||||
[](https://wakatime.com/badge/github/BBN-Holding/Hadder)
|
||||
[](https://github.com/BigBotNetwork/Hadder/issues)
|
||||
[](https://github.com/BigBotNetwork/Hadder/blob/master/LICENSE)
|
||||
|
||||
<a href="https://discordextremelist.xyz/bots/Hadder"><img src="https://discordextremelist.xyz/api/bot/637002314162372639/widget"/></a>
|
||||
[](https://top.gg/bot/637002314162372639)
|
||||
[](https://botlist.space/bot/637002314162372639?utm_source=bls&utm_medium=widget&utm_campaign=637002314162372639)
|
||||
|
||||
## Hadder Team
|
||||
### Developer
|
||||
Skidder#6775 <br>
|
||||
Hax#6775
|
||||
|
||||
## A few commands
|
||||
| **Command** | **Description** |
|
||||
|----------------|---------------------------------------------------------------|
|
||||
| h.about | Shows information about Hadder |
|
||||
| h.avatar | Sends the avatar of the specified Member |
|
||||
| h.ban | Bans one or more users from the server |
|
||||
| h.bass | Change the bass for the song which is played at the moment |
|
||||
| h.clear | Deletes the specified number of messages |
|
||||
| h.clyde | Sends a message as a webhook named Clyde |
|
||||
| h.code | Shows information about a invite code |
|
||||
| h.corona | Shows the newest stats of COVID-19 |
|
||||
| h.echo | Sends your voice through Hadder |
|
||||
| h.editrules | Edits the rules message |
|
||||
| h.equals | Checks if two strings are equal |
|
||||
| h.feedback | Sends feedback directly to the developers |
|
||||
| h.gif | Looks for a GIF on Giphy |
|
||||
| h.github | Displays information about a GitHub user profile |
|
||||
| h.help | Shows each command and explains its usage |
|
||||
| h.info | Shows information about the playing song |
|
||||
| h.invite | Shows the invitation link to invite Hadder to your server |
|
||||
| h.invitedetect | Activate or deactivate the Discord invite link detection |
|
||||
| h.join | Joins your voice channel |
|
||||
| h.kick | Kicks one or more user from the server |
|
||||
| h.language | Sets the new primary language for a user |
|
||||
| h.loop | Repeats a song/queue |
|
||||
| h.meme | Sends you a random meme |
|
||||
| h.moveall | Moves all users in the source channel to the target channel |
|
||||
| h.nick | Rename a one or more user |
|
||||
| h.pause | Pause the playing song |
|
||||
| h.ping | Shows the ping to the Discord API |
|
||||
| h.play | Plays the specified song |
|
||||
| h.prefix | Sets the Guild-Prefix |
|
||||
| h.profile | Shows some information about the specified user |
|
||||
| h.queue | Shows the music queue |
|
||||
| h.regionchange | Changes the server region to locked regions |
|
||||
| h.role | Adds and removes one or more role(s) from one or more user(s) |
|
||||
| h.rules | Setup the rules on your Discord server |
|
||||
| h.screenshare | Shows you the link to share your screen |
|
||||
| h.serverstats | Shows information about a server |
|
||||
| h.skip | Skips the currently playing song |
|
||||
| h.starboard | Sets the starboard channel |
|
||||
| h.stop | Stops the song |
|
||||
| h.volume | Change the volume of the music |
|
||||
### Designer
|
||||
TopComp#1288
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
base_url: 'https://bbn.one'
|
||||
base_url: 'https://bigbotnetwork.com'
|
||||
commit_message: 'New %language% translation'
|
||||
files:
|
||||
- source: /src/main/resources/Translations/Translations_en.properties
|
||||
|
|
|
|||
|
|
@ -1,17 +1,25 @@
|
|||
{
|
||||
"Owners": [
|
||||
],
|
||||
"Database": {
|
||||
"IP": "",
|
||||
"Owners":
|
||||
[],
|
||||
"Database":{"IP":"",
|
||||
"Port": 6775,
|
||||
"DBName": "",
|
||||
"Username": "",
|
||||
"Password": ""
|
||||
},
|
||||
"Password": ""},
|
||||
"Tokens": {
|
||||
"BotToken": "",
|
||||
"Giphy": "",
|
||||
"GitHub": ""
|
||||
"GitHub": "",
|
||||
"MythicalBotList": "",
|
||||
"BotsForDiscord": "",
|
||||
"DiscordBotList": "",
|
||||
"DiscordBestBots": "",
|
||||
"DiscordBoats": "",
|
||||
"YetAnotherBotList": "",
|
||||
"DiscordExtremeList": "",
|
||||
"DiscordBotReviews": "",
|
||||
"DiscordBots": "",
|
||||
"BotListSpace": ""
|
||||
},
|
||||
"Clyde": ""
|
||||
}
|
||||
|
|
|
|||
268
pom.xml
268
pom.xml
|
|
@ -1,138 +1,150 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Hadder</groupId>
|
||||
<artifactId>Hadder</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<name>Hadder</name>
|
||||
<inceptionYear>2019</inceptionYear>
|
||||
<description>Hadder is a multi-purpose Discord bot.</description>
|
||||
<url>https://github.com/BBN-Holding/Hadder</url>
|
||||
<groupId>Hadder</groupId>
|
||||
<artifactId>Hadder</artifactId>
|
||||
<version>0.1-BETA</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU Affero General Public License v3.0</name>
|
||||
<url>https://www.gnu.org/licenses/agpl-3.0.en.html</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<name>Hadder</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.15</maven.compiler.source>
|
||||
<maven.compiler.target>1.15</maven.compiler.target>
|
||||
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
|
||||
</properties>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.13</maven.compiler.source>
|
||||
<maven.compiler.target>1.13</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>Hax#6775</id>
|
||||
<name>Hax</name>
|
||||
<email>hax@bbn.one</email>
|
||||
<url>https://bbn.one/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/261083609148948488/f2c9efc629ef65fffa634f0d63cd467e.webp
|
||||
</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>Skidder#6775</id>
|
||||
<name>Greg</name>
|
||||
<email>skidder@bbn.one</email>
|
||||
<url>https://bbn.one/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/401817301919465482/a_f81bd03e3862de579dec59241714d86d.gif
|
||||
</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
</developers>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.0.0_79</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20190722</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.rethinkdb</groupId>
|
||||
<artifactId>rethinkdb-driver</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.30</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.30</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>club.minnced</groupId>
|
||||
<artifactId>discord-webhooks</artifactId>
|
||||
<version>0.1.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.101</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
<artifactId>lavaplayer</artifactId>
|
||||
<version>1.3.32</version>
|
||||
</dependency>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dv8tion</id>
|
||||
<name>m2-dv8tion</name>
|
||||
<url>https://m2.dv8tion.net/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</dependencies>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>3.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.4.0_352</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20220924</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>club.minnced</groupId>
|
||||
<artifactId>discord-webhooks</artifactId>
|
||||
<version>0.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.313</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
<artifactId>lavaplayer</artifactId>
|
||||
<version>1.3.78</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongodb-driver-sync</artifactId>
|
||||
<version>4.7.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>Hadder-Build</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>one.bbn.hadder.Hadder</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<finalName>Hadder-Build</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.bbn.hadder.Hadder</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>13</source>
|
||||
<target>13</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>Hadder-Build</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.bbn.hadder.Hadder</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
|||
109
src/main/java/com/bbn/hadder/Hadder.java
Normal file
109
src/main/java/com/bbn/hadder/Hadder.java
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
package com.bbn.hadder;
|
||||
|
||||
import com.bbn.hadder.commands.general.*;
|
||||
import com.bbn.hadder.commands.misc.*;
|
||||
import com.bbn.hadder.commands.moderation.*;
|
||||
import com.bbn.hadder.commands.nsfw.*;
|
||||
import com.bbn.hadder.commands.owner.*;
|
||||
import com.bbn.hadder.commands.fun.*;
|
||||
import com.bbn.hadder.commands.settings.*;
|
||||
import com.bbn.hadder.commands.music.*;
|
||||
import com.bbn.hadder.core.*;
|
||||
import com.bbn.hadder.listener.*;
|
||||
import net.dv8tion.jda.api.entities.Activity;
|
||||
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
|
||||
import net.dv8tion.jda.api.sharding.ShardManager;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
import java.util.List;
|
||||
|
||||
public class Hadder {
|
||||
|
||||
public static ShardManager shardManager;
|
||||
|
||||
public static void main(String[] args) {
|
||||
startBot();
|
||||
}
|
||||
|
||||
private static void startBot() {
|
||||
Config config = new Config("./config.json");
|
||||
if (!config.fileExists()) config.create();
|
||||
config.load();
|
||||
|
||||
Rethink rethink = new Rethink(config);
|
||||
rethink.connect();
|
||||
|
||||
DefaultShardManagerBuilder builder = new DefaultShardManagerBuilder();
|
||||
|
||||
builder.setAutoReconnect(true);
|
||||
builder.setShardsTotal(1);
|
||||
builder.setActivity(Activity.streaming("on the BigBotNetwork", "https://twitch.tv/BigBotNetwork"));
|
||||
builder.setToken(config.getBotToken());
|
||||
|
||||
HelpCommand helpCommand = new HelpCommand();
|
||||
|
||||
CommandHandler commandHandler = new CommandHandler(
|
||||
List.of(
|
||||
helpCommand,
|
||||
new TestCommand(),
|
||||
new BanCommand(),
|
||||
new UserPrefixCommand(),
|
||||
new ShutdownCommand(),
|
||||
new KickCommand(),
|
||||
new PingCommand(),
|
||||
new GifCommand(),
|
||||
new ClearCommand(),
|
||||
new GitHubCommand(),
|
||||
new RebootCommand(),
|
||||
new EqualsCommand(),
|
||||
new InviteCommand(),
|
||||
new NickCommand(),
|
||||
new PrefixCommand(),
|
||||
new BlowjobCommand(),
|
||||
new PornCommand(),
|
||||
new AnalCommand(),
|
||||
new CumCommand(),
|
||||
new TransCommand(),
|
||||
new PussyCommand(),
|
||||
new BoobsCommand(),
|
||||
new FeetCommand(),
|
||||
new EroticCommand(),
|
||||
new RoleCommand(),
|
||||
new RulesCommand(),
|
||||
new FeedbackCommand(),
|
||||
new AvatarCommand(),
|
||||
new EvalCommand(),
|
||||
new JoinCommand(),
|
||||
new LeaveCommand(),
|
||||
new GuildLeaveCommand(),
|
||||
new MemeCommand(),
|
||||
new InviteDetectCommand(),
|
||||
new BDSMCommand(),
|
||||
new FingeringCommand(),
|
||||
new LickingCommand(),
|
||||
new SpankCommand(),
|
||||
new RandomPornCommand(),
|
||||
new SoloCommand(),
|
||||
new RegionChangeCommand(),
|
||||
new AboutCommand(),
|
||||
new LanguageCommand(),
|
||||
new ClydeCommand(),
|
||||
new StarBoardCommand()), config, helpCommand);
|
||||
|
||||
builder.addEventListeners(
|
||||
new MentionListener(rethink),
|
||||
new PrivateMessageListener(rethink),
|
||||
new CommandListener(rethink, commandHandler),
|
||||
new GuildListener(rethink, config),
|
||||
new ReadyListener(rethink, config),
|
||||
new InviteLinkListener(rethink),
|
||||
new RulesListener(rethink),
|
||||
new StarboardListener(rethink));
|
||||
|
||||
try {
|
||||
shardManager = builder.build();
|
||||
} catch (LoginException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
221
src/main/java/com/bbn/hadder/Rethink.java
Normal file
221
src/main/java/com/bbn/hadder/Rethink.java
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
package com.bbn.hadder;
|
||||
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.rethinkdb.RethinkDB;
|
||||
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
||||
import com.rethinkdb.net.Connection;
|
||||
import com.rethinkdb.net.Cursor;
|
||||
import org.json.JSONArray;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public class Rethink {
|
||||
private RethinkDB r = RethinkDB.r;
|
||||
private Connection conn;
|
||||
private Config config;
|
||||
|
||||
Rethink(Config config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
try {
|
||||
conn = r.connection()
|
||||
.hostname(config.getDatabaseIP())
|
||||
.db(config.getDatabaseName())
|
||||
.port(config.getDatabasePort())
|
||||
.user(config.getDatabaseUsername(), config.getDatabasePassword())
|
||||
.connect();
|
||||
System.out.println("DB CONNECTED");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("DB CONNECTION FAILED");
|
||||
}
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
conn.close();
|
||||
System.out.println("DISCONNECTED");
|
||||
}
|
||||
|
||||
private JSONArray getAsArray(String table, String where, String value) {
|
||||
try {
|
||||
String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn);
|
||||
return new JSONArray(string);
|
||||
} catch (NoSuchElementException e) {
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JSONArray();
|
||||
}
|
||||
|
||||
public Object get(String table, String where, String value, String column) {
|
||||
JSONArray array = this.getAsArray(table, where, value);
|
||||
if (array.length()>0)
|
||||
if (array.getJSONObject(0).has(column))
|
||||
return array.getJSONObject(0).get(column);
|
||||
else return null;
|
||||
else return null;
|
||||
}
|
||||
|
||||
public String update(String table, String wherevalue, String what, String whatvalue) {
|
||||
String out = "";
|
||||
try {
|
||||
Cursor cursor = r.table(table).get(wherevalue).update(r.hashMap(what, whatvalue)).run(conn);
|
||||
out=cursor.toString();
|
||||
} catch (ClassCastException ignored) {}
|
||||
return out;
|
||||
}
|
||||
|
||||
public String insert(String table, Object object) {
|
||||
String out = "";
|
||||
try {
|
||||
Cursor cursor = r.table(table).insert(object).run(conn);
|
||||
out = cursor.next().toString();
|
||||
} catch (ClassCastException ignored) {}
|
||||
return out;
|
||||
}
|
||||
|
||||
public void remove(String table, String where, String wherevalue) {
|
||||
r.table(table).filter(row -> row.g(where.toLowerCase()).eq(wherevalue)).delete().run(conn);
|
||||
}
|
||||
|
||||
public void setup() {
|
||||
try {
|
||||
r.dbCreate("Hadder").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
try {
|
||||
r.tableCreate("server").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
try {
|
||||
r.tableCreate("user").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
try {
|
||||
r.tableCreate("stars").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setUserPrefix(String prefix, String userid) {
|
||||
this.update("user", userid, "prefix", prefix);
|
||||
}
|
||||
|
||||
public String getUserPrefix(String id) {
|
||||
return (String) this.get("user", "id", id, "prefix");
|
||||
}
|
||||
|
||||
public void setGuildPrefix(String prefix, String guildid) {
|
||||
this.update("server", guildid, "prefix", prefix);
|
||||
}
|
||||
|
||||
public String getGuildPrefix(String id) {
|
||||
return (String) this.get("server", "id", id, "prefix");
|
||||
}
|
||||
|
||||
public void insertGuild(String id) {
|
||||
this.insert("server", r.hashMap("id", id)
|
||||
.with("prefix", "h.")
|
||||
.with("message_id", "")
|
||||
.with("role_id", "")
|
||||
.with("invite_detect", false)
|
||||
.with("starboard", "")
|
||||
.with("neededstars", "4")
|
||||
);
|
||||
}
|
||||
|
||||
public void insertUser(String id) {
|
||||
this.insert("user", r.hashMap("id", id).with("prefix", "h.").with("language", "en"));
|
||||
}
|
||||
|
||||
public void setNeededstars(String stars, String guildid) {
|
||||
this.update("server", guildid, "neededstars", stars);
|
||||
}
|
||||
|
||||
public String getNeededstars(String guildid) {
|
||||
return (String) this.get("server", "id", guildid, "neededstars");
|
||||
}
|
||||
|
||||
public void setStarboardChannel(String guildid, String channelid) {
|
||||
this.update("server", guildid, "starboard", channelid);
|
||||
}
|
||||
|
||||
public String getStarboardChannel(String guildid) {
|
||||
return (String) this.get("server", "id", guildid, "starboard");
|
||||
}
|
||||
|
||||
public boolean hasStarboardChannel(String guildid) {
|
||||
return !this.get("server", "id", guildid, "starboard").equals("");
|
||||
}
|
||||
|
||||
public void insertStarboardMessage(String messageid, String guildid, String starboardmessageid) {
|
||||
this.insert("stars", r.hashMap("id", messageid).with("guild", guildid).with("starboardmsg", starboardmessageid));
|
||||
}
|
||||
|
||||
public String getStarboardMessage(String messageid) {
|
||||
return (String) this.get("stars", "id", messageid, "starboardmsg");
|
||||
}
|
||||
|
||||
public void removeStarboardMessage(String messageid) {
|
||||
this.remove("stars", "id", messageid);
|
||||
}
|
||||
|
||||
public boolean hasStarboardMessage(String messageid) {
|
||||
return this.get("stars", "id", messageid, "guild") != null;
|
||||
}
|
||||
|
||||
public void updateRules(String guild_id, String message_id, String role_id, String accept_emote, String decline_emote) {
|
||||
this.update("server", guild_id, "message_id", message_id);
|
||||
this.update("server", guild_id, "role_id", role_id);
|
||||
this.update("server", guild_id, "accept_emote", accept_emote);
|
||||
this.update("server", guild_id, "decline_emote", decline_emote);
|
||||
}
|
||||
|
||||
public String getRulesMID(String guild_id) {
|
||||
return (String) this.get("server", "id", guild_id, "message_id");
|
||||
}
|
||||
|
||||
public String getRulesRID(String guild_id) {
|
||||
return (String) this.get("server", "id", guild_id, "role_id");
|
||||
}
|
||||
|
||||
public String getRulesAEmote(String guild_id) {
|
||||
return this.get("server", "id", guild_id, "accept_emote").toString().replaceAll("\"", "");
|
||||
}
|
||||
|
||||
public String getRulesDEmote(String guild_id) {
|
||||
return this.get("server", "id", guild_id, "decline_emote").toString().replaceAll("\"", "");
|
||||
}
|
||||
|
||||
public void setInviteDetection(String guild_id, boolean b) {
|
||||
try {
|
||||
r.table("server").get(guild_id).update(r.hashMap("invite_detect", b)).run(conn);
|
||||
} catch (ClassCastException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getInviteDetection(String guild_id) {
|
||||
return (Boolean) this.get("server", "id", guild_id, "invite_detect");
|
||||
}
|
||||
|
||||
public void setLanguage(String user_id, String language) {
|
||||
this.update("users", user_id, "language", language);
|
||||
}
|
||||
|
||||
public String getLanguage(String user_id) {
|
||||
return (String) this.get("user", "id", user_id, "language");
|
||||
}
|
||||
|
||||
}
|
||||
12
src/main/java/com/bbn/hadder/commands/Command.java
Normal file
12
src/main/java/com/bbn/hadder/commands/Command.java
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package com.bbn.hadder.commands;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public interface Command {
|
||||
void executed(String[] args, CommandEvent event);
|
||||
String[] labels();
|
||||
String description();
|
||||
String usage();
|
||||
}
|
||||
50
src/main/java/com/bbn/hadder/commands/CommandEvent.java
Normal file
50
src/main/java/com/bbn/hadder/commands/CommandEvent.java
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
package com.bbn.hadder.commands;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.commands.general.HelpCommand;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CommandEvent extends MessageReceivedEvent {
|
||||
|
||||
private Rethink rethink;
|
||||
private Config config;
|
||||
private CommandHandler commandHandler;
|
||||
private HelpCommand helpCommand;
|
||||
private MessageEditor messageEditor;
|
||||
|
||||
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Rethink rethink, Config config, CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor) {
|
||||
super(api, responseNumber, message);
|
||||
this.rethink = rethink;
|
||||
this.config = config;
|
||||
this.commandHandler = commandHandler;
|
||||
this.helpCommand = helpCommand;
|
||||
this.messageEditor = messageEditor;
|
||||
}
|
||||
|
||||
public Rethink getRethink() {
|
||||
return rethink;
|
||||
}
|
||||
|
||||
public Config getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public HelpCommand getHelpCommand() {
|
||||
return helpCommand;
|
||||
}
|
||||
|
||||
public CommandHandler getCommandHandler() {
|
||||
return commandHandler;
|
||||
}
|
||||
|
||||
public MessageEditor getMessageEditor() {
|
||||
return messageEditor;
|
||||
}
|
||||
}
|
||||
71
src/main/java/com/bbn/hadder/commands/fun/AvatarCommand.java
Normal file
71
src/main/java/com/bbn/hadder/commands/fun/AvatarCommand.java
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
public class AvatarCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length == 0) {
|
||||
Member member = event.getMember();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.fun.avatar.success.title",
|
||||
member.getUser().getAsTag(),
|
||||
"",
|
||||
"")
|
||||
.setImage(member.getUser().getAvatarUrl())
|
||||
.setFooter(member.getUser().getAsTag())
|
||||
.build()).queue();
|
||||
} else if (event.getMessage().getMentionedMembers().size() == 1) {
|
||||
Member member = event.getMessage().getMentionedMembers().get(0);
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.fun.avatar.success.title",
|
||||
member.getUser().getAsTag(),
|
||||
"",
|
||||
"")
|
||||
.setImage(member.getUser().getAvatarUrl())
|
||||
.setFooter(member.getUser().getAsTag())
|
||||
.build()).queue();
|
||||
} else if (args[0].length() == 18){
|
||||
Member member = event.getGuild().getMemberById(args[0]);
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.fun.avatar.success.title",
|
||||
member.getUser().getAsTag(),
|
||||
"",
|
||||
"")
|
||||
.setImage(member.getUser().getAvatarUrl())
|
||||
.setFooter(member.getUser().getAsTag())
|
||||
.build()).queue();
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"avatar"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.fun.avatar.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[@User]/[ID]";
|
||||
}
|
||||
}
|
||||
77
src/main/java/com/bbn/hadder/commands/fun/ClydeCommand.java
Normal file
77
src/main/java/com/bbn/hadder/commands/fun/ClydeCommand.java
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import club.minnced.discord.webhook.WebhookClient;
|
||||
import club.minnced.discord.webhook.WebhookClientBuilder;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Icon;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.Webhook;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Perms(Perm.MANAGE_WEBHOOKS)
|
||||
public class ClydeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length > 0) {
|
||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) {
|
||||
TextChannel channel = event.getMessage().getTextChannel();
|
||||
String content = event.getMessage().getContentRaw().replace(event.getRethink().getGuildPrefix(event.getGuild().getId()), "").replace(event.getRethink().getUserPrefix(event.getAuthor().getId()), "").replace("clyde", "");
|
||||
|
||||
Webhook webhook = channel.createWebhook(event.getConfig().getClydeName()).complete();
|
||||
try {
|
||||
InputStream s = new URL("https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png").openStream();
|
||||
webhook.getManager().setAvatar(Icon.from(s)).queue();
|
||||
|
||||
WebhookClientBuilder builder = new WebhookClientBuilder(webhook.getUrl());
|
||||
|
||||
WebhookClient client = builder.build();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
client.send(content);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
webhook.delete().queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else event.getHelpCommand().sendHelp(this, event);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"clyde"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.fun.clyde.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "content";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,12 @@
|
|||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
|
@ -30,7 +18,7 @@ import java.util.Random;
|
|||
public class GifCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length > 0) {
|
||||
StringBuilder query = new StringBuilder();
|
||||
for (String arg : args) {
|
||||
|
|
@ -39,7 +27,7 @@ public class GifCommand implements Command {
|
|||
}
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + e.getConfig().getGiphyToken()).build();
|
||||
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + event.getConfig().getGiphyToken()).build();
|
||||
try {
|
||||
Random rand = new Random();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
|
@ -47,15 +35,15 @@ public class GifCommand implements Command {
|
|||
JSONArray array = json.getJSONArray("data");
|
||||
int gifIndex = rand.nextInt(array.length());
|
||||
String url = array.getJSONObject(gifIndex).get("url").toString();
|
||||
e.getTextChannel().sendMessage(url).queue();
|
||||
} catch (Exception ignore) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
event.getTextChannel().sendMessage(url).queue();
|
||||
} catch (Exception e) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"error",
|
||||
"commands.fun.gif.error.description").build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -70,11 +58,6 @@ public class GifCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[term]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "cute cat";
|
||||
return "<SearchTerm>";
|
||||
}
|
||||
}
|
||||
61
src/main/java/com/bbn/hadder/commands/fun/MemeCommand.java
Normal file
61
src/main/java/com/bbn/hadder/commands/fun/MemeCommand.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MemeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://some-random-api.ml/meme").build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
String url = json.get("image").toString();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.fun.meme.success.title", "")
|
||||
.setImage(url)
|
||||
.build()).queue();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"error",
|
||||
"commands.fun.meme.api.error")
|
||||
.setColor(Color.RED)
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"meme"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.fun.meme.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.bbn.hadder.commands.general;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class AboutCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.about.success.title",
|
||||
"commands.general.about.success.description")
|
||||
.addField(event.getMessageEditor().getTerm("commands.general.about.success.field.one.title"), event.getMessageEditor().getTerm("commands.general.about.success.field.one.description", "(https://donatebot.io/checkout/448554629282922527?buyer=" + event.getAuthor().getId() + "). :smiley:", ""), true)
|
||||
.setThumbnail("https://bigbotnetwork.com/images/Hadder.png")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"about", "info"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.about.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public class EqualsCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
event.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.equals.string.first.request", "")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
|
||||
String firstString = msgevent.getMessage().getContentRaw();
|
||||
event.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.equals.string.second.request",
|
||||
"").build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(msgevent2 -> {
|
||||
String secondString = msgevent2.getMessage().getContentRaw();
|
||||
event.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle((firstString.equals(secondString)) ? event.getMessageEditor().getTerm( "commands.general.equals.string.equals.true") : event.getMessageEditor().getTerm( "commands.general.equals.string.equals.false"))
|
||||
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.first"), firstString, false)
|
||||
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.second"), secondString, false)
|
||||
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.result"), String.valueOf(firstString.equals(secondString)), false)
|
||||
.build()).queue();
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"equals"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.equals.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HelpCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
|
||||
if (args.length == 0) {
|
||||
HashMap<String, ArrayList<Command>> hashMap = new HashMap<>();
|
||||
for (Command cmd : event.getCommandHandler().getCommandList()) {
|
||||
if (!hashMap.containsKey(cmd.getClass().getPackageName())) {
|
||||
ArrayList<Command> cmdlist = new ArrayList<>();
|
||||
cmdlist.add(cmd);
|
||||
hashMap.put(cmd.getClass().getPackageName(), cmdlist);
|
||||
} else {
|
||||
hashMap.get(cmd.getClass().getPackageName()).add(cmd);
|
||||
}
|
||||
}
|
||||
EmbedBuilder eb = new EmbedBuilder();
|
||||
for (Map.Entry<String, ArrayList<Command>> entry : hashMap.entrySet()) {
|
||||
if (!entry.getKey().endsWith("owner") || (entry.getKey().endsWith("owner") && (event.getAuthor().getId().equals("477141528981012511") ||
|
||||
event.getAuthor().getId().equals("261083609148948488")))) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < entry.getValue().size(); i++) {
|
||||
Command cmd = entry.getValue().get(i);
|
||||
sb.append("`").append(cmd.labels()[0]).append("`");
|
||||
if (i < entry.getValue().size() - 1) sb.append(", ");
|
||||
}
|
||||
String[] ps = entry.getKey().split("\\.");
|
||||
eb.addField(ps[ps.length - 1], sb.toString(), false);
|
||||
}
|
||||
}
|
||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO);
|
||||
event.getChannel().sendMessage(eb.build()).queue();
|
||||
} else {
|
||||
for (Command cmd : event.getCommandHandler().getCommandList()) {
|
||||
for (String label : cmd.labels()) {
|
||||
if (label.equalsIgnoreCase(args[0])) {
|
||||
sendHelp(cmd, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getTerm("commands.general.help.error.description")).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendHelp(Command cmd, CommandEvent event) {
|
||||
if (!cmd.getClass().getPackageName().endsWith("owner") || (cmd.getClass().getPackageName().endsWith("owner") &&
|
||||
(event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().getId().equals("261083609148948488")))) {
|
||||
String name = cmd.labels()[0];
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO, "", cmd.description())
|
||||
.setTitle(name.replaceFirst(String.valueOf(name.charAt(0)), String.valueOf(name.charAt(0)).toUpperCase()))
|
||||
.addField(MessageEditor.getTerm(event, "commands.general.help.field.usage", "", ""),
|
||||
event.getRethink().getUserPrefix(event.getAuthor().getId()) + cmd.labels()[0] + " " + event.getMessageEditor().getTerm(cmd.usage()), false)
|
||||
.build()).queue();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"help"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.help.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "commands.general.help.help.label";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import com.bbn.hadder.Hadder;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public class InviteCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.invite.success.title",
|
||||
"",
|
||||
"commands.general.invite.success.description",
|
||||
"(https://discordapp.com/oauth2/authorize?client_id="
|
||||
+ Hadder.shardManager.getGuilds().get(0).getSelfMember().getId()
|
||||
+ "&scope=bot&permissions=470133879)")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"invite"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.invite.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bbn.hadder.commands.general;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class PingCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
event.getJDA().getRestPing().queue(ping -> event.getTextChannel().sendMessage(event.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Ping")
|
||||
.setDescription(String.valueOf(ping))
|
||||
.build()).queue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"ping"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.ping.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import org.kohsuke.github.GHIssue;
|
||||
import org.kohsuke.github.GHRepository;
|
||||
import org.kohsuke.github.GitHub;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class FeedbackCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.feedback.title.request.title",
|
||||
"commands.misc.feedback.title.request.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event1 -> {
|
||||
String title = event1.getMessage().getContentDisplay();
|
||||
event1.getChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.feedback.description.request.title",
|
||||
"commands.misc.feedback.description.request.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event2 -> {
|
||||
String description = event2.getMessage().getContentDisplay();
|
||||
try {
|
||||
GitHub connection = GitHub.connectUsingOAuth(event.getConfig().getGitHubToken());
|
||||
GHRepository Hadder = connection.getOrganization("BigBotNetwork").getRepository("Hadder");
|
||||
GHIssue issue = Hadder.createIssue(title).body("<strong>Feedback by " + event.getAuthor().getAsTag() + "</strong><br>" + description).label("feedback").create();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.feedback.success.title",
|
||||
"")
|
||||
.setDescription(issue.getHtmlUrl().toString())
|
||||
.build()).queue();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"feedback"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.feedback.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
104
src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java
Normal file
104
src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GitHubCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equals("link")) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.github.link.title",
|
||||
"")
|
||||
.setDescription("https://github.com/login/oauth/authorize?client_id=25321f690bb1b6952942")
|
||||
.build()
|
||||
).queue();
|
||||
} else {
|
||||
Request request = new Request.Builder().url("https://api.github.com/users/" + args[0]).build();
|
||||
try {
|
||||
|
||||
Response response = new OkHttpClient().newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
|
||||
String nickname = json.getString("name");
|
||||
String bio = "None";
|
||||
String location = "None";
|
||||
String website = "None";
|
||||
try {
|
||||
bio = json.getString("bio");
|
||||
} catch (JSONException ignored) {
|
||||
}
|
||||
try {
|
||||
location = json.getString("location");
|
||||
} catch (JSONException ignored) {
|
||||
}
|
||||
|
||||
if (!json.getString("blog").equals("")) website = json.getString("blog");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.misc.github.success.title", nickname + " (" + args[0] + ")", ""), "https://github.com/" + args[0] + "", "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
|
||||
.setThumbnail(json.getString("avatar_url"))
|
||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.bio"), bio, false)
|
||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.location"), location, true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.website"), website, true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.repositories"), String.valueOf(json.getInt("public_repos")), true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.gists"), String.valueOf(json.getInt("public_gists")), true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.followers"), String.valueOf(json.getInt("followers")), true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.following"), String.valueOf(json.getInt("following")), true)
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException | NullPointerException e) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"",
|
||||
"commands.misc.github.api.error.description")
|
||||
.build()
|
||||
).queue();
|
||||
} catch (JSONException e) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "","commands.misc.github.user.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.github.connect.title",
|
||||
"",
|
||||
"commands.misc.github.connect.description",
|
||||
"(https://github.com/login/oauth/authorize?client_id=25321f690bb1b6952942)")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"github"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.github.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "username";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.MessageEditor.MessageType;
|
||||
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ScreenShareCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length>0) {
|
||||
if (args[0].matches("[0-9]*")&&args.length==1) {
|
||||
for (VoiceChannel vc : event.getGuild().getVoiceChannels()) {
|
||||
try {
|
||||
if (vc.getIdLong() == Long.parseLong(args[0])) {
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vc.getId() + "/").build()).queue();
|
||||
return;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.id.error.description").build()).queue();
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<VoiceChannel> vcs = event.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
|
||||
if (vcs.size() > 1) {
|
||||
EmbedBuilder eb = event.getMessageEditor().getMessage(MessageType.ERROR, "commands.misc.screenshare.channel.error.title", "commands.misc.screenshare.channel.error.description");
|
||||
for (int i = 0; i < vcs.size(); i++) {
|
||||
VoiceChannel voiceChannel = vcs.get(i);
|
||||
eb.addField(i + ": " + voiceChannel.getName(), voiceChannel.getId(), false);
|
||||
}
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING).build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
|
||||
try {
|
||||
int i = Integer.parseInt(msgevent.getMessage().getContentRaw());
|
||||
if (vcs.size() > i) {
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
|
||||
} else {
|
||||
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.number.error.title", "").build()).queue();
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.number.error.description").build()).queue();
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
} else if (vcs.size()==0) {
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.channel.existing.error", "commands.misc.screenshare.channel.existing.description").build()).queue();
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
} else {
|
||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"screenshare"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.screenshare.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "vc-name/id";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.BAN_MEMBERS)
|
||||
public class BanCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getMessage().getMentionedMembers().size() == 1) {
|
||||
Member victim = event.getMessage().getMentionedMembers().get(0);
|
||||
if (!event.getAuthor().getId().equals(victim.getId())) {
|
||||
if (!event.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
||||
if (event.getGuild().getSelfMember().canInteract(victim)) {
|
||||
event.getGuild().ban(victim, 0, "Banned by " + event.getAuthor().getAsTag()).queue();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.ban.success.title",
|
||||
"✅",
|
||||
"commands.moderation.ban.success.description",
|
||||
victim.getUser().getName() + ".").build()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage
|
||||
(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.yourself.error.description").build()).queue();
|
||||
}
|
||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
} else if (event.getMessage().getMentionedMembers().size() > 1) {
|
||||
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = event.getMessage().getMentionedMembers().get(i);
|
||||
if (!event.getAuthor().getId().equals(member.getId())) {
|
||||
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
||||
event.getGuild().ban(member, 0).reason("Mass Ban by " + event.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.yourself.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.ban.success.title",
|
||||
"✅",
|
||||
"commands.moderation.ban.massban.success.description",
|
||||
String.valueOf(event.getMessage().getMentionedMembers().size())).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"ban"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.ban.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "user";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Perms(Perm.MANAGE_MESSAGES)
|
||||
public class ClearCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length > 0) {
|
||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
|
||||
if (args[0].equals("all")) {
|
||||
List<Message> msg = event.getTextChannel().getIterableHistory().complete();
|
||||
for (Message message : msg) {
|
||||
message.delete().queue();
|
||||
}
|
||||
Message message = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.lear.all.success.title",
|
||||
"",
|
||||
"commands.moderation.lear.all.success.description",
|
||||
String.valueOf(msg.size()))
|
||||
.build()).complete();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(3);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
message.delete().queue();
|
||||
} else {
|
||||
try {
|
||||
int nbToDelete = Integer.parseInt(args[0]);
|
||||
if (nbToDelete < 1 || nbToDelete > 99) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "", "commands.moderation.clear.number.error.description").build()).queue();
|
||||
} else {
|
||||
List<Message> history = event.getTextChannel().getHistory().retrievePast(nbToDelete + 1).complete();
|
||||
List<Message> msgToDelete = new ArrayList<>(history);
|
||||
event.getTextChannel().deleteMessages(msgToDelete).queue();
|
||||
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "", "", "commands.moderation.clear.success.description", String.valueOf(nbToDelete)).build()).complete();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
msg.delete().queue();
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
} catch (IllegalArgumentException e) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.moderation.clear.message.error.title", "commands.moderation.clear.message.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"clear"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.clear.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class InviteDetectCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length == 1) {
|
||||
String opinion = args[0].toLowerCase();
|
||||
switch (opinion) {
|
||||
case "on":
|
||||
if (!event.getRethink().getInviteDetection(event.getGuild().getId())) {
|
||||
event.getRethink().setInviteDetection(event.getGuild().getId(), true);
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.invitedetect.activate.success.title",
|
||||
"commands.moderation.invitedetect.activate.success.description")
|
||||
.build()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.invitedetect.activate.error.title",
|
||||
"commands.moderation.invitedetect.activate.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
|
||||
case "off":
|
||||
if (event.getRethink().getInviteDetection(event.getGuild().getId())) {
|
||||
event.getRethink().setInviteDetection(event.getGuild().getId(), false);
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.invitedetect.deactivate.success.title",
|
||||
"commands.moderation.invitedetect.deactivate.success.description")
|
||||
.build()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.invitedetect.deactivate.error.title",
|
||||
"commands.moderation.invitedetect.deactivate.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"invitedetect", "detectinvite"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.invitedetect.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "<on/off>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.KICK_MEMBERS)
|
||||
public class KickCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getMessage().getMentionedMembers().size() == 1) {
|
||||
Member victim = event.getMessage().getMentionedMembers().get(0);
|
||||
if (!event.getAuthor().getId().equals(victim.getId())) {
|
||||
if (!event.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
||||
if (event.getGuild().getSelfMember().canInteract(victim)) {
|
||||
event.getGuild().kick(victim, "Kicked by " + event.getAuthor().getAsTag()).queue();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.kick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.kick.success.description",
|
||||
victim.getUser().getName()).build()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.kick.error.title",
|
||||
"commands.moderation.kick.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
||||
}
|
||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
} else if (event.getMessage().getMentionedMembers().size() > 1) {
|
||||
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = event.getMessage().getMentionedMembers().get(i);
|
||||
if (!event.getAuthor().getId().equals(member.getId())) {
|
||||
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
||||
event.getGuild().kick(member).reason("Mass Kicked by " + event.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.moderation.kick.error.title", "commands.moderation.kick.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.kick.success.title", "✅", "commands.moderation.kick.masskick.success.description", String.valueOf(event.getMessage().getMentionedMembers().size())).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"kick"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.kick.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "user";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.CHANGE_NICKNAME)
|
||||
public class NickCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getGuild().getSelfMember().hasPermission(Permission.NICKNAME_MANAGE)) {
|
||||
if (event.getMessage().getMentionedMembers().size() == 1) {
|
||||
if (!event.getMessage().getMentionedMembers().get(0).getId().equals(event.getGuild().getSelfMember().getId())) {
|
||||
if (event.getGuild().getSelfMember().canInteract(event.getMessage().getMentionedMembers().get(0))) {
|
||||
if (args.length > 1) {
|
||||
if (event.getMessage().getContentRaw().startsWith(event.getRethink().getUserPrefix(event.getMember().getId()))) {
|
||||
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethink().getUserPrefix(event.getMember().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.success.description",
|
||||
event.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
||||
).build()).queue();
|
||||
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getGuildPrefix(event.getGuild().getId()))) {
|
||||
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethink().getGuildPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.success.description", event.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
||||
).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
if (event.getMessage().getContentRaw().startsWith(event.getRethink().getUserPrefix(event.getMember().getId()))) {
|
||||
event.getGuild().getSelfMember().modifyNickname(event.getMessage().getContentRaw().replaceFirst(event.getRethink().getUserPrefix(event.getMember().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.myself.success.description",
|
||||
"").build()).queue();
|
||||
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getGuildPrefix(event.getGuild().getId()))) {
|
||||
event.getGuild().getSelfMember().modifyNickname(event.getMessage().getContentRaw().replaceFirst(event.getRethink().getGuildPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.myself.success.description", ""
|
||||
).build()).queue();
|
||||
}
|
||||
}
|
||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
} else {
|
||||
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = event.getMessage().getMentionedMembers().get(i);
|
||||
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||
event.getGuild().modifyNickname(member, args[args.length - 1]).reason("Mass Nicked by " + event.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
event.getGuild().getSelfMember().modifyNickname(args[args.length - 1]).reason("Mass Nicked by " + event.getAuthor().getAsTag()).queue();
|
||||
}
|
||||
}
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.myself.success.description", String.valueOf(event.getMessage().getMentionedMembers().size())
|
||||
).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"nick"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.nick.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "user+nickname";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class PrefixCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length == 1) {
|
||||
if (!args[0].contains("\"")) {
|
||||
|
||||
event.getRethink().setGuildPrefix(args[0], event.getGuild().getId());
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.prefix.success.title",
|
||||
"✅",
|
||||
"commands.moderation.prefix.success.description",
|
||||
args[0]).build()
|
||||
).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"",
|
||||
"commands.moderation.prefix.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"prefix"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.prefix.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "prefix";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +1,14 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.Region;
|
||||
|
||||
|
|
@ -28,67 +16,67 @@ import net.dv8tion.jda.api.Region;
|
|||
public class RegionChangeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length == 1) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER)) {
|
||||
if (event.getMember().hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "amsterdam":
|
||||
setRegion(Region.AMSTERDAM, "Amsterdam", e);
|
||||
setRegion(Region.AMSTERDAM, "Amsterdam", event);
|
||||
break;
|
||||
case "frankfurt":
|
||||
setRegion(Region.FRANKFURT, "Frankfurt", e);
|
||||
setRegion(Region.FRANKFURT, "Frankfurt", event);
|
||||
break;
|
||||
case "eu-west":
|
||||
setRegion(Region.EU_WEST, "EU West", e);
|
||||
setRegion(Region.EU_WEST, "EU West", event);
|
||||
break;
|
||||
case "eu-central":
|
||||
setRegion(Region.EU_CENTRAL, "EU Central", e);
|
||||
setRegion(Region.EU_CENTRAL, "EU Central", event);
|
||||
break;
|
||||
case "europe":
|
||||
setRegion(Region.EUROPE, "EUROPE", e);
|
||||
setRegion(Region.EUROPE, "EUROPE", event);
|
||||
break;
|
||||
case "brazil":
|
||||
setRegion(Region.BRAZIL, "Brazil", e);
|
||||
setRegion(Region.BRAZIL, "Brazil", event);
|
||||
break;
|
||||
case "hongkong":
|
||||
setRegion(Region.HONG_KONG, "Hong Kong", e);
|
||||
setRegion(Region.HONG_KONG, "Hong Kong", event);
|
||||
break;
|
||||
case "india":
|
||||
setRegion(Region.INDIA, "India", e);
|
||||
setRegion(Region.INDIA, "India", event);
|
||||
break;
|
||||
case "japan":
|
||||
setRegion(Region.JAPAN, "Japan", e);
|
||||
setRegion(Region.JAPAN, "Japan", event);
|
||||
break;
|
||||
case "london":
|
||||
setRegion(Region.LONDON, "London", e);
|
||||
setRegion(Region.LONDON, "London", event);
|
||||
break;
|
||||
case "russia":
|
||||
setRegion(Region.RUSSIA, "Russia", e);
|
||||
setRegion(Region.RUSSIA, "Russia", event);
|
||||
break;
|
||||
case "singapore":
|
||||
setRegion(Region.SINGAPORE, "Singapore", e);
|
||||
setRegion(Region.SINGAPORE, "Singapore", event);
|
||||
break;
|
||||
case "south-africa":
|
||||
setRegion(Region.SOUTH_AFRICA, "South Africa", e);
|
||||
setRegion(Region.SOUTH_AFRICA, "South Africa", event);
|
||||
break;
|
||||
case "sydney":
|
||||
setRegion(Region.SYDNEY, "Sydney", e);
|
||||
setRegion(Region.SYDNEY, "Sydney", event);
|
||||
break;
|
||||
case "us-central":
|
||||
setRegion(Region.US_CENTRAL, "US Central", e);
|
||||
setRegion(Region.US_CENTRAL, "US Central", event);
|
||||
break;
|
||||
case "us-east":
|
||||
setRegion(Region.US_EAST, "US East", e);
|
||||
setRegion(Region.US_EAST, "US East", event);
|
||||
break;
|
||||
case "us-west":
|
||||
setRegion(Region.US_WEST, "US West", e);
|
||||
setRegion(Region.US_WEST, "US West", event);
|
||||
break;
|
||||
case "us-south":
|
||||
setRegion(Region.US_SOUTH, "US South", e);
|
||||
setRegion(Region.US_SOUTH, "US South", event);
|
||||
break;
|
||||
default:
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
case "list":
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.regionchange.regions.title",
|
||||
"")
|
||||
|
|
@ -96,11 +84,10 @@ public class RegionChangeCommand implements Command {
|
|||
.build()).queue();
|
||||
break;
|
||||
}
|
||||
|
||||
} else
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
} else e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
} else event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.regionchange.regions.title",
|
||||
"")
|
||||
|
|
@ -108,19 +95,19 @@ public class RegionChangeCommand implements Command {
|
|||
.build()).queue();
|
||||
}
|
||||
|
||||
public void setRegion(Region region, String region_name, CommandEvent e) {
|
||||
e.getGuild().getManager().setRegion(region).reason("Region changed by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
public void setRegion (Region region, String region_name, CommandEvent event) {
|
||||
event.getGuild().getManager().setRegion(region).reason("Region changed by " + event.getAuthor().getAsTag()).queue();
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.regionchange.success.title", "",
|
||||
"commands.moderation.regionchange.success.description", region_name)
|
||||
.build()).queue();
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"changeregion", "cr", "change-region", "region"};
|
||||
return new String[]{"changeregion", "cr", "change-region"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -130,11 +117,6 @@ public class RegionChangeCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[new region]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "frankfurt";
|
||||
return "region";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
|
||||
@Perms(Perm.MANAGE_ROLES)
|
||||
public class RoleCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length > 0) {
|
||||
if (event.getMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||
|
||||
String action = args[0].toLowerCase();
|
||||
switch (action) {
|
||||
case "add":
|
||||
if (event.getMessage().getMentionedMembers().size() > 0 && event.getMessage().getMentionedRoles().size() > 0) {
|
||||
for (Member member : event.getMessage().getMentionedMembers()) {
|
||||
for (Role role : event.getMessage().getMentionedRoles()) {
|
||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
||||
if (event.getGuild().getSelfMember().canInteract(role)) {
|
||||
event.getGuild().addRoleToMember(member, role).reason("Role added by " + event.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
event.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.role.add.success.title",
|
||||
"✅",
|
||||
"",
|
||||
"commands.moderation.role.add.success.description",
|
||||
String.valueOf(event.getMessage().getMentionedRoles().size()),
|
||||
String.valueOf(event.getMessage().getMentionedMembers().size()))
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
|
||||
case "remove":
|
||||
if (event.getMessage().getMentionedMembers().size() > 0 && event.getMessage().getMentionedRoles().size() > 0) {
|
||||
for (Member member : event.getMessage().getMentionedMembers()) {
|
||||
for (Role role : event.getMessage().getMentionedRoles()) {
|
||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
||||
if (event.getGuild().getSelfMember().canInteract(role)) {
|
||||
event.getGuild().removeRoleFromMember(member, role).reason("Role removed by " + event.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
event.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.role.remove.success.title",
|
||||
"✅",
|
||||
"",
|
||||
"commands.moderation.role.remove.success.description",
|
||||
String.valueOf(event.getMessage().getMentionedRoles().size()),
|
||||
String.valueOf(event.getMessage().getMentionedMembers().size()))
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"role", "roles"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.role.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "add/remove <@role> <@user>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,233 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class RulesCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.setup.title",
|
||||
"commands.moderation.rules.setup.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event1 -> {
|
||||
if (event1.getMessage().getMentionedChannels().size() == 1) {
|
||||
try {
|
||||
TextChannel channel = event1.getMessage().getMentionedChannels().get(0);
|
||||
createRules(event, event1, channel);
|
||||
} catch (Exception e) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.channel.error.title",
|
||||
"commands.moderation.rules.channel.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
TextChannel channel = event1.getGuild().getTextChannelsByName(event1.getMessage().getContentRaw(), true).get(0);
|
||||
createRules(event, event1, channel);
|
||||
} catch (Exception e) {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.channel.error.title",
|
||||
"commands.moderation.rules.channel.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void createRules(CommandEvent event, GuildMessageReceivedEvent event1, TextChannel channel) {
|
||||
if (channel.getGuild().getId().equals(event1.getGuild().getId())) {
|
||||
if (event.getGuild().getSelfMember().hasPermission(channel, Permission.MESSAGE_WRITE)) {
|
||||
event1.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.rules.title",
|
||||
"",
|
||||
"commands.moderation.rules.rules.description",
|
||||
channel.getName())
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event2 -> {
|
||||
String message = event2.getMessage().getContentRaw();
|
||||
event2.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.role.title",
|
||||
"commands.moderation.rules.role.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event3 -> {
|
||||
if (event3.getMessage().getMentionedRoles().size() == 1) {
|
||||
Role role = event3.getMessage().getMentionedRoles().get(0);
|
||||
setRole(event, channel, message, event3, role);
|
||||
} else if (event3.getGuild().getRolesByName(event3.getMessage().getContentStripped(), true).size() > 0) {
|
||||
Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentStripped(), true).get(0);
|
||||
setRole(event, channel, message, event3, role);
|
||||
} else {
|
||||
event3.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.rules.role.error.title",
|
||||
"commands.moderation.rules.role.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION)
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.rules.guild.error.title",
|
||||
"commands.moderation.rules.guild.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void setRole(CommandEvent event, TextChannel channel, String message, GuildMessageReceivedEvent event3, Role role) {
|
||||
if (event3.getGuild().getSelfMember().canInteract(role)) {
|
||||
event3.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.emote.accept.title",
|
||||
"",
|
||||
"commands.moderation.rules.emote.accept.description", role.getName())
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event4 -> {
|
||||
if (event4.getMessage().getEmotes().size() == 1) {
|
||||
Emote aemote = event4.getMessage().getEmotes().get(0);
|
||||
event4.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.emote.decline.title", "",
|
||||
"commands.moderation.rules.emote.decline.title", String.valueOf(aemote))
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event5 -> {
|
||||
Emote demote = event5.getMessage().getEmotes().get(0);
|
||||
if (!aemote.equals(demote)) {
|
||||
Message rules = channel.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Rules")
|
||||
.setDescription(message)
|
||||
.build()).complete();
|
||||
try {
|
||||
rules.addReaction(aemote).queue();
|
||||
rules.addReaction(demote).queue();
|
||||
event5.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.success.title",
|
||||
"",
|
||||
"commands.moderation.rules.success.description",
|
||||
channel.getAsMention())
|
||||
.build()).queue();
|
||||
} catch (Exception e) {
|
||||
event5.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"error",
|
||||
"commands.moderation.rules.emote.error.access.description")
|
||||
.build()).queue();
|
||||
e.printStackTrace();
|
||||
}
|
||||
event.getRethink().updateRules(event.getGuild().getId(), rules.getId(), role.getId(), aemote.toString(), demote.toString());
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.rules.emote.error.equal.title",
|
||||
"commands.moderation.rules.emote.error.equal.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
} else {
|
||||
String aemote = event4.getMessage().getContentRaw();
|
||||
event4.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.emote.decline.title",
|
||||
"commands.moderation.rules.emoji.decline.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(event5 -> {
|
||||
String demote = event5.getMessage().getContentRaw();
|
||||
if (!aemote.equals(demote)) {
|
||||
Message rules = channel.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Rules")
|
||||
.setDescription(message)
|
||||
.build()).complete();
|
||||
try {
|
||||
rules.addReaction(aemote).queue();
|
||||
rules.addReaction(demote).queue();
|
||||
event5.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.success.title",
|
||||
"",
|
||||
"commands.moderation.rules.success.description",
|
||||
channel.getAsMention())
|
||||
.build()).queue();
|
||||
} catch (Exception e) {
|
||||
event5.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"error",
|
||||
"commands.moderation.rules.emoji.error.description")
|
||||
.build()).queue();
|
||||
e.printStackTrace();
|
||||
}
|
||||
event.getRethink().updateRules(event.getGuild().getId(), rules.getId(), role.getId(), aemote, demote);
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.moderation.rules.emote.error.equal.title",
|
||||
"commands.moderation.rules.emote.error.equal.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
}
|
||||
}, event.getJDA(), event.getAuthor());
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"rules", "rule", "setup"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.rules.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
||||
public class StarBoardCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getMessage().getMentionedChannels().size()==1) {
|
||||
event.getRethink().setStarboardChannel(event.getGuild().getId(), event.getMessage().getMentionedChannels().get(0).getId());
|
||||
event.getChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.starboard.successchannel","")
|
||||
.build())
|
||||
.queue();
|
||||
} else {
|
||||
if (args.length>0) {
|
||||
TextChannel channel = event.getGuild().getTextChannelById(args[0]);
|
||||
if (channel!=null) {
|
||||
event.getRethink().setStarboardChannel(event.getGuild().getId(), channel.getId());
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length==2) {
|
||||
event.getRethink().setNeededstars(args[1], event.getGuild().getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"starboard"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Sets the starboard channel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "<Channel id or channel mention> [Needed stars]";
|
||||
}
|
||||
}
|
||||
81
src/main/java/com/bbn/hadder/commands/music/JoinCommand.java
Normal file
81
src/main/java/com/bbn/hadder/commands/music/JoinCommand.java
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
package com.bbn.hadder.commands.music;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
||||
|
||||
public class JoinCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getMember().getVoiceState().inVoiceChannel()) {
|
||||
AudioManager audioManager = event.getGuild().getAudioManager();
|
||||
if(!audioManager.isAttemptingToConnect()) {
|
||||
VoiceChannel vc = event.getMember().getVoiceState().getChannel();
|
||||
if (event.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
||||
if (!event.getGuild().getSelfMember().getVoiceState().getChannel().getId().equals(vc.getId())) {
|
||||
event.getGuild().getAudioManager().openAudioConnection(vc);
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.music.join.success.title",
|
||||
"",
|
||||
"commands.music.join.success.description",
|
||||
vc.getName())
|
||||
.build()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(
|
||||
event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.music.join.error.connecting.already.title",
|
||||
"commands.music.join.error.connecting.already.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getGuild().getAudioManager().openAudioConnection(vc);
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.music.join.success.title",
|
||||
"",
|
||||
"commands.music.join.success.description",
|
||||
vc.getName())
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.music.join.error.connecting.trying.title",
|
||||
"commands.music.join.error.connecting.trying.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.music.join.error.channel.title",
|
||||
"commands.music.join.error.channel.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"join"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.join.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bbn.hadder.commands.music;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class LeaveCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
||||
event.getGuild().getAudioManager().closeAudioConnection();
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.music.leave.success.title",
|
||||
"commands.music.leave.success.description")
|
||||
.build()).queue();
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.music.leave.error.tile",
|
||||
"commands.music.leave.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"leave"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.leave.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/bbn/hadder/commands/nsfw/AnalCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/AnalCommand.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AnalCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/anal/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Anal")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"anal"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.anal.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/bbn/hadder/commands/nsfw/BDSMCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/BDSMCommand.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BDSMCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/img/bdsm_lewd").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("BDSM")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[] { "bdsm" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.bdsm.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BlowjobCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/blowjob").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
String url = response.body().string().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Blowjob")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"blowjob"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.blowjob.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/bbn/hadder/commands/nsfw/BoobsCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/BoobsCommand.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BoobsCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/tits/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Boobs")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"boobs", "boob", "tits"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.boobs.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/bbn/hadder/commands/nsfw/CumCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/CumCommand.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CumCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/cum/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Cum")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"cum"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.cum.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class EroticCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/erok").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
String url = response.body().string().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Erotic")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"erotic"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.erotic.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/bbn/hadder/commands/nsfw/FeetCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/FeetCommand.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class FeetCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/feet/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Feet")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"feet"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.feet.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class FingeringCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/pussy_wank/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Fingering")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"fingering"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.fingering.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LickingCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/kuni/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Licking")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"licking"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.linking.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/bbn/hadder/commands/nsfw/PornCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/PornCommand.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PornCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/classic/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Porn")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"porn"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.porn.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
59
src/main/java/com/bbn/hadder/commands/nsfw/PussyCommand.java
Normal file
59
src/main/java/com/bbn/hadder/commands/nsfw/PussyCommand.java
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PussyCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/pussy").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
String url = response.body().string().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Pussy")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"pussy"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.pussy.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class RandomPornCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/all_tags/")
|
||||
.build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel()
|
||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
|
||||
url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", "")).setFooter("Random Porn").build())
|
||||
.queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel()
|
||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
|
||||
.queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[] { "randomporn", "pornrandom" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.randomporn.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/bbn/hadder/commands/nsfw/SoloCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/SoloCommand.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SoloCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/girls_solo/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", ""))
|
||||
.setFooter("Solo")
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"solo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.solo.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
64
src/main/java/com/bbn/hadder/commands/nsfw/SpankCommand.java
Normal file
64
src/main/java/com/bbn/hadder/commands/nsfw/SpankCommand.java
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SpankCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/spank/").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONObject response1 = data.getJSONObject("response");
|
||||
String url = response1.toString().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
|
||||
url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", "")).setFooter("Spank").build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel()
|
||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
|
||||
.queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[] { "spank", "beat", "hit" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.spank.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/bbn/hadder/commands/nsfw/TransCommand.java
Normal file
60
src/main/java/com/bbn/hadder/commands/nsfw/TransCommand.java
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
package com.bbn.hadder.commands.nsfw;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TransCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (event.getTextChannel().isNSFW()) {
|
||||
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/trap").build();
|
||||
|
||||
try {
|
||||
|
||||
Response response = caller.newCall(request).execute();
|
||||
String url = response.body().string().replace("{\"url\":\"", "");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
|
||||
url.replace("\"}", ""))
|
||||
.setImage(url.replace("\"}", "")).setFooter("Trans").build()).queue();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
event.getTextChannel()
|
||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
|
||||
.queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[] { "trans" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.trans.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
105
src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java
Normal file
105
src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Hadder;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.ScriptException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class EvalCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length > 0) {
|
||||
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
|
||||
|
||||
try {
|
||||
engine.eval("var imports = new JavaImporter(java.io, java.lang, java.util);");
|
||||
} catch (ScriptException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
engine.put("msg", event.getMessage());
|
||||
engine.put("shardmanager", Hadder.shardManager);
|
||||
engine.put("rethink", event.getRethink());
|
||||
engine.put("event", event);
|
||||
engine.put("jda", event.getJDA());
|
||||
engine.put("message", event.getMessage());
|
||||
engine.put("guild", event.getGuild());
|
||||
engine.put("channel", event.getChannel());
|
||||
engine.put("author", event.getAuthor());
|
||||
engine.put("member", event.getMember());
|
||||
engine.put("self", event.getGuild().getSelfMember());
|
||||
|
||||
ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
|
||||
|
||||
service.schedule(() -> {
|
||||
|
||||
long startExec = System.currentTimeMillis();
|
||||
Object out;
|
||||
|
||||
try {
|
||||
String script = "";
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = args[i].replace("```java", "").replace("```", "");
|
||||
script += i == args.length - 1 ? args[i] : args[i] + " ";
|
||||
}
|
||||
out = engine.eval(script);
|
||||
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
|
||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.input"),
|
||||
"```java\n\n" + script + "```", false)
|
||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.output"),
|
||||
"```java\n\n" + out.toString() + "```", false)
|
||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
|
||||
System.currentTimeMillis() - startExec + " milliseconds", false)
|
||||
.build()).queue();
|
||||
} catch (Exception ex) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
|
||||
.addField(event.getMessageEditor().getTerm("error"),
|
||||
"```java\n\n" + ex.getMessage() + "```", false)
|
||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
|
||||
System.currentTimeMillis() - startExec + " milliseconds", false)
|
||||
.build()).queue();
|
||||
|
||||
}
|
||||
|
||||
service.shutdownNow();
|
||||
|
||||
}, 0, TimeUnit.MILLISECONDS);
|
||||
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"eval"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.owner.eval.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "commands.owner.eval.help.usage";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class GuildLeaveCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length > 0) {
|
||||
Guild guild = event.getJDA().getGuildById(args[0]);
|
||||
try {
|
||||
guild.leave().queue();
|
||||
event.getTextChannel()
|
||||
.sendMessage(event.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.guildleave.success.title",
|
||||
"", "commands.owner.guildleave.success.description", guild.getName())
|
||||
.build())
|
||||
.queue();
|
||||
} catch (Exception e) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.owner.guildleave.error.title", "", "commands.owner.guildleave.help.description", guild.getName()).build()).queue();
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"guildleave"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.owner.guildleave.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "guildid";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class RebootCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
Runtime.getRuntime().exit(69);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"restart", "restart"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.owner.reboot.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class ShutdownCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO).setTitle("Shutdown").build()).queue();
|
||||
event.getJDA().getShardManager().shutdown();
|
||||
System.out.println("Bot shut down via Command...");
|
||||
Runtime.getRuntime().exit(69);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"shutdown", "exit"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.owner.shutdown.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
32
src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
Normal file
32
src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor.MessageType;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public class TestCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageType.INFO, "commands.owner.test.success", "").build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"test"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.owner.test.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bbn.hadder.commands.settings;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class LanguageCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length == 1) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "de":
|
||||
setLanguage("de", "German", event);
|
||||
break;
|
||||
case "en":
|
||||
setLanguage("en", "English", event);
|
||||
break;
|
||||
case "es":
|
||||
setLanguage("es", "Spanish", event);
|
||||
break;
|
||||
case "fr":
|
||||
setLanguage("fr", "French", event);
|
||||
break;
|
||||
case "ru":
|
||||
setLanguage("ru", "Russian", event);
|
||||
break;
|
||||
case "tr":
|
||||
setLanguage("tr", "Turkish", event);
|
||||
break;
|
||||
case "zh":
|
||||
setLanguage("zh", "Chinese", event);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLanguage(String language_code, String language, CommandEvent event) {
|
||||
event.getRethink().setLanguage(event.getAuthor().getId(), language_code);
|
||||
event.getTextChannel()
|
||||
.sendMessage(
|
||||
event.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.language.success.title",
|
||||
"", "commands.settings.language.success.description", language)
|
||||
.build())
|
||||
.queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[] { "language" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.settings.language.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "commands.settings.language.help.usage";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.bbn.hadder.commands.settings;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class UserPrefixCommand implements Command {
|
||||
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
if (args.length == 1) {
|
||||
event.getRethink().setUserPrefix(args[0], event.getAuthor().getId());
|
||||
event.getTextChannel()
|
||||
.sendMessage(event.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.prefix.success.title", "",
|
||||
"commands.settings.prefix.success.description", args[0])
|
||||
.build())
|
||||
.queue();
|
||||
} else {
|
||||
event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[] { "userprefix" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.settings.prefix.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "userprefix";
|
||||
}
|
||||
}
|
||||
59
src/main/java/com/bbn/hadder/core/CommandHandler.java
Normal file
59
src/main/java/com/bbn/hadder/core/CommandHandler.java
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
package com.bbn.hadder.core;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.commands.general.HelpCommand;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandHandler {
|
||||
|
||||
private List<Command> commandList;
|
||||
private Config config;
|
||||
private HelpCommand helpCommand;
|
||||
|
||||
public CommandHandler(List<Command> commandList, Config config, HelpCommand helpCommand) {
|
||||
this.commandList = commandList;
|
||||
this.config = config;
|
||||
this.helpCommand = helpCommand;
|
||||
}
|
||||
|
||||
public void handle(MessageReceivedEvent event, Rethink rethink, String prefix) {
|
||||
String invoke = event.getMessage().getContentRaw().replaceFirst(prefix, "").split(" ")[0];
|
||||
for (Command cmd : commandList) {
|
||||
for (String label : cmd.labels()) {
|
||||
if (label.equals(invoke)) {
|
||||
String argString = event.getMessage().getContentRaw()
|
||||
.replaceFirst(prefix, "").replaceFirst(invoke, "");
|
||||
if (argString.startsWith(" ")) argString = argString.replaceFirst(" ", "");
|
||||
String[] args = argString.split(" ");
|
||||
if (args.length > 0 && args[0].equals("")) args = new String[0];
|
||||
|
||||
CommandEvent commandEvent = new CommandEvent(event.getJDA(), event.getResponseNumber(), event.getMessage(), rethink,
|
||||
config, this, helpCommand, new MessageEditor(rethink, event.getAuthor()));
|
||||
if (cmd.getClass().getAnnotations().length > 0 && !Arrays.asList(cmd.getClass().getAnnotations()).contains(Perms.class)) {
|
||||
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
|
||||
if (!perm.check(commandEvent)) {
|
||||
commandEvent.getTextChannel()
|
||||
.sendMessage(commandEvent.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION).build())
|
||||
.queue();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmd.executed(args, commandEvent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Command> getCommandList() {
|
||||
return commandList;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,4 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.core;
|
||||
package com.bbn.hadder.core;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONStringer;
|
||||
|
|
@ -70,22 +54,17 @@ public class Config {
|
|||
.key("Tokens").object()
|
||||
.key("BotToken").value(null)
|
||||
.key("Giphy").value(null)
|
||||
.key("GitHub").value(null)
|
||||
.key("MythicalBotList").value(null)
|
||||
.key("BotsForDiscord").value(null)
|
||||
.key("DiscordBotList").value(null)
|
||||
.key("DiscordBestBots").value(null)
|
||||
.key("DiscordBoats").value(null)
|
||||
.key("YetAnotherBotList").value(null)
|
||||
.key("DiscordExtremeList").value(null)
|
||||
.key("DiscordBotReviews").value(null)
|
||||
.key("DiscordBots").value(null)
|
||||
.key("BotListSpace").value(null)
|
||||
.key("DiscordBots2").value(null)
|
||||
.key("CloudList").value(null)
|
||||
.key("Arcane").value(null)
|
||||
.endObject()
|
||||
.key("Clyde").value("Clyde")
|
||||
.endObject().toString();
|
||||
.value("DiscordExtremeList").value(null)
|
||||
.value("DiscordBotReviews").value(null)
|
||||
.value("DiscordBots").value(null)
|
||||
.value("BotListSpace").value(null)
|
||||
.endObject().endObject().toString();
|
||||
}
|
||||
|
||||
public String getBotToken() {
|
||||
|
|
@ -136,6 +115,10 @@ public class Config {
|
|||
return config.getJSONObject("Tokens").getString("DiscordBotList");
|
||||
}
|
||||
|
||||
public String getDiscordBestBotsToken() {
|
||||
return config.getJSONObject("Tokens").getString("DiscordBestBots");
|
||||
}
|
||||
|
||||
public String getDiscordBoatsToken() {
|
||||
return config.getJSONObject("Tokens").getString("DiscordBoats");
|
||||
}
|
||||
|
|
@ -148,6 +131,10 @@ public class Config {
|
|||
return config.getJSONObject("Tokens").getString("DiscordExtremeList");
|
||||
}
|
||||
|
||||
public String getDiscordBotReviewsToken() {
|
||||
return config.getJSONObject("Tokens").getString("DiscordBotReviews");
|
||||
}
|
||||
|
||||
public String getDiscordBotsToken() {
|
||||
return config.getJSONObject("Tokens").getString("DiscordBots");
|
||||
}
|
||||
|
|
@ -156,18 +143,6 @@ public class Config {
|
|||
return config.getJSONObject("Tokens").getString("BotListSpace");
|
||||
}
|
||||
|
||||
public String getDiscordBots2Token() {
|
||||
return config.getJSONObject("Tokens").getString("DiscordBots2");
|
||||
}
|
||||
|
||||
public String getCloudListToken() {
|
||||
return config.getJSONObject("Tokens").getString("CloudList");
|
||||
}
|
||||
|
||||
public String getArcaneToken() {
|
||||
return config.getJSONObject("Tokens").getString("Arcane");
|
||||
}
|
||||
|
||||
public String getClydeName() {
|
||||
return config.getString("Clyde");
|
||||
}
|
||||
75
src/main/java/com/bbn/hadder/core/Perm.java
Normal file
75
src/main/java/com/bbn/hadder/core/Perm.java
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
package com.bbn.hadder.core;
|
||||
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
|
||||
/**
|
||||
* @author Skidder / GregTCLTK
|
||||
* @author Hax / Hax6775 / Schlauer_Hax
|
||||
*/
|
||||
|
||||
public enum Perm {
|
||||
|
||||
BOT_OWNER() {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
MANAGE_MESSAGES {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.MESSAGE_MANAGE) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
EMBED_MESSAGES {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.MESSAGE_EMBED_LINKS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
BAN_MEMBERS {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.BAN_MEMBERS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
KICK_MEMBERS {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.KICK_MEMBERS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
MANAGE_SERVER {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
MANAGE_ROLES {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.MANAGE_ROLES) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
CHANGE_NICKNAME {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.NICKNAME_CHANGE) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
ADMINISTRATOR {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.ADMINISTRATOR) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
MANAGE_WEBHOOKS {
|
||||
@Override
|
||||
public boolean check(CommandEvent event) {
|
||||
return event.getMember().hasPermission(Permission.MANAGE_WEBHOOKS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
||||
}
|
||||
};
|
||||
|
||||
public abstract boolean check(CommandEvent event);
|
||||
}
|
||||
14
src/main/java/com/bbn/hadder/core/Perms.java
Normal file
14
src/main/java/com/bbn/hadder/core/Perms.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package com.bbn.hadder.core;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* @author Skidder / GregTCLTK
|
||||
* @author Hax / Hax6775 / Schlauer_Hax
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Perms {
|
||||
Perm[] value() default {};
|
||||
}
|
||||
40
src/main/java/com/bbn/hadder/listener/CommandListener.java
Normal file
40
src/main/java/com/bbn/hadder/listener/CommandListener.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public class CommandListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
private CommandHandler handler;
|
||||
|
||||
public CommandListener(Rethink rethink, CommandHandler handler) {
|
||||
this.rethink = rethink;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(MessageReceivedEvent event) {
|
||||
if (event.isFromType(ChannelType.TEXT) && !event.getAuthor().isBot()) {
|
||||
String[] prefixes = {
|
||||
rethink.getUserPrefix(event.getAuthor().getId()), rethink.getGuildPrefix(event.getGuild().getId()),
|
||||
event.getGuild().getSelfMember().getAsMention() + " ", event.getGuild().getSelfMember().getAsMention(),
|
||||
event.getGuild().getSelfMember().getAsMention().replace("@", "@!") + " ",
|
||||
event.getGuild().getSelfMember().getAsMention().replace("@", "@!")
|
||||
};
|
||||
for (String prefix : prefixes) {
|
||||
if (event.getMessage().getContentRaw().startsWith(prefix)) {
|
||||
handler.handle(event, rethink, prefix);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
73
src/main/java/com/bbn/hadder/listener/GuildListener.java
Normal file
73
src/main/java/com/bbn/hadder/listener/GuildListener.java
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.utils.BotList;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
|
||||
import net.dv8tion.jda.api.events.guild.GuildLeaveEvent;
|
||||
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public class GuildListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
private Config config;
|
||||
|
||||
public GuildListener(Rethink rethink, Config config) {
|
||||
this.rethink = rethink;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void onGuildJoin(GuildJoinEvent event) {
|
||||
new Thread(() -> {
|
||||
for (Member member : event.getGuild().getMembers()) {
|
||||
if (!member.getUser().getId().equals(event.getJDA().getSelfUser().getId())) {
|
||||
rethink.insertUser(member.getUser().getId());
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
rethink.insertGuild(event.getGuild().getId());
|
||||
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Joined Server")
|
||||
.setThumbnail(event.getGuild().getIconUrl())
|
||||
.addField("Name", event.getGuild().getName(), true)
|
||||
.addField("Guild ID", event.getGuild().getId(), true)
|
||||
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
||||
.addField("Users", String.valueOf(event.getGuild().getMembers().size()), true)
|
||||
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
|
||||
new BotList(config).post();
|
||||
}
|
||||
|
||||
public void onGuildLeave(GuildLeaveEvent event) {
|
||||
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Left Server")
|
||||
.setThumbnail(event.getGuild().getIconUrl())
|
||||
.addField("Name", event.getGuild().getName(), true)
|
||||
.addField("Guild ID", event.getGuild().getId(), true)
|
||||
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
||||
.addField("Users", String.valueOf(event.getGuild().getMembers().size()), true)
|
||||
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
|
||||
new BotList(config).post();
|
||||
}
|
||||
|
||||
public void onGuildMemberJoin(GuildMemberJoinEvent event) {
|
||||
if (!event.getUser().getId().equals(event.getJDA().getSelfUser().getId())) {
|
||||
rethink.insertUser(event.getUser().getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.MessageUpdateEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class InviteLinkListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
|
||||
public InviteLinkListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
||||
if (event.isFromType(ChannelType.TEXT)) {
|
||||
if (event.getMessage().getContentRaw().contains("discord.gg/") && (!event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId()))) {
|
||||
checkInvite(event.getMessage(), "discord.gg/");
|
||||
} else if (event.getMessage().getContentRaw().contains("discordapp.com/invite") && (!event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId()))) {
|
||||
checkInvite(event.getMessage(), "discordapp.com/invite/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkInvite(Message message, String regex) {
|
||||
String split = message.getContentRaw().split(regex, 10)[1];
|
||||
String invite = split.split(" ")[0];
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/invites/" + invite).build();
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
if (!json.toString().contains("\"message\":")) {
|
||||
message.delete().reason("Invite Link detected").queue();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageUpdate(@Nonnull MessageUpdateEvent event) {
|
||||
if (event.isFromType(ChannelType.TEXT)) {
|
||||
if (event.getMessage().getContentRaw().contains("discord.gg/") && !event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
||||
checkInvite(event.getMessage(), "discord.gg/");
|
||||
} else if (event.getMessage().getContentRaw().contains("discordapp.com/invite") && !event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
||||
checkInvite(event.getMessage(), "discordapp.com/invite/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
40
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Random;
|
||||
|
||||
public class MentionListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
|
||||
|
||||
public MentionListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
||||
if (event.isFromType(ChannelType.TEXT) && (event.getMessage().getContentRaw().equals(event.getGuild().getSelfMember().getAsMention())||
|
||||
event.getMessage().getContentRaw().equals(event.getGuild().getSelfMember().getAsMention().replace("@", "@!")))) {
|
||||
event.getChannel().sendMessage(new MessageEditor(rethink, event.getAuthor()).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Hello I'm Hadder.")
|
||||
.setAuthor(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl(), event.getJDA().getSelfUser().getAvatarUrl())
|
||||
.addField("Users", String.valueOf(event.getJDA().getUsers().size()), false)
|
||||
.addField("Guilds", String.valueOf(event.getJDA().getGuilds().size()), false)
|
||||
.addField("Prefix (User)", rethink.getUserPrefix(event.getAuthor().getId()), false)
|
||||
.addField("Prefix (Guild)", rethink.getGuildPrefix(event.getGuild().getId()), false)
|
||||
.build()).queue();
|
||||
} else if (event.getMessage().getContentRaw().equalsIgnoreCase("@someone")) {
|
||||
int member = new Random().nextInt(event.getGuild().getMembers().size()-1);
|
||||
if (member>0&&member<event.getGuild().getMembers().size()) {
|
||||
event.getChannel().sendMessage(event.getGuild().getMembers().get(member).getAsMention()+ " (Executed by: "+event.getAuthor().getAsTag()+")").queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.PrivateChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public class PrivateMessageListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
|
||||
public PrivateMessageListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
public void onMessageReceived(MessageReceivedEvent event) {
|
||||
if (event.isFromType(ChannelType.PRIVATE) && !event.getAuthor().getId().equals(event.getJDA().getSelfUser().getId())) {
|
||||
PrivateChannel Skidder = event.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
|
||||
PrivateChannel Hax = event.getJDA().getUserById("261083609148948488").openPrivateChannel().complete();
|
||||
|
||||
Skidder.sendMessage(new MessageEditor(rethink, event.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("New DM by " + event.getAuthor().getAsTag())
|
||||
.setAuthor(event.getAuthor().getName(), event.getAuthor().getAvatarUrl(), event.getAuthor().getAvatarUrl())
|
||||
.setDescription(event.getMessage().getContentRaw())
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
Hax.sendMessage(new MessageEditor(rethink, event.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("New DM by " + event.getAuthor().getAsTag())
|
||||
.setAuthor(event.getAuthor().getName(), event.getAuthor().getAvatarUrl(), event.getAuthor().getAvatarUrl())
|
||||
.setDescription(event.getMessage().getContentRaw())
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
39
src/main/java/com/bbn/hadder/listener/ReadyListener.java
Normal file
39
src/main/java/com/bbn/hadder/listener/ReadyListener.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.utils.BotList;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.ReadyEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ReadyListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
private Config config;
|
||||
|
||||
public ReadyListener(Rethink rethink, Config config) {
|
||||
this.rethink = rethink;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady(@Nonnull ReadyEvent event) {
|
||||
rethink.setup();
|
||||
new Thread(() -> {
|
||||
for (User user : event.getJDA().getUsers()) {
|
||||
if (!user.getId().equals(event.getJDA().getSelfUser().getId())) {
|
||||
rethink.insertUser(user.getId());
|
||||
}
|
||||
}
|
||||
for (Guild g : event.getJDA().getGuilds()) {
|
||||
rethink.insertGuild(g.getId());
|
||||
}
|
||||
}).start();
|
||||
|
||||
new BotList(config).post();
|
||||
}
|
||||
}
|
||||
44
src/main/java/com/bbn/hadder/listener/RulesListener.java
Normal file
44
src/main/java/com/bbn/hadder/listener/RulesListener.java
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class RulesListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
|
||||
public RulesListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReactionAdd(MessageReactionAddEvent event) {
|
||||
if (event.getMessageId().equals(rethink.getRulesMID(event.getGuild().getId())) && !event.getMember().getUser().isBot()) {
|
||||
if (event.getReactionEmote().isEmote()) {
|
||||
if (rethink.getRulesAEmote(event.getGuild().getId()).contains(event.getReactionEmote().getId())) {
|
||||
event.getGuild().addRoleToMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
|
||||
} else if (rethink.getRulesDEmote(event.getGuild().getId()).contains(event.getReactionEmote().getId())) {
|
||||
event.getReaction().removeReaction(event.getUser()).queue();
|
||||
if (event.getGuild().getSelfMember().canInteract(event.getMember())) {
|
||||
event.getMember().kick().reason("Declined the rules");
|
||||
}
|
||||
}
|
||||
} else if (event.getReactionEmote().isEmoji()) {
|
||||
event.getGuild().addRoleToMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReactionRemove(MessageReactionRemoveEvent event) {
|
||||
if (event.getMessageId().equals(rethink.getRulesMID(event.getGuild().getId())) && !event.getMember().getUser().isBot()) {
|
||||
event.getGuild().removeRoleFromMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Withdrawal of the acceptance of the rules").queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,6 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.db.MongoServer;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.MessageBuilder;
|
||||
import net.dv8tion.jda.api.entities.MessageReaction;
|
||||
|
|
@ -30,47 +13,47 @@ import javax.annotation.Nonnull;
|
|||
|
||||
public class StarboardListener extends ListenerAdapter {
|
||||
|
||||
private final Mongo mongo;
|
||||
private Rethink rethink;
|
||||
|
||||
public StarboardListener(Mongo mongo) {
|
||||
this.mongo = mongo;
|
||||
public StarboardListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent e) {
|
||||
update(e);
|
||||
public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent event) {
|
||||
update(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReactionRemove(@Nonnull MessageReactionRemoveEvent e) {
|
||||
update(e);
|
||||
public void onMessageReactionRemove(@Nonnull MessageReactionRemoveEvent event) {
|
||||
update(event);
|
||||
}
|
||||
|
||||
public void update(GenericMessageReactionEvent e) {
|
||||
if (e.getReaction().getReactionEmote().getName().equals("⭐")) {
|
||||
MongoServer mongoServer = new MongoServer(mongo.getObjectByID("server", e.getGuild().getId()), mongo);
|
||||
if (!mongo.hasStarboardMessage(e.getMessageId())) {
|
||||
if (mongoServer.hasStarboardChannel()) {
|
||||
e.getTextChannel().retrieveMessageById(e.getMessageId()).queue(
|
||||
public void update(GenericMessageReactionEvent event) {
|
||||
if (event.getReaction().getReactionEmote().getName().equals("⭐")) {
|
||||
if (!rethink.hasStarboardMessage(event.getMessageId())) {
|
||||
if (rethink.hasStarboardChannel(event.getGuild().getId())) {
|
||||
|
||||
event.getTextChannel().retrieveMessageById(event.getMessageId()).queue(
|
||||
msg -> {
|
||||
int stars = 0;
|
||||
Integer stars = 0;
|
||||
for (MessageReaction reaction : msg.getReactions()) {
|
||||
if (reaction.getReactionEmote().getName().equals("⭐")) {
|
||||
stars = reaction.getCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (Integer.parseInt(mongoServer.getNeededStars()) <= stars) {
|
||||
e.getGuild().getTextChannelById(mongoServer.getStarboard())
|
||||
if (Integer.parseInt(rethink.getNeededstars(event.getGuild().getId())) <= stars) {
|
||||
event.getGuild().getTextChannelById(rethink.getStarboardChannel(event.getGuild().getId()))
|
||||
.sendMessage(new MessageBuilder()
|
||||
.setContent("⭐ 1" + " " + e.getTextChannel().getAsMention())
|
||||
.setContent("⭐ 1" + " " + event.getTextChannel().getAsMention())
|
||||
.setEmbed(
|
||||
new EmbedBuilder()
|
||||
.setAuthor(msg.getAuthor().getAsTag())
|
||||
.setDescription(msg.getContentRaw())
|
||||
.setTimestamp(msg.getTimeCreated()).build()).build()).queue(
|
||||
starboardmsg -> {
|
||||
mongo.insertStarboardMessage(msg.getId(), e.getGuild().getId(), starboardmsg.getId());
|
||||
rethink.insertStarboardMessage(msg.getId(), event.getGuild().getId(), starboardmsg.getId());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -80,23 +63,23 @@ public class StarboardListener extends ListenerAdapter {
|
|||
}
|
||||
} else {
|
||||
|
||||
e.getTextChannel().retrieveMessageById(e.getMessageId()).queue(
|
||||
event.getTextChannel().retrieveMessageById(event.getMessageId()).queue(
|
||||
msg -> {
|
||||
int stars = 0;
|
||||
Integer stars = 0;
|
||||
for (MessageReaction reaction : msg.getReactions()) {
|
||||
if (reaction.getReactionEmote().getName().equals("⭐")) {
|
||||
stars = reaction.getCount();
|
||||
}
|
||||
}
|
||||
|
||||
int finalStars = stars;
|
||||
e.getGuild().getTextChannelById(mongoServer.getStarboard())
|
||||
.retrieveMessageById(mongo.getStarboardMessage(e.getMessageId())).queue(
|
||||
Integer finalStars = stars;
|
||||
event.getGuild().getTextChannelById(rethink.getStarboardChannel(event.getGuild().getId()))
|
||||
.retrieveMessageById(rethink.getStarboardMessage(event.getMessageId())).queue(
|
||||
msg2 -> {
|
||||
|
||||
if (Integer.parseInt(mongoServer.getNeededStars()) <= finalStars) {
|
||||
if (Integer.parseInt(rethink.getNeededstars(event.getGuild().getId())) <= finalStars) {
|
||||
msg2.editMessage(new MessageBuilder()
|
||||
.setContent("⭐ " + finalStars + " " + e.getTextChannel().getAsMention())
|
||||
.setContent("⭐ " + finalStars + " " + event.getTextChannel().getAsMention())
|
||||
.setEmbed(
|
||||
new EmbedBuilder()
|
||||
.setAuthor(msg.getAuthor().getAsTag())
|
||||
|
|
@ -104,12 +87,14 @@ public class StarboardListener extends ListenerAdapter {
|
|||
.setTimestamp(msg.getTimeCreated()).build()).build()).queue();
|
||||
} else {
|
||||
msg2.delete().queue();
|
||||
mongo.removeStarboardMessage(msg.getId());
|
||||
rethink.removeStarboardMessage(msg.getId());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bbn.hadder.utils;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import net.dv8tion.jda.api.audio.AudioSendHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class AudioPlayerSendHandler implements AudioSendHandler {
|
||||
|
||||
@Override
|
||||
public boolean canProvide() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ByteBuffer provide20MsAudio() {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
200
src/main/java/com/bbn/hadder/utils/BotList.java
Normal file
200
src/main/java/com/bbn/hadder/utils/BotList.java
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
package com.bbn.hadder.utils;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Hadder;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class BotList {
|
||||
|
||||
private static String MythicalBotList = "https://mythicalbots.xyz/api/bot/637002314162372639";
|
||||
private static String BotsForDiscord = "https://botsfordiscord.com/api/bot/637002314162372639";
|
||||
private static String DiscordBotList = "https://discordbotlist.com/api/bots/637002314162372639/stats";
|
||||
private static String DiscordBestBots = "https://discordsbestbots.xyz/api/bots/637002314162372639/stats";
|
||||
private static String DiscordBoats = "https://discord.boats/api/bot/637002314162372639";
|
||||
private static String YetAnotherBotList = "https://yabl.xyz/api/bot/637002314162372639/stats";
|
||||
private static String DiscordExtremeList = "https://discordextremelist.xyz/api/bot/637002314162372639";
|
||||
private static String DiscordBotReviews = "https://discordbotreviews.xyz/api/bot/637002314162372639/stats";
|
||||
private static String DiscordBots = "https://top.gg/api/bots/637002314162372639/stats";
|
||||
private static String BotListSpace = "https://api.botlist.space/v1/bots/637002314162372639";
|
||||
|
||||
private Config config;
|
||||
|
||||
public BotList(Config config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void post() {
|
||||
if (Files.notExists(Paths.get("./DEBUG"))) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("server_count", Hadder.shardManager.getGuilds().size());
|
||||
json.put("guildCount", Hadder.shardManager.getGuilds().size());
|
||||
json.put("guilds", Hadder.shardManager.getGuilds().size());
|
||||
json.put("users", Hadder.shardManager.getUsers().size());
|
||||
json.put("shard_count", Hadder.shardManager.getShards().size());
|
||||
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), json.toString());
|
||||
|
||||
// Mythical Bot List
|
||||
|
||||
Request mythicalbotlist = new Request.Builder()
|
||||
.url(MythicalBotList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getMythicalBotListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(mythicalbotlist).execute().close();
|
||||
System.out.println("Successfully posted count for the Mythical Bot List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// BotsForDiscord
|
||||
|
||||
Request botsfordiscord = new Request.Builder()
|
||||
.url(BotsForDiscord)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getBotsForDiscordToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(botsfordiscord).execute().close();
|
||||
System.out.println("Successfully posted count to Bots For Discord!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Bot List
|
||||
|
||||
Request discordbotlist = new Request.Builder()
|
||||
.url(DiscordBotList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", "Bot " + config.getDiscordBotListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbotlist).execute().close();
|
||||
System.out.println("Successfully posted count for the Discord Bot List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Best Bots
|
||||
|
||||
Request discordbestbots = new Request.Builder()
|
||||
.url(DiscordBestBots)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBestBotsToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbestbots).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Best Bots!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Boats
|
||||
|
||||
Request discordboats = new Request.Builder()
|
||||
.url(DiscordBoats)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBoatsToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordboats).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Boats!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Yet Another Bot List
|
||||
|
||||
Request yetanotherbotlist = new Request.Builder()
|
||||
.url(YetAnotherBotList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getYetAnotherBotListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(yetanotherbotlist).execute().close();
|
||||
System.out.println("Successfully posted count to Yet Another Bot List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Extreme List
|
||||
|
||||
Request discordextremelist = new Request.Builder()
|
||||
.url(DiscordExtremeList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordExtremeListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordextremelist).execute().close();
|
||||
System.out.println("Successfully posted count for the Discord Extreme List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Bot Reviews
|
||||
|
||||
Request discordbotreviews = new Request.Builder()
|
||||
.url(DiscordBotReviews)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBotReviewsToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbotreviews).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Bot Reviews!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Bots
|
||||
|
||||
Request discordbots = new Request.Builder()
|
||||
.url(DiscordBots)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBotsToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbots).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Bots!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// BotListSpace
|
||||
|
||||
Request botlistspace = new Request.Builder()
|
||||
.url(BotListSpace)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getBotListSpaceToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(botlistspace).execute().close();
|
||||
System.out.println("Successfully posted count to BotList.Space!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/main/java/com/bbn/hadder/utils/EventWaiter.java
Normal file
29
src/main/java/com/bbn/hadder/utils/EventWaiter.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package com.bbn.hadder.utils;
|
||||
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class EventWaiter {
|
||||
|
||||
public void newOnMessageEventWaiter(Consumer<GuildMessageReceivedEvent> onEvent, JDA jda, User user) {
|
||||
Object listener = new ListenerAdapter() {
|
||||
@Override
|
||||
public void onGuildMessageReceived(@Nonnull GuildMessageReceivedEvent event) {
|
||||
if (user==null) {
|
||||
onEvent.accept(event);
|
||||
event.getJDA().getShardManager().removeEventListener(this);
|
||||
} else if (event.getAuthor().getId().equals(user.getId())) {
|
||||
onEvent.accept(event);
|
||||
event.getJDA().getShardManager().removeEventListener(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
jda.getShardManager().addEventListener(listener);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +1,7 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.bbn.hadder.utils;
|
||||
|
||||
package one.bbn.hadder.utils;
|
||||
|
||||
import one.bbn.hadder.db.MongoUser;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
|
|
@ -27,11 +12,11 @@ import java.util.ResourceBundle;
|
|||
|
||||
public class MessageEditor {
|
||||
|
||||
private final MongoUser mongoUser;
|
||||
private final User user;
|
||||
private Rethink rethink;
|
||||
private User user;
|
||||
|
||||
public MessageEditor(MongoUser mongoUser, User user) {
|
||||
this.mongoUser = mongoUser;
|
||||
public MessageEditor(Rethink rethink, User user) {
|
||||
this.rethink = rethink;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
|
@ -39,22 +24,21 @@ public class MessageEditor {
|
|||
return this.getMessage(type, "", "", "", "", "", "");
|
||||
}
|
||||
|
||||
public EmbedBuilder getMessage(MessageType type, String title, String description) {
|
||||
return this.getMessage(type, title, "", "", description, "", "");
|
||||
public EmbedBuilder getMessage(MessageType type, String title_language_string, String description_language_string) {
|
||||
return this.getMessage(type, title_language_string, "", "", description_language_string, "", "");
|
||||
}
|
||||
|
||||
public EmbedBuilder getMessage(MessageType type, String title, String title_extra,
|
||||
String description, String description_extra) {
|
||||
return this.getMessage(type, title, title_extra, "", description, description_extra, "");
|
||||
public EmbedBuilder getMessage(MessageType type, String title_language_string, String title_extra,
|
||||
String description_language_string, String description_extra) {
|
||||
return this.getMessage(type, title_language_string, title_extra, "", description_language_string, description_extra, "");
|
||||
}
|
||||
|
||||
public EmbedBuilder getMessage(MessageType type, String title, String title_extra, String title_extra_two,
|
||||
String description, String description_extra, String description_extra_two) {
|
||||
String language = (this.user != null) ? mongoUser.getLanguage() : null;
|
||||
public EmbedBuilder getMessage(MessageType type, String title_language_string, String title_extra, String title_extra_two,
|
||||
String description_language_string, String description_extra, String description_extra_two) {
|
||||
String language = (this.user!=null) ? rethink.getLanguage(this.user.getId()) : null;
|
||||
EmbedBuilder eb = this.getDefaultSettings(type);
|
||||
if (!"".equals(title)) eb.setTitle(this.handle(language, title, title_extra, title_extra_two));
|
||||
if (!"".equals(description))
|
||||
eb.setDescription(this.handle(language, description, description_extra, description_extra_two));
|
||||
if (!title_language_string.equals("")) eb.setTitle(this.handle(language, title_language_string, title_extra, title_extra_two));
|
||||
if (!description_language_string.equals("")) eb.setDescription(this.handle(language, description_language_string, description_extra, description_extra_two));
|
||||
return eb;
|
||||
}
|
||||
|
||||
|
|
@ -72,22 +56,22 @@ public class MessageEditor {
|
|||
switch (type) {
|
||||
case INFO:
|
||||
builder
|
||||
.setColor(new Color(78, 156, 174))
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setColor(new Color(47, 94, 105))
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
builder
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
builder
|
||||
.setColor(Color.ORANGE)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
|
|
@ -96,7 +80,7 @@ public class MessageEditor {
|
|||
.setTitle("⛔ No Permission ⛔")
|
||||
.setDescription("You are not authorized to execute this command!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
|
|
@ -105,7 +89,7 @@ public class MessageEditor {
|
|||
.setTitle("⛔ No Permission ⛔")
|
||||
.setDescription("Unfortunately, I do not have the required rights to perform this action!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
|
|
@ -114,7 +98,7 @@ public class MessageEditor {
|
|||
.setTitle("⛔ No NSFW ⛔")
|
||||
.setDescription("You can only execute this command in NSFW channels!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
}
|
||||
|
|
@ -122,19 +106,23 @@ public class MessageEditor {
|
|||
}
|
||||
|
||||
public String getTerm(String string) {
|
||||
return this.handle(mongoUser.getLanguage(), string, "", "");
|
||||
return this.handle(rethink.getLanguage(user.getId()), string, "", "");
|
||||
}
|
||||
|
||||
public String getTerm(String string, String extra, String extra_two) {
|
||||
return this.handle(mongoUser.getLanguage(), string, extra, extra_two);
|
||||
return this.handle(rethink.getLanguage(user.getId()), string, extra, extra_two);
|
||||
}
|
||||
|
||||
public static String getTerm(CommandEvent event, String string, String extra, String extra_two) {
|
||||
return new MessageEditor(null, null)
|
||||
.handle(event.getRethink().getLanguage(event.getAuthor().getId()), string, extra, extra_two);
|
||||
}
|
||||
|
||||
private String handle(String language_code, String string, String extra, String extra_two) {
|
||||
Locale locale = new Locale(language_code);
|
||||
ResourceBundle resourceBundle = ResourceBundle.getBundle("Translations/Translations", locale);
|
||||
if (resourceBundle.containsKey(string))
|
||||
return resourceBundle.getString(string).replaceAll("%extra%", extra).replaceAll("%extra_two%", extra_two);
|
||||
else
|
||||
return "This key doesn't exist. Please report this to the Bot Developers. Key: `" + string + "` Language_code: `" + language_code + "`";
|
||||
return resourceBundle.getString(string).replaceAll("%prefix%", "h.").replaceAll("%extra%", extra).replaceAll("%extra_two%", extra_two);
|
||||
else return "This key doesn't exist. Please report this to the Bot Developers. Key: "+string+" Language_code: "+language_code;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2020 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder;
|
||||
|
||||
import net.dv8tion.jda.api.utils.cache.CacheFlag;
|
||||
import one.bbn.hadder.audio.AudioManager;
|
||||
import one.bbn.hadder.commands.fun.AvatarCommand;
|
||||
import one.bbn.hadder.commands.fun.ClydeCommand;
|
||||
import one.bbn.hadder.commands.fun.GifCommand;
|
||||
import one.bbn.hadder.commands.fun.MemeCommand;
|
||||
import one.bbn.hadder.commands.general.*;
|
||||
import one.bbn.hadder.commands.misc.*;
|
||||
import one.bbn.hadder.commands.moderation.*;
|
||||
import one.bbn.hadder.commands.music.*;
|
||||
import one.bbn.hadder.commands.nsfw.*;
|
||||
import one.bbn.hadder.commands.owner.*;
|
||||
import one.bbn.hadder.commands.settings.LanguageCommand;
|
||||
import one.bbn.hadder.commands.settings.UserPrefixCommand;
|
||||
import one.bbn.hadder.core.CommandHandler;
|
||||
import one.bbn.hadder.core.Config;
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.listener.*;
|
||||
import net.dv8tion.jda.api.OnlineStatus;
|
||||
import net.dv8tion.jda.api.entities.Activity;
|
||||
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
|
||||
import net.dv8tion.jda.api.sharding.ShardManager;
|
||||
import net.dv8tion.jda.api.utils.ChunkingFilter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Hadder {
|
||||
|
||||
public static ShardManager shardManager;
|
||||
|
||||
public static void main(String[] args) {
|
||||
startBot();
|
||||
}
|
||||
|
||||
private static void startBot() {
|
||||
Config config = new Config("./config.json");
|
||||
if (!config.fileExists()) config.create();
|
||||
config.load();
|
||||
|
||||
Mongo mongo = new Mongo(config);
|
||||
mongo.connect();
|
||||
|
||||
DefaultShardManagerBuilder builder = DefaultShardManagerBuilder.create(GatewayIntent.getIntents(14053));
|
||||
|
||||
builder.setAutoReconnect(true);
|
||||
builder.setShardsTotal(1);
|
||||
builder.setChunkingFilter(ChunkingFilter.NONE);
|
||||
builder.setBulkDeleteSplittingEnabled(true);
|
||||
builder.setActivity(Activity.listening("h.help"));
|
||||
builder.setStatus(OnlineStatus.DO_NOT_DISTURB);
|
||||
builder.setToken(config.getBotToken());
|
||||
builder.disableCache(CacheFlag.ACTIVITY, CacheFlag.EMOTE, CacheFlag.CLIENT_STATUS);
|
||||
|
||||
HelpCommand helpCommand = new HelpCommand();
|
||||
AudioManager audioManager = new AudioManager();
|
||||
|
||||
CommandHandler commandHandler = new CommandHandler(
|
||||
List.of(
|
||||
helpCommand,
|
||||
new TestCommand(),
|
||||
new BanCommand(),
|
||||
new UserPrefixCommand(),
|
||||
new ShutdownCommand(),
|
||||
new KickCommand(),
|
||||
new PingCommand(),
|
||||
new GifCommand(),
|
||||
new ClearCommand(),
|
||||
new GitHubCommand(),
|
||||
new RebootCommand(),
|
||||
new EqualsCommand(),
|
||||
new InviteCommand(),
|
||||
new ScreenShareCommand(),
|
||||
new NickCommand(),
|
||||
new PrefixCommand(),
|
||||
new BlowjobCommand(),
|
||||
new PornCommand(),
|
||||
new AnalCommand(),
|
||||
new CumCommand(),
|
||||
new TransCommand(),
|
||||
new PussyCommand(),
|
||||
new BoobsCommand(),
|
||||
new FeetCommand(),
|
||||
new EroticCommand(),
|
||||
new RoleCommand(),
|
||||
new RulesCommand(),
|
||||
new FeedbackCommand(),
|
||||
new AvatarCommand(),
|
||||
new EvalCommand(),
|
||||
new JoinCommand(),
|
||||
new GuildLeaveCommand(),
|
||||
new MemeCommand(),
|
||||
new InviteDetectCommand(),
|
||||
new BDSMCommand(),
|
||||
new FingeringCommand(),
|
||||
new LickingCommand(),
|
||||
new SpankCommand(),
|
||||
new RandomPornCommand(),
|
||||
new SoloCommand(),
|
||||
new RegionChangeCommand(),
|
||||
new AboutCommand(),
|
||||
new LanguageCommand(),
|
||||
new ClydeCommand(),
|
||||
new PlayCommand(),
|
||||
new StarboardCommand(),
|
||||
new QueueCommand(),
|
||||
new InfoCommand(),
|
||||
new SkipCommand(),
|
||||
new EditRulesCommand(),
|
||||
new VolumeCommand(),
|
||||
new StopCommand(),
|
||||
new BlacklistCommand(),
|
||||
new PauseCommand(),
|
||||
new LoopCommand(),
|
||||
new BassCommand(),
|
||||
new EchoCommand(),
|
||||
new ServerStatsCommand(),
|
||||
new ProfileCommand(),
|
||||
new CodeCommand(),
|
||||
new MoveAllCommand(),
|
||||
new CoronaCommand()), config, helpCommand);
|
||||
|
||||
builder.addEventListeners(
|
||||
new MentionListener(mongo, config),
|
||||
new PrivateMessageListener(mongo),
|
||||
new CommandListener(mongo, commandHandler, audioManager),
|
||||
new GuildListener(mongo, config),
|
||||
new ReadyListener(config),
|
||||
new InviteLinkListener(mongo),
|
||||
new RulesListener(mongo),
|
||||
new StarboardListener(mongo),
|
||||
new VoiceLeaveListener(audioManager),
|
||||
new OwnerMessageListener(config));
|
||||
|
||||
try {
|
||||
shardManager = builder.build();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.audio;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
public class AudioInfo {
|
||||
|
||||
private final AudioTrack track;
|
||||
private final Member author;
|
||||
|
||||
AudioInfo(AudioTrack track, Member author) {
|
||||
this.track = track;
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public AudioTrack getTrack() {
|
||||
return track;
|
||||
}
|
||||
|
||||
public Member getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.audio;
|
||||
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
||||
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
|
||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AudioManager {
|
||||
|
||||
public Map<String, Map.Entry<AudioPlayer, TrackManager>> players = new HashMap<>();
|
||||
private final AudioPlayerManager myManager = new DefaultAudioPlayerManager();
|
||||
|
||||
public AudioManager() {
|
||||
AudioSourceManagers.registerRemoteSources(myManager);
|
||||
myManager.getConfiguration().setFilterHotSwapEnabled(true);
|
||||
}
|
||||
|
||||
public boolean hasPlayer(Guild guild) {
|
||||
return players.containsKey(guild.getId());
|
||||
}
|
||||
|
||||
public AudioPlayer getPlayer(Guild guild) {
|
||||
AudioPlayer p;
|
||||
if (hasPlayer(guild)) {
|
||||
p = players.get(guild.getId()).getKey();
|
||||
} else {
|
||||
p = createPlayer(guild);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
public TrackManager getTrackManager(Guild guild) {
|
||||
return players.get(guild.getId()).getValue();
|
||||
}
|
||||
|
||||
public AudioPlayer createPlayer(Guild guild) {
|
||||
AudioPlayer nPlayer = myManager.createPlayer();
|
||||
TrackManager manager = new TrackManager(nPlayer, this);
|
||||
nPlayer.addListener(manager);
|
||||
guild.getAudioManager().setSendingHandler(new AudioPlayerSendHandler(nPlayer));
|
||||
players.put(guild.getId(), new AbstractMap.SimpleEntry<>(nPlayer, manager));
|
||||
return nPlayer;
|
||||
}
|
||||
|
||||
public void loadTrack(String identifier, CommandEvent event, Message msg) {
|
||||
Guild guild = event.getGuild();
|
||||
getPlayer(guild);
|
||||
|
||||
myManager.loadItemOrdered(guild, identifier, new AudioLoadResultHandler() {
|
||||
|
||||
@Override
|
||||
public void trackLoaded(AudioTrack track) {
|
||||
if (getTrackManager(guild).getQueuedTracks().isEmpty()) {
|
||||
getTrackManager(guild).queue(track, event.getMember());
|
||||
msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.success.loading.title", "⏯",
|
||||
"", "")
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.title"), track.getInfo().title, false)
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.author"), track.getInfo().author, true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.length"),
|
||||
String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(track.getInfo().length),
|
||||
TimeUnit.MILLISECONDS.toMinutes(track.getInfo().length) % TimeUnit.HOURS.toMinutes(1),
|
||||
TimeUnit.MILLISECONDS.toSeconds(track.getInfo().length) % TimeUnit.MINUTES.toSeconds(1)), true)
|
||||
.build()).queue();
|
||||
} else {
|
||||
getTrackManager(guild).queue(track, event.getMember());
|
||||
msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.success.queueing.title", "⏺",
|
||||
"", "")
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.title"), track.getInfo().title, false)
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.author"), track.getInfo().author, true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.length"),
|
||||
String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(track.getInfo().length),
|
||||
TimeUnit.MILLISECONDS.toMinutes(track.getInfo().length) % TimeUnit.HOURS.toMinutes(1),
|
||||
TimeUnit.MILLISECONDS.toSeconds(track.getInfo().length) % TimeUnit.MINUTES.toSeconds(1)), true)
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playlistLoaded(AudioPlaylist playlist) {
|
||||
if (playlist.getSelectedTrack() != null) {
|
||||
trackLoaded(playlist.getSelectedTrack());
|
||||
} else if (playlist.isSearchResult()) {
|
||||
trackLoaded(playlist.getTracks().get(0));
|
||||
} else {
|
||||
for (int i = 0; i < Math.min(playlist.getTracks().size(), 69); i++) {
|
||||
getTrackManager(guild).queue(playlist.getTracks().get(i), event.getMember());
|
||||
}
|
||||
msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.success.loading.title", "⏯",
|
||||
"", "")
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.title"), playlist.getName(), true)
|
||||
.addField(event.getMessageEditor().getTerm("commands.music.play.success.tracks"), String.valueOf(playlist.getTracks().size()), true)
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void noMatches() {
|
||||
msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.error.match.title", "❌",
|
||||
"commands.music.play.error.match.description", "")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFailed(FriendlyException e) {
|
||||
msg.editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.error.load.title", "❌",
|
||||
"commands.music.play.error.load.description", "")
|
||||
.build()).queue();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: DJ integration
|
||||
public boolean isDj(Member member) {
|
||||
return member.getRoles().stream().anyMatch(r -> r.getName().equals("DJ"));
|
||||
}
|
||||
|
||||
public boolean isCurrentDj(Member member) {
|
||||
return getTrackManager(member.getGuild()).getTrackInfo(getPlayer(member.getGuild()).getPlayingTrack()).getAuthor().equals(member);
|
||||
}
|
||||
*/
|
||||
public void forceSkipTrack(CommandEvent event) {
|
||||
getPlayer(event.getGuild()).stopTrack();
|
||||
}
|
||||
|
||||
public String getTimestamp(long m) {
|
||||
long s = m / 1000;
|
||||
long hours = Math.floorDiv(s, 3600);
|
||||
s = s - (hours * 3600);
|
||||
long minutes = Math.floorDiv(s, 60);
|
||||
s = s - (minutes * 60);
|
||||
return (hours == 0 ? "" : hours + ":") + String.format("%02d", minutes) + ":" + String.format("%02d", s);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.audio;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||
import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame;
|
||||
import net.dv8tion.jda.api.audio.AudioReceiveHandler;
|
||||
import net.dv8tion.jda.api.audio.AudioSendHandler;
|
||||
import net.dv8tion.jda.api.audio.CombinedAudio;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class AudioPlayerSendHandler implements AudioSendHandler, AudioReceiveHandler {
|
||||
|
||||
private final AudioPlayer audioPlayer;
|
||||
private AudioFrame lastFrame;
|
||||
private final Queue<byte[]> queue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public AudioPlayerSendHandler(AudioPlayer audioPlayer) {
|
||||
this.audioPlayer = audioPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvide() {
|
||||
if (audioPlayer.getPlayingTrack() == null)
|
||||
return !queue.isEmpty();
|
||||
else if (lastFrame == null) {
|
||||
lastFrame = audioPlayer.provide();
|
||||
return lastFrame != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ByteBuffer provide20MsAudio() {
|
||||
if (audioPlayer.getPlayingTrack() == null) {
|
||||
byte[] data = queue.poll();
|
||||
return data == null ? null : ByteBuffer.wrap(data);
|
||||
} else {
|
||||
if (lastFrame == null) {
|
||||
lastFrame = audioPlayer.provide();
|
||||
}
|
||||
|
||||
byte[] data = lastFrame != null ? lastFrame.getData() : null;
|
||||
lastFrame = null;
|
||||
|
||||
return ByteBuffer.wrap(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveCombined() {
|
||||
return queue.size() < 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCombinedAudio(CombinedAudio combinedAudio) {
|
||||
if (combinedAudio.getUsers().isEmpty())
|
||||
return;
|
||||
|
||||
byte[] data = combinedAudio.getAudioData(1.0f);
|
||||
queue.add(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpus() {
|
||||
return audioPlayer.getPlayingTrack() != null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.audio;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||
import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
public class TrackManager extends AudioEventAdapter {
|
||||
|
||||
private final AudioPlayer player;
|
||||
private final AudioManager manager;
|
||||
private final Queue<AudioInfo> queue;
|
||||
private AudioTrack lastTrack;
|
||||
private boolean loop = false;
|
||||
|
||||
public TrackManager(AudioPlayer player, AudioManager manager) {
|
||||
this.manager = manager;
|
||||
this.player = player;
|
||||
this.queue = new LinkedBlockingQueue<>();
|
||||
}
|
||||
|
||||
public void queue(AudioTrack track, Member author) {
|
||||
AudioInfo info = new AudioInfo(track, author);
|
||||
queue.add(info);
|
||||
|
||||
if (player.getPlayingTrack() == null) {
|
||||
player.playTrack(track);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackStart(AudioPlayer player, AudioTrack track) {
|
||||
AudioInfo info = queue.element();
|
||||
VoiceChannel vChan = info.getAuthor().getVoiceState().getChannel();
|
||||
if (vChan == null) {
|
||||
player.stopTrack();
|
||||
} else {
|
||||
info.getAuthor().getGuild().getAudioManager().openAudioConnection(vChan);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
|
||||
if (loop) {
|
||||
this.lastTrack = track;
|
||||
player.playTrack(lastTrack.makeClone());
|
||||
} else {
|
||||
Guild g = queue.poll().getAuthor().getGuild();
|
||||
manager.getPlayer(g).stopTrack();
|
||||
if (!queue.isEmpty()) player.playTrack(queue.element().getTrack().makeClone());
|
||||
else {
|
||||
manager.players.remove(g.getId());
|
||||
manager.getPlayer(g).destroy();
|
||||
manager.getTrackManager(g).purgeQueue();
|
||||
g.getAudioManager().closeAudioConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Set<AudioInfo> getQueuedTracks() {
|
||||
return new LinkedHashSet<>(queue);
|
||||
}
|
||||
|
||||
public void purgeQueue() {
|
||||
queue.clear();
|
||||
}
|
||||
|
||||
public void remove(AudioInfo entry) {
|
||||
queue.remove(entry);
|
||||
}
|
||||
|
||||
public boolean isLoop() {
|
||||
return loop;
|
||||
}
|
||||
|
||||
public void setLoop(boolean repeating) {
|
||||
this.loop = repeating;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands;
|
||||
|
||||
public interface Command {
|
||||
void executed(String[] args, CommandEvent e);
|
||||
|
||||
String[] labels();
|
||||
|
||||
String description();
|
||||
|
||||
String usage();
|
||||
|
||||
String example();
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands;
|
||||
|
||||
import one.bbn.hadder.audio.AudioManager;
|
||||
import one.bbn.hadder.commands.general.HelpCommand;
|
||||
import one.bbn.hadder.core.CommandHandler;
|
||||
import one.bbn.hadder.core.Config;
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.db.MongoServer;
|
||||
import one.bbn.hadder.db.MongoUser;
|
||||
import one.bbn.hadder.utils.EventWaiter;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CommandEvent extends MessageReceivedEvent {
|
||||
|
||||
private Mongo mongo;
|
||||
private Config config;
|
||||
private CommandHandler commandHandler;
|
||||
private HelpCommand helpCommand;
|
||||
private MessageEditor messageEditor;
|
||||
private EventWaiter eventWaiter;
|
||||
private AudioManager audioManager;
|
||||
private MongoUser mongoUser;
|
||||
private MongoServer mongoServer;
|
||||
|
||||
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Mongo mongo, Config config,
|
||||
CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor,
|
||||
EventWaiter eventWaiter, AudioManager audioManager, MongoUser mongoUser,
|
||||
MongoServer mongoServer) {
|
||||
super(api, responseNumber, message);
|
||||
this.mongo = mongo;
|
||||
this.config = config;
|
||||
this.commandHandler = commandHandler;
|
||||
this.helpCommand = helpCommand;
|
||||
this.messageEditor = messageEditor;
|
||||
this.eventWaiter = eventWaiter;
|
||||
this.audioManager = audioManager;
|
||||
this.mongoUser = mongoUser;
|
||||
this.mongoServer = mongoServer;
|
||||
}
|
||||
|
||||
public Mongo getMongo() {
|
||||
return mongo;
|
||||
}
|
||||
|
||||
public Config getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public HelpCommand getHelpCommand() {
|
||||
return helpCommand;
|
||||
}
|
||||
|
||||
public CommandHandler getCommandHandler() {
|
||||
return commandHandler;
|
||||
}
|
||||
|
||||
public MessageEditor getMessageEditor() {
|
||||
return messageEditor;
|
||||
}
|
||||
|
||||
public EventWaiter getEventWaiter() {
|
||||
return eventWaiter;
|
||||
}
|
||||
|
||||
public AudioManager getAudioManager() {
|
||||
return audioManager;
|
||||
}
|
||||
|
||||
public MongoServer getMongoServer() {
|
||||
return mongoServer;
|
||||
}
|
||||
|
||||
public MongoUser getMongoUser() {
|
||||
return mongoUser;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class AvatarCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length == 0) {
|
||||
User u = e.getAuthor();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.fun.avatar.success.title",
|
||||
u.getAsTag(),
|
||||
"",
|
||||
"")
|
||||
.setImage(u.getAvatarUrl())
|
||||
.setFooter(u.getAsTag())
|
||||
.build()).queue();
|
||||
} else if (e.getMessage().getMentionedUsers().size() == 1) {
|
||||
User u = e.getMessage().getMentionedUsers().get(0);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.fun.avatar.success.title",
|
||||
u.getAsTag(),
|
||||
"",
|
||||
"")
|
||||
.setImage(u.getAvatarUrl())
|
||||
.setFooter(u.getAsTag())
|
||||
.build()).queue();
|
||||
} else if (args[0].length() == 18) {
|
||||
try {
|
||||
User u = e.getJDA().getUserById(args[0]);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.fun.avatar.success.title",
|
||||
u.getAsTag(),
|
||||
"",
|
||||
"")
|
||||
.setImage(u.getAvatarUrl())
|
||||
.setFooter(u.getAsTag())
|
||||
.build()).queue();
|
||||
} catch (NullPointerException ignore) {
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://canary.discord.com/api/v8/users/" + args[0]).addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
String url = "https://cdn.discordapp.com/avatars/" + args[0] + "/" + json.getString("avatar") + ".png";
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.fun.avatar.success.title",
|
||||
json.getString("username") + "#" + json.getString("discriminator"),
|
||||
"",
|
||||
"")
|
||||
.setImage(url)
|
||||
.setFooter(json.getString("username") + "#" + json.getString("discriminator"))
|
||||
.build()).queue();
|
||||
} catch (JSONException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.fun.avatar.error.title",
|
||||
"commands.fun.avatar.error.description"
|
||||
).build()).queue();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"avatar"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.fun.avatar.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "@Skidder";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
|
||||
import club.minnced.discord.webhook.WebhookClient;
|
||||
import club.minnced.discord.webhook.WebhookClientBuilder;
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Icon;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.Webhook;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Perms(Perm.MANAGE_WEBHOOKS)
|
||||
public class ClydeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) {
|
||||
TextChannel channel = e.getMessage().getTextChannel();
|
||||
String content = e.getMessage().getContentRaw().replace(e.getMongoServer().getPrefix(), "").replace(e.getMongoUser().getPrefix(), "").replace("clyde", "");
|
||||
|
||||
Webhook webhook = channel.createWebhook(e.getConfig().getClydeName()).complete();
|
||||
try {
|
||||
InputStream s = new URL("https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png").openStream();
|
||||
webhook.getManager().setAvatar(Icon.from(s)).queue();
|
||||
|
||||
WebhookClientBuilder builder = new WebhookClientBuilder(webhook.getUrl());
|
||||
|
||||
WebhookClient client = builder.build();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
client.send(content);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
webhook.delete().queue();
|
||||
e.getMessage().delete().queue();
|
||||
} else
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"clyde"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.fun.clyde.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[content]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Hey I am Clyde";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MemeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://meme-api.herokuapp.com/gimme").build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
String url = json.getString("url");
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.fun.meme.success.title", "")
|
||||
.setImage(url)
|
||||
.setAuthor("Subreddit: " + json.getString("subreddit"))
|
||||
.build()).queue();
|
||||
} catch (IOException ignore) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"error",
|
||||
"commands.fun.meme.api.error")
|
||||
.setColor(Color.RED)
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"meme"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.fun.meme.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class AboutCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.about.success.title",
|
||||
"commands.general.about.success.description")
|
||||
.addField(e.getMessageEditor().getTerm("commands.general.about.success.field.one.title"), e.getMessageEditor().getTerm("commands.general.about.success.field.one.description", "(https://donatebot.io/checkout/448554629282922527?buyer=" + e.getAuthor().getId() + "). :smiley:", ""), true)
|
||||
.setThumbnail("https://bbn.one/images/Hadder.png")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"about"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.about.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.EventWaiter;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class EqualsCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
e.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.equals.string.first.request", "")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(msge -> {
|
||||
String firstString = msge.getMessage().getContentRaw();
|
||||
e.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.equals.string.second.request",
|
||||
"").build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(msge2 -> {
|
||||
String secondString = msge2.getMessage().getContentRaw();
|
||||
e.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle((firstString.equals(secondString)) ? e.getMessageEditor().getTerm("commands.general.equals.string.equals.true") : e.getMessageEditor().getTerm("commands.general.equals.string.equals.false"))
|
||||
.addField(e.getMessageEditor().getTerm("commands.general.equals.string.first"), firstString, false)
|
||||
.addField(e.getMessageEditor().getTerm("commands.general.equals.string.second"), secondString, false)
|
||||
.addField(e.getMessageEditor().getTerm("commands.general.equals.string.result"), String.valueOf(firstString.equals(secondString)), false)
|
||||
.build()).queue();
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"equals"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.equals.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HelpCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
|
||||
if (args.length == 0) {
|
||||
HashMap<String, ArrayList<Command>> hashMap = new HashMap<>();
|
||||
for (Command cmd : e.getCommandHandler().getCommandList()) {
|
||||
if (!hashMap.containsKey(cmd.getClass().getPackageName())) {
|
||||
ArrayList<Command> cmdlist = new ArrayList<>();
|
||||
cmdlist.add(cmd);
|
||||
hashMap.put(cmd.getClass().getPackageName(), cmdlist);
|
||||
} else {
|
||||
hashMap.get(cmd.getClass().getPackageName()).add(cmd);
|
||||
}
|
||||
}
|
||||
EmbedBuilder eb = new EmbedBuilder();
|
||||
for (Map.Entry<String, ArrayList<Command>> entry : hashMap.entrySet()) {
|
||||
if (!entry.getKey().endsWith("owner") || (entry.getKey().endsWith("owner") && (e.getAuthor().getId().equals("477141528981012511") ||
|
||||
e.getAuthor().getId().equals("261083609148948488")))) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < entry.getValue().size(); i++) {
|
||||
Command cmd = entry.getValue().get(i);
|
||||
sb.append("`").append(cmd.labels()[0]).append("`");
|
||||
if (i < entry.getValue().size() - 1) sb.append(", ");
|
||||
}
|
||||
String[] ps = entry.getKey().split("\\.");
|
||||
eb.addField(ps[ps.length - 1], sb.toString(), false);
|
||||
}
|
||||
}
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO);
|
||||
e.getChannel().sendMessage(eb.build()).queue();
|
||||
} else {
|
||||
for (Command cmd : e.getCommandHandler().getCommandList()) {
|
||||
for (String label : cmd.labels()) {
|
||||
if (label.equalsIgnoreCase(args[0])) {
|
||||
sendHelp(cmd, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getTerm("commands.general.help.error.description")).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendHelp(Command cmd, CommandEvent e) {
|
||||
if (!cmd.getClass().getPackageName().endsWith("owner") || (cmd.getClass().getPackageName().endsWith("owner") &&
|
||||
(e.getAuthor().getId().equals("477141528981012511") || e.getAuthor().getId().equals("261083609148948488")))) {
|
||||
String name = cmd.labels()[0];
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(e.getMessageEditor().getTerm("commands.general.help.description")).append(" ").append(e.getMessageEditor().getTerm(cmd.description())).append("\n");
|
||||
if (cmd.usage() != null) {
|
||||
b.append(e.getMessageEditor().getTerm("commands.general.help.usage")).append(" ").append(e.getMongoServer().getPrefix()).append(name).append(" ").append(cmd.usage()).append("\n");
|
||||
}
|
||||
if (cmd.example() != null) {
|
||||
b.append(e.getMessageEditor().getTerm("commands.general.help.example")).append(" ").append(e.getMongoServer().getPrefix()).append(name).append(" ").append(cmd.example());
|
||||
}
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO)
|
||||
.setTitle(cmd.labels()[0])
|
||||
.setDescription(b.toString())
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"help"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.help.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[command]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "ban";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class InviteCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.general.invite.success.title",
|
||||
"",
|
||||
"commands.general.invite.success.description",
|
||||
"(https://discord.com/oauth2/authorize?client_id="
|
||||
+ e.getJDA().getSelfUser().getId()
|
||||
+ "&scope=bot&permissions=1043852663)")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"invite"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.invite.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class PingCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
e.getJDA().getRestPing().queue(ping -> e.getTextChannel().sendMessage(e.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Ping")
|
||||
.setDescription(String.valueOf(ping))
|
||||
.build()).queue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"ping"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.general.ping.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class CodeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://canary.discord.com/api/v8/invite/" + args[0] + "?with_counts=true").addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.misc.code.success.title",
|
||||
"commands.misc.code.success.description")
|
||||
.addField("Code", "[" + args[0] + "](https://discord.gg/" + args[0] + ")", true)
|
||||
.addField("Guild Name", json.getJSONObject("guild").getString("name"), true)
|
||||
.addBlankField(true)
|
||||
.addField("Verification Level", String.valueOf(json.getJSONObject("guild").getInt("verification_level")), true)
|
||||
.addField("Guild ID", json.getJSONObject("guild").getString("id"), true)
|
||||
.addBlankField(true)
|
||||
.addField("Members", String.valueOf(json.get("approximate_member_count")), true)
|
||||
.addBlankField(true)
|
||||
.addBlankField(true)
|
||||
.setThumbnail("https://cdn.discordapp.com/icons/" + json.getJSONObject("guild").getString("id") + "/" + json.getJSONObject("guild").getString("icon") + ".png")
|
||||
.build()).queue();
|
||||
} catch (JSONException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.code.error.title",
|
||||
"commands.misc.code.error.description").build()).queue();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"code", "invite-code", "ic"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.code.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Invite-code]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "nPwjaJk";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CoronaCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://corona.lmao.ninja/v2/all").build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder
|
||||
.append("`Confirmed cases:` **").append(json.get("cases")).append("**\n")
|
||||
.append("`Deaths:` **").append(json.get("deaths")).append("** \n")
|
||||
.append("`Recovered:` **").append(json.get("recovered")).append("** \n")
|
||||
.append("`Active cases:` **").append(json.get("active")).append("**");
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO)
|
||||
.setDescription(stringBuilder)
|
||||
.build()).queue();
|
||||
} catch (IOException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR)
|
||||
.setTitle("API Error")
|
||||
.setDescription("Try again later!")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"corona"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.corona.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.EventWaiter;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import org.kohsuke.github.GHIssue;
|
||||
import org.kohsuke.github.GHRepository;
|
||||
import org.kohsuke.github.GitHub;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class FeedbackCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.feedback.title.request.title",
|
||||
"commands.misc.feedback.title.request.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(e1 -> {
|
||||
String title = e1.getMessage().getContentDisplay();
|
||||
e1.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.feedback.description.request.title",
|
||||
"commands.misc.feedback.description.request.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(e2 -> {
|
||||
String description = e2.getMessage().getContentDisplay();
|
||||
try {
|
||||
GitHub connection = GitHub.connectUsingOAuth(e.getConfig().getGitHubToken());
|
||||
GHRepository Hadder = connection.getOrganization("BBN-Holding").getRepository("Hadder");
|
||||
GHIssue issue = Hadder.createIssue(title).body("<strong>Feedback by " + e.getAuthor().getAsTag() + "</strong><br>" + description).label("feedback").create();
|
||||
issue.addLabels("feedback");
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.feedback.success.title",
|
||||
"")
|
||||
.setDescription(issue.getHtmlUrl().toString())
|
||||
.build()).queue();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"feedback"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.feedback.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GitHubCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equals("link")) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.github.link.title",
|
||||
"")
|
||||
.setDescription("https://github.com/login/oauth/authorize?client_id=25321f690bb1b6952942")
|
||||
.build()
|
||||
).queue();
|
||||
} else {
|
||||
Request request = new Request.Builder().url("https://api.github.com/users/" + args[0]).build();
|
||||
try {
|
||||
|
||||
Response response = new OkHttpClient().newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
|
||||
String nickname = json.getString("name");
|
||||
String bio = "None";
|
||||
String location = "None";
|
||||
String website = "None";
|
||||
try {
|
||||
bio = json.getString("bio");
|
||||
} catch (JSONException ignored) {
|
||||
}
|
||||
try {
|
||||
location = json.getString("location");
|
||||
} catch (JSONException ignored) {
|
||||
}
|
||||
|
||||
if (!json.getString("blog").equals("")) website = json.getString("blog");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.misc.github.success.title", nickname + " (" + args[0] + ")", ""), "https://github.com/" + args[0] + "", "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
|
||||
.setThumbnail(json.getString("avatar_url"))
|
||||
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.bio"), bio, false)
|
||||
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.location"), location, true)
|
||||
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.website"), website, true)
|
||||
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.repositories"), String.valueOf(json.getInt("public_repos")), true)
|
||||
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.gists"), String.valueOf(json.getInt("public_gists")), true)
|
||||
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.followers"), String.valueOf(json.getInt("followers")), true)
|
||||
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.following"), String.valueOf(json.getInt("following")), true)
|
||||
.build()).queue();
|
||||
|
||||
} catch (IOException | NullPointerException ex) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.github.api.error.title",
|
||||
"commands.misc.github.api.error.description")
|
||||
.build()
|
||||
).queue();
|
||||
} catch (JSONException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.github.user.error.title",
|
||||
"commands.misc.github.user.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
/*
|
||||
TODO: THIS
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.github.connect.title",
|
||||
"",
|
||||
"commands.misc.github.connect.description",
|
||||
"(https://github.com/login/oauth/authorize?client_id=25321f690bb1b6952942)")
|
||||
.build()).queue(); */
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"github"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.github.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "GregTCLTK";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Perms(Perm.VOICE_MOVE_OTHERS)
|
||||
public class MoveAllCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length == 2) {
|
||||
if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
|
||||
if (StringUtils.isNumeric(args[1]) && args[1].length() == 18) {
|
||||
if (!args[0].equals(args[1])) {
|
||||
int count = e.getGuild().getVoiceChannelById(args[0]).getMembers().size();
|
||||
e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach(
|
||||
member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue()
|
||||
);
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.misc.moveall.success.title", "",
|
||||
"commands.misc.moveall.success.description", String.valueOf(count))
|
||||
.build()).queue();
|
||||
} else {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.moveall.error.equals.title",
|
||||
"commands.misc.moveall.error.equals.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.moveall.error.target.int.title",
|
||||
"commands.misc.moveall.error.target.int.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.moveall.error.source.int.title",
|
||||
"commands.misc.moveall.error.source.int.description").build()).queue();
|
||||
}
|
||||
} else if (args.length == 1) {
|
||||
if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel()) {
|
||||
int count = e.getMember().getVoiceState().getChannel().getMembers().size();
|
||||
e.getMember().getVoiceState().getChannel().getMembers().forEach(
|
||||
member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[0])).queue()
|
||||
);
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.misc.moveall.success.title", "",
|
||||
"commands.misc.moveall.success.description", String.valueOf(count))
|
||||
.build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.moveall.error.source.int.title",
|
||||
"commands.misc.moveall.error.source.int.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.moveall.error.target.int.title",
|
||||
"commands.misc.moveall.error.target.int.description").build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"moveall", "move-all", "ma"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.moveall.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "([source-channel]) [target-channel]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "452806287307046923 452858405212782623";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class ProfileCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
User u = null;
|
||||
if (args.length == 0) {
|
||||
u = e.getAuthor();
|
||||
} else if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
|
||||
u = e.getJDA().getUserById(args[0]);
|
||||
} else if (!StringUtils.isNumeric(args[0]) && args[0].contains("#")) {
|
||||
try {
|
||||
u = e.getJDA().getUserByTag(args[0]);
|
||||
} catch (Exception ex) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.profile.error.title",
|
||||
"commands.misc.profile.error.description").build()).queue();
|
||||
return;
|
||||
}
|
||||
} else if (e.getMessage().getMentionedUsers().size() == 1) {
|
||||
u = e.getMessage().getMentionedUsers().get(0);
|
||||
}
|
||||
try {
|
||||
// TODO: Translate
|
||||
EmbedBuilder embed = e.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("User Information")
|
||||
.addField("Username", u.getName(), true)
|
||||
.addField("Tag", u.getAsTag(), true)
|
||||
.addField("ID", u.getId(), true)
|
||||
.addField("Account Creation Date", u.getTimeCreated()
|
||||
.format(DateTimeFormatter.ISO_DATE_TIME).replace("T", " ").replace("Z", ""), true)
|
||||
.addField("Nickname", e.getGuild().getMember(u).getEffectiveName(), true)
|
||||
.addField("Guild Join Date", e.getGuild().getMember(u).getTimeJoined()
|
||||
.format(DateTimeFormatter.ISO_DATE_TIME).replace("T", " ").replace("Z", ""), true)
|
||||
.addField("Roles", String.valueOf(e.getGuild().getMember(u).getRoles().size()), true);
|
||||
|
||||
e.getChannel().sendMessage(embed.build()).queue();
|
||||
} catch (NullPointerException ex) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.profile.error.title",
|
||||
"commands.misc.profile.error.description").build()).queue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"profile", "user", "userinfo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.profile.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[user/id]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Hax#6775";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.EventWaiter;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ScreenShareCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].matches("[0-9]*") && args.length == 1 && args[0].length() == 18) {
|
||||
if (e.getGuild().getVoiceChannelById(args[0]) != null) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discord.com/channels/" + e.getGuild().getId() + "/" + args[0] + "/").build()).queue();
|
||||
} else {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.id.error.description").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
} else {
|
||||
List<VoiceChannel> vcs = e.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
|
||||
if (vcs.size() > 1) {
|
||||
EmbedBuilder eb = e.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.misc.screenshare.channel.error.title", "commands.misc.screenshare.channel.error.description");
|
||||
for (int i = 0; i < vcs.size(); i++) {
|
||||
VoiceChannel voiceChannel = vcs.get(i);
|
||||
eb.addField(i + ": " + voiceChannel.getName(), voiceChannel.getId(), false);
|
||||
}
|
||||
e.getChannel().sendMessage(eb.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(msge -> {
|
||||
try {
|
||||
int i = Integer.parseInt(msge.getMessage().getContentRaw());
|
||||
if (vcs.size() > i) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discord.com/channels/" + e.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
|
||||
} else {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.number.error.title", "").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.number.error.description").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
} else if (vcs.size() == 0) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.channel.existing.error", "commands.misc.screenshare.channel.existing.description").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discord.com/channels/" + e.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
|
||||
}
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"screenshare"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.screenshare.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[channel]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Talk";
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue