Compare commits
No commits in common. "master" and "0.10-alpha" have entirely different histories.
master
...
0.10-alpha
176 changed files with 4206 additions and 10868 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]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v1
|
||||||
- name: Set up JDK 15
|
- name: Set up JDK 1.13
|
||||||
uses: actions/setup-java@v1.4.3
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: '15'
|
java-version: 1.13
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v1
|
||||||
- name: Set up JDK 15
|
- name: Set up JDK 1.13
|
||||||
uses: actions/setup-java@v1.4.3
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: '15'
|
java-version: 1.13
|
||||||
- name: Build Final Jar
|
- name: Build Final Jar
|
||||||
run: mvn clean compile assembly:single
|
run: mvn clean compile assembly:single
|
||||||
- name: Copy folder content recursively to remote
|
- name: Copy folder content recursively to remote
|
||||||
uses: garygrossgarten/github-action-scp@release
|
uses: garygrossgarten/github-action-scp@release
|
||||||
with:
|
with:
|
||||||
local: ./target/Hadder-Build.jar
|
local: ./target/Hadder-Build.jar
|
||||||
remote: /root/bots/Hadder/Hadder-Build.jar
|
remote: /home/Bots/Hadder-Build.jar
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
port: ${{ secrets.PORT }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
|
|
@ -42,7 +41,7 @@ jobs:
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
script: /root/bots/Hadder/deploy.sh
|
script: /home/Bots/deploy.sh
|
||||||
- name: Send Webhook Notification
|
- name: Send Webhook Notification
|
||||||
if: always()
|
if: always()
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ If a community member engages in unacceptable behavior, the community organizers
|
||||||
|
|
||||||
## 7. Reporting Guidelines
|
## 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.de.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ Additionally, community organizers are available to help community members engag
|
||||||
|
|
||||||
## 8. Addressing Grievances
|
## 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
|
## 10. Contact info
|
||||||
|
|
||||||
admin@bbn.one
|
admin@bigbotnetwork.de
|
||||||
|
|
||||||
## 11. License and attribution
|
## 11. License and attribution
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ further defined and clarified by project maintainers.
|
||||||
### Enforcement
|
### Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
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
|
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
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
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
|
MIT License
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
Copyright (c) 2019 Big Bot Network
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this license document, but changing it is not allowed.
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
Preamble
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
furnished to do so, subject to the following conditions:
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the 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,
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
share and change all versions of a program--to make sure it remains free
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
software for all its users.
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
When we speak of free software, we are referring to freedom, not
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
SOFTWARE.
|
||||||
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/>.
|
|
||||||
|
|
|
||||||
72
README.md
72
README.md
|
|
@ -1,61 +1,11 @@
|
||||||
# Hadder
|
# Hadder
|
||||||
|
|
||||||
Hadder Discord is a multi-purpose Discord bot with 100% uptime.
|
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>
|
<a href="https://discord.gg/58My2dM"><img src="https://discordapp.com/api/guilds/448554629282922527/embed.png"/></a>
|
||||||
[](https://github.com/BBN-Holding/Hadder)
|
[](https://github.com/BigBotNetwork/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)
|
[](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)
|
<a href="https://discordextremelist.xyz/bots/Hadder"><img src="https://discordextremelist.xyz/api/bot/637002314162372639/widget"/></a>
|
||||||
[](https://github.com/BBN-Holding/Hadder/issues)
|
[](https://top.gg/bot/637002314162372639)
|
||||||
[](https://github.com/BBN-Holding/Hadder/blob/master/LICENSE)
|
[](https://botlist.space/bot/637002314162372639?utm_source=bls&utm_medium=widget&utm_campaign=637002314162372639)
|
||||||
[](https://wakatime.com/badge/github/BBN-Holding/Hadder)
|
|
||||||
|
|
||||||
## 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 |
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
base_url: 'https://bbn.one'
|
|
||||||
commit_message: 'New %language% translation'
|
|
||||||
files:
|
|
||||||
- source: /src/main/resources/Translations/Translations_en.properties
|
|
||||||
translation: /src/main/resources/Translations/Translations_%two_letters_code%.properties
|
|
||||||
0
docs/remove.md
Normal file
0
docs/remove.md
Normal file
|
|
@ -1,17 +1,24 @@
|
||||||
{
|
{
|
||||||
"Owners": [
|
"Owners":
|
||||||
],
|
[],
|
||||||
"Database": {
|
"Database":{"IP":"",
|
||||||
"IP": "",
|
|
||||||
"Port": 6775,
|
"Port": 6775,
|
||||||
"DBName": "",
|
"DBName": "",
|
||||||
"Username": "",
|
"Username": "",
|
||||||
"Password": ""
|
"Password": ""},
|
||||||
},
|
|
||||||
"Tokens": {
|
"Tokens": {
|
||||||
"BotToken": "",
|
"BotToken": "",
|
||||||
"Giphy": "",
|
"Giphy": "",
|
||||||
"GitHub": ""
|
"GitHub": "",
|
||||||
},
|
"MythicalBotList": "",
|
||||||
"Clyde": ""
|
"BotsForDiscord": "",
|
||||||
|
"DiscordBotList": "",
|
||||||
|
"DiscordBestBots": "",
|
||||||
|
"DiscordBoats": "",
|
||||||
|
"YetAnotherBotList": "",
|
||||||
|
"DiscordExtremeList": "",
|
||||||
|
"DiscordBotReviews": "",
|
||||||
|
"DiscordBots": "",
|
||||||
|
"BotListSpace": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
274
pom.xml
274
pom.xml
|
|
@ -1,138 +1,156 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?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"
|
<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">
|
||||||
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>
|
||||||
<groupId>Hadder</groupId>
|
<artifactId>Hadder</artifactId>
|
||||||
<artifactId>Hadder</artifactId>
|
<version>0.8-ALPHA</version>
|
||||||
<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>
|
|
||||||
|
|
||||||
<licenses>
|
<name>Hadder</name>
|
||||||
<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>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.15</maven.compiler.source>
|
<maven.compiler.source>1.13</maven.compiler.source>
|
||||||
<maven.compiler.target>1.15</maven.compiler.target>
|
<maven.compiler.target>1.13</maven.compiler.target>
|
||||||
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
|
</properties>
|
||||||
</properties>
|
|
||||||
|
|
||||||
<developers>
|
<dependencies>
|
||||||
<developer>
|
<dependency>
|
||||||
<id>Hax#6775</id>
|
<groupId>junit</groupId>
|
||||||
<name>Hax</name>
|
<artifactId>junit</artifactId>
|
||||||
<email>hax@bbn.one</email>
|
<version>4.12</version>
|
||||||
<url>https://bbn.one/</url>
|
<scope>test</scope>
|
||||||
<timezone>Europe/Berlin</timezone>
|
</dependency>
|
||||||
<properties>
|
<dependency>
|
||||||
<picUrl>https://cdn.discordapp.com/avatars/261083609148948488/f2c9efc629ef65fffa634f0d63cd467e.webp
|
<groupId>net.dv8tion</groupId>
|
||||||
</picUrl>
|
<artifactId>JDA</artifactId>
|
||||||
</properties>
|
<version>4.0.0_70</version>
|
||||||
</developer>
|
</dependency>
|
||||||
<developer>
|
<dependency>
|
||||||
<id>Skidder#6775</id>
|
<groupId>org.json</groupId>
|
||||||
<name>Greg</name>
|
<artifactId>json</artifactId>
|
||||||
<email>skidder@bbn.one</email>
|
<version>20190722</version>
|
||||||
<url>https://bbn.one/</url>
|
</dependency>
|
||||||
<timezone>Europe/Berlin</timezone>
|
<dependency>
|
||||||
<properties>
|
<groupId>com.rethinkdb</groupId>
|
||||||
<picUrl>https://cdn.discordapp.com/avatars/401817301919465482/a_f81bd03e3862de579dec59241714d86d.gif
|
<artifactId>rethinkdb-driver</artifactId>
|
||||||
</picUrl>
|
<version>2.3.3</version>
|
||||||
</properties>
|
</dependency>
|
||||||
</developer>
|
<dependency>
|
||||||
</developers>
|
<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.29</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
<version>1.7.29</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>
|
</dependencies>
|
||||||
<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>
|
<repositories>
|
||||||
<dependency>
|
<repository>
|
||||||
<groupId>org.apache.maven</groupId>
|
<id>jcenter</id>
|
||||||
<artifactId>maven-model</artifactId>
|
<name>jcenter-bintray</name>
|
||||||
<version>3.8.6</version>
|
<url>https://jcenter.bintray.com</url>
|
||||||
</dependency>
|
</repository>
|
||||||
<dependency>
|
</repositories>
|
||||||
<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>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<pluginManagement>
|
||||||
<plugin>
|
<plugins>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<configuration>
|
<version>3.1.0</version>
|
||||||
<source>15</source>
|
</plugin>
|
||||||
<target>15</target>
|
<plugin>
|
||||||
</configuration>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
</plugin>
|
<version>3.1.0</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<plugin>
|
||||||
<configuration>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<finalName>Hadder-Build</finalName>
|
<version>3.8.1</version>
|
||||||
<archive>
|
</plugin>
|
||||||
<manifest>
|
<plugin>
|
||||||
<mainClass>one.bbn.hadder.Hadder</mainClass>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
</manifest>
|
<version>2.22.2</version>
|
||||||
</archive>
|
</plugin>
|
||||||
<descriptorRefs>
|
<plugin>
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
</descriptorRefs>
|
<version>3.2.0</version>
|
||||||
<appendAssemblyId>false</appendAssemblyId>
|
<configuration>
|
||||||
</configuration>
|
<finalName>Hadder-Build</finalName>
|
||||||
</plugin>
|
<archive>
|
||||||
</plugins>
|
<manifest>
|
||||||
</build>
|
<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>
|
</project>
|
||||||
|
|
|
||||||
3
src/META-INF/MANIFEST.MF
Normal file
3
src/META-INF/MANIFEST.MF
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: com.bbn.hadder.Hadder
|
||||||
|
|
||||||
0
src/main/Translations/DE_TRANSLATION.properties
Normal file
0
src/main/Translations/DE_TRANSLATION.properties
Normal file
0
src/main/Translations/EN_TRANSLATION.properties
Normal file
0
src/main/Translations/EN_TRANSLATION.properties
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: com.bbn.hadder.Hadder
|
||||||
|
|
||||||
106
src/main/java/com/bbn/hadder/Hadder.java
Normal file
106
src/main/java/com/bbn/hadder/Hadder.java
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
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 PrefixCommand(),
|
||||||
|
new ShutdownCommand(),
|
||||||
|
new KickCommand(),
|
||||||
|
new PingCommand(),
|
||||||
|
new GifCommand(),
|
||||||
|
new ClearCommand(),
|
||||||
|
new GitHubCommand(),
|
||||||
|
new ScreenShareCommand(),
|
||||||
|
new RebootCommand(),
|
||||||
|
new EqualsCommand(),
|
||||||
|
new InviteCommand(),
|
||||||
|
new NickCommand(),
|
||||||
|
new GuildPrefixCommand(),
|
||||||
|
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 LinkCommand()), config, helpCommand);
|
||||||
|
|
||||||
|
builder.addEventListeners(
|
||||||
|
new MentionListener(rethink),
|
||||||
|
new PrivateMessageListener(),
|
||||||
|
new CommandListener(rethink, commandHandler),
|
||||||
|
new GuildListener(rethink, config),
|
||||||
|
new ReadyListener(rethink, config),
|
||||||
|
// new LinkListener(rethink),
|
||||||
|
new InviteLinkListener(rethink),
|
||||||
|
new RulesListener(rethink));
|
||||||
|
|
||||||
|
try {
|
||||||
|
shardManager = builder.build();
|
||||||
|
} catch (LoginException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
188
src/main/java/com/bbn/hadder/Rethink.java
Normal file
188
src/main/java/com/bbn/hadder/Rethink.java
Normal file
|
|
@ -0,0 +1,188 @@
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object get(String table, String where, String value, String column) {
|
||||||
|
return this.getAsArray(table, where, value).getJSONObject(0).get(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
private 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private 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 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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 JSONArray getLinks(String id) {
|
||||||
|
return new JSONArray((String) this.get("server", "id", id, "links"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addLinkedGuild(String guildid, String linkid) {
|
||||||
|
JSONArray links = getLinks(guildid);
|
||||||
|
for (int i = 0; links.length()>i; i++) {
|
||||||
|
if (links.getString(i).equals(linkid)) return;
|
||||||
|
}
|
||||||
|
this.update("server", guildid, "links", this.getLinks(guildid).put(linkid).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String removeLinkedGuild(String guildid, String linkid) {
|
||||||
|
JSONArray linkedguildslist = this.getLinks(guildid);
|
||||||
|
for (int i = 0; linkedguildslist.length()>i; i++) {
|
||||||
|
if (linkedguildslist.getString(i).equals(linkid)) {
|
||||||
|
linkedguildslist.remove(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.update("server", guildid, "links", linkedguildslist.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkChannel(String guildid, String channelid) {
|
||||||
|
this.update("server", guildid, "linkchannel", channelid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkChannel(String guildid) {
|
||||||
|
return (String) this.get("server", "id", guildid, "linkchannel");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertGuild(String id) {
|
||||||
|
this.insert("server", r.hashMap("id", id).with("prefix", "h.").with("links", "[]").with("linkchannel", "").with("message_id", "").with("role_id", "").with("invite_detect", false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertUser(String id) {
|
||||||
|
this.insert("user", r.hashMap("id", id).with("prefix", "h."));
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
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();
|
||||||
|
}
|
||||||
51
src/main/java/com/bbn/hadder/commands/CommandEvent.java
Normal file
51
src/main/java/com/bbn/hadder/commands/CommandEvent.java
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
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 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;
|
||||||
|
|
||||||
|
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Config config, Rethink rethink, CommandHandler commandHandler, HelpCommand helpCommand) {
|
||||||
|
super(api, responseNumber, message);
|
||||||
|
this.config = config;
|
||||||
|
this.rethink = rethink;
|
||||||
|
this.commandHandler = commandHandler;
|
||||||
|
this.helpCommand = helpCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandEvent(@Nonnull MessageReceivedEvent event, Config config, Rethink rethink, CommandHandler commandHandler, HelpCommand helpCommand) {
|
||||||
|
super(event.getJDA(), event.getResponseNumber(), event.getMessage());
|
||||||
|
this.config = config;
|
||||||
|
this.rethink = rethink;
|
||||||
|
this.commandHandler = commandHandler;
|
||||||
|
this.helpCommand = helpCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rethink getRethink() {
|
||||||
|
return rethink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Config getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HelpCommand getHelpCommand() {
|
||||||
|
return helpCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandHandler getCommandHandler() {
|
||||||
|
return commandHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
56
src/main/java/com/bbn/hadder/commands/fun/AvatarCommand.java
Normal file
56
src/main/java/com/bbn/hadder/commands/fun/AvatarCommand.java
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Avatar of " + 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Avatar of " + 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Avatar of " + member.getUser().getAsTag())
|
||||||
|
.setImage(member.getUser().getAvatarUrl())
|
||||||
|
.setFooter(member.getUser().getAsTag())
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this , event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"avatar"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Sends the avatar of the specified member.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<@User>/<ID>";
|
||||||
|
}
|
||||||
|
}
|
||||||
61
src/main/java/com/bbn/hadder/commands/fun/GifCommand.java
Normal file
61
src/main/java/com/bbn/hadder/commands/fun/GifCommand.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.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class GifCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (args.length > 0) {
|
||||||
|
StringBuilder query = new StringBuilder();
|
||||||
|
for (String arg : args) {
|
||||||
|
query.append(arg.toLowerCase()).append("+");
|
||||||
|
query = new StringBuilder(query.substring(0, query.length() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
OkHttpClient client = new OkHttpClient();
|
||||||
|
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();
|
||||||
|
JSONObject json = new JSONObject(response.body().string());
|
||||||
|
JSONArray array = json.getJSONArray("data");
|
||||||
|
int gifIndex = rand.nextInt(array.length());
|
||||||
|
String url = array.getJSONObject(gifIndex).get("url").toString();
|
||||||
|
event.getTextChannel().sendMessage(url).queue();
|
||||||
|
} catch (Exception e) {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR).setTitle("Error").setDescription("Please try again with another term.").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"gif"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Look for a GIF on Giphy";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<SearchTerm>";
|
||||||
|
}
|
||||||
|
}
|
||||||
58
src/main/java/com/bbn/hadder/commands/fun/MemeCommand.java
Normal file
58
src/main/java/com/bbn/hadder/commands/fun/MemeCommand.java
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Your random meme")
|
||||||
|
.setImage(url)
|
||||||
|
.build()).queue();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Error!")
|
||||||
|
.setDescription("The request to the meme API could not be processed. Please try it again later.")
|
||||||
|
.setColor(Color.RED)
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"meme"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Sends you a random meme.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
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(
|
||||||
|
new MessageEditor()
|
||||||
|
.setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Please send me the first String")
|
||||||
|
.build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
|
||||||
|
String firstString = msgevent.getMessage().getContentRaw();
|
||||||
|
event.getChannel().sendMessage(
|
||||||
|
new MessageEditor()
|
||||||
|
.setDefaultSettings(
|
||||||
|
MessageEditor.MessageType.INFO).setTitle("Please send me the second String").build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(msgevent2 -> {
|
||||||
|
String secondString = msgevent2.getMessage().getContentRaw();
|
||||||
|
event.getChannel().sendMessage(
|
||||||
|
new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle((firstString.equals(secondString)) ? "Yes! The first string equals the second string!" : "Well yes, but actually No. This isn't the same.")
|
||||||
|
.addField("First String", firstString, false)
|
||||||
|
.addField("Second String", secondString, false)
|
||||||
|
.addField("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 "Check if two strings are the same";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
package com.bbn.hadder.commands.general;
|
||||||
|
|
||||||
|
import com.bbn.hadder.Rethink;
|
||||||
|
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 net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new MessageEditor().setDefaultSettings(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.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage("I need the Embed Links Permission to send the Help Menu!").queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendHelp(Command cmd, Rethink rethink, User author, TextChannel channel) {
|
||||||
|
if (!cmd.getClass().getPackageName().endsWith("owner") || (cmd.getClass().getPackageName().endsWith("owner") &&
|
||||||
|
(author.getId().equals("477141528981012511") || author.getId().equals("261083609148948488")))) {
|
||||||
|
EmbedBuilder eb = new EmbedBuilder();
|
||||||
|
String name = cmd.labels()[0];
|
||||||
|
eb.setDescription(cmd.description()).setTitle(name.replaceFirst(String.valueOf(name.charAt(0)), String.valueOf(name.charAt(0)).toUpperCase()));
|
||||||
|
eb.addField("Usage", rethink.getUserPrefix(author.getId()) + cmd.labels()[0] + " " + cmd.usage(), false);
|
||||||
|
new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO);
|
||||||
|
channel.sendMessage(eb.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"help"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows each command or explains its usage";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "[CommandName]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.bbn.hadder.commands.general;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author Skidder / GregTCLTK
|
||||||
|
*/
|
||||||
|
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Invite me!")
|
||||||
|
.setDescription("[Invite me here!](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 "Shows the invitation to invite Hadder to your server";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("Ping").setDescription(String.valueOf(ping)).build()).queue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"ping"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows the ping to the Discord API";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Feedback Topic")
|
||||||
|
.setDescription("Please send me the feedback topic.")
|
||||||
|
.build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(event1 -> {
|
||||||
|
String title = event1.getMessage().getContentDisplay();
|
||||||
|
event1.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Feedback Description")
|
||||||
|
.setDescription("Please send me the feedback description now.")
|
||||||
|
.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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Feedback successfully sent")
|
||||||
|
.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 "Sends feedback directly to the developers.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("Link your GitHub Account").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 = "Unknown";
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("Information about " + 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("User bio", bio, false)
|
||||||
|
.addField("Location", location, true)
|
||||||
|
.addField("Website", website, true)
|
||||||
|
.addField("Public repositories", String.valueOf(json.getInt("public_repos")), true)
|
||||||
|
.addField("Public gists", String.valueOf(json.getInt("public_gists")), true)
|
||||||
|
.addField("Followers", String.valueOf(json.getInt("followers")), true)
|
||||||
|
.addField("Following", String.valueOf(json.getInt("following")), true)
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException | NullPointerException e) {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR).setDescription("The GitHub API might be down at the moment!").build()).queue();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("This user does not exist!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Connect you GH account")
|
||||||
|
.setDescription("[Please connect your GitHub account here](https://github.com/login/oauth/authorize?client_id=25321f690bb1b6952942)")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"github"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Displays information about a GitHub user profile";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<Username>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
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 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Here's your Url to share your Screen")
|
||||||
|
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vc.getId() + "/").build()).queue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Wait, that's illegal")
|
||||||
|
.setDescription("This ID is invalid. \nMaybe you entered a wrong ID? \n\nNote: Make sure the Voice Channel is on this Guild.").build()).queue();
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<VoiceChannel> vcs = event.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
|
||||||
|
if (vcs.size() > 1) {
|
||||||
|
EmbedBuilder eb = new EmbedBuilder()
|
||||||
|
.setTitle("Please Choose a Voice Channel")
|
||||||
|
.setDescription("There is more than one channel with this name");
|
||||||
|
for (int i = 0; i < vcs.size(); i++) {
|
||||||
|
VoiceChannel voiceChannel = vcs.get(i);
|
||||||
|
eb.addField(i + ": " + voiceChannel.getName(), voiceChannel.getId(), false);
|
||||||
|
}
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
|
||||||
|
try {
|
||||||
|
int i = Integer.parseInt(msgevent.getMessage().getContentRaw());
|
||||||
|
if (vcs.size() > i) {
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Here's your Url to share your Screen")
|
||||||
|
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("You specified a wrong number!").build()).queue();
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Wait, that's illegal")
|
||||||
|
.setDescription("This isn't a Number.").build()).queue();
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}, event.getJDA(), event.getAuthor());
|
||||||
|
} else if (vcs.size()==0) {
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Hol' up")
|
||||||
|
.setDescription("There is no Voice Channel named like this. \n\nNote: Make sure the Voice Channel is on this Guild.").build()).queue();
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
} else {
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Here's your Url to share your Screen")
|
||||||
|
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"screenshare"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows you the link to share your screen";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<VoiceChannelID|VoiceChannelName>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
|
||||||
|
public class BanCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.BAN_MEMBERS) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully banned ✅").setDescription("I successfully baned " + victim.getUser().getName() + ".").build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("I can not ban myself").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("Not possible").setDescription("You can't ban yourself.").build()).queue();
|
||||||
|
}
|
||||||
|
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
} 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("I can not ban myself!").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("You can't ban yourself.").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully banned ✅").setDescription("I successfully banned " + event.getMessage().getMentionedMembers().size() + " Members!").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"ban"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Bans one ore more user from the server";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<@User>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class ClearCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (args.length > 0) {
|
||||||
|
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.MESSAGE_MANAGE) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
if (event.getGuild().getMemberById(event.getJDA().getSelfUser().getId()).hasPermission(Permission.MESSAGE_MANAGE)) {
|
||||||
|
try {
|
||||||
|
int nbToDelete = Integer.parseInt(args[0]);
|
||||||
|
if(nbToDelete < 1 || nbToDelete > 200) {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("You have to choose a number between 1 and 200!").build()).queue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Message> history = event.getTextChannel().getHistory().retrievePast(nbToDelete +1).complete();
|
||||||
|
List<Message> msgToDelete = new ArrayList<>();
|
||||||
|
msgToDelete.addAll(history);
|
||||||
|
event.getTextChannel().deleteMessages(msgToDelete).queue();
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setDescription("Successfully deleted " + nbToDelete + " messages.").build()).queue();
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"clear"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Deletes the specified number of messages";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<Number>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
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.Permission;
|
||||||
|
|
||||||
|
public class GuildPrefixCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
if (args.length == 1) {
|
||||||
|
if (!args[0].contains("\"")) {
|
||||||
|
|
||||||
|
event.getRethink().setGuildPrefix(args[0], event.getGuild().getId());
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully set ✅").setDescription("I successfully set the new prefix for the guild to " + args[0]).build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("The prefix must not contain **\"**").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"guildprefix"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Sets the Guild-Prefix";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<New Guild-Prefix>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
|
||||||
|
public class InviteDetectCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (args.length == 1) {
|
||||||
|
if (event.getMember().hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Successfully activated")
|
||||||
|
.setDescription("I successfully activated the invite link detection for this guild.")
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("Already activated")
|
||||||
|
.setDescription("The invite link detection is already activated on this guild.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "off":
|
||||||
|
if (event.getRethink().getInviteDetection(event.getGuild().getId())) {
|
||||||
|
event.getRethink().setInviteDetection(event.getGuild().getId(), false);
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Successfully deactivated")
|
||||||
|
.setDescription("I successfully deactivated the invite link detection for this guild.")
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("Already deactivated")
|
||||||
|
.setDescription("The invite link detection is already deactivated on this guild.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"invitedetect", "detectinvite"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Activate or deactivate the Discord invite link detection.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<on/off>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
|
||||||
|
|
||||||
|
public class KickCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.KICK_MEMBERS) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully kicked ✅").setDescription("I successfully kicked " + victim.getUser().getName() + ".").build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("I can not kick myself!").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("You can't kick yourself.").build()).queue();
|
||||||
|
}
|
||||||
|
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
} 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("I can not kick myself!").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setDescription("You can't kick yourself.").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully kicked ✅").setDescription("I successfully kicked " + event.getMessage().getMentionedMembers().size() + " Members!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"kick"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Kicks one or more user from the server";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<@User>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
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.EmbedBuilder;
|
||||||
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
|
||||||
|
public class LinkCommand implements Command {
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (args.length == 0) event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
switch (args[0].toLowerCase()) {
|
||||||
|
case "add":
|
||||||
|
if (args.length != 2) return;
|
||||||
|
String linkid = args[1];
|
||||||
|
|
||||||
|
// Check if guild exists
|
||||||
|
boolean found = false;
|
||||||
|
Guild linkguild = null;
|
||||||
|
for (Guild g : event.getJDA().getGuilds()) {
|
||||||
|
if (g.getId().equals(linkid)) {
|
||||||
|
found = true;
|
||||||
|
linkguild = g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
event.getChannel().sendMessage(
|
||||||
|
new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Success!").setDescription("If i'm on this guild i sent a message to accept the link.")
|
||||||
|
.build()).queue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the guild is the same
|
||||||
|
if (event.getGuild().getId().equals(args[1])) {
|
||||||
|
event.getChannel().sendMessage(
|
||||||
|
new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Wait thats illegal.").setDescription("You specified the same guild as the guild on which you're reading this").build()).queue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send poll to all connected guilds
|
||||||
|
Guild finalLinkguild = linkguild;
|
||||||
|
new Thread(() -> {
|
||||||
|
if (event.getRethink().getLinkChannel(linkid).isEmpty()) {
|
||||||
|
event.getRethink().setLinkChannel(linkid, finalLinkguild.createTextChannel("linkchannel").complete().getId());
|
||||||
|
}
|
||||||
|
// Send Request to link Guild
|
||||||
|
event.getJDA().getTextChannelById(event.getRethink().getLinkChannel(linkid)).sendMessage(
|
||||||
|
new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle(event.getGuild().getName() + " (" + event.getGuild().getId() + ") wants to link guilds!")
|
||||||
|
.setDescription("React with the reactions to accept or decline it").build()
|
||||||
|
).queue(
|
||||||
|
msg -> {
|
||||||
|
msg.addReaction("✅").queue();
|
||||||
|
msg.addReaction("❌").queue();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
|
||||||
|
event.getChannel().sendMessage(
|
||||||
|
new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Success!").setDescription("If i'm on this guild i sent a message to accept the link.")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "channel":
|
||||||
|
if (args.length == 2) {
|
||||||
|
event.getRethink().setLinkChannel(event.getGuild().getId(), args[1]);
|
||||||
|
event.getChannel().sendMessage(new EmbedBuilder().setTitle("Success").setDescription("Set the thing boi").build()).queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"link"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Links two or more servers.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
|
||||||
|
public class NickCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getMember().hasPermission(Permission.NICKNAME_MANAGE) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully nicked ✅").setDescription("I successfully nicked " + 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully nicked ✅").setDescription("I successfully nicked " + event.getMessage().getMentionedMembers().get(0).getUser().getAsTag() + ".").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully nicked ✅").setDescription("I successfully changed my nickname.").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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully nicked ✅").setDescription("I successfully changed my nickname.").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
} 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully nicked ✅").setDescription("I successfully nicked " + event.getMessage().getMentionedMembers().size() + " Members!").build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"nick"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Rename a one or more user";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<@user> <New Nickname>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
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.Permission;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
|
|
||||||
|
public class RoleCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (args.length > 0) {
|
||||||
|
if (event.getMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||||
|
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("✅ Successfully added role(s) ✅")
|
||||||
|
.setDescription("I successfully added " + event.getMessage().getMentionedRoles().size() + " roles to " + event.getMessage().getMentionedMembers().size() + " members.")
|
||||||
|
.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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("✅ Successfully removed role(s) ✅")
|
||||||
|
.setDescription("I successfully removed " + event.getMessage().getMentionedRoles().size() + " roles from " + event.getMessage().getMentionedMembers().size() + " members.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"role", "roles"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Adds and removes roles from one or more user";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "add/remove <@role> <@user>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,192 @@
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
public class RulesCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getMember().hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Set up rules")
|
||||||
|
.setDescription("Welcome to the Hadder rules setup. Please mention the channel in which I should send the rules. Your message should look like: #rules or #verify.")
|
||||||
|
.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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Channel not found")
|
||||||
|
.setDescription("I can't find the specified channel. Please start the setup again.")
|
||||||
|
.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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Channel not found")
|
||||||
|
.setDescription("I can't find the specified channel. Please start the setup again.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, event.getJDA(), event.getAuthor());
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Rules")
|
||||||
|
.setDescription("The channel was successfully set to " + channel.getName() + ". Please send me the rules now.")
|
||||||
|
.build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(event2 -> {
|
||||||
|
String message = event2.getMessage().getContentDisplay();
|
||||||
|
event2.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Role to assign")
|
||||||
|
.setDescription("The rules were successfully set. Please send me the name of the role which the user receives after he accepted the rules.")
|
||||||
|
.build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(event3 -> {
|
||||||
|
if (event.getMessage().getMentionedRoles().size() == 1) {
|
||||||
|
Role role = event.getMessage().getMentionedRoles().get(0);
|
||||||
|
setRole(event, channel, message, event3, role);
|
||||||
|
} else {
|
||||||
|
Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentStripped(), true).get(0);
|
||||||
|
setRole(event, channel, message, event3, role);
|
||||||
|
}
|
||||||
|
}, event.getJDA(), event.getAuthor());
|
||||||
|
}, event.getJDA(), event.getAuthor());
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION)
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("Wrong Guild")
|
||||||
|
.setDescription("The mentioned channel must be on this guid!")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(CommandEvent event, TextChannel channel, String message, GuildMessageReceivedEvent event3, Role role) {
|
||||||
|
if (event3.getGuild().getSelfMember().canInteract(role)) {
|
||||||
|
event3.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Custom Accept Emote")
|
||||||
|
.setDescription("The role has been successfully set to " + role.getName() + ". Now send me the emote on which your user should react to to get verified.")
|
||||||
|
.build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(event4 -> {
|
||||||
|
if (event4.getMessage().getEmotes().size() == 1) {
|
||||||
|
Emote aemote = event4.getMessage().getEmotes().get(0);
|
||||||
|
event4.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Custom Decline Emote")
|
||||||
|
.setDescription("The first emote has been successfully set to " + aemote + ". Please send me now the decline emote.")
|
||||||
|
.build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(event5 -> {
|
||||||
|
Emote demote = event5.getMessage().getEmotes().get(0);
|
||||||
|
if (!aemote.equals(demote)) {
|
||||||
|
Message rules = channel.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Rules")
|
||||||
|
.setDescription(message)
|
||||||
|
.build()).complete();
|
||||||
|
try {
|
||||||
|
rules.addReaction(aemote).queue();
|
||||||
|
rules.addReaction(demote).queue();
|
||||||
|
event5.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Successfully set the rules")
|
||||||
|
.setDescription("I successfully send the rules in " + channel.getAsMention() + ".")
|
||||||
|
.build()).queue();
|
||||||
|
} catch (Exception e) {
|
||||||
|
event5.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Error")
|
||||||
|
.setDescription("I can not access the custom emote(s),")
|
||||||
|
.build()).queue();
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
event.getRethink().updateRules(event.getGuild().getId(), rules.getId(), role.getId(), aemote.toString(), demote.toString());
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("Emotes are equal")
|
||||||
|
.setDescription("The 1st and 2nd emote equals each other.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}, event.getJDA(), event.getAuthor());
|
||||||
|
} else {
|
||||||
|
String aemote = event4.getMessage().getContentRaw();
|
||||||
|
event4.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Custom Decline Emote")
|
||||||
|
.setDescription("The first emote has been successfully set. Please send me now the decline emote.")
|
||||||
|
.build()).queue();
|
||||||
|
new EventWaiter().newOnMessageEventWaiter(event5 -> {
|
||||||
|
String demote = event5.getMessage().getContentRaw();
|
||||||
|
if (!aemote.equals(demote)) {
|
||||||
|
Message rules = channel.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Rules")
|
||||||
|
.setDescription(message)
|
||||||
|
.build()).complete();
|
||||||
|
try {
|
||||||
|
rules.addReaction(aemote).queue();
|
||||||
|
rules.addReaction(demote).queue();
|
||||||
|
event5.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Successfully set the rules")
|
||||||
|
.setDescription("I successfully send the rules in " + channel.getAsMention() + ".")
|
||||||
|
.build()).queue();
|
||||||
|
} catch (Exception e) {
|
||||||
|
event5.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.ERROR)
|
||||||
|
.setTitle("Error")
|
||||||
|
.setDescription("The given emote can't be used.")
|
||||||
|
.build()).queue();
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
event.getRethink().updateRules(event.getGuild().getId(), rules.getId(), role.getId(), aemote, demote);
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("Emotes are equal")
|
||||||
|
.setDescription("The 1st and 2nd emote equals each other.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}, event.getJDA(), event.getAuthor());
|
||||||
|
}
|
||||||
|
}, event.getJDA(), event.getAuthor());
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"rules", "rule", "setup"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Setup the rules on your Discord server";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
55
src/main/java/com/bbn/hadder/commands/music/JoinCommand.java
Normal file
55
src/main/java/com/bbn/hadder/commands/music/JoinCommand.java
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
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();
|
||||||
|
event.getGuild().getAudioManager().openAudioConnection(vc);
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Successfully connected")
|
||||||
|
.setDescription("I successfully connected to " + vc.getName() + ".")
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("Already trying to connect")
|
||||||
|
.setDescription("Hadder is already trying to connect. Please wait a moment.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("No Voice Channel")
|
||||||
|
.setDescription("You aren't in a Voice Channel.")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"join"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Joins your voice channel";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Successfully disconnected")
|
||||||
|
.setDescription("I successfully disconnected from the Voice Channel")
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING)
|
||||||
|
.setTitle("Not connected")
|
||||||
|
.setDescription("I'm currently in no Voice Channel on this Guild")
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"leave"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Leaves a voice channel";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Anal")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"anal"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random anal gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("Image not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("BDSM")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"bdsm"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random bdsm picture.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("Image not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Blowjob")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"blowjob"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random Blowjob picture.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Boobs")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"boobs", "boob", "tits"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random boob gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Cum")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"cum"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random cum gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("Image not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Erotic")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"erotic"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random erotic picture.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Feet")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"feet"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random feet gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Fingering")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"fingering"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random fingering gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Licking")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"licking"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random licking gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Porn")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"porn"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random porn gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Pussy")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"pussy"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random pussy gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Random Porn")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"randomporn", "pornrandom"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a completely random porn gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Solo")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"solo"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random solo gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
63
src/main/java/com/bbn/hadder/commands/nsfw/SpankCommand.java
Normal file
63
src/main/java/com/bbn/hadder/commands/nsfw/SpankCommand.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 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("GIF not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Spank")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"spank", "beat", "hit"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random spank gif.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
59
src/main/java/com/bbn/hadder/commands/nsfw/TransCommand.java
Normal file
59
src/main/java/com/bbn/hadder/commands/nsfw/TransCommand.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 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor("Image not showing? Click here", url.replace("\"}", ""))
|
||||||
|
.setImage(url.replace("\"}", ""))
|
||||||
|
.setFooter("Trans")
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING).setTitle("No NSFW").setDescription("You can only execute this command in NSFW channels!").build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"trans"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shows a random trans picture.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
101
src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java
Normal file
101
src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
public class EvalCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
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("shradmanager", 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(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Eval Command")
|
||||||
|
.addField("Input", "```java\n\n" + script + "```", false)
|
||||||
|
.addField("Output", "```java\n\n" + out.toString() + "```", false)
|
||||||
|
.addField("Timing", System.currentTimeMillis()-startExec + " milliseconds", false)
|
||||||
|
.build()).queue();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Eval Command")
|
||||||
|
.addField("Error", "```java\n\n" + ex.getMessage() + "```", false)
|
||||||
|
.addField("Timing", System.currentTimeMillis()-startExec + " milliseconds", false)
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
service.shutdownNow();
|
||||||
|
|
||||||
|
}, 0, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"eval"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Execute the given code";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<Code to execute>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
|
||||||
|
public class GuildLeaveCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
if (args.length > 0) {
|
||||||
|
Guild guild = event.getJDA().getGuildById(args[0]);
|
||||||
|
guild.leave().queue();
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Successfully left")
|
||||||
|
.setDescription("I successfully left " + guild.getName())
|
||||||
|
.build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"guildleave"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Quit from a guild";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<Guild-ID>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
|
||||||
|
|
||||||
|
public class RebootCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
Runtime.getRuntime().exit(69);
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"restart", "restart"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Restart the bot";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
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.utils.MessageEditor;
|
||||||
|
|
||||||
|
public class ShutdownCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("Shutdown").build()).queue();
|
||||||
|
event.getJDA().getShardManager().shutdown();
|
||||||
|
System.out.println("Bot shut down via Command...");
|
||||||
|
Runtime.getRuntime().exit(69);
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"shutdown", "exit"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Shuts the Bot down";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
Normal file
31
src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.bbn.hadder.commands.owner;
|
||||||
|
|
||||||
|
import com.bbn.hadder.commands.Command;
|
||||||
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author Skidder / GregTCLTK
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestCommand implements Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
event.getTextChannel().sendMessage("TEST my friends").queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"test"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Just a little Test Command";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
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 PrefixCommand implements Command {
|
||||||
|
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
if (args.length == 1) {
|
||||||
|
event.getRethink().setUserPrefix(args[0], event.getAuthor().getId());
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO).setTitle("✅ Successfully set ✅").setDescription("I successfully set the new prefix for you to " + args[0]).build()).queue();
|
||||||
|
} else {
|
||||||
|
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"prefix"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return "Sets a new Prefix";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return "<New Prefix>";
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/main/java/com/bbn/hadder/core/CommandHandler.java
Normal file
43
src/main/java/com/bbn/hadder/core/CommandHandler.java
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
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 net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|
||||||
|
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];
|
||||||
|
cmd.executed(args, new CommandEvent(event, config, rethink, this, helpCommand));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Command> getCommandList() {
|
||||||
|
return commandList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +1,4 @@
|
||||||
/*
|
package com.bbn.hadder.core;
|
||||||
* 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;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONStringer;
|
import org.json.JSONStringer;
|
||||||
|
|
@ -70,22 +54,16 @@ public class Config {
|
||||||
.key("Tokens").object()
|
.key("Tokens").object()
|
||||||
.key("BotToken").value(null)
|
.key("BotToken").value(null)
|
||||||
.key("Giphy").value(null)
|
.key("Giphy").value(null)
|
||||||
.key("GitHub").value(null)
|
|
||||||
.key("MythicalBotList").value(null)
|
.key("MythicalBotList").value(null)
|
||||||
.key("BotsForDiscord").value(null)
|
.key("BotsForDiscord").value(null)
|
||||||
.key("DiscordBotList").value(null)
|
.key("DiscordBotList").value(null)
|
||||||
|
.key("DiscordBestBots").value(null)
|
||||||
.key("DiscordBoats").value(null)
|
.key("DiscordBoats").value(null)
|
||||||
.key("YetAnotherBotList").value(null)
|
.key("YetAnotherBotList").value(null)
|
||||||
.key("DiscordExtremeList").value(null)
|
.value("DiscordExtremeList").value(null)
|
||||||
.key("DiscordBotReviews").value(null)
|
.value("DiscordBotReviews").value(null)
|
||||||
.key("DiscordBots").value(null)
|
.value("DiscordBots").value(null)
|
||||||
.key("BotListSpace").value(null)
|
.endObject().endObject().toString();
|
||||||
.key("DiscordBots2").value(null)
|
|
||||||
.key("CloudList").value(null)
|
|
||||||
.key("Arcane").value(null)
|
|
||||||
.endObject()
|
|
||||||
.key("Clyde").value("Clyde")
|
|
||||||
.endObject().toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBotToken() {
|
public String getBotToken() {
|
||||||
|
|
@ -136,6 +114,10 @@ public class Config {
|
||||||
return config.getJSONObject("Tokens").getString("DiscordBotList");
|
return config.getJSONObject("Tokens").getString("DiscordBotList");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDiscordBestBotsToken() {
|
||||||
|
return config.getJSONObject("Tokens").getString("DiscordBestBots");
|
||||||
|
}
|
||||||
|
|
||||||
public String getDiscordBoatsToken() {
|
public String getDiscordBoatsToken() {
|
||||||
return config.getJSONObject("Tokens").getString("DiscordBoats");
|
return config.getJSONObject("Tokens").getString("DiscordBoats");
|
||||||
}
|
}
|
||||||
|
|
@ -148,6 +130,10 @@ public class Config {
|
||||||
return config.getJSONObject("Tokens").getString("DiscordExtremeList");
|
return config.getJSONObject("Tokens").getString("DiscordExtremeList");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDiscordBotReviewsToken() {
|
||||||
|
return config.getJSONObject("Tokens").getString("DiscordBotReviews");
|
||||||
|
}
|
||||||
|
|
||||||
public String getDiscordBotsToken() {
|
public String getDiscordBotsToken() {
|
||||||
return config.getJSONObject("Tokens").getString("DiscordBots");
|
return config.getJSONObject("Tokens").getString("DiscordBots");
|
||||||
}
|
}
|
||||||
|
|
@ -155,20 +141,4 @@ public class Config {
|
||||||
public String getBotListSpaceToken() {
|
public String getBotListSpaceToken() {
|
||||||
return config.getJSONObject("Tokens").getString("BotListSpace");
|
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
95
src/main/java/com/bbn/hadder/core/LinkUtils.java
Normal file
95
src/main/java/com/bbn/hadder/core/LinkUtils.java
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.bbn.hadder.core;
|
||||||
|
|
||||||
|
import club.minnced.discord.webhook.WebhookClient;
|
||||||
|
import club.minnced.discord.webhook.WebhookClientBuilder;
|
||||||
|
import club.minnced.discord.webhook.send.WebhookEmbed;
|
||||||
|
import club.minnced.discord.webhook.send.WebhookMessageBuilder;
|
||||||
|
import com.bbn.hadder.Rethink;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
import net.dv8tion.jda.api.JDA;
|
||||||
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
import net.dv8tion.jda.api.entities.*;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public class LinkUtils {
|
||||||
|
|
||||||
|
public void sendAll(JSONArray jsonArray, JDA jda, Message message, User user, List<String> reactions, Rethink rethink, boolean usedmessagebuilder) {
|
||||||
|
for (int i = 0; jsonArray.length() > i; i++) {
|
||||||
|
this.send(message, jda.getTextChannelById(rethink.getLinkChannel(jsonArray.getString(i))), user, reactions, usedmessagebuilder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void send(Message message, TextChannel channel, User user, List<String> reactions, boolean usedmessagebuilder) {
|
||||||
|
if (!channel.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) {
|
||||||
|
channel.sendMessage(new EmbedBuilder().setTitle("Wait a sec").setDescription("Please contact the owner of the server to give me the Manage Webhooks permission").build()).queue();
|
||||||
|
} else {
|
||||||
|
channel.retrieveWebhooks().queue(
|
||||||
|
webhooks -> {
|
||||||
|
Webhook webhook = null;
|
||||||
|
for (Webhook webhooktemp : webhooks) {
|
||||||
|
if (webhooktemp.getOwner().equals(channel.getGuild().getSelfMember())) {
|
||||||
|
webhook = webhooktemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (webhook == null) {
|
||||||
|
channel.createWebhook("Hadder GuildLink").queue(
|
||||||
|
webhook1 -> sendMessage(webhook1, channel, user, message, reactions, usedmessagebuilder)
|
||||||
|
);
|
||||||
|
} else sendMessage(webhook, channel, user, message, reactions, usedmessagebuilder);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendMessage(Webhook webhook, TextChannel channel, User user, Message message, List<String> reactions, boolean usedmessagebuilder) {
|
||||||
|
WebhookClientBuilder builder = new WebhookClientBuilder(webhook.getUrl());
|
||||||
|
WebhookClient client = builder.build();
|
||||||
|
WebhookMessageBuilder mb = new WebhookMessageBuilder();
|
||||||
|
mb.setUsername(user.getName())
|
||||||
|
.setAvatarUrl((user.getAvatarUrl()!=null) ? user.getAvatarUrl() : user.getDefaultAvatarUrl())
|
||||||
|
.setContent(message.getContentRaw());
|
||||||
|
if (!usedmessagebuilder) {
|
||||||
|
for (Message.Attachment attachment : message.getAttachments()) {
|
||||||
|
try {
|
||||||
|
mb.addFile(attachment.getFileName(), attachment.retrieveInputStream().get());
|
||||||
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MessageEmbed embed : message.getEmbeds()) {
|
||||||
|
List<WebhookEmbed.EmbedField> fields = new ArrayList<>();
|
||||||
|
for (MessageEmbed.Field field : embed.getFields()) {
|
||||||
|
fields.add(new WebhookEmbed.EmbedField(field.isInline(), field.getName(), field.getValue()));
|
||||||
|
}
|
||||||
|
mb.addEmbeds(new WebhookEmbed(
|
||||||
|
embed.getTimestamp(), embed.getColorRaw(), embed.getDescription(),
|
||||||
|
(embed.getThumbnail()!=null) ? embed.getThumbnail().getUrl() : "", (embed.getImage()!=null) ? embed.getImage().getUrl() : "",
|
||||||
|
new WebhookEmbed.EmbedFooter((embed.getFooter()!=null) ? (embed.getFooter().getText()!=null) ? embed.getFooter().getText() : "" : "",
|
||||||
|
(embed.getFooter()!=null) ? embed.getFooter().getIconUrl():""),
|
||||||
|
new WebhookEmbed.EmbedTitle((embed.getTitle()!=null) ? embed.getTitle() : "", embed.getUrl()),
|
||||||
|
new WebhookEmbed.EmbedAuthor((embed.getAuthor()!=null) ? (embed.getAuthor().getName() != null) ? embed.getAuthor().getName() : "" : "",
|
||||||
|
(embed.getAuthor()!=null) ? (embed.getAuthor().getIconUrl()!=null) ? embed.getAuthor().getIconUrl(): "" : "",
|
||||||
|
(embed.getAuthor()!=null) ? embed.getAuthor().getUrl() : ""), fields));
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
long msgid = client.send(mb.build()).get().getId();
|
||||||
|
channel.retrieveMessageById(msgid).queue(
|
||||||
|
msg -> {
|
||||||
|
for (String reaction: reactions) {
|
||||||
|
msg.addReaction(reaction).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
35
src/main/java/com/bbn/hadder/listener/CommandListener.java
Normal file
35
src/main/java/com/bbn/hadder/listener/CommandListener.java
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
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()};
|
||||||
|
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().setDefaultSettings(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().setDefaultSettings(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,97 @@
|
||||||
|
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.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/")) {
|
||||||
|
if (!event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
||||||
|
String split = event.getMessage().getContentRaw().split("discord.gg/", 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\":")) {
|
||||||
|
event.getMessage().delete().reason("Invite Link detected").queue();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (event.getMessage().getContentRaw().contains("discordapp.com/invite") && !event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
||||||
|
String split = event.getMessage().getContentRaw().split("discordapp.com/invite/", 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\":")) {
|
||||||
|
event.getMessage().delete().reason("Invite Link detected").queue();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageUpdate(@Nonnull MessageUpdateEvent event) {
|
||||||
|
if (event.isFromType(ChannelType.TEXT) && event.getMessage().getContentRaw().contains("discord.gg/") && !event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
||||||
|
String split = event.getMessage().getContentRaw().split("discord.gg/", 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\":")) {
|
||||||
|
event.getMessage().delete().reason("Invite Link detected").queue();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else if (event.getMessage().getContentRaw().contains("discordapp.com/invite") && !event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
||||||
|
String split = event.getMessage().getContentRaw().split("discordapp.com/invite/", 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\":")) {
|
||||||
|
event.getMessage().delete().reason("Invite Link detected").queue();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
73
src/main/java/com/bbn/hadder/listener/LinkListener.java
Normal file
73
src/main/java/com/bbn/hadder/listener/LinkListener.java
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.bbn.hadder.listener;
|
||||||
|
|
||||||
|
import com.bbn.hadder.Rethink;
|
||||||
|
import com.bbn.hadder.core.LinkUtils;
|
||||||
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
import net.dv8tion.jda.api.entities.ChannelType;
|
||||||
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class LinkListener extends ListenerAdapter {
|
||||||
|
|
||||||
|
private Rethink rethink;
|
||||||
|
|
||||||
|
public LinkListener(Rethink rethink) {
|
||||||
|
this.rethink = rethink;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent event) {
|
||||||
|
event.getChannel().retrieveMessageById(event.getMessageId()).queue(
|
||||||
|
msg -> {
|
||||||
|
if (!event.getMember().getUser().equals(event.getJDA().getSelfUser()) && msg.getAuthor().equals(event.getJDA().getSelfUser()) && msg.getEmbeds().size() == 1 && msg.getEmbeds().get(0).getFooter() == null && msg.getEmbeds().get(0).getTitle().endsWith(") wants to link guilds!")) {
|
||||||
|
if (event.getMember().hasPermission(Permission.MANAGE_CHANNEL)) {
|
||||||
|
String requestguild = msg.getEmbeds().get(0).getTitle().replaceAll("\\) wants to link guilds!", "");
|
||||||
|
String requestguildid = null;
|
||||||
|
for (int i = requestguild.length() - 1; i >= 0; i--) {
|
||||||
|
if (String.valueOf(requestguild.charAt(i)).equals("(")) {
|
||||||
|
requestguildid = requestguild.substring(i + 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestguildid != null) {
|
||||||
|
if (event.getReactionEmote().getName().equals("✅")) {
|
||||||
|
rethink.addLinkedGuild(event.getGuild().getId(), requestguildid);
|
||||||
|
rethink.addLinkedGuild(requestguildid, event.getGuild().getId());
|
||||||
|
|
||||||
|
msg.delete().queue();
|
||||||
|
|
||||||
|
MessageEmbed msgembed = new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Guilds linked!").setDescription("The Guild allowed the link. Have fun!").build();
|
||||||
|
event.getChannel().sendMessage(msgembed).queue();
|
||||||
|
event.getJDA().getTextChannelById(rethink.getLinkChannel(requestguildid)).sendMessage(msgembed).queue();
|
||||||
|
} else if (event.getReactionEmote().getName().equals("❌")) {
|
||||||
|
msg.delete().queue();
|
||||||
|
|
||||||
|
MessageEmbed msgembed = new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO)
|
||||||
|
.setTitle("Guild linking denied.").setDescription("The Guild denied the linking. :(").build();
|
||||||
|
event.getChannel().sendMessage(msgembed).queue();
|
||||||
|
event.getJDA().getTextChannelById(rethink.getLinkChannel(requestguildid)).sendMessage(msgembed).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.NO_PERMISSION).build()).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
||||||
|
if (!event.isWebhookMessage() && event.getChannel().getId().equals(rethink.getLinkChannel(event.getGuild().getId())) && event.isFromType(ChannelType.TEXT)) {
|
||||||
|
new LinkUtils().sendAll(rethink.getLinks(event.getGuild().getId()), event.getJDA(), event.getMessage(), event.getAuthor(), new ArrayList<>() {
|
||||||
|
}, rethink, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
32
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
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.getChannel().sendMessage(new MessageEditor().setDefaultSettings(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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bbn.hadder.listener;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author Skidder / GregTCLTK
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 {
|
||||||
|
|
||||||
|
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().setDefaultSettings(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().setDefaultSettings(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 {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
62
src/main/java/com/bbn/hadder/utils/MessageEditor.java
Normal file
62
src/main/java/com/bbn/hadder/utils/MessageEditor.java
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.bbn.hadder.utils;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
public class MessageEditor {
|
||||||
|
|
||||||
|
public EmbedBuilder setDefaultSettings(MessageType type) {
|
||||||
|
EmbedBuilder builder = new EmbedBuilder();
|
||||||
|
switch (type) {
|
||||||
|
case INFO:
|
||||||
|
builder
|
||||||
|
.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://bigbotnetwork.com/images/Hadder.png")
|
||||||
|
.setTimestamp(Instant.now());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WARNING:
|
||||||
|
builder
|
||||||
|
.setColor(Color.ORANGE)
|
||||||
|
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||||
|
.setTimestamp(Instant.now());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NO_PERMISSION:
|
||||||
|
builder
|
||||||
|
.setTitle("⛔ No Permission ⛔")
|
||||||
|
.setDescription("You are not authorized to execute this command!")
|
||||||
|
.setColor(Color.RED)
|
||||||
|
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||||
|
.setTimestamp(Instant.now());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NO_SELF_PERMISSION:
|
||||||
|
builder
|
||||||
|
.setTitle("⛔ No Permission ⛔")
|
||||||
|
.setDescription("Unfortunately, I do not have the required rights to perform this action")
|
||||||
|
.setColor(Color.RED)
|
||||||
|
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||||
|
.setTimestamp(Instant.now());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum MessageType {
|
||||||
|
ERROR,
|
||||||
|
WARNING,
|
||||||
|
INFO,
|
||||||
|
NO_PERMISSION,
|
||||||
|
NO_SELF_PERMISSION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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,80 +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.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class GifCommand implements Command {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void executed(String[] args, CommandEvent e) {
|
|
||||||
if (args.length > 0) {
|
|
||||||
StringBuilder query = new StringBuilder();
|
|
||||||
for (String arg : args) {
|
|
||||||
query.append(arg.toLowerCase()).append("+");
|
|
||||||
query = new StringBuilder(query.substring(0, query.length() - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
try {
|
|
||||||
Random rand = new Random();
|
|
||||||
Response response = client.newCall(request).execute();
|
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
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(
|
|
||||||
MessageEditor.MessageType.ERROR,
|
|
||||||
"error",
|
|
||||||
"commands.fun.gif.error.description").build()).queue();
|
|
||||||
}
|
|
||||||
} else e.getHelpCommand().sendHelp(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] labels() {
|
|
||||||
return new String[]{"gif"};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String description() {
|
|
||||||
return "commands.fun.gif.help.description";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String usage() {
|
|
||||||
return "[term]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String example() {
|
|
||||||
return "cute cat";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue