Compare commits
No commits in common. "master" and "v0.6-alpha" have entirely different histories.
master
...
v0.6-alpha
144 changed files with 1416 additions and 11113 deletions
|
|
@ -1,3 +0,0 @@
|
|||
.github/
|
||||
target/
|
||||
.idea/
|
||||
28
.gitattributes
vendored
28
.gitattributes
vendored
|
|
@ -1,28 +0,0 @@
|
|||
# Java sources
|
||||
*.java text diff=java
|
||||
*.gradle text diff=java
|
||||
*.gradle.kts text diff=java
|
||||
|
||||
# These files are text and should be normalized (Convert crlf => lf)
|
||||
*.css text diff=css
|
||||
*.df text
|
||||
*.htm text diff=html
|
||||
*.html text diff=html
|
||||
*.js text
|
||||
*.jsp text
|
||||
*.jspf text
|
||||
*.jspx text
|
||||
*.properties text
|
||||
*.tld text
|
||||
*.tag text
|
||||
*.tagx text
|
||||
*.xml text
|
||||
|
||||
# These files are binary and should be left untouched
|
||||
# (binary is a macro for -text -diff)
|
||||
*.class binary
|
||||
*.dll binary
|
||||
*.ear binary
|
||||
*.jar binary
|
||||
*.so binary
|
||||
*.war binary
|
||||
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
|
@ -1 +0,0 @@
|
|||
* @GregTCLTK @Schlauer-Hax
|
||||
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: Bug report
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- Discord version: [e.g. Discord PTB]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
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
|
||||
56
.github/workflows/maven.yml
vendored
56
.github/workflows/maven.yml
vendored
|
|
@ -1,56 +0,0 @@
|
|||
name: Hadder
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: Set up JDK 15
|
||||
uses: actions/setup-java@v1.4.3
|
||||
with:
|
||||
java-version: '15'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: Set up JDK 15
|
||||
uses: actions/setup-java@v1.4.3
|
||||
with:
|
||||
java-version: '15'
|
||||
- name: Build Final Jar
|
||||
run: mvn clean compile assembly:single
|
||||
- name: Copy folder content recursively to remote
|
||||
uses: garygrossgarten/github-action-scp@release
|
||||
with:
|
||||
local: ./target/Hadder-Build.jar
|
||||
remote: /root/bots/Hadder/Hadder-Build.jar
|
||||
host: ${{ secrets.HOST }}
|
||||
port: ${{ secrets.PORT }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
- name: executing remote ssh commands using password
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
port: ${{ secrets.PORT }}
|
||||
script: /root/bots/Hadder/deploy.sh
|
||||
- name: Send Webhook Notification
|
||||
if: always()
|
||||
env:
|
||||
JOB_STATUS: ${{ job.status }}
|
||||
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
||||
HOOK_OS_NAME: ${{ runner.os }}
|
||||
WORKFLOW_NAME: ${{ github.workflow }}
|
||||
run: |
|
||||
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
|
||||
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
|
||||
shell: bash
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -22,11 +22,12 @@
|
|||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# IDE Files
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
.settings/
|
||||
|
||||
.vscode/
|
||||
|
||||
config.json
|
||||
|
||||
.project
|
||||
|
|
|
|||
24
.travis.yml
Normal file
24
.travis.yml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
language: java
|
||||
jdk:
|
||||
- openjdk12
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- sshpass
|
||||
|
||||
after_success:
|
||||
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
|
||||
- chmod +x send.sh
|
||||
- ./send.sh success $WEBHOOK_URL
|
||||
- mvn clean compile assembly:single
|
||||
- cd target
|
||||
- sshpass -p $SFTP_PASSWORD scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r Hadder-Build.jar $SFTP_USER@$SFTP_IP:/home/Bots/Hadder-Build.jar
|
||||
- echo $?
|
||||
- sshpass -p $SFTP_PASSWORD ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $SFTP_IP /home/Bots/deploy.sh
|
||||
- echo $?
|
||||
|
||||
after_failure:
|
||||
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
|
||||
- chmod +x send.sh
|
||||
- ./send.sh failure $WEBHOOK_URL
|
||||
|
|
@ -57,7 +57,7 @@ If a community member engages in unacceptable behavior, the community organizers
|
|||
|
||||
## 7. Reporting Guidelines
|
||||
|
||||
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. admin@bbn.one.
|
||||
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. admin@bigbotnetwork.de.
|
||||
|
||||
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ Additionally, community organizers are available to help community members engag
|
|||
|
||||
## 8. Addressing Grievances
|
||||
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify BBN with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify BigBotNetwork with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
|
||||
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ This code of conduct and its related procedures also applies to unacceptable beh
|
|||
|
||||
## 10. Contact info
|
||||
|
||||
admin@bbn.one
|
||||
admin@bigbotnetwork.de
|
||||
|
||||
## 11. License and attribution
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ further defined and clarified by project maintainers.
|
|||
### Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team on [Discord](https://discordapp.com/invite/nPwjaJk). All
|
||||
reported by contacting the project team on [Discord](https://discordapp.com/invite/Vf4zCYn). All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
FROM debian:buster
|
||||
WORKDIR /home/Hadder
|
||||
682
LICENSE
682
LICENSE
|
|
@ -1,661 +1,21 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Big Bot Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
|
|||
64
README.md
64
README.md
|
|
@ -1,61 +1,3 @@
|
|||
# Hadder
|
||||
|
||||
Hadder Discord is a multi-purpose Discord bot with 100% uptime.
|
||||
|
||||
<a href="https://discord.gg/nPwjaJk"><img src="https://discord.com/api/guilds/757966278936756345/embed.png"/></a>
|
||||
[](https://github.com/BBN-Holding/Hadder)
|
||||
[](https://www.codacy.com/gh/BBN-Holding/Hadder?utm_source=github.com&utm_medium=referral&utm_content=BBN-Holding/Hadder&utm_campaign=Badge_Grade)
|
||||
[](https://www.codefactor.io/repository/github/bigbotnetwork/hadder)
|
||||
[](https://bbn.crowdin.com/hadder)
|
||||
[](https://github.com/BBN-Holding/Hadder/issues)
|
||||
[](https://github.com/BBN-Holding/Hadder/blob/master/LICENSE)
|
||||
[](https://wakatime.com/badge/github/BBN-Holding/Hadder)
|
||||
|
||||
## 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 |
|
||||
# Hadder
|
||||
|
||||
[](https://travis-ci.com/BigBotNetwork/Hadder)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
theme: jekyll-theme-cayman
|
||||
|
|
@ -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
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"Owners": [
|
||||
],
|
||||
"Database": {
|
||||
"IP": "",
|
||||
"Port": 6775,
|
||||
"DBName": "",
|
||||
"Username": "",
|
||||
"Password": ""
|
||||
},
|
||||
"Tokens": {
|
||||
"BotToken": "",
|
||||
"Giphy": "",
|
||||
"GitHub": ""
|
||||
},
|
||||
"Clyde": ""
|
||||
}
|
||||
268
pom.xml
268
pom.xml
|
|
@ -1,138 +1,148 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Hadder</groupId>
|
||||
<artifactId>Hadder</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<name>Hadder</name>
|
||||
<inceptionYear>2019</inceptionYear>
|
||||
<description>Hadder is a multi-purpose Discord bot.</description>
|
||||
<url>https://github.com/BBN-Holding/Hadder</url>
|
||||
<groupId>Hadder</groupId>
|
||||
<artifactId>Hadder</artifactId>
|
||||
<version>0.3-ALPHA</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU Affero General Public License v3.0</name>
|
||||
<url>https://www.gnu.org/licenses/agpl-3.0.en.html</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<name>Hadder</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.15</maven.compiler.source>
|
||||
<maven.compiler.target>1.15</maven.compiler.target>
|
||||
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
|
||||
</properties>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.13</maven.compiler.source>
|
||||
<maven.compiler.target>1.13</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>Hax#6775</id>
|
||||
<name>Hax</name>
|
||||
<email>hax@bbn.one</email>
|
||||
<url>https://bbn.one/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/261083609148948488/f2c9efc629ef65fffa634f0d63cd467e.webp
|
||||
</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>Skidder#6775</id>
|
||||
<name>Greg</name>
|
||||
<email>skidder@bbn.one</email>
|
||||
<url>https://bbn.one/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/401817301919465482/a_f81bd03e3862de579dec59241714d86d.gif
|
||||
</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
</developers>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.rethinkdb</groupId>
|
||||
<artifactId>rethinkdb-driver</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.29</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.29</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dv8tion</id>
|
||||
<name>m2-dv8tion</name>
|
||||
<url>https://m2.dv8tion.net/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>3.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.4.0_352</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20220924</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>club.minnced</groupId>
|
||||
<artifactId>discord-webhooks</artifactId>
|
||||
<version>0.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.313</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
<artifactId>lavaplayer</artifactId>
|
||||
<version>1.3.78</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongodb-driver-sync</artifactId>
|
||||
<version>4.7.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>Hadder-Build</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>one.bbn.hadder.Hadder</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<configuration>
|
||||
<finalName>Hadder-Build</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.bbn.hadder.Hadder</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>13</source>
|
||||
<target>13</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>12</source>
|
||||
<target>12</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>
|
||||
|
|
|
|||
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/EN_TRANSLATION.properties
Normal file
0
src/main/Translations/EN_TRANSLATION.properties
Normal file
71
src/main/java/com/bbn/hadder/Hadder.java
Normal file
71
src/main/java/com/bbn/hadder/Hadder.java
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
package com.bbn.hadder;
|
||||
|
||||
import com.bbn.hadder.commands.general.*;
|
||||
import com.bbn.hadder.commands.fun.GifCommand;
|
||||
import com.bbn.hadder.commands.misc.GitHubCommand;
|
||||
import com.bbn.hadder.commands.moderation.*;
|
||||
import com.bbn.hadder.commands.owner.RebootCommand;
|
||||
import com.bbn.hadder.commands.owner.ShutdownCommand;
|
||||
import com.bbn.hadder.commands.owner.TestCommand;
|
||||
import com.bbn.hadder.commands.settings.PrefixCommand;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
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 org.json.JSONObject;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
public class Hadder {
|
||||
|
||||
public static ShardManager shardManager;
|
||||
|
||||
public static void main(String[] args) {
|
||||
startBot();
|
||||
}
|
||||
|
||||
public static void startBot() {
|
||||
File configfile = new File("./config.json");
|
||||
if (!configfile.exists()) {
|
||||
System.err.println("No Config File Found!");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
JSONObject config = null;
|
||||
try {
|
||||
config = new JSONObject(new String(Files.readAllBytes(Paths.get(configfile.toURI()))));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Rethink.connect();
|
||||
|
||||
DefaultShardManagerBuilder builder = new DefaultShardManagerBuilder();
|
||||
|
||||
builder.setShardsTotal(1);
|
||||
builder.setActivity(Activity.streaming("on the BigBotNetwork", "https://twitch.tv/BigBotNetwork"));
|
||||
builder.setToken(config.getString("Token"));
|
||||
|
||||
|
||||
CommandHandler.cmdlist.addAll(List.of(new HelpCommand(), new TestCommand(), new BanCommand(), new PrefixCommand(), new ShutdownCommand(), new KickCommand(), new PingCommand(), new GifCommand(), new ClearCommand(), new GitHubCommand(), new RebootCommand()));
|
||||
|
||||
builder.addEventListeners(
|
||||
new MentionListener(),
|
||||
new PrivateMessageListener(),
|
||||
new CommandListener(),
|
||||
new GuildListener(),
|
||||
new ReadyListener());
|
||||
|
||||
try {
|
||||
shardManager = builder.build();
|
||||
} catch (LoginException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
104
src/main/java/com/bbn/hadder/Rethink.java
Normal file
104
src/main/java/com/bbn/hadder/Rethink.java
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
package com.bbn.hadder;
|
||||
|
||||
import com.google.gson.JsonParser;
|
||||
import com.rethinkdb.RethinkDB;
|
||||
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
||||
import com.rethinkdb.net.Connection;
|
||||
import com.rethinkdb.net.Cursor;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public class Rethink {
|
||||
private static RethinkDB r = RethinkDB.r;
|
||||
static Connection conn;
|
||||
|
||||
public static boolean connect() {
|
||||
try {
|
||||
conn = r.connection().hostname("127.0.0.1").db("Hadder").port(28015).connect();
|
||||
System.out.println("DB CONNECTED");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.toString());
|
||||
System.out.println("DB CONNECTION FAILED");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void disconnect() {
|
||||
conn.close();
|
||||
System.out.println("DISCONNECTED");
|
||||
}
|
||||
|
||||
public static String get(String table, String where, String value, String column) {
|
||||
try {
|
||||
Cursor cursor = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).run(conn);
|
||||
if (cursor.hasNext()) {
|
||||
String sad = new JsonParser().parse(cursor.next().toString()).getAsJsonObject().get(column).toString();
|
||||
if (sad.startsWith("\"") && sad.endsWith("\"")) {
|
||||
return sad.substring(1, sad.length()-1);
|
||||
} else {
|
||||
return sad;
|
||||
}
|
||||
} else return null;
|
||||
} catch (NoSuchElementException e) {
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "<3";
|
||||
}
|
||||
|
||||
public static String update(String table, String whatvalue, String where, String wherevalue) {
|
||||
String out="";
|
||||
try {
|
||||
Cursor cursor = r.table(table).get(whatvalue).update(r.hashMap(where, wherevalue)).run(conn);
|
||||
out=cursor.toString();
|
||||
} catch (ClassCastException ignored) {}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static String insertServer(String id) {
|
||||
String out = "";
|
||||
try {
|
||||
Cursor cursor = r.table("server")
|
||||
.insert(r.hashMap("id", id)
|
||||
).run(conn);
|
||||
out = cursor.next().toString();
|
||||
} catch (ClassCastException ignored) {}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static String insertUser(String id) {
|
||||
String out = "";
|
||||
try {
|
||||
Cursor cursor = r.table("user")
|
||||
.insert(r.hashMap("id", id)
|
||||
.with("prefix", "h.")
|
||||
).run(conn);
|
||||
out = cursor.next().toString();
|
||||
} catch (ClassCastException ignored) {}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static 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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
14
src/main/java/com/bbn/hadder/commands/Command.java
Normal file
14
src/main/java/com/bbn/hadder/commands/Command.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package com.bbn.hadder.commands;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public interface Command {
|
||||
void executed(String[] args, MessageReceivedEvent event);
|
||||
String[] labels();
|
||||
String description();
|
||||
String usage();
|
||||
}
|
||||
76
src/main/java/com/bbn/hadder/commands/fun/GifCommand.java
Normal file
76
src/main/java/com/bbn/hadder/commands/fun/GifCommand.java
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Random;
|
||||
|
||||
public class GifCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, MessageReceivedEvent 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));
|
||||
}
|
||||
|
||||
File configfile = new File("./config.json");
|
||||
|
||||
JSONObject config = null;
|
||||
try {
|
||||
config = new JSONObject(new String(Files.readAllBytes(Paths.get(configfile.toURI()))));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
OkHttpClient caller = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + config.getString("Giphy")).build();
|
||||
try {
|
||||
Random rand = new Random();
|
||||
Response response = caller.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) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.ERROR, builder).setTitle("Error").setDescription("Please try again with another term.").build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You have to write at least one search term!").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"gif"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Displays a gif";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0]+" <Searchterm>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HelpCommand implements Command {
|
||||
@Override
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
if (args.length == 0) {
|
||||
HashMap<String, ArrayList<Command>> hashMap = new HashMap<>();
|
||||
for (Command cmd : CommandHandler.cmdlist) {
|
||||
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("`" + cmd.labels()[0] + "`");
|
||||
if (i < entry.getValue().size() - 1) sb.append(", ");
|
||||
}
|
||||
String[] packagesplit = entry.getKey().split("\\.");
|
||||
eb.addField(packagesplit[packagesplit.length - 1], sb.toString(), false);
|
||||
}
|
||||
}
|
||||
new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, eb);
|
||||
event.getChannel().sendMessage(eb.build()).queue();
|
||||
} else {
|
||||
for (Command cmd : CommandHandler.cmdlist) {
|
||||
for (String label : cmd.labels()) {
|
||||
if (label.toLowerCase().equals(args[0])) {
|
||||
if (!cmd.getClass().getPackageName().endsWith("owner") || (cmd.getClass().getPackageName().endsWith("owner") && (event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().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.get("user", "id", event.getAuthor().getId(), "prefix") + cmd.usage(), false);
|
||||
new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, eb);
|
||||
event.getChannel().sendMessage(eb.build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"help"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Shows every Command or explains a Command";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "help [Commandname]";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bbn.hadder.commands.general;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class PingCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getJDA().getRestPing().queue(ping -> {
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).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 labels()[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
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, MessageReceivedEvent event) {
|
||||
if (args.length > 0) {
|
||||
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 e) {
|
||||
|
||||
}
|
||||
try {
|
||||
location = json.getString("location");
|
||||
} catch (JSONException e) {
|
||||
|
||||
}
|
||||
|
||||
if(!json.getString("blog").equals("")) website = json.getString("blog");
|
||||
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
|
||||
.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) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.ERROR, builder).setDescription("The GitHub API might be down at the moment!").build()).queue();
|
||||
} catch (JSONException e) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("This user does not exist!").build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You have to specify a user!").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"GitHub"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Shows info of an user";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0]+" <Username>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class BanCommand implements Command {
|
||||
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.BAN_MEMBERS) || event.getGuild().getOwner().getId().equals(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();
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("✅ Successfully banned ✅").setDescription("I successfully baned " + victim.getUser().getName() + ".").build()).queue();
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_SELF_PERMISSION, builder).build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("I can not ban myself").build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setTitle("Not possible").setDescription("You can't ban yourself.").build()).queue();
|
||||
}
|
||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You have to mention a user!").build()).queue();
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("We will be adding multiple banning within a command in the future.").build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_PERMISSION, builder).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"ban"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Bans an user";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0]+" <@User>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.time.temporal.ChronoUnit.DAYS;
|
||||
|
||||
public class ClearCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
if (args.length > 0) {
|
||||
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.MESSAGE_MANAGE) || event.getGuild().getOwnerId().equals(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) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).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();
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setDescription("Successfully deleted " + nbToDelete + " messages.").build()).queue();
|
||||
} catch (NumberFormatException e) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You have to specify a number!").build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_SELF_PERMISSION, builder).build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_PERMISSION, builder).build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You have to specify a number!").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"clear"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Clears messages";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0]+" <Number>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class KickCommand implements Command {
|
||||
@Override
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.KICK_MEMBERS) || event.getGuild().getOwnerId().equals(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();
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("✅ Successfully kicked ✅").setDescription("I successfully kicked " + victim.getUser().getName() + ".").build()).queue();
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_SELF_PERMISSION, builder).build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("I can not kick myself").build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You can't kick yourself.").build()).queue();
|
||||
}
|
||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You have to mention a user!").build()).queue();
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("We will be adding multiple kicking within a command in the future.").build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"kick"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Kicks an user";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0]+" <@User>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import static com.bbn.hadder.Hadder.startBot;
|
||||
|
||||
public class RebootCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
if (event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().getId().equals("261083609148948488")) {
|
||||
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_PERMISSION, builder).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"restart"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Restart the bot";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class ShutdownCommand implements Command {
|
||||
@Override
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
if (event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().getId().equals("261083609148948488")) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("Shutdown").build()).queue();
|
||||
event.getJDA().getShardManager().shutdown();
|
||||
System.out.println("Bot shut down via Command...");
|
||||
System.exit(0);
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_PERMISSION, builder).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"shutdown"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Shuts the Bot down";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0];
|
||||
}
|
||||
}
|
||||
34
src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
Normal file
34
src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
public class TestCommand implements Command {
|
||||
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
event.getTextChannel().sendMessage("TEST my friends").queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"test"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Sub to bbn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bbn.hadder.commands.settings;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
|
||||
public class PrefixCommand implements Command {
|
||||
public void executed(String[] args, MessageReceivedEvent event) {
|
||||
if (args.length == 1) {
|
||||
if (!args[0].contains("\"")) {
|
||||
|
||||
Rethink.update("user", event.getAuthor().getId(), "prefix", args[0]);
|
||||
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("✅ Successfully set ✅").setDescription("I successfully set the new prefix for you to " + args[0]).build()).queue();
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("The prefix must not contain **\"**").build()).queue();
|
||||
}
|
||||
} else {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.WARNING, builder).setDescription("You have to set a prefix.").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"prefix"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Changes the prefix";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return labels()[0]+" <New Prefix>";
|
||||
}
|
||||
}
|
||||
23
src/main/java/com/bbn/hadder/core/CommandHandler.java
Normal file
23
src/main/java/com/bbn/hadder/core/CommandHandler.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package com.bbn.hadder.core;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CommandHandler {
|
||||
|
||||
public static ArrayList<Command> cmdlist = new ArrayList<>();
|
||||
|
||||
public static void handleCommand(CommandParser.commandContainer cmd) {
|
||||
for (Command command : cmdlist) {
|
||||
for (String label : command.labels()) {
|
||||
if (label.toLowerCase().equals(cmd.invoke.toLowerCase())) command.executed(cmd.args, cmd.event);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
46
src/main/java/com/bbn/hadder/core/CommandParser.java
Normal file
46
src/main/java/com/bbn/hadder/core/CommandParser.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package com.bbn.hadder.core;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class CommandParser {
|
||||
public static commandContainer parser(String raw, MessageReceivedEvent event) {
|
||||
|
||||
String cmd = raw.replaceFirst(Rethink.get("user", "id", event.getAuthor().getId(), "prefix"), "");
|
||||
String[] cmdsplit = cmd.split(" ");
|
||||
String invoke = cmdsplit[0];
|
||||
ArrayList<String> split = new ArrayList<>();
|
||||
Collections.addAll(split, cmdsplit);
|
||||
String[] args = new String[split.size() - 1];
|
||||
split.subList(1, split.size()).toArray(args);
|
||||
|
||||
return new commandContainer(raw, cmd, cmdsplit, invoke, args, event);
|
||||
}
|
||||
|
||||
static class commandContainer {
|
||||
|
||||
final String raw;
|
||||
final String cmd;
|
||||
final String[] cmdsplit;
|
||||
final String invoke;
|
||||
final String[] args;
|
||||
final MessageReceivedEvent event;
|
||||
|
||||
commandContainer(String rw, String cmd, String[] cmdsplit, String invoke, String[] args, MessageReceivedEvent event) {
|
||||
this.raw = rw;
|
||||
this.cmd = cmd;
|
||||
this.cmdsplit = cmdsplit;
|
||||
this.invoke = invoke;
|
||||
this.args = args;
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
26
src/main/java/com/bbn/hadder/listener/CommandListener.java
Normal file
26
src/main/java/com/bbn/hadder/listener/CommandListener.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
import com.bbn.hadder.core.CommandParser;
|
||||
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 {
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(MessageReceivedEvent event) {
|
||||
if (event.isFromType(ChannelType.TEXT)) {
|
||||
if (!event.getAuthor().isBot()) {
|
||||
if (event.getMessage().getContentRaw().startsWith(Rethink.get("user", "id", event.getAuthor().getId(), "prefix"))) {
|
||||
CommandHandler.handleCommand(CommandParser.parser(event.getMessage().getContentRaw(), event));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
61
src/main/java/com/bbn/hadder/listener/GuildListener.java
Normal file
61
src/main/java/com/bbn/hadder/listener/GuildListener.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.utils.BotList;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
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 {
|
||||
|
||||
public void onGuildJoin(GuildJoinEvent event) {
|
||||
for (User user : event.getJDA().getUsers()) {
|
||||
if (!user.getId().equals(event.getJDA().getSelfUser().getId())) {
|
||||
Rethink.insertUser(user.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Rethink.insertServer(event.getGuild().getId());
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
|
||||
.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)
|
||||
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
|
||||
BotList.post();
|
||||
}
|
||||
|
||||
public void onGuildLeave(GuildLeaveEvent event) {
|
||||
EmbedBuilder builder = new EmbedBuilder();
|
||||
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
|
||||
.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)
|
||||
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
|
||||
BotList.post();
|
||||
}
|
||||
|
||||
public void onGuildMemberJoin(GuildMemberJoinEvent event) {
|
||||
if (!event.getUser().getId().equals(event.getJDA().getSelfUser().getId())) {
|
||||
Rethink.insertUser(event.getUser().getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
26
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
26
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
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 {
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
||||
if (event.isFromType(ChannelType.TEXT)) {
|
||||
if (event.getMessage().getContentRaw().equals(event.getGuild().getSelfMember().getAsMention())) {
|
||||
EmbedBuilder builder = new EmbedBuilder()
|
||||
.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);
|
||||
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
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)) {
|
||||
if (!event.getAuthor().getId().equals(event.getJDA().getSelfUser().getId())) {
|
||||
|
||||
PrivateChannel Skidder = event.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
|
||||
PrivateChannel Hax = event.getJDA().getUserById("261083609148948488").openPrivateChannel().complete();
|
||||
|
||||
EmbedBuilder message = new EmbedBuilder().setTitle("New DM by " + event.getAuthor().getAsTag()).setAuthor(event.getAuthor().getName(), event.getAuthor().getAvatarUrl(), event.getAuthor().getAvatarUrl()).setDescription(event.getMessage().getContentRaw()).setTimestamp(Instant.now());
|
||||
|
||||
Skidder.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, message).build()).queue();
|
||||
Hax.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, message).build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/main/java/com/bbn/hadder/listener/ReadyListener.java
Normal file
28
src/main/java/com/bbn/hadder/listener/ReadyListener.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package com.bbn.hadder.listener;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
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 {
|
||||
|
||||
@Override
|
||||
public void onReady(@Nonnull ReadyEvent event) {
|
||||
Rethink.setup();
|
||||
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.insertServer(g.getId());
|
||||
}
|
||||
|
||||
BotList.post();
|
||||
}
|
||||
}
|
||||
105
src/main/java/com/bbn/hadder/utils/BotList.java
Normal file
105
src/main/java/com/bbn/hadder/utils/BotList.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
package com.bbn.hadder.utils;
|
||||
|
||||
/*
|
||||
* @author Skidder / GregTCLTK
|
||||
*/
|
||||
|
||||
import com.bbn.hadder.Hadder;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
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 JSONObject json = new JSONObject();
|
||||
|
||||
public static void post() {
|
||||
json.put("server_count", Hadder.shardManager.getGuilds().size());
|
||||
json.put("guilds", Hadder.shardManager.getGuilds().size());
|
||||
json.put("users", Hadder.shardManager.getUsers().size());
|
||||
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), json.toString());
|
||||
|
||||
File configfile = new File("./config.json");
|
||||
|
||||
JSONObject config = null;
|
||||
try {
|
||||
config = new JSONObject(new String(Files.readAllBytes(Paths.get(configfile.toURI()))));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Mythical Bot List
|
||||
|
||||
Request mythicalbotlist = new Request.Builder()
|
||||
.url(MythicalBotList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getString("MythicalBotList"))
|
||||
.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.getString("BotsForDiscord"))
|
||||
.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.getString("DiscordBotList"))
|
||||
.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.getString("DiscordBestBots"))
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbestbots).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Best Bots!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
42
src/main/java/com/bbn/hadder/utils/MessageEditor.java
Normal file
42
src/main/java/com/bbn/hadder/utils/MessageEditor.java
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package com.bbn.hadder.utils;
|
||||
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class MessageEditor {
|
||||
|
||||
public EmbedBuilder setDefaultSettings(Messagetype type, EmbedBuilder embedBuilder) {
|
||||
switch (type) {
|
||||
case INFO:
|
||||
embedBuilder.setColor(new Color(47,94,105));
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
embedBuilder.setColor(Color.RED);
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
embedBuilder.setTitle("⚠ Warning ⚠").setColor(Color.ORANGE);
|
||||
break;
|
||||
|
||||
case NO_PERMISSION:
|
||||
embedBuilder.setTitle("⛔ No Permission ⛔").setDescription("You are not authorized to execute this command!").setColor(Color.RED);
|
||||
break;
|
||||
|
||||
case NO_SELF_PERMISSION:
|
||||
embedBuilder.setTitle("⛔ No Permission ⛔").setDescription("Unfortunately, I do not have the required rights to perform this action").setColor(Color.RED);
|
||||
break;
|
||||
}
|
||||
return embedBuilder;
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.EventWaiter;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ScreenShareCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].matches("[0-9]*") && args.length == 1 && args[0].length() == 18) {
|
||||
if (e.getGuild().getVoiceChannelById(args[0]) != null) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discord.com/channels/" + e.getGuild().getId() + "/" + args[0] + "/").build()).queue();
|
||||
} else {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.id.error.description").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
} else {
|
||||
List<VoiceChannel> vcs = e.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
|
||||
if (vcs.size() > 1) {
|
||||
EmbedBuilder eb = e.getMessageEditor().getMessage(MessageEditor.MessageType.WARNING, "commands.misc.screenshare.channel.error.title", "commands.misc.screenshare.channel.error.description");
|
||||
for (int i = 0; i < vcs.size(); i++) {
|
||||
VoiceChannel voiceChannel = vcs.get(i);
|
||||
eb.addField(i + ": " + voiceChannel.getName(), voiceChannel.getId(), false);
|
||||
}
|
||||
e.getChannel().sendMessage(eb.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(msge -> {
|
||||
try {
|
||||
int i = Integer.parseInt(msge.getMessage().getContentRaw());
|
||||
if (vcs.size() > i) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discord.com/channels/" + e.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
|
||||
} else {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.number.error.title", "").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.number.error.description").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
} else if (vcs.size() == 0) {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.channel.existing.error", "commands.misc.screenshare.channel.existing.description").build()).queue();
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||
.setDescription("http://discord.com/channels/" + e.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
|
||||
}
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"screenshare"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.screenshare.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[channel]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Talk";
|
||||
}
|
||||
}
|
||||
|
|
@ -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 net.dv8tion.jda.api.EmbedBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ServerStatsCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
EmbedBuilder eb = e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.misc.serverstats.title", "",
|
||||
"commands.misc.serverstats.description", e.getGuild().getName())
|
||||
.addField("Owner", e.getGuild().getOwner().getUser().getAsTag(), true)
|
||||
.addField("ID", e.getGuild().getId(), true)
|
||||
.addField("Region", e.getGuild().getRegion().getName(), true)
|
||||
.addField("Time created", new Date(e.getGuild().getTimeCreated().toInstant().toEpochMilli()).toString(), true)
|
||||
.addField("Roles", String.valueOf(e.getGuild().getRoles().size()), true)
|
||||
.addField("Emotes", String.valueOf(e.getGuild().getEmotes().size()), true)
|
||||
.addField("Categories", String.valueOf(e.getGuild().getCategories().size()), true)
|
||||
.addField("Text/Voice/Store Channels", "`" + e.getGuild().getTextChannels().size() + "`" + "/" + "`" + e.getGuild().getVoiceChannels().size() + "`" + "/" + "`" + e.getGuild().getStoreChannels().size() + "`", true)
|
||||
.addField("Verification Level", e.getGuild().getVerificationLevel().getKey() + ": " + e.getGuild().getVerificationLevel(), true)
|
||||
.addField("MFA Level", String.valueOf(e.getGuild().getRequiredMFALevel().getKey()), true)
|
||||
.addField("Member Count", String.valueOf(e.getGuild().getMemberCount()), true)
|
||||
.addField("Explicit Content Level", e.getGuild().getExplicitContentLevel().getKey() + ": " + e.getGuild().getExplicitContentLevel(), true)
|
||||
.addField("Features", e.getGuild().getFeatures().toString().replaceAll("\\[", "`").replaceAll(",", "`, `").replaceAll("]", "`"), true)
|
||||
.addBlankField(true)
|
||||
.setThumbnail(e.getGuild().getIconUrl())
|
||||
.setImage(e.getGuild().getBannerUrl());
|
||||
|
||||
if (e.getGuild().getDescription() != null) eb.addField("Description", e.getGuild().getDescription(), true);
|
||||
if (e.getGuild().getVanityCode() != null)
|
||||
eb.addField("Vanity Code", "[" + e.getGuild().getVanityCode() + "](https://discord.gg/" + e.getGuild().getVanityCode() + ")", true);
|
||||
|
||||
e.getTextChannel().sendMessage(eb.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"serverstats", "guildstats"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.misc.serverstats.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,112 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.BAN_MEMBERS)
|
||||
public class BanCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getMessage().getMentionedMembers().size() == 1) {
|
||||
Member victim = e.getMessage().getMentionedMembers().get(0);
|
||||
if (!e.getAuthor().getId().equals(victim.getId())) {
|
||||
if (!e.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
||||
if (e.getGuild().getSelfMember().canInteract(victim)) {
|
||||
e.getGuild().ban(victim, 0, "Banned by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.ban.success.title",
|
||||
"",
|
||||
"commands.moderation.ban.success.description",
|
||||
victim.getUser().getName() + ".").build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage
|
||||
(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.yourself.error.description").build()).queue();
|
||||
}
|
||||
} else if (e.getMessage().getMentionedMembers().size() > 1) {
|
||||
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||
if (!e.getAuthor().getId().equals(member.getId())) {
|
||||
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||
e.getGuild().ban(member, 0).reason("Mass Ban by " + e.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.yourself.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.ban.success.title",
|
||||
"",
|
||||
"commands.moderation.ban.massban.success.description",
|
||||
String.valueOf(e.getMessage().getMentionedMembers().size())).build()).queue();
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"ban"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.ban.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "@Skidder";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,117 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Perms(Perm.MANAGE_MESSAGES)
|
||||
public class ClearCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
|
||||
if (args[0].equals("all")) {
|
||||
List<Message> msg = e.getTextChannel().getIterableHistory().complete();
|
||||
for (Message message : msg) {
|
||||
message.delete().queue();
|
||||
}
|
||||
Message message = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.clear.all.success.title",
|
||||
"",
|
||||
"commands.moderation.clear.all.success.description",
|
||||
String.valueOf(msg.size()))
|
||||
.build()).complete();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(3);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
message.delete().queue();
|
||||
} else {
|
||||
try {
|
||||
int nbToDelete = Integer.parseInt(args[0]);
|
||||
if (nbToDelete < 1 || nbToDelete > 99) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.number.error.title", "commands.moderation.clear.number.error.description").build()).queue();
|
||||
} else {
|
||||
List<Message> history = e.getTextChannel().getHistory().retrievePast(nbToDelete + 1).complete();
|
||||
List<Message> msgToDelete = new ArrayList<>(history);
|
||||
e.getTextChannel().deleteMessages(msgToDelete).queue();
|
||||
if (nbToDelete == 1) {
|
||||
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title",
|
||||
"commands.moderation.clear.success.description.singular").build()).complete();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
msg.delete().queue();
|
||||
} else {
|
||||
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title", "",
|
||||
"commands.moderation.clear.success.description.plural", String.valueOf(nbToDelete)).build()).complete();
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
msg.delete().queue();
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.message.error.title", "commands.moderation.clear.message.error.description")
|
||||
.build()).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[]{"clear"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.clear.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[amount]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "69";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,115 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class EditRulesCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getMongoServer().getMessageID().length() == 18) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.editrules.message.title",
|
||||
"commands.moderation.editrules.message.description").build()).queue();
|
||||
|
||||
e.getEventWaiter().newOnMessageEventWaiter(e1 -> {
|
||||
String rules = e1.getMessage().getContentRaw();
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.editrules.channel.title",
|
||||
"commands.moderation.editrules.channel.description").build()).queue();
|
||||
|
||||
e.getEventWaiter().newOnMessageEventWaiter(e2 -> {
|
||||
if (e2.getMessage().getMentionedChannels().size() == 1) {
|
||||
try {
|
||||
TextChannel channel = e2.getMessage().getMentionedChannels().get(0);
|
||||
checkChannel(e, rules, channel);
|
||||
} catch (Exception ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.editrules.channel.error.title",
|
||||
"commands.moderation.editrules.channel.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
TextChannel channel = e1.getGuild().getTextChannelsByName(e2.getMessage().getContentRaw(), true).get(0);
|
||||
checkChannel(e, rules, channel);
|
||||
} catch (Exception ex) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.editrules.channel.error.title",
|
||||
"commands.moderation.editrules.channel.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.editrules.error.title", "",
|
||||
"commands.moderation.editrules.error.description", e.getMongoServer().getPrefix()).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkChannel(CommandEvent e, String rules, TextChannel channel) {
|
||||
try {
|
||||
channel.retrieveMessageById(e.getMongoServer().getMessageID()).queue();
|
||||
setRules(e, rules, channel);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.editrules.success.title",
|
||||
"commands.moderation.editrules.success.description").build()).queue();
|
||||
} catch (Exception ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.editrules.channel.message.error.title",
|
||||
"commands.moderation.editrules.channel.message.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void setRules(CommandEvent e, String rules, TextChannel channel) {
|
||||
channel.retrieveMessageById(e.getMongoServer().getMessageID()).complete().editMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Rules")
|
||||
.setDescription(rules)
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"editrules", "rulesedit", "edit_rules", "rules_edit"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.editrules.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class InviteDetectCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length == 1) {
|
||||
String opinion = args[0].toLowerCase();
|
||||
switch (opinion) {
|
||||
case "on":
|
||||
if (!e.getMongoServer().hasInviteDetect()) {
|
||||
e.getMongoServer().setInviteDetect(true);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.invitedetect.activate.success.title",
|
||||
"commands.moderation.invitedetect.activate.success.description")
|
||||
.build()).queue();
|
||||
e.getMongoServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.invitedetect.activate.error.title",
|
||||
"commands.moderation.invitedetect.activate.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
|
||||
case "off":
|
||||
if (e.getMongoServer().hasInviteDetect()) {
|
||||
e.getMongoServer().setInviteDetect(false);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.invitedetect.deactivate.success.title",
|
||||
"commands.moderation.invitedetect.deactivate.success.description")
|
||||
.build()).queue();
|
||||
e.getMongoServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.invitedetect.deactivate.error.title",
|
||||
"commands.moderation.invitedetect.deactivate.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
break;
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"invitedetect", "detectinvite", "invite-detect"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.invitedetect.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[on/off]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "on";
|
||||
}
|
||||
}
|
||||
|
|
@ -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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.KICK_MEMBERS)
|
||||
public class KickCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getMessage().getMentionedMembers().size() == 1) {
|
||||
Member victim = e.getMessage().getMentionedMembers().get(0);
|
||||
if (!e.getAuthor().getId().equals(victim.getId())) {
|
||||
if (!e.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
||||
if (e.getGuild().getSelfMember().canInteract(victim)) {
|
||||
e.getGuild().kick(victim, "Kicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.kick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.kick.success.description",
|
||||
victim.getUser().getName()).build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.kick.error.title",
|
||||
"commands.moderation.kick.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
||||
}
|
||||
} else if (e.getMessage().getMentionedMembers().size() > 1) {
|
||||
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||
if (!e.getAuthor().getId().equals(member.getId())) {
|
||||
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||
e.getGuild().kick(member).reason("Mass Kicked by " + e.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.myself.error.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.kick.success.title", "✅", "commands.moderation.kick.masskick.success.description", String.valueOf(e.getMessage().getMentionedMembers().size())).build()).queue();
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"kick"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.kick.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "@Skidder";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,123 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.MANAGE_NICKNAMES)
|
||||
public class NickCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.NICKNAME_MANAGE)) {
|
||||
if (e.getMessage().getMentionedMembers().size() == 1) {
|
||||
if (!e.getMessage().getMentionedMembers().get(0).getId().equals(e.getGuild().getSelfMember().getId())) {
|
||||
if (e.getGuild().getSelfMember().canInteract(e.getMessage().getMentionedMembers().get(0))) {
|
||||
if (args.length > 1) {
|
||||
if (e.getMessage().getContentRaw().startsWith(e.getMongoUser().getPrefix())) {
|
||||
e.getGuild().modifyNickname(e.getMessage().getMentionedMembers().get(0), e.getMessage().getContentRaw().replaceFirst(e.getMongoUser().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.success.description",
|
||||
e.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
||||
).build()).queue();
|
||||
} else if (e.getMessage().getContentRaw().startsWith(e.getMongoServer().getPrefix())) {
|
||||
e.getGuild().modifyNickname(e.getMessage().getMentionedMembers().get(0), e.getMessage().getContentRaw().replaceFirst(e.getMongoServer().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.success.description", e.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
||||
).build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
if (e.getMessage().getContentRaw().startsWith(e.getMongoUser().getPrefix())) {
|
||||
e.getGuild().getSelfMember().modifyNickname(e.getMessage().getContentRaw().replaceFirst(e.getMongoUser().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.myself.success.description",
|
||||
"").build()).queue();
|
||||
} else if (e.getMessage().getContentRaw().startsWith(e.getMongoServer().getPrefix())) {
|
||||
e.getGuild().getSelfMember().modifyNickname(e.getMessage().getContentRaw().replaceFirst(e.getMongoServer().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.myself.success.description", ""
|
||||
).build()).queue();
|
||||
}
|
||||
}
|
||||
} else if (e.getMessage().getMentionedUsers().size() > 1) {
|
||||
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||
e.getGuild().modifyNickname(member, args[args.length - 1]).reason("Mass Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
e.getGuild().getSelfMember().modifyNickname(args[args.length - 1]).reason("Mass Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
}
|
||||
}
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.nick.success.title",
|
||||
"✅",
|
||||
"commands.moderation.nick.myself.success.description", String.valueOf(e.getMessage().getMentionedMembers().size())
|
||||
).build()).queue();
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"nick"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.nick.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[user] [nickname]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "@Skidder Cutie";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class PrefixCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length == 1) {
|
||||
if (!args[0].contains("\"")) {
|
||||
e.getMongoServer().setPrefix(args[0]);
|
||||
e.getMongoServer().push();
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.prefix.success.title",
|
||||
"",
|
||||
"commands.moderation.prefix.success.description",
|
||||
args[0]).build()
|
||||
).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"",
|
||||
"commands.moderation.prefix.error.description").build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"prefix"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.prefix.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[new prefix]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "!";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,140 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.Region;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class RegionChangeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length == 1) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER)) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "amsterdam":
|
||||
setRegion(Region.AMSTERDAM, "Amsterdam", e);
|
||||
break;
|
||||
case "frankfurt":
|
||||
setRegion(Region.FRANKFURT, "Frankfurt", e);
|
||||
break;
|
||||
case "eu-west":
|
||||
setRegion(Region.EU_WEST, "EU West", e);
|
||||
break;
|
||||
case "eu-central":
|
||||
setRegion(Region.EU_CENTRAL, "EU Central", e);
|
||||
break;
|
||||
case "europe":
|
||||
setRegion(Region.EUROPE, "EUROPE", e);
|
||||
break;
|
||||
case "brazil":
|
||||
setRegion(Region.BRAZIL, "Brazil", e);
|
||||
break;
|
||||
case "hongkong":
|
||||
setRegion(Region.HONG_KONG, "Hong Kong", e);
|
||||
break;
|
||||
case "india":
|
||||
setRegion(Region.INDIA, "India", e);
|
||||
break;
|
||||
case "japan":
|
||||
setRegion(Region.JAPAN, "Japan", e);
|
||||
break;
|
||||
case "london":
|
||||
setRegion(Region.LONDON, "London", e);
|
||||
break;
|
||||
case "russia":
|
||||
setRegion(Region.RUSSIA, "Russia", e);
|
||||
break;
|
||||
case "singapore":
|
||||
setRegion(Region.SINGAPORE, "Singapore", e);
|
||||
break;
|
||||
case "south-africa":
|
||||
setRegion(Region.SOUTH_AFRICA, "South Africa", e);
|
||||
break;
|
||||
case "sydney":
|
||||
setRegion(Region.SYDNEY, "Sydney", e);
|
||||
break;
|
||||
case "us-central":
|
||||
setRegion(Region.US_CENTRAL, "US Central", e);
|
||||
break;
|
||||
case "us-east":
|
||||
setRegion(Region.US_EAST, "US East", e);
|
||||
break;
|
||||
case "us-west":
|
||||
setRegion(Region.US_WEST, "US West", e);
|
||||
break;
|
||||
case "us-south":
|
||||
setRegion(Region.US_SOUTH, "US South", e);
|
||||
break;
|
||||
default:
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.regionchange.regions.title",
|
||||
"")
|
||||
.setDescription("**LOCKED:**\n`amsterdam` `frankfurt` `eu-west` `eu-central` `london`\n\n**UNLOCKED:**\n`europe` `brazil` `hongkong` `india` `japan` `singapore` `south-africa` `sydney` `us-central` `us-east` `us-west` `us-south`")
|
||||
.build()).queue();
|
||||
break;
|
||||
}
|
||||
|
||||
} else
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
} else e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.regionchange.regions.title",
|
||||
"")
|
||||
.setDescription("**LOCKED:**\n`amsterdam` `frankfurt` `eu-west` `eu-central` `london`\n\n**UNLOCKED:**\n`europe` `brazil` `hongkong` `india` `japan` `singapore` `south-africa` `sydney` `us-central` `us-east` `us-west` `us-south`")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
public void setRegion(Region region, String region_name, CommandEvent e) {
|
||||
e.getGuild().getManager().setRegion(region).reason("Region changed by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.regionchange.success.title", "",
|
||||
"commands.moderation.regionchange.success.description", region_name)
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"changeregion", "cr", "change-region", "region"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.regionchange.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[new region]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "frankfurt";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,120 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
|
||||
@Perms(Perm.MANAGE_ROLES)
|
||||
public class RoleCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "add":
|
||||
if (e.getMessage().getMentionedMembers().size() > 0 && e.getMessage().getMentionedRoles().size() > 0) {
|
||||
for (Member member : e.getMessage().getMentionedMembers()) {
|
||||
for (Role role : e.getMessage().getMentionedRoles()) {
|
||||
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||
if (e.getGuild().getSelfMember().canInteract(role)) {
|
||||
e.getGuild().addRoleToMember(member, role).reason("Role added by " + e.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
e.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.role.add.success.title",
|
||||
"",
|
||||
"",
|
||||
"commands.moderation.role.add.success.description",
|
||||
String.valueOf(e.getMessage().getMentionedRoles().size()),
|
||||
String.valueOf(e.getMessage().getMentionedMembers().size()))
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
|
||||
case "remove":
|
||||
if (e.getMessage().getMentionedMembers().size() > 0 && e.getMessage().getMentionedRoles().size() > 0) {
|
||||
for (Member member : e.getMessage().getMentionedMembers()) {
|
||||
for (Role role : e.getMessage().getMentionedRoles()) {
|
||||
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||
if (e.getGuild().getSelfMember().canInteract(role)) {
|
||||
e.getGuild().removeRoleFromMember(member, role).reason("Role removed by " + e.getAuthor().getAsTag()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
e.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.role.remove.success.title",
|
||||
"",
|
||||
"",
|
||||
"commands.moderation.role.remove.success.description",
|
||||
String.valueOf(e.getMessage().getMentionedRoles().size()),
|
||||
String.valueOf(e.getMessage().getMentionedMembers().size()))
|
||||
.build()).queue();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
break;
|
||||
}
|
||||
} 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[]{"role", "roles"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.role.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[add/remove] [role] [user]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "add @Skidder @Epic-Gamer";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,269 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.EventWaiter;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class RulesCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.setup.title",
|
||||
"commands.moderation.rules.setup.description")
|
||||
.build()).queue();
|
||||
e.getEventWaiter().newOnMessageEventWaiter(e1 -> {
|
||||
if (e1.getMessage().getMentionedChannels().size() == 1) {
|
||||
try {
|
||||
TextChannel channel = e1.getMessage().getMentionedChannels().get(0);
|
||||
createRules(e, e1, channel);
|
||||
} catch (Exception ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.channel.error.title",
|
||||
"commands.moderation.rules.channel.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
TextChannel channel = e1.getGuild().getTextChannelsByName(e1.getMessage().getContentRaw(), true).get(0);
|
||||
createRules(e, e1, channel);
|
||||
} catch (NullPointerException | IndexOutOfBoundsException ex) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.channel.error.title",
|
||||
"commands.moderation.rules.channel.error.description")
|
||||
.build()).queue();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.error.permission.title",
|
||||
"commands.moderation.rules.error.permission.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void createRules(CommandEvent e, GuildMessageReceivedEvent e1, TextChannel channel) {
|
||||
if (channel.getGuild().getId().equals(e1.getGuild().getId())) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(channel, Permission.MESSAGE_WRITE)) {
|
||||
e1.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.rules.title",
|
||||
"",
|
||||
"commands.moderation.rules.rules.description",
|
||||
channel.getName())
|
||||
.build()).queue();
|
||||
e.getEventWaiter().newOnMessageEventWaiter(e2 -> {
|
||||
String message = e2.getMessage().getContentRaw();
|
||||
e2.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.role.title",
|
||||
"commands.moderation.rules.role.description")
|
||||
.build()).queue();
|
||||
new EventWaiter().newOnMessageEventWaiter(e3 -> {
|
||||
if (e3.getMessage().getMentionedRoles().size() == 1) {
|
||||
Role role = e3.getMessage().getMentionedRoles().get(0);
|
||||
setRole(e, channel, message, e3, role);
|
||||
} else if (e3.getGuild().getRolesByName(e3.getMessage().getContentRaw(), true).size() > 0) {
|
||||
Role role = e3.getGuild().getRolesByName(e3.getMessage().getContentRaw(), true).get(0);
|
||||
setRole(e, channel, message, e3, role);
|
||||
} else {
|
||||
e3.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.role.error.title",
|
||||
"commands.moderation.rules.role.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.error.message.title",
|
||||
"commands.moderation.rules.error.message.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.guild.error.title",
|
||||
"commands.moderation.rules.guild.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void setRole(CommandEvent e, TextChannel channel, String message, GuildMessageReceivedEvent e3, Role role) {
|
||||
if (e3.getGuild().getSelfMember().canInteract(role)) {
|
||||
if (e3.getMember().canInteract(role)) {
|
||||
e3.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.emote.accept.title",
|
||||
"",
|
||||
"commands.moderation.rules.emote.accept.description", role.getName())
|
||||
.build()).queue();
|
||||
e.getEventWaiter().newOnMessageEventWaiter(e4 -> {
|
||||
if (e4.getMessage().getEmotes().size() == 1) {
|
||||
Emote aemote = e4.getMessage().getEmotes().get(0);
|
||||
e4.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.emote.decline.title", "",
|
||||
"commands.moderation.rules.emote.decline.description", String.valueOf(aemote))
|
||||
.build()).queue();
|
||||
e.getEventWaiter().newOnMessageEventWaiter(e5 -> {
|
||||
Emote demote = e5.getMessage().getEmotes().get(0);
|
||||
if (!aemote.equals(demote)) {
|
||||
Message rules = channel.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Rules")
|
||||
.setDescription(message)
|
||||
.build()).complete();
|
||||
try {
|
||||
rules.addReaction(aemote).queue();
|
||||
rules.addReaction(demote).queue();
|
||||
e5.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.success.title",
|
||||
"",
|
||||
"commands.moderation.rules.success.description",
|
||||
channel.getAsMention())
|
||||
.build()).queue();
|
||||
} catch (Exception ex) {
|
||||
e5.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"error",
|
||||
"commands.moderation.rules.emote.error.access.description")
|
||||
.build()).queue();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
e.getMongoServer().updateRules(rules.getId(), role.getId(), aemote.toString(), demote.toString());
|
||||
e.getMongoServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.emote.error.equal.title",
|
||||
"commands.moderation.rules.emote.error.equal.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
} else {
|
||||
String aemote = e4.getMessage().getContentRaw();
|
||||
e4.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.emote.decline.title",
|
||||
"commands.moderation.rules.emoji.decline.description")
|
||||
.build()).queue();
|
||||
e.getEventWaiter().newOnMessageEventWaiter(e5 -> {
|
||||
String demote = e5.getMessage().getContentRaw();
|
||||
if (!aemote.equals(demote)) {
|
||||
Message rules = channel.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Rules")
|
||||
.setDescription(message)
|
||||
.build()).complete();
|
||||
try {
|
||||
rules.addReaction(aemote).queue();
|
||||
rules.addReaction(demote).queue();
|
||||
e5.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.rules.success.title",
|
||||
"",
|
||||
"commands.moderation.rules.success.description",
|
||||
channel.getAsMention())
|
||||
.build()).queue();
|
||||
} catch (Exception ex) {
|
||||
e5.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"error",
|
||||
"commands.moderation.rules.emoji.error.description")
|
||||
.build()).queue();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
e.getMongoServer().updateRules(rules.getId(), role.getId(), aemote, demote);
|
||||
e.getMongoServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.emote.error.equal.title",
|
||||
"commands.moderation.rules.emote.error.equal.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
}
|
||||
}, e.getJDA(), e.getAuthor());
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.role.permission.error.title",
|
||||
"commands.moderation.rules.role.permission.error.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.moderation.rules.error.interact.title",
|
||||
"commands.moderation.rules.error.interact.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"rules", "rule", "setup"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.rules.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +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.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
||||
public class StarboardCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getMessage().getMentionedChannels().size() == 1) {
|
||||
e.getMongoServer().setStarboard(e.getMessage().getMentionedChannels().get(0).getId());
|
||||
e.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.starboard.success.title", "")
|
||||
.build())
|
||||
.queue();
|
||||
} else {
|
||||
if (args.length > 0) {
|
||||
TextChannel channel = e.getGuild().getTextChannelById(args[0]);
|
||||
if (channel != null) {
|
||||
e.getMongoServer().setStarboard(channel.getId());
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
e.getMongoServer().setNeededStars(args[1]);
|
||||
}
|
||||
|
||||
e.getMongoServer().push();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"starboard"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.moderation.starboard.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[channel] [needed stars]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "#starboard 4";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.sedmelluq.discord.lavaplayer.filter.equalizer.EqualizerFactory;
|
||||
|
||||
public class BassCommand implements Command {
|
||||
private static final float[] BASS_BOOST = {0.2f, 0.15f, 0.1f, 0.05f, 0.0f, -0.05f, -0.1f, -0.1f, -0.1f, -0.1f, -0.1f,
|
||||
-0.1f, -0.1f, -0.1f, -0.1f};
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
float value = Float.parseFloat(args[0]);
|
||||
EqualizerFactory equalizer = new EqualizerFactory();
|
||||
for (int i = 0; i < BASS_BOOST.length; i++) {
|
||||
equalizer.setGain(i, BASS_BOOST[i] + value);
|
||||
}
|
||||
e.getAudioManager().getPlayer(e.getGuild()).setFrameBufferDuration(500);
|
||||
e.getAudioManager().getPlayer(e.getGuild()).setFilterFactory(equalizer);
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.bass.error.connected.title",
|
||||
"commands.music.bass.error.connected.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.info.error.title",
|
||||
"commands.music.info.error.description").build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"bass"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.bass.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[bass level]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "1000";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +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.music;
|
||||
|
||||
import one.bbn.hadder.audio.AudioPlayerSendHandler;
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
||||
public class EchoCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
Guild guild = e.getMember().getVoiceState().getChannel().getGuild();
|
||||
AudioManager audioManager = guild.getAudioManager();
|
||||
AudioPlayerSendHandler handler = new AudioPlayerSendHandler(e.getAudioManager().getPlayer(e.getGuild()));
|
||||
if (!audioManager.isConnected()) {
|
||||
audioManager.setSendingHandler(handler);
|
||||
audioManager.setReceivingHandler(handler);
|
||||
audioManager.openAudioConnection(e.getMember().getVoiceState().getChannel());
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.echo.success.title",
|
||||
"commands.music.echo.success.description")
|
||||
.build()).queue();
|
||||
} else {
|
||||
audioManager.closeAudioConnection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"echo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.echo.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
|
||||
public class InfoCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||
AudioTrack track = e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack();
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.info.success.title", "")
|
||||
.setAuthor(track.getInfo().author)
|
||||
.addField("Title", track.getInfo().title, true)
|
||||
.addField("Progress", "`[ " + e.getAudioManager().getTimestamp(track.getPosition()) + " / " + e.getAudioManager().getTimestamp(track.getInfo().length) + " ]`", false)
|
||||
.build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.info.error.title",
|
||||
"commands.music.info.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"info", "songinfo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.info.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,110 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
||||
public class JoinCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel()) {
|
||||
AudioManager audioManager = e.getGuild().getAudioManager();
|
||||
if (!audioManager.isAttemptingToConnect()) {
|
||||
VoiceChannel vc = e.getMember().getVoiceState().getChannel();
|
||||
if (e.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
||||
if (!e.getGuild().getSelfMember().getVoiceState().getChannel().getId().equals(vc.getId())) {
|
||||
try {
|
||||
e.getGuild().getAudioManager().openAudioConnection(vc);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.music.join.success.title",
|
||||
"",
|
||||
"commands.music.join.success.description",
|
||||
vc.getName())
|
||||
.build()).queue();
|
||||
} catch (InsufficientPermissionException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.join.error.permission.title",
|
||||
"commands.music.join.error.permission.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.music.join.error.connecting.already.title",
|
||||
"commands.music.join.error.connecting.already.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
e.getGuild().getAudioManager().openAudioConnection(vc);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.music.join.success.title", "",
|
||||
"commands.music.join.success.description", vc.getName())
|
||||
.build()).queue();
|
||||
} catch (InsufficientPermissionException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.join.error.permission.title",
|
||||
"commands.music.join.error.permission.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.WARNING,
|
||||
"commands.music.join.error.connecting.trying.title",
|
||||
"commands.music.join.error.connecting.trying.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.music.join.error.channel.title",
|
||||
"commands.music.join.error.channel.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"join"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.join.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class LoopCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
if (e.getAudioManager().getTrackManager(e.getGuild()).isLoop()) {
|
||||
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(false);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue();
|
||||
} else {
|
||||
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(true);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.loop.error.connected.title",
|
||||
"commands.music.loop.error.connected.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.info.error.title",
|
||||
"commands.music.info.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"loop", "repeat"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.loop.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class PauseCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
if (!e.getAudioManager().getPlayer(e.getGuild()).isPaused()) {
|
||||
e.getAudioManager().getPlayer(e.getGuild()).setPaused(true);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.pause.success.title",
|
||||
"commands.music.pause.success.description")
|
||||
.build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.pause.error.paused.title", "",
|
||||
"commands.music.pause.error.paused.description", e.getMongoServer().getPrefix())
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.pause.error.connected.title",
|
||||
"commands.music.pause.error.connected.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.info.error.title",
|
||||
"commands.music.info.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"pause"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.pause.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,93 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public class PlayCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel()) {
|
||||
String input = e.getMessage().getContentRaw().replaceFirst(e.getMongoServer().getPrefix() + "play ", "").replaceFirst(e.getMongoUser().getPrefix() + "play ", "");
|
||||
try {
|
||||
new URL(input).toURI();
|
||||
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.load.title", "⭕",
|
||||
"commands.music.play.load.description", "").build()).complete();
|
||||
e.getAudioManager().loadTrack(input, e, msg);
|
||||
} catch (InsufficientPermissionException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.join.error.permission.title",
|
||||
"commands.music.join.error.permission.description")
|
||||
.build()).queue();
|
||||
} catch (Exception ignore) {
|
||||
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.load.title", "⭕",
|
||||
"commands.music.play.load.description", "").build()).complete();
|
||||
e.getAudioManager().loadTrack("ytsearch: " + input, e, msg);
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.music.join.error.channel.title",
|
||||
"commands.music.join.error.channel.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else if (e.getAudioManager().getPlayer(e.getGuild()).isPaused()) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
e.getAudioManager().getPlayer(e.getGuild()).setPaused(false);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.play.success.unpause.title",
|
||||
"commands.music.play.success.unpause.description")
|
||||
.build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.play.error.connected.title",
|
||||
"commands.music.play.error.connected.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"play"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.play.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[URL/name]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "Last Christmas";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +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.music;
|
||||
|
||||
import one.bbn.hadder.audio.AudioInfo;
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class QueueCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (!e.getAudioManager().hasPlayer(e.getGuild()) || e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.queue.error.title",
|
||||
"commands.music.queue.error.description"
|
||||
).build()).queue();
|
||||
} else {
|
||||
Set<AudioInfo> queue = e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
long queuelength = 0;
|
||||
for (AudioInfo g : queue) {
|
||||
queuelength = queuelength + g.getTrack().getInfo().length;
|
||||
builder.append("(" + e.getAudioManager().getTimestamp(g.getTrack().getInfo().length) + ") **").append(g.getTrack().getInfo().author).append("**: `").append(g.getTrack().getInfo().title).append("` \n");
|
||||
}
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.queue.success.title", "(" + String.valueOf(e.getAudioManager().getTimestamp(queuelength)) + ")",
|
||||
"commands.music.queue.success.description", builder.toString())
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"queue"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.queue.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,116 +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.music;
|
||||
|
||||
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 net.dv8tion.jda.api.audio.AudioReceiveHandler;
|
||||
import net.dv8tion.jda.api.audio.AudioSendHandler;
|
||||
import net.dv8tion.jda.api.audio.UserAudio;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class RecordCommand implements Command {
|
||||
|
||||
private final HashMap<String, Queue<byte[]>> queue = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
Guild guild = event.getMember().getVoiceState().getChannel().getGuild();
|
||||
AudioManager audioManager = guild.getAudioManager();
|
||||
EchoHandler handler = new EchoHandler(queue);
|
||||
if (!audioManager.isConnected()) {
|
||||
audioManager.setSendingHandler(handler);
|
||||
audioManager.setReceivingHandler(handler);
|
||||
audioManager.openAudioConnection(event.getMember().getVoiceState().getChannel());
|
||||
} else {
|
||||
for (Map.Entry<String, Queue<byte[]>> key : queue.entrySet()) {
|
||||
File file = new File("./" + event.getJDA().getUserById(key.getKey()) + ".wav");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class EchoHandler implements AudioSendHandler, AudioReceiveHandler {
|
||||
|
||||
private HashMap<String, Queue<byte[]>> queue;
|
||||
|
||||
public EchoHandler(HashMap<String, Queue<byte[]>> queue) {
|
||||
this.queue = queue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvide() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ByteBuffer provide20MsAudio() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUserAudio(@Nonnull UserAudio userAudio) {
|
||||
if (queue.containsKey(userAudio.getUser().getId())) {
|
||||
queue.get(userAudio.getUser().getId()).add(userAudio.getAudioData(1.0f));
|
||||
} else {
|
||||
Queue<byte[]> newqueue = new ConcurrentLinkedQueue<>();
|
||||
newqueue.add(userAudio.getAudioData(1.0f));
|
||||
queue.put(userAudio.getUser().getId(), newqueue);
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<String, Queue<byte[]>> getQueue() {
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"record"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,73 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class SkipCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getAudioManager().hasPlayer(e.getGuild()) && !e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
if (!e.getAudioManager().getTrackManager(e.getGuild()).isLoop()) {
|
||||
e.getAudioManager().forceSkipTrack(e);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.skip.success.title",
|
||||
"commands.music.skip.success.description").build()).queue();
|
||||
} else {
|
||||
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(false);
|
||||
e.getAudioManager().forceSkipTrack(e);
|
||||
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(true);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.skip.success.title",
|
||||
"commands.music.skip.success.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.skip.error.connected.title",
|
||||
"commands.music.skip.error.connected.description").build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.info.error.title",
|
||||
"commands.music.info.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"skip"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.skip.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class StopCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(false);
|
||||
e.getAudioManager().players.remove(e.getGuild().getId());
|
||||
e.getAudioManager().getPlayer(e.getGuild()).destroy();
|
||||
e.getAudioManager().getTrackManager(e.getGuild()).purgeQueue();
|
||||
e.getGuild().getAudioManager().closeAudioConnection();
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.stop.success.title",
|
||||
"commands.music.stop.success.description").build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.stop.error.connected.title",
|
||||
"commands.music.stop.error.connected.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.info.error.title",
|
||||
"commands.music.info.error.description").build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"stop", "leave"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.stop.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,77 +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.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
public class VolumeCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length > 0) {
|
||||
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
if (StringUtils.isNumeric(args[0])) {
|
||||
int volume = Integer.parseInt(args[0]);
|
||||
if (volume < 201 && volume > 0 || e.getConfig().getOwners().contains(e.getAuthor().getIdLong())) {
|
||||
e.getAudioManager().getPlayer(e.getGuild()).setVolume(volume);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.music.volume.success.title", "",
|
||||
"commands.music.volume.success.description", String.valueOf(volume)).build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.volume.error.int.title",
|
||||
"commands.music.volume.error.int.description").build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.volume.error.connected.title",
|
||||
"commands.music.volume.error.connected.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.info.error.title",
|
||||
"commands.music.info.error.description").build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"volume"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.volume.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[volume]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "100";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class AnalCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/anal");
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("Anal")
|
||||
.build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"anal"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.anal.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class BDSMCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/img/bdsm_lewd");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("BDSM")
|
||||
.build()).queue();
|
||||
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"bdsm"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.bdsm.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class BlowjobCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://nekos.life/api/v2/img/blowjob");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("Blowjob")
|
||||
.build()).queue();
|
||||
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"blowjob"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.blowjob.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class BoobsCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/tits");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("Boobs")
|
||||
.build()).queue();
|
||||
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"boobs", "boob", "tits"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.boobs.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class CumCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/cum");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("Cum")
|
||||
.build()).queue();
|
||||
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"cum"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.cum.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class EroticCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://nekos.life/api/v2/img/erok");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("Erotic")
|
||||
.build()).queue();
|
||||
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"erotic"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.erotic.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class FeetCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/feet");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("Feet")
|
||||
.build()).queue();
|
||||
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"feet"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.feet.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +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.nsfw;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.Http;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class FingeringCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/pussy_wank");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
.setImage(url)
|
||||
.setFooter("Fingering")
|
||||
.build()).queue();
|
||||
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"fingering"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.nsfw.fingering.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue