Compare commits
No commits in common. "master" and "v1.0.2" have entirely different histories.
115 changed files with 2433 additions and 2456 deletions
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,5 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: BBN Holding Discord Support
|
||||
url: https://discord.gg/nPwjaJk
|
||||
about: Please ask questions here.
|
||||
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
name: "💡 Feature request"
|
||||
about: Submit your idea for a change in the codebase.
|
||||
---
|
||||
|
||||
# Feature request
|
||||
|
||||
<!--
|
||||
This issue should serve for you to present or pitch an idea to the maintainers - but remember that it would be better if you were to submit a PR instead 🤗
|
||||
-->
|
||||
|
||||
## Why it is needed
|
||||
|
||||
<!--
|
||||
Please tell us a bit more of why you want this feature to be added, what's its origin.
|
||||
-->
|
||||
|
||||
## Possible implementation
|
||||
|
||||
<!--
|
||||
It really helps if you could describe from a technical POV how this new feature would work, which code it rely on, etc.
|
||||
-->
|
||||
|
||||
### Code sample
|
||||
|
||||
<!--
|
||||
Please show how the new code could work, if doable.
|
||||
-->
|
||||
13
.github/dependabot.yml
vendored
13
.github/dependabot.yml
vendored
|
|
@ -1,13 +0,0 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: maven
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "13:00"
|
||||
open-pull-requests-limit: 99
|
||||
target-branch: greg-dev
|
||||
assignees:
|
||||
- GregTCLTK
|
||||
labels:
|
||||
- pending-deploy
|
||||
21
.github/workflows/maven.yml
vendored
21
.github/workflows/maven.yml
vendored
|
|
@ -6,11 +6,11 @@ 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
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 1.13
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '15'
|
||||
java-version: 1.13
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
|
|
@ -19,20 +19,19 @@ jobs:
|
|||
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
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 1.13
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '15'
|
||||
java-version: 1.13
|
||||
- name: Build Final Jar
|
||||
run: mvn clean compile assembly:single
|
||||
- name: Copy folder content recursively to remote
|
||||
uses: garygrossgarten/github-action-scp@release
|
||||
with:
|
||||
local: ./target/Hadder-Build.jar
|
||||
remote: /root/bots/Hadder/Hadder-Build.jar
|
||||
remote: /home/Hadder-Build.jar
|
||||
host: ${{ secrets.HOST }}
|
||||
port: ${{ secrets.PORT }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
- name: executing remote ssh commands using password
|
||||
|
|
@ -42,7 +41,7 @@ jobs:
|
|||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
port: ${{ secrets.PORT }}
|
||||
script: /root/bots/Hadder/deploy.sh
|
||||
script: /home/deploy.sh
|
||||
- name: Send Webhook Notification
|
||||
if: always()
|
||||
env:
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ If a community member engages in unacceptable behavior, the community organizers
|
|||
|
||||
## 7. Reporting Guidelines
|
||||
|
||||
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. admin@bbn.one.
|
||||
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. admin@bigbotnetwork.com.
|
||||
|
||||
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ Additionally, community organizers are available to help community members engag
|
|||
|
||||
## 8. Addressing Grievances
|
||||
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify BBN with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify BigBotNetwork with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
|
||||
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ This code of conduct and its related procedures also applies to unacceptable beh
|
|||
|
||||
## 10. Contact info
|
||||
|
||||
admin@bbn.one
|
||||
admin@bigbotnetwork.com
|
||||
|
||||
## 11. License and attribution
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ further defined and clarified by project maintainers.
|
|||
### Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team on [Discord](https://discordapp.com/invite/nPwjaJk). All
|
||||
reported by contacting the project team on [Discord](https://discordapp.com/invite/58My2dM). 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.
|
||||
|
|
|
|||
83
README.md
83
README.md
|
|
@ -2,14 +2,18 @@
|
|||
|
||||
Hadder Discord is a multi-purpose Discord bot with 100% uptime.
|
||||
|
||||
<a href="https://discord.gg/nPwjaJk"><img src="https://discord.com/api/guilds/757966278936756345/embed.png"/></a>
|
||||
[](https://github.com/BBN-Holding/Hadder)
|
||||
[](https://www.codacy.com/gh/BBN-Holding/Hadder?utm_source=github.com&utm_medium=referral&utm_content=BBN-Holding/Hadder&utm_campaign=Badge_Grade)
|
||||
<a href="https://discord.gg/58My2dM"><img src="https://discordapp.com/api/guilds/448554629282922527/embed.png"/></a>
|
||||
[](https://github.com/BigBotNetwork/Hadder)
|
||||
[](https://www.codacy.com/gh/BigBotNetwork/Hadder?utm_source=github.com&utm_medium=referral&utm_content=BigBotNetwork/Hadder&utm_campaign=Badge_Grade)
|
||||
[](https://www.codefactor.io/repository/github/bigbotnetwork/hadder)
|
||||
[](https://bbn.crowdin.com/hadder)
|
||||
[](https://github.com/BBN-Holding/Hadder/issues)
|
||||
[](https://github.com/BBN-Holding/Hadder/blob/master/LICENSE)
|
||||
[](https://wakatime.com/badge/github/BBN-Holding/Hadder)
|
||||
[](https://github.com/BigBotNetwork/Hadder/issues)
|
||||
[](https://github.com/BigBotNetwork/Hadder/blob/master/LICENSE)
|
||||
[](https://wakatime.com/badge/github/BigBotNetwork/Hadder)
|
||||
|
||||
[](https://discordextremelist.xyz/bots/Hadder)
|
||||
[](https://top.gg/bot/637002314162372639)
|
||||
[](https://botlist.space/bot/637002314162372639?utm_source=bls&utm_medium=widget&utm_campaign=637002314162372639)
|
||||
|
||||
## Hadder Team
|
||||
### Developer
|
||||
|
|
@ -19,43 +23,34 @@ 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.help | Shows each command and explains its usage. |
|
||||
| h.about | Shows information about Hadder. |
|
||||
| h.equals | Checks if two strings are the same. |
|
||||
| h.invite | Shows the invite link to invite Hadder to your server. |
|
||||
| h.ping | Shows the ping to the Discord API. |
|
||||
| h.avatar | Sends the avatar of the specified member. |
|
||||
| h.gif | Looks for a GIF on Giphy. |
|
||||
| h.meme | Sends you a random meme. |
|
||||
| h.clyde | Sends a message as a webhook named Clyde. |
|
||||
| h.feedback | Sends feedback directly to the developers. |
|
||||
| h.github | Displays information about a GitHub user profile. |
|
||||
| h.screenshare | Shows you the link to share your screen. |
|
||||
| h.ban | Bans one or more users from the server. |
|
||||
| h.clear | Deletes the specified number of messages. |
|
||||
| h.prefix | Sets the Guild-Prefix. |
|
||||
| h.invitedetect | Activate or deactivate the Discord invite link detection. |
|
||||
| h.kick | Kicks one or more user from the server. |
|
||||
| h.nick | Rename a one or more user. |
|
||||
| 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 |
|
||||
| h.starboard | Sets the starboard channel. |
|
||||
| h.editrules | Edits the rules message. |
|
||||
| h.join | Joins your voice channel. |
|
||||
| h.leave | Leaves your voice channel. |
|
||||
| h.play | Plays the specified song. |
|
||||
| h.stop | Stops the song. |
|
||||
| h.info | Shows information about the playing song. |
|
||||
| h.queue | Shows the music queue. |
|
||||
| h.skip | Skips the currently playing song. |
|
||||
| h.volume | Change the volume of the music. |
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
base_url: 'https://bbn.one'
|
||||
base_url: 'https://bigbotnetwork.com'
|
||||
commit_message: 'New %language% translation'
|
||||
files:
|
||||
- source: /src/main/resources/Translations/Translations_en.properties
|
||||
|
|
|
|||
|
|
@ -1,17 +1,26 @@
|
|||
{
|
||||
"Owners": [
|
||||
],
|
||||
"Database": {
|
||||
"IP": "",
|
||||
"Owners":
|
||||
[],
|
||||
"Database":{"IP":"",
|
||||
"Port": 6775,
|
||||
"DBName": "",
|
||||
"Username": "",
|
||||
"Password": ""
|
||||
},
|
||||
"Password": ""},
|
||||
"Tokens": {
|
||||
"BotToken": "",
|
||||
"Giphy": "",
|
||||
"GitHub": ""
|
||||
"GitHub": "",
|
||||
"MythicalBotList": "",
|
||||
"BotsForDiscord": "",
|
||||
"DiscordBotList": "",
|
||||
"DiscordBestBots": "",
|
||||
"DiscordBoats": "",
|
||||
"YetAnotherBotList": "",
|
||||
"DiscordExtremeList": "",
|
||||
"DiscordBotReviews": "",
|
||||
"DiscordBots": "",
|
||||
"BotListSpace": "",
|
||||
"DiscordBots2": ""
|
||||
},
|
||||
"Clyde": ""
|
||||
}
|
||||
|
|
|
|||
115
pom.xml
115
pom.xml
|
|
@ -1,29 +1,18 @@
|
|||
<?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>
|
||||
<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>
|
||||
<version>1.0.2</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.compiler.source>1.13</maven.compiler.source>
|
||||
<maven.compiler.target>1.13</maven.compiler.target>
|
||||
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
|
|
@ -31,23 +20,21 @@
|
|||
<developer>
|
||||
<id>Hax#6775</id>
|
||||
<name>Hax</name>
|
||||
<email>hax@bbn.one</email>
|
||||
<url>https://bbn.one/</url>
|
||||
<email>hax@bigbotnetwork.com</email>
|
||||
<url>https://bigbotnetwork.com/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/261083609148948488/f2c9efc629ef65fffa634f0d63cd467e.webp
|
||||
</picUrl>
|
||||
<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>
|
||||
<email>skidder@bigbotnetwork.com</email>
|
||||
<url>https://bigbotnetwork.com/</url>
|
||||
<timezone>Europe/Berlin</timezone>
|
||||
<properties>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/401817301919465482/a_f81bd03e3862de579dec59241714d86d.gif
|
||||
</picUrl>
|
||||
<picUrl>https://cdn.discordapp.com/avatars/477141528981012511/a_ba4bd8e5b381874edcd06a68d1acd3aa.gif</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
</developers>
|
||||
|
|
@ -58,64 +45,104 @@
|
|||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dv8tion</id>
|
||||
<name>m2-dv8tion</name>
|
||||
<url>https://m2.dv8tion.net/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>3.8.6</version>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.4.0_352</version>
|
||||
<version>4.1.1_105</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20220924</version>
|
||||
<version>20190722</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.rethinkdb</groupId>
|
||||
<artifactId>rethinkdb-driver</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.3</version>
|
||||
<version>1.7.30</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>club.minnced</groupId>
|
||||
<artifactId>discord-webhooks</artifactId>
|
||||
<version>0.8.2</version>
|
||||
<version>0.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.313</version>
|
||||
<version>1.106</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>
|
||||
<version>1.3.34</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<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-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<finalName>Hadder-Build</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.bbn.hadder.Hadder</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
<source>13</source>
|
||||
<target>13</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
@ -124,7 +151,7 @@
|
|||
<finalName>Hadder-Build</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>one.bbn.hadder.Hadder</mainClass>
|
||||
<mainClass>com.bbn.hadder.Hadder</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
|
|
|
|||
|
|
@ -14,29 +14,21 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder;
|
||||
package com.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 com.bbn.hadder.audio.AudioManager;
|
||||
import com.bbn.hadder.commands.general.*;
|
||||
import com.bbn.hadder.commands.misc.*;
|
||||
import com.bbn.hadder.commands.moderation.*;
|
||||
import com.bbn.hadder.commands.nsfw.*;
|
||||
import com.bbn.hadder.commands.owner.*;
|
||||
import com.bbn.hadder.commands.fun.*;
|
||||
import com.bbn.hadder.commands.settings.*;
|
||||
import com.bbn.hadder.commands.music.*;
|
||||
import com.bbn.hadder.core.*;
|
||||
import com.bbn.hadder.listener.*;
|
||||
import net.dv8tion.jda.api.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;
|
||||
|
|
@ -56,19 +48,18 @@ public class Hadder {
|
|||
if (!config.fileExists()) config.create();
|
||||
config.load();
|
||||
|
||||
Mongo mongo = new Mongo(config);
|
||||
mongo.connect();
|
||||
Rethink rethink = new Rethink(config);
|
||||
rethink.connect();
|
||||
|
||||
DefaultShardManagerBuilder builder = DefaultShardManagerBuilder.create(GatewayIntent.getIntents(14053));
|
||||
DefaultShardManagerBuilder builder = new DefaultShardManagerBuilder();
|
||||
|
||||
builder.setAutoReconnect(true);
|
||||
builder.setShardsTotal(1);
|
||||
builder.setChunkingFilter(ChunkingFilter.NONE);
|
||||
builder.setChunkingFilter(ChunkingFilter.ALL);
|
||||
builder.setBulkDeleteSplittingEnabled(true);
|
||||
builder.setActivity(Activity.listening("h.help"));
|
||||
builder.setActivity(Activity.listening("to 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();
|
||||
|
|
@ -106,6 +97,7 @@ public class Hadder {
|
|||
new AvatarCommand(),
|
||||
new EvalCommand(),
|
||||
new JoinCommand(),
|
||||
new LeaveCommand(),
|
||||
new GuildLeaveCommand(),
|
||||
new MemeCommand(),
|
||||
new InviteDetectCommand(),
|
||||
|
|
@ -134,21 +126,18 @@ public class Hadder {
|
|||
new EchoCommand(),
|
||||
new ServerStatsCommand(),
|
||||
new ProfileCommand(),
|
||||
new CodeCommand(),
|
||||
new MoveAllCommand(),
|
||||
new CoronaCommand()), config, helpCommand);
|
||||
new CodeCommand()), 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));
|
||||
new MentionListener(rethink),
|
||||
new PrivateMessageListener(rethink),
|
||||
new CommandListener(rethink, commandHandler, audioManager),
|
||||
new GuildListener(rethink, config),
|
||||
new ReadyListener(rethink, config),
|
||||
new InviteLinkListener(rethink),
|
||||
new RulesListener(rethink),
|
||||
new StarboardListener(rethink),
|
||||
new VoiceLeaveListener(audioManager));
|
||||
|
||||
try {
|
||||
shardManager = builder.build();
|
||||
189
src/main/java/com/bbn/hadder/Rethink.java
Normal file
189
src/main/java/com/bbn/hadder/Rethink.java
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* 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 com.bbn.hadder;
|
||||
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.rethinkdb.RethinkDB;
|
||||
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
||||
import com.rethinkdb.net.Connection;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
|
||||
public class Rethink {
|
||||
private RethinkDB r = RethinkDB.r;
|
||||
private Connection conn;
|
||||
private Config config;
|
||||
|
||||
Rethink(Config config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
try {
|
||||
conn = r.connection()
|
||||
.hostname(config.getDatabaseIP())
|
||||
.db(config.getDatabaseName())
|
||||
.port(config.getDatabasePort())
|
||||
.user(config.getDatabaseUsername(), config.getDatabasePassword())
|
||||
.connect();
|
||||
System.out.println("DB CONNECTED");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("DB CONNECTION FAILED");
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray getAsArray(String table, String where, String value) {
|
||||
try {
|
||||
String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn);
|
||||
return new JSONArray(string);
|
||||
} catch (NoSuchElementException e) {
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JSONArray();
|
||||
}
|
||||
|
||||
public Object get(String table, String where, String value, String column) {
|
||||
JSONArray array = this.getAsArray(table, where, value);
|
||||
if (array.length() > 0)
|
||||
if (array.getJSONObject(0).has(column))
|
||||
return array.getJSONObject(0).get(column);
|
||||
else return null;
|
||||
else return null;
|
||||
}
|
||||
|
||||
public Object getByID(String table, String wherevalue, String column) {
|
||||
return r.table(table).get(wherevalue).getField(column).run(conn);
|
||||
}
|
||||
|
||||
public JSONObject getObjectByID(String table, String id) {
|
||||
String response = r.table(table).get(id).toJson().run(conn);
|
||||
return new JSONObject(response);
|
||||
}
|
||||
|
||||
public void insert(String table, Object object) {
|
||||
try {
|
||||
r.table(table).insert(object).run(conn);
|
||||
} catch (ClassCastException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(String table, String where, String value) {
|
||||
r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).delete().run(conn);
|
||||
}
|
||||
|
||||
public void setup() {
|
||||
try {
|
||||
r.dbCreate("Hadder").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
try {
|
||||
r.tableCreate("server").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
try {
|
||||
r.tableCreate("user").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
try {
|
||||
r.tableCreate("stars").run(conn);
|
||||
} catch (ReqlOpFailedError e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void insertGuild(String id) {
|
||||
this.insert("server", r
|
||||
.hashMap("id", id)
|
||||
.with("prefix", "h.")
|
||||
.with("message_id", "")
|
||||
.with("role_id", "")
|
||||
.with("invite_detect", false)
|
||||
.with("starboard", "")
|
||||
.with("neededstars", "4")
|
||||
);
|
||||
}
|
||||
|
||||
public void insertUser(String id) {
|
||||
this.insert("user", r
|
||||
.hashMap("id", id)
|
||||
.with("prefix", "h.")
|
||||
.with("language", "en")
|
||||
.with("blacklisted", "none"));
|
||||
}
|
||||
|
||||
// TODO
|
||||
public boolean hasStarboardChannel(String guild_id) {
|
||||
return !this.getByID("server", guild_id, "starboard").equals("");
|
||||
}
|
||||
// TODO
|
||||
public void insertStarboardMessage(String message_id, String guild_id, String starboard_message_id) {
|
||||
this.insert("stars", r.hashMap("id", message_id).with("guild", guild_id).with("starboardmsg", starboard_message_id));
|
||||
}
|
||||
// TODO
|
||||
public String getStarboardMessage(String message_id) {
|
||||
return (String) this.getByID("stars", message_id, "starboardmsg");
|
||||
}
|
||||
// TODO
|
||||
public void removeStarboardMessage(String message_id) {
|
||||
this.remove("stars", "id", message_id);
|
||||
}
|
||||
// TODO
|
||||
public boolean hasStarboardMessage(String message_id) {
|
||||
return this.getByID("stars", message_id, "guild") != null;
|
||||
}
|
||||
|
||||
|
||||
public void pushServer(RethinkServer server) {
|
||||
JSONObject object = new JSONObject();
|
||||
for (Field field : server.getClass().getDeclaredFields()) {
|
||||
if (!field.getName().equals("rethink")) {
|
||||
try {
|
||||
object.put(field.getName(), field.get(server));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
r.table("server").get(server.getId()).update(object.toMap()).run(conn);
|
||||
}
|
||||
|
||||
public void pushUser(RethinkUser user) {
|
||||
JSONObject object = new JSONObject();
|
||||
for (Field field : user.getClass().getDeclaredFields()) {
|
||||
if (!field.getName().equals("rethink")) {
|
||||
try {
|
||||
object.put(field.getName(), field.get(user));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
r.table("user").get(user.getId()).update(object.toMap()).run(conn);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,29 +14,29 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.db;
|
||||
package com.bbn.hadder;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class MongoServer {
|
||||
public class RethinkServer {
|
||||
|
||||
private Mongo mongo;
|
||||
private Rethink rethink;
|
||||
|
||||
public String accept_emote = "";
|
||||
public String decline_emote = "";
|
||||
public String id;
|
||||
public boolean invite_detect = false;
|
||||
public String message_id = "";
|
||||
public String neededstars = "3";
|
||||
public String prefix = "h.";
|
||||
public String role_id = "";
|
||||
public String starboard = "";
|
||||
String accept_emote = "";
|
||||
String decline_emote = "";
|
||||
String id;
|
||||
boolean invite_detect = false;
|
||||
String message_id = "";
|
||||
String neededstars = "3";
|
||||
String prefix = "h.";
|
||||
String role_id = "";
|
||||
String starboard = "";
|
||||
|
||||
public MongoServer(JSONObject object, Mongo mongo) {
|
||||
public RethinkServer(JSONObject object, Rethink rethink) {
|
||||
for (Field field : this.getClass().getDeclaredFields()) {
|
||||
if (!field.getName().equals("mongo")) {
|
||||
if (!field.getName().equals("rethink")) {
|
||||
try {
|
||||
if (object.has(field.getName()))
|
||||
field.set(this, object.get(field.getName()));
|
||||
|
|
@ -45,7 +45,7 @@ public class MongoServer {
|
|||
}
|
||||
}
|
||||
}
|
||||
this.mongo = mongo;
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
public String getAcceptEmote() {
|
||||
|
|
@ -68,7 +68,7 @@ public class MongoServer {
|
|||
return id;
|
||||
}
|
||||
|
||||
public boolean hasInviteDetect() {
|
||||
public boolean isInviteDetect() {
|
||||
return invite_detect;
|
||||
}
|
||||
|
||||
|
|
@ -116,10 +116,6 @@ public class MongoServer {
|
|||
this.starboard = starboard;
|
||||
}
|
||||
|
||||
public boolean hasStarboardChannel() {
|
||||
return !"".equals(starboard);
|
||||
}
|
||||
|
||||
public void updateRules(String message_id, String role_id, String accept_emote, String decline_emote) {
|
||||
this.setMessageID(message_id);
|
||||
this.setRoleID(role_id);
|
||||
|
|
@ -128,6 +124,6 @@ public class MongoServer {
|
|||
}
|
||||
|
||||
public void push() {
|
||||
mongo.push(this);
|
||||
rethink.pushServer(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,24 +14,24 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.db;
|
||||
package com.bbn.hadder;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class MongoUser {
|
||||
public class RethinkUser {
|
||||
|
||||
private Mongo mongo;
|
||||
private Rethink rethink;
|
||||
|
||||
public String id;
|
||||
public String prefix = "h.";
|
||||
public String language = "en";
|
||||
public String blacklisted = "none";
|
||||
String id;
|
||||
String prefix = "h.";
|
||||
String language = "en";
|
||||
String blacklisted = "none";
|
||||
|
||||
public MongoUser(JSONObject object, Mongo mongo) {
|
||||
public RethinkUser(JSONObject object, Rethink rethink) {
|
||||
for (Field field : this.getClass().getDeclaredFields()) {
|
||||
if (!field.getName().equals("mongo")) {
|
||||
if (!field.getName().equals("rethink")) {
|
||||
try {
|
||||
if (object.has(field.getName()))
|
||||
field.set(this, object.getString(field.getName()));
|
||||
|
|
@ -40,11 +40,11 @@ public class MongoUser {
|
|||
}
|
||||
}
|
||||
}
|
||||
this.mongo = mongo;
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
public Mongo getMongo() {
|
||||
return mongo;
|
||||
public Rethink getRethink() {
|
||||
return rethink;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
|
@ -76,6 +76,6 @@ public class MongoUser {
|
|||
}
|
||||
|
||||
public void push() {
|
||||
mongo.push(this);
|
||||
rethink.pushUser(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.audio;
|
||||
package com.bbn.hadder.audio;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,14 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.audio;
|
||||
package com.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.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.sedmelluq.discord.lavaplayer.player.*;
|
||||
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
|
||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||
|
|
@ -79,7 +76,6 @@ public class AudioManager {
|
|||
|
||||
@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", "⏯",
|
||||
|
|
@ -91,19 +87,6 @@ public class AudioManager {
|
|||
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
|
||||
|
|
@ -165,4 +148,5 @@ public class AudioManager {
|
|||
s = s - (minutes * 60);
|
||||
return (hours == 0 ? "" : hours + ":") + String.format("%02d", minutes) + ":" + String.format("%02d", s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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 com.bbn.hadder.audio;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||
import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame;
|
||||
import net.dv8tion.jda.api.audio.AudioSendHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class AudioPlayerSendHandler implements AudioSendHandler {
|
||||
|
||||
private final AudioPlayer audioPlayer;
|
||||
private AudioFrame lastFrame;
|
||||
|
||||
public AudioPlayerSendHandler(AudioPlayer audioPlayer) {
|
||||
this.audioPlayer = audioPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvide() {
|
||||
if (lastFrame == null) {
|
||||
lastFrame = audioPlayer.provide();
|
||||
}
|
||||
|
||||
return lastFrame != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ByteBuffer provide20MsAudio() {
|
||||
if (lastFrame == null) {
|
||||
lastFrame = audioPlayer.provide();
|
||||
}
|
||||
|
||||
byte[] data = lastFrame != null ? lastFrame.getData() : null;
|
||||
lastFrame = null;
|
||||
|
||||
return ByteBuffer.wrap(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpus() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.audio;
|
||||
package com.bbn.hadder.audio;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||
import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter;
|
||||
|
|
@ -24,9 +24,7 @@ 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.*;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
public class TrackManager extends AudioEventAdapter {
|
||||
|
|
@ -65,19 +63,17 @@ public class TrackManager extends AudioEventAdapter {
|
|||
|
||||
@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 {
|
||||
this.lastTrack = track;
|
||||
if (loop) {
|
||||
player.playTrack(lastTrack.makeClone());
|
||||
} else if (queue.isEmpty()) {
|
||||
manager.players.remove(g.getId());
|
||||
manager.getPlayer(g).destroy();
|
||||
manager.getTrackManager(g).purgeQueue();
|
||||
g.getAudioManager().closeAudioConnection();
|
||||
}
|
||||
} else {
|
||||
player.playTrack(queue.element().getTrack());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,11 +89,17 @@ public class TrackManager extends AudioEventAdapter {
|
|||
queue.remove(entry);
|
||||
}
|
||||
|
||||
public boolean isLoop() {
|
||||
public boolean isLoop()
|
||||
{
|
||||
return loop;
|
||||
}
|
||||
|
||||
public void setLoop(boolean repeating) {
|
||||
public void setLoop(boolean repeating)
|
||||
{
|
||||
this.loop = repeating;
|
||||
}
|
||||
|
||||
public AudioInfo getTrackInfo(AudioTrack track) {
|
||||
return queue.stream().filter(audioInfo -> audioInfo.getTrack().equals(track)).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands;
|
||||
package com.bbn.hadder.commands;
|
||||
|
||||
public interface Command {
|
||||
void executed(String[] args, CommandEvent e);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,17 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands;
|
||||
package com.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 com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import com.bbn.hadder.RethinkUser;
|
||||
import com.bbn.hadder.audio.AudioManager;
|
||||
import com.bbn.hadder.commands.general.HelpCommand;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
|
@ -33,34 +33,34 @@ import javax.annotation.Nonnull;
|
|||
|
||||
public class CommandEvent extends MessageReceivedEvent {
|
||||
|
||||
private Mongo mongo;
|
||||
private Rethink rethink;
|
||||
private Config config;
|
||||
private CommandHandler commandHandler;
|
||||
private HelpCommand helpCommand;
|
||||
private MessageEditor messageEditor;
|
||||
private EventWaiter eventWaiter;
|
||||
private AudioManager audioManager;
|
||||
private MongoUser mongoUser;
|
||||
private MongoServer mongoServer;
|
||||
private RethinkUser rethinkUser;
|
||||
private RethinkServer rethinkServer;
|
||||
|
||||
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Mongo mongo, Config config,
|
||||
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Rethink rethink, Config config,
|
||||
CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor,
|
||||
EventWaiter eventWaiter, AudioManager audioManager, MongoUser mongoUser,
|
||||
MongoServer mongoServer) {
|
||||
EventWaiter eventWaiter, AudioManager audioManager, RethinkUser rethinkUser,
|
||||
RethinkServer rethinkServer) {
|
||||
super(api, responseNumber, message);
|
||||
this.mongo = mongo;
|
||||
this.rethink = rethink;
|
||||
this.config = config;
|
||||
this.commandHandler = commandHandler;
|
||||
this.helpCommand = helpCommand;
|
||||
this.messageEditor = messageEditor;
|
||||
this.eventWaiter = eventWaiter;
|
||||
this.audioManager = audioManager;
|
||||
this.mongoUser = mongoUser;
|
||||
this.mongoServer = mongoServer;
|
||||
this.rethinkUser = rethinkUser;
|
||||
this.rethinkServer = rethinkServer;
|
||||
}
|
||||
|
||||
public Mongo getMongo() {
|
||||
return mongo;
|
||||
public Rethink getRethink() {
|
||||
return rethink;
|
||||
}
|
||||
|
||||
public Config getConfig() {
|
||||
|
|
@ -87,11 +87,11 @@ public class CommandEvent extends MessageReceivedEvent {
|
|||
return audioManager;
|
||||
}
|
||||
|
||||
public MongoServer getMongoServer() {
|
||||
return mongoServer;
|
||||
public RethinkServer getRethinkServer() {
|
||||
return rethinkServer;
|
||||
}
|
||||
|
||||
public MongoUser getMongoUser() {
|
||||
return mongoUser;
|
||||
public RethinkUser getRethinkUser() {
|
||||
return rethinkUser;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
|
|
@ -70,7 +70,7 @@ public class AvatarCommand implements Command {
|
|||
} 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();
|
||||
Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/users/" + args[0]).addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,15 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
package com.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 com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Icon;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
|
@ -40,7 +40,7 @@ public class ClydeCommand implements Command {
|
|||
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", "");
|
||||
String content = e.getMessage().getContentRaw().replace(e.getRethinkServer().getPrefix(), "").replace(e.getRethinkUser().getPrefix(), "").replace("clyde", "");
|
||||
|
||||
Webhook webhook = channel.createWebhook(e.getConfig().getClydeName()).complete();
|
||||
try {
|
||||
|
|
@ -66,8 +66,9 @@ public class ClydeCommand implements Command {
|
|||
}
|
||||
webhook.delete().queue();
|
||||
e.getMessage().delete().queue();
|
||||
} else
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.fun;
|
||||
package com.bbn.hadder.commands.fun;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class AboutCommand implements Command {
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ public class AboutCommand implements Command {
|
|||
"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")
|
||||
.setThumbnail("https://bigbotnetwork.com/images/Hadder.png")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class EqualsCommand implements Command {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
|
||||
|
|
@ -79,10 +79,10 @@ public class HelpCommand implements Command {
|
|||
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");
|
||||
b.append(e.getMessageEditor().getTerm("commands.general.help.usage")).append(" ").append(e.getRethinkServer().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());
|
||||
b.append(e.getMessageEditor().getTerm("commands.general.help.example")).append(" ").append(e.getRethinkServer().getPrefix()).append(name).append(" ").append(cmd.example());
|
||||
}
|
||||
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.Hadder;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class InviteCommand implements Command {
|
||||
|
||||
|
|
@ -30,9 +31,9 @@ public class InviteCommand implements Command {
|
|||
"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)")
|
||||
"(https://discordapp.com/oauth2/authorize?client_id="
|
||||
+ Hadder.shardManager.getGuilds().get(0).getSelfMember().getId()
|
||||
+ "&scope=bot&permissions=470133879)")
|
||||
.build()).queue();
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.general;
|
||||
package com.bbn.hadder.commands.general;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class PingCommand implements Command {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
|
@ -31,7 +31,7 @@ public class CodeCommand implements Command {
|
|||
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();
|
||||
Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/invite/" + args[0]).addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
|
|
@ -41,15 +41,11 @@ public class CodeCommand implements Command {
|
|||
"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)
|
||||
.addField("Verification Level", json.getJSONObject("guild").getString("verification_level"), true)
|
||||
.setThumbnail("https://cdn.discordapp.com/icons/" + json.getJSONObject("guild").getString("id") + "/" + json.getJSONObject("guild").getString("icon") + ".png")
|
||||
.build()).queue();
|
||||
e.getTextChannel().sendMessage(json.toString()).queue();
|
||||
} catch (JSONException ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.misc.code.error.title",
|
||||
|
|
@ -77,6 +73,6 @@ public class CodeCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String example() {
|
||||
return "nPwjaJk";
|
||||
return "58My2dM";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
package com.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 com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import org.kohsuke.github.GHIssue;
|
||||
import org.kohsuke.github.GHRepository;
|
||||
import org.kohsuke.github.GitHub;
|
||||
|
|
@ -47,7 +47,7 @@ public class FeedbackCommand implements Command {
|
|||
String description = e2.getMessage().getContentDisplay();
|
||||
try {
|
||||
GitHub connection = GitHub.connectUsingOAuth(e.getConfig().getGitHubToken());
|
||||
GHRepository Hadder = connection.getOrganization("BBN-Holding").getRepository("Hadder");
|
||||
GHRepository Hadder = connection.getOrganization("BigBotNetwork").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(
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.MessageEditor.MessageType;
|
||||
|
||||
import 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;
|
||||
|
||||
|
|
@ -35,7 +37,7 @@ public class ScreenShareCommand implements Command {
|
|||
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();
|
||||
.setDescription("http://discordapp.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);
|
||||
|
|
@ -43,7 +45,7 @@ public class ScreenShareCommand implements Command {
|
|||
} 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");
|
||||
EmbedBuilder eb = e.getMessageEditor().getMessage(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);
|
||||
|
|
@ -54,7 +56,7 @@ public class ScreenShareCommand implements Command {
|
|||
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();
|
||||
.setDescription("http://discordapp.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);
|
||||
|
|
@ -69,10 +71,12 @@ public class ScreenShareCommand implements Command {
|
|||
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();
|
||||
.setDescription("http://discordapp.com/channels/" + e.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
|
||||
}
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.misc;
|
||||
package com.bbn.hadder.commands.misc;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -43,13 +43,11 @@ public class ServerStatsCommand implements Command {
|
|||
.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);
|
||||
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();
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.BAN_MEMBERS)
|
||||
|
|
@ -58,6 +58,8 @@ public class BanCommand implements Command {
|
|||
"commands.moderation.ban.error.title",
|
||||
"commands.moderation.ban.yourself.error.description").build()).queue();
|
||||
}
|
||||
} else if (e.getMessage().getMentionedMembers().size() == 0) {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
} else if (e.getMessage().getMentionedMembers().size() > 1) {
|
||||
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||
|
|
@ -87,7 +89,7 @@ public class BanCommand implements Command {
|
|||
"",
|
||||
"commands.moderation.ban.massban.success.description",
|
||||
String.valueOf(e.getMessage().getMentionedMembers().size())).build()).queue();
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
||||
|
|
@ -92,7 +92,9 @@ public class ClearCommand implements Command {
|
|||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
|
|
@ -28,7 +28,7 @@ public class EditRulesCommand implements Command {
|
|||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getMongoServer().getMessageID().length() == 18) {
|
||||
if (e.getRethinkServer().getMessageID().length() == 18) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.editrules.message.title",
|
||||
"commands.moderation.editrules.message.description").build()).queue();
|
||||
|
|
@ -68,13 +68,13 @@ public class EditRulesCommand implements Command {
|
|||
} 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();
|
||||
"commands.moderation.editrules.error.description", e.getRethinkServer().getPrefix()).build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkChannel(CommandEvent e, String rules, TextChannel channel) {
|
||||
try {
|
||||
channel.retrieveMessageById(e.getMongoServer().getMessageID()).queue();
|
||||
channel.retrieveMessageById(e.getRethinkServer().getMessageID()).queue();
|
||||
setRules(e, rules, channel);
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.editrules.success.title",
|
||||
|
|
@ -87,7 +87,7 @@ public class EditRulesCommand implements Command {
|
|||
}
|
||||
|
||||
public void setRules(CommandEvent e, String rules, TextChannel channel) {
|
||||
channel.retrieveMessageById(e.getMongoServer().getMessageID()).complete().editMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
channel.retrieveMessageById(e.getRethinkServer().getMessageID()).complete().editMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Rules")
|
||||
.setDescription(rules)
|
||||
.build()).queue();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class InviteDetectCommand implements Command {
|
||||
|
|
@ -31,15 +31,15 @@ public class InviteDetectCommand implements Command {
|
|||
String opinion = args[0].toLowerCase();
|
||||
switch (opinion) {
|
||||
case "on":
|
||||
if (!e.getMongoServer().hasInviteDetect()) {
|
||||
e.getMongoServer().setInviteDetect(true);
|
||||
if (!e.getRethinkServer().isInviteDetect()) {
|
||||
e.getRethinkServer().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();
|
||||
e.getRethinkServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
|
|
@ -50,14 +50,14 @@ public class InviteDetectCommand implements Command {
|
|||
break;
|
||||
|
||||
case "off":
|
||||
if (e.getMongoServer().hasInviteDetect()) {
|
||||
e.getMongoServer().setInviteDetect(false);
|
||||
if (e.getRethinkServer().isInviteDetect()) {
|
||||
e.getRethinkServer().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();
|
||||
e.getRethinkServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
|
|
@ -68,14 +68,15 @@ public class InviteDetectCommand implements Command {
|
|||
break;
|
||||
default:
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
break;
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"invitedetect", "detectinvite", "invite-detect"};
|
||||
return new String[]{"invitedetect", "detectinvite"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
@Perms(Perm.KICK_MEMBERS)
|
||||
|
|
@ -54,6 +54,8 @@ public class KickCommand implements Command {
|
|||
} 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() == 0) {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
} else if (e.getMessage().getMentionedMembers().size() > 1) {
|
||||
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||
|
|
@ -72,7 +74,7 @@ public class KickCommand implements Command {
|
|||
}
|
||||
}
|
||||
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
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
|
|
@ -34,8 +34,8 @@ public class NickCommand implements Command {
|
|||
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();
|
||||
if (e.getMessage().getContentRaw().startsWith(e.getRethinkUser().getPrefix())) {
|
||||
e.getGuild().modifyNickname(e.getMessage().getMentionedMembers().get(0), e.getMessage().getContentRaw().replaceFirst(e.getRethinkUser().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
|
|
@ -44,8 +44,8 @@ public class NickCommand implements Command {
|
|||
"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();
|
||||
} else if (e.getMessage().getContentRaw().startsWith(e.getRethinkServer().getPrefix())) {
|
||||
e.getGuild().modifyNickname(e.getMessage().getMentionedMembers().get(0), e.getMessage().getContentRaw().replaceFirst(e.getRethinkServer().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
|
|
@ -54,13 +54,15 @@ public class NickCommand implements Command {
|
|||
"commands.moderation.nick.success.description", e.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
||||
).build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} 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();
|
||||
if (e.getMessage().getContentRaw().startsWith(e.getRethinkUser().getPrefix())) {
|
||||
e.getGuild().getSelfMember().modifyNickname(e.getMessage().getContentRaw().replaceFirst(e.getRethinkUser().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
|
|
@ -68,8 +70,8 @@ public class NickCommand implements Command {
|
|||
"✅",
|
||||
"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();
|
||||
} else if (e.getMessage().getContentRaw().startsWith(e.getRethinkServer().getPrefix())) {
|
||||
e.getGuild().getSelfMember().modifyNickname(e.getMessage().getContentRaw().replaceFirst(e.getRethinkServer().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
|
|
@ -79,7 +81,9 @@ public class NickCommand implements Command {
|
|||
).build()).queue();
|
||||
}
|
||||
}
|
||||
} else if (e.getMessage().getMentionedUsers().size() > 1) {
|
||||
} else if (e.getMessage().getMentionedMembers().size() == 0) {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
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())) {
|
||||
|
|
@ -95,7 +99,7 @@ public class NickCommand implements Command {
|
|||
"✅",
|
||||
"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();
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.MANAGE_SERVER)
|
||||
public class PrefixCommand implements Command {
|
||||
|
|
@ -29,12 +29,12 @@ public class PrefixCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length == 1) {
|
||||
if (!args[0].contains("\"")) {
|
||||
e.getMongoServer().setPrefix(args[0]);
|
||||
e.getMongoServer().push();
|
||||
e.getRethinkServer().setPrefix(args[0]);
|
||||
e.getRethinkServer().push();
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.moderation.prefix.success.title",
|
||||
"",
|
||||
"✅",
|
||||
"commands.moderation.prefix.success.description",
|
||||
args[0]).build()
|
||||
).queue();
|
||||
|
|
@ -45,7 +45,9 @@ public class PrefixCommand implements Command {
|
|||
"",
|
||||
"commands.moderation.prefix.error.description").build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.Region;
|
||||
|
||||
|
|
@ -86,6 +86,10 @@ public class RegionChangeCommand implements Command {
|
|||
case "us-south":
|
||||
setRegion(Region.US_SOUTH, "US South", e);
|
||||
break;
|
||||
/*case "south-korea":
|
||||
setRegion(Region.SOUTH_KOREA, "South Korea", e);
|
||||
break;
|
||||
TODO: Publish when JDA v4.2.0 is released*/
|
||||
default:
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
|
|
@ -120,7 +124,7 @@ public class RegionChangeCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"changeregion", "cr", "change-region", "region"};
|
||||
return new String[]{"changeregion", "cr", "change-region"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
|
|
@ -95,7 +95,9 @@ public class RoleCommand implements Command {
|
|||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,14 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.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 com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
|
@ -56,7 +56,7 @@ public class RulesCommand implements Command {
|
|||
try {
|
||||
TextChannel channel = e1.getGuild().getTextChannelsByName(e1.getMessage().getContentRaw(), true).get(0);
|
||||
createRules(e, e1, channel);
|
||||
} catch (NullPointerException | IndexOutOfBoundsException ex) {
|
||||
} catch (NullPointerException ex) {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
|
|
@ -174,8 +174,8 @@ public class RulesCommand implements Command {
|
|||
.build()).queue();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
e.getMongoServer().updateRules(rules.getId(), role.getId(), aemote.toString(), demote.toString());
|
||||
e.getMongoServer().push();
|
||||
e.getRethinkServer().updateRules(rules.getId(), role.getId(), aemote.toString(), demote.toString());
|
||||
e.getRethinkServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
|
|
@ -220,8 +220,8 @@ public class RulesCommand implements Command {
|
|||
.build()).queue();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
e.getMongoServer().updateRules(rules.getId(), role.getId(), aemote, demote);
|
||||
e.getMongoServer().push();
|
||||
e.getRethinkServer().updateRules(rules.getId(), role.getId(), aemote, demote);
|
||||
e.getRethinkServer().push();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.moderation;
|
||||
package com.bbn.hadder.commands.moderation;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
|
||||
public class StarboardCommand implements Command {
|
||||
|
|
@ -26,7 +26,7 @@ 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.getRethinkServer().setStarboard(e.getMessage().getMentionedChannels().get(0).getId());
|
||||
e.getChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
|
|
@ -37,16 +37,18 @@ public class StarboardCommand implements Command {
|
|||
if (args.length>0) {
|
||||
TextChannel channel = e.getGuild().getTextChannelById(args[0]);
|
||||
if (channel!=null) {
|
||||
e.getMongoServer().setStarboard(channel.getId());
|
||||
e.getRethinkServer().setStarboard(channel.getId());
|
||||
}
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
|
||||
if (args.length==2) {
|
||||
e.getMongoServer().setNeededStars(args[1]);
|
||||
e.getRethinkServer().setNeededStars(args[1]);
|
||||
}
|
||||
|
||||
e.getMongoServer().push();
|
||||
e.getRethinkServer().push();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.sedmelluq.discord.lavaplayer.filter.equalizer.EqualizerFactory;
|
||||
|
||||
public class BassCommand implements Command {
|
||||
101
src/main/java/com/bbn/hadder/commands/music/EchoCommand.java
Normal file
101
src/main/java/com/bbn/hadder/commands/music/EchoCommand.java
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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 com.bbn.hadder.commands.music;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import net.dv8tion.jda.api.audio.*;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class EchoCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
Guild guild = event.getMember().getVoiceState().getChannel().getGuild();
|
||||
AudioManager audioManager = guild.getAudioManager();
|
||||
EchoHandler handler = new EchoHandler();
|
||||
if (!audioManager.isConnected()) {
|
||||
audioManager.setSendingHandler(handler);
|
||||
audioManager.setReceivingHandler(handler);
|
||||
audioManager.openAudioConnection(event.getMember().getVoiceState().getChannel());
|
||||
} else {
|
||||
audioManager.closeAudioConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public static class EchoHandler implements AudioSendHandler, AudioReceiveHandler {
|
||||
|
||||
private final Queue<byte[]> queue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
@Override
|
||||
public boolean canProvide() {
|
||||
return !queue.isEmpty();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ByteBuffer provide20MsAudio() {
|
||||
byte[] data = queue.poll();
|
||||
return data == null ? null : ByteBuffer.wrap(data); // Wrap this in a java.nio.ByteBuffer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveCombined() {
|
||||
return queue.size() < 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCombinedAudio(@Nonnull CombinedAudio combinedAudio) {
|
||||
if (combinedAudio.getUsers().isEmpty())
|
||||
return;
|
||||
|
||||
byte[] data = combinedAudio.getAudioData(1.0f); // volume at 100% = 1.0 (50% = 0.5 / 55% = 0.55)
|
||||
queue.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"echo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
|
||||
public class InfoCommand implements Command {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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 com.bbn.hadder.commands.music;
|
||||
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class LeaveCommand implements Command {
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
||||
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||
e.getGuild().getAudioManager().closeAudioConnection();
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.INFO,
|
||||
"commands.music.leave.success.title",
|
||||
"commands.music.leave.success.description")
|
||||
.build()).queue();
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||
"commands.music.leave.error.channel.title",
|
||||
"commands.music.leave.error.channel.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||
MessageEditor.MessageType.ERROR,
|
||||
"commands.music.leave.error.connected.tile",
|
||||
"commands.music.leave.error.connected.description")
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"leave", "quit"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.leave.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class LoopCommand implements Command {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class PauseCommand implements Command {
|
||||
|
||||
|
|
@ -34,8 +34,8 @@ public class PauseCommand implements Command {
|
|||
.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())
|
||||
"commands.music.pause.error.paused.title",
|
||||
"commands.music.pause.error.paused.description")
|
||||
.build()).queue();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ public class PlayCommand implements Command {
|
|||
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 ", "");
|
||||
String input = e.getMessage().getContentRaw().replaceFirst(e.getRethinkServer().getPrefix() + "play ", "").replaceFirst(e.getRethinkUser().getPrefix() + "play ", "");
|
||||
try {
|
||||
new URL(input).toURI();
|
||||
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.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 com.bbn.hadder.audio.AudioInfo;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -1,25 +1,13 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License, Version 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* @author Hax / Hax6775 / Schlauer_Hax
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.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 com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.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;
|
||||
|
|
@ -95,7 +83,7 @@ public class RecordCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"record"};
|
||||
return new String[]{"echo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class SkipCommand implements Command {
|
||||
|
||||
|
|
@ -26,19 +26,10 @@ public class SkipCommand implements Command {
|
|||
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",
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.bbn.hadder.commands.music;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class StopCommand implements Command {
|
||||
|
||||
|
|
@ -26,7 +26,6 @@ public class StopCommand implements Command {
|
|||
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();
|
||||
|
|
@ -49,7 +48,7 @@ public class StopCommand implements Command {
|
|||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"stop", "leave"};
|
||||
return new String[]{"stop"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.music;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import org.jsoup.internal.StringUtil;
|
||||
|
||||
public class VolumeCommand implements Command {
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ public class VolumeCommand implements Command {
|
|||
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])) {
|
||||
if (StringUtil.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);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,19 +14,19 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
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");
|
||||
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)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class BDSMCommand implements Command {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class BlowjobCommand implements Command {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class BoobsCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class BoobsCommand implements Command {
|
|||
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");
|
||||
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)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class CumCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class CumCommand implements Command {
|
|||
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");
|
||||
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)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class EroticCommand implements Command {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class FeetCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class FeetCommand implements Command {
|
|||
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");
|
||||
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)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class FingeringCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class FingeringCommand implements Command {
|
|||
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");
|
||||
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)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class LickingCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class LickingCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/kuni");
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/kuni/");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class PornCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class PornCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/classic");
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/classic/");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class PussyCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class PussyCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://nekos.life/api/v2/img/pussy");
|
||||
String url = Http.getNSFW("https://nekos.life/api/v2/img/pussy/");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class RandomPornCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class RandomPornCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/all_tags");
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/all_tags/");
|
||||
|
||||
e.getTextChannel()
|
||||
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class SoloCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class SoloCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/girls_solo");
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/girls_solo/");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class SpankCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class SpankCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/spank");
|
||||
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/spank/");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.nsfw;
|
||||
package com.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;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.utils.Http;
|
||||
|
||||
public class TransCommand implements Command {
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class TransCommand implements Command {
|
|||
public void executed(String[] args, CommandEvent e) {
|
||||
if (e.getTextChannel().isNSFW()) {
|
||||
|
||||
String url = Http.getNSFW("https://nekos.life/api/v2/img/trap");
|
||||
String url = Http.getNSFW("https://nekos.life/api/v2/img/trap/");
|
||||
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,14 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.owner;
|
||||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
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.db.MongoUser;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -39,34 +38,50 @@ public class BlacklistCommand implements Command {
|
|||
} else {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "add":
|
||||
case "remove":
|
||||
if (args.length == 3 && e.getMessage().getMentionedUsers().size() == 1) {
|
||||
MongoUser u = new MongoUser(e.getMongo().getObjectByID("user", e.getMessage().getMentionedUsers().get(0).getId()), e.getMongo());
|
||||
String blacklisted = e.getMongoUser().getBlacklisted();
|
||||
if (args.length == 3) {
|
||||
String blacklisted = e.getRethinkUser().getBlacklisted();
|
||||
List<String> commands = new ArrayList<>();
|
||||
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
|
||||
if (args[0].equalsIgnoreCase("add")) commands.addAll(Arrays.asList(args[1].split(",")));
|
||||
else commands.removeAll(Arrays.asList(args[1].split(",")));
|
||||
commands.addAll(Arrays.asList(args[1].split(",")));
|
||||
LinkedHashSet<String> hashSet = new LinkedHashSet<>(commands);
|
||||
|
||||
ArrayList<String> commandsWithoutDuplicates = new ArrayList<>(hashSet);
|
||||
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
||||
u.setBlacklisted(newblacklisted);
|
||||
e.getRethinkUser().setBlacklisted(newblacklisted);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.owner.blacklist.success." + args[0].toLowerCase() + ".title", "",
|
||||
"commands.owner.blacklist.success." + args[0].toLowerCase() + ".description", newblacklisted)
|
||||
"commands.owner.blacklist.success.add.title", "",
|
||||
"commands.owner.blacklist.success.add.description", newblacklisted)
|
||||
.build()).queue();
|
||||
u.push();
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
e.getRethinkUser().push();
|
||||
}
|
||||
break;
|
||||
|
||||
case "remove":
|
||||
if (args.length == 3) {
|
||||
String blacklisted = e.getRethinkUser().getBlacklisted();
|
||||
List<String> commands = new ArrayList<>();
|
||||
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
|
||||
commands.removeAll(Arrays.asList(args[1].split(",")));
|
||||
LinkedHashSet<String> hashSet = new LinkedHashSet<>(commands);
|
||||
|
||||
ArrayList<String> commandsWithoutDuplicates = new ArrayList<>(hashSet);
|
||||
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
||||
e.getRethinkUser().setBlacklisted(newblacklisted);
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.owner.blacklist.success.remove.title", "",
|
||||
"commands.owner.blacklist.success.remove.description", newblacklisted)
|
||||
.build()).queue();
|
||||
e.getRethinkUser().push();
|
||||
}
|
||||
break;
|
||||
|
||||
case "list":
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (User user : e.getJDA().getUsers()) {
|
||||
if (!user.getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||
MongoUser u = new MongoUser(e.getMongo().getObjectByID("user", user.getId()), e.getMongo());
|
||||
String blacklisted = u.getBlacklisted();
|
||||
String blacklisted = e.getRethinkUser().getBlacklisted();
|
||||
if (!"none".equals(blacklisted)) {
|
||||
stringBuilder.append(user.getAsTag()).append(" (").append(user.getId()).append(") - ").append(blacklisted).append("\n");
|
||||
}
|
||||
|
|
@ -74,7 +89,7 @@ public class BlacklistCommand implements Command {
|
|||
}
|
||||
e.getTextChannel().sendMessage(
|
||||
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Blacklisted Users")
|
||||
.setTitle("Blacklisted Users:")
|
||||
.setDescription((stringBuilder.length()!=0) ? ("``" + stringBuilder.toString() + "``") : "No blacklisted Users")
|
||||
.build()).queue();
|
||||
break;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,14 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.owner;
|
||||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
import one.bbn.hadder.Hadder;
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.Hadder;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
|
@ -43,9 +43,10 @@ public class EvalCommand implements Command {
|
|||
} catch (ScriptException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
engine.put("msg".toLowerCase(), e.getMessage());
|
||||
engine.put("shardmanager".toLowerCase(), Hadder.shardManager);
|
||||
engine.put("rethink".toLowerCase(), e.getMongo());
|
||||
engine.put("rethink".toLowerCase(), e.getRethink());
|
||||
engine.put("e".toLowerCase(), e);
|
||||
engine.put("jda".toLowerCase(), e.getJDA());
|
||||
engine.put("message".toLowerCase(), e.getMessage());
|
||||
|
|
@ -96,7 +97,9 @@ public class EvalCommand implements Command {
|
|||
|
||||
}, 0, TimeUnit.MILLISECONDS);
|
||||
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.owner;
|
||||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
|
|
@ -41,7 +41,9 @@ public class GuildLeaveCommand implements Command {
|
|||
} catch (Exception ex) {
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.owner.guildleave.error.title", "", "commands.owner.guildleave.help.description", guild.getName()).build()).queue();
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.owner;
|
||||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
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 com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class RebootCommand implements Command {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.owner;
|
||||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.core.Perm;
|
||||
import one.bbn.hadder.core.Perms;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.core.Perm;
|
||||
import com.bbn.hadder.core.Perms;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
@Perms(Perm.BOT_OWNER)
|
||||
public class ShutdownCommand implements Command {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.owner;
|
||||
package com.bbn.hadder.commands.owner;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor.MessageType;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor.MessageType;
|
||||
|
||||
public class TestCommand implements Command {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.settings;
|
||||
package com.bbn.hadder.commands.settings;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class LanguageCommand implements Command {
|
||||
|
||||
|
|
@ -49,23 +49,25 @@ public class LanguageCommand implements Command {
|
|||
break;
|
||||
default:
|
||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||
"commands.settings.language.error.title", "",
|
||||
"commands.settings.language.error.description", "`de`, `en`, `es`, `fr`, `ru`, `tr`, `zh`")
|
||||
"List",
|
||||
"`de`, `en`, `es`, `fr`, `ru`, `tr`, `zh`")
|
||||
.build()).queue();
|
||||
break;
|
||||
}
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLanguage(String language_code, String language, CommandEvent e) {
|
||||
e.getMongoUser().setLanguage(language_code);
|
||||
e.getRethinkUser().setLanguage(language_code);
|
||||
e.getTextChannel()
|
||||
.sendMessage(
|
||||
e.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.language.success.title",
|
||||
"", "commands.settings.language.success.description", language)
|
||||
.build()).queue();
|
||||
e.getMongoUser().push();
|
||||
e.getRethinkUser().push();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,25 +14,27 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.commands.settings;
|
||||
package com.bbn.hadder.commands.settings;
|
||||
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
|
||||
public class UserPrefixCommand implements Command {
|
||||
|
||||
public void executed(String[] args, CommandEvent e) {
|
||||
if (args.length == 1) {
|
||||
e.getMongoUser().setPrefix(args[0]);
|
||||
e.getRethinkUser().setPrefix(args[0]);
|
||||
e.getTextChannel()
|
||||
.sendMessage(e.getMessageEditor()
|
||||
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.prefix.success.title", "",
|
||||
"commands.settings.prefix.success.description", args[0])
|
||||
.build())
|
||||
.queue();
|
||||
e.getMongoUser().push();
|
||||
} else e.getHelpCommand().sendHelp(this, e);
|
||||
e.getRethinkUser().push();
|
||||
} else {
|
||||
e.getHelpCommand().sendHelp(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,17 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.core;
|
||||
package com.bbn.hadder.core;
|
||||
|
||||
import one.bbn.hadder.audio.AudioManager;
|
||||
import one.bbn.hadder.commands.Command;
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import one.bbn.hadder.commands.general.HelpCommand;
|
||||
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 com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import com.bbn.hadder.RethinkUser;
|
||||
import com.bbn.hadder.audio.AudioManager;
|
||||
import com.bbn.hadder.commands.Command;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.commands.general.HelpCommand;
|
||||
import com.bbn.hadder.utils.EventWaiter;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -42,7 +42,7 @@ public class CommandHandler {
|
|||
this.helpCommand = helpCommand;
|
||||
}
|
||||
|
||||
public void handle(MessageReceivedEvent event, Mongo mongo, String prefix, AudioManager audioManager, MongoUser mongoUser, MongoServer mongoServer) {
|
||||
public void handle(MessageReceivedEvent event, Rethink rethink, String prefix, AudioManager audioManager, RethinkUser rethinkUser, RethinkServer rethinkServer) {
|
||||
String invoke = event.getMessage().getContentRaw().replaceFirst(prefix, "").split(" ")[0];
|
||||
for (Command cmd : commandList) {
|
||||
for (String label : cmd.labels()) {
|
||||
|
|
@ -53,8 +53,8 @@ public class CommandHandler {
|
|||
String[] args = argString.split(" ");
|
||||
if (args.length > 0 && args[0].equals("")) args = new String[0];
|
||||
|
||||
CommandEvent commandEvent = new CommandEvent(event.getJDA(), event.getResponseNumber(), event.getMessage(), mongo,
|
||||
config, this, helpCommand, new MessageEditor(mongoUser, event.getAuthor()), new EventWaiter(), audioManager, mongoUser, mongoServer);
|
||||
CommandEvent commandEvent = new CommandEvent(event.getJDA(), event.getResponseNumber(), event.getMessage(), rethink,
|
||||
config, this, helpCommand, new MessageEditor(rethinkUser, event.getAuthor()), new EventWaiter(), audioManager, rethinkUser, rethinkServer);
|
||||
if (cmd.getClass().getAnnotations().length > 0 && !Arrays.asList(cmd.getClass().getAnnotations()).contains(Perms.class)) {
|
||||
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
|
||||
if (!perm.check(commandEvent)) {
|
||||
|
|
@ -68,7 +68,7 @@ public class CommandHandler {
|
|||
}
|
||||
|
||||
boolean run = true;
|
||||
String blacklisted = mongoUser.getBlacklisted();
|
||||
String blacklisted = rethinkUser.getBlacklisted();
|
||||
if (!"none".equals(blacklisted)) {
|
||||
for (String BLLabel : blacklisted.split(",")) {
|
||||
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
|
||||
|
|
@ -76,8 +76,8 @@ public class CommandHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (run) cmd.executed(args, commandEvent);
|
||||
else event.getMessage().addReaction("❌").queue();
|
||||
if (run)
|
||||
cmd.executed(args, commandEvent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.core;
|
||||
package com.bbn.hadder.core;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONStringer;
|
||||
|
|
@ -70,22 +70,17 @@ public class Config {
|
|||
.key("Tokens").object()
|
||||
.key("BotToken").value(null)
|
||||
.key("Giphy").value(null)
|
||||
.key("GitHub").value(null)
|
||||
.key("MythicalBotList").value(null)
|
||||
.key("BotsForDiscord").value(null)
|
||||
.key("DiscordBotList").value(null)
|
||||
.key("DiscordBestBots").value(null)
|
||||
.key("DiscordBoats").value(null)
|
||||
.key("YetAnotherBotList").value(null)
|
||||
.key("DiscordExtremeList").value(null)
|
||||
.key("DiscordBotReviews").value(null)
|
||||
.key("DiscordBots").value(null)
|
||||
.key("BotListSpace").value(null)
|
||||
.key("DiscordBots2").value(null)
|
||||
.key("CloudList").value(null)
|
||||
.key("Arcane").value(null)
|
||||
.endObject()
|
||||
.key("Clyde").value("Clyde")
|
||||
.endObject().toString();
|
||||
.value("DiscordExtremeList").value(null)
|
||||
.value("DiscordBotReviews").value(null)
|
||||
.value("DiscordBots").value(null)
|
||||
.value("BotListSpace").value(null)
|
||||
.endObject().endObject().toString();
|
||||
}
|
||||
|
||||
public String getBotToken() {
|
||||
|
|
@ -148,6 +143,10 @@ public class Config {
|
|||
return config.getJSONObject("Tokens").getString("DiscordExtremeList");
|
||||
}
|
||||
|
||||
public String getDiscordBotReviewsToken() {
|
||||
return config.getJSONObject("Tokens").getString("DiscordBotReviews");
|
||||
}
|
||||
|
||||
public String getDiscordBotsToken() {
|
||||
return config.getJSONObject("Tokens").getString("DiscordBots");
|
||||
}
|
||||
|
|
@ -164,10 +163,6 @@ public class Config {
|
|||
return config.getJSONObject("Tokens").getString("CloudList");
|
||||
}
|
||||
|
||||
public String getArcaneToken() {
|
||||
return config.getJSONObject("Tokens").getString("Arcane");
|
||||
}
|
||||
|
||||
public String getClydeName() {
|
||||
return config.getString("Clyde");
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.core;
|
||||
package com.bbn.hadder.core;
|
||||
|
||||
import one.bbn.hadder.commands.CommandEvent;
|
||||
import com.bbn.hadder.commands.CommandEvent;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
|
||||
public enum Perm {
|
||||
|
|
@ -33,6 +33,12 @@ public enum Perm {
|
|||
return e.getMember().hasPermission(Permission.MESSAGE_MANAGE) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
EMBED_MESSAGES {
|
||||
@Override
|
||||
public boolean check(CommandEvent e) {
|
||||
return e.getMember().hasPermission(Permission.MESSAGE_EMBED_LINKS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
BAN_MEMBERS {
|
||||
@Override
|
||||
public boolean check(CommandEvent e) {
|
||||
|
|
@ -74,12 +80,6 @@ public enum Perm {
|
|||
public boolean check(CommandEvent e) {
|
||||
return e.getMember().hasPermission(Permission.MANAGE_WEBHOOKS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||
}
|
||||
},
|
||||
VOICE_MOVE_OTHERS {
|
||||
@Override
|
||||
public boolean check(CommandEvent e) {
|
||||
return e.getMember().hasPermission(Permission.VOICE_MOVE_OTHERS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||
}
|
||||
};
|
||||
|
||||
public abstract boolean check(CommandEvent e);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.core;
|
||||
package com.bbn.hadder.core;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,18 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.audio.AudioManager;
|
||||
import one.bbn.hadder.core.CommandHandler;
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.db.MongoServer;
|
||||
import one.bbn.hadder.db.MongoUser;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import com.bbn.hadder.RethinkUser;
|
||||
import com.bbn.hadder.audio.AudioManager;
|
||||
import com.bbn.hadder.core.CommandHandler;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
import java.awt.*;
|
||||
|
|
@ -33,12 +32,12 @@ import java.time.Instant;
|
|||
|
||||
public class CommandListener extends ListenerAdapter {
|
||||
|
||||
private final Mongo mongo;
|
||||
private final CommandHandler handler;
|
||||
private final AudioManager audioManager;
|
||||
private Rethink rethink;
|
||||
private CommandHandler handler;
|
||||
private AudioManager audioManager;
|
||||
|
||||
public CommandListener(Mongo mongo, CommandHandler handler, AudioManager audioManager) {
|
||||
this.mongo = mongo;
|
||||
public CommandListener(Rethink rethink, CommandHandler handler, AudioManager audioManager) {
|
||||
this.rethink = rethink;
|
||||
this.handler = handler;
|
||||
this.audioManager = audioManager;
|
||||
}
|
||||
|
|
@ -48,46 +47,39 @@ public class CommandListener extends ListenerAdapter {
|
|||
if (e.isFromType(ChannelType.TEXT) && !e.getAuthor().isBot()) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_WRITE)) {
|
||||
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
|
||||
MongoUser mongoUser = new MongoUser(mongo.getObjectByID("user", e.getAuthor().getId()), mongo);
|
||||
MongoServer mongoServer = new MongoServer(mongo.getObjectByID("server", e.getGuild().getId()), mongo);
|
||||
mongoUser.push();
|
||||
mongoServer.push();
|
||||
RethinkUser rethinkUser = new RethinkUser(rethink.getObjectByID("user", e.getAuthor().getId()), rethink);
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
rethinkUser.push();
|
||||
rethinkServer.push();
|
||||
String[] prefixes = {
|
||||
mongoUser.getPrefix(), mongoServer.getPrefix(),
|
||||
rethinkUser.getPrefix(), rethinkServer.getPrefix(),
|
||||
e.getGuild().getSelfMember().getAsMention() + " ", e.getGuild().getSelfMember().getAsMention(),
|
||||
e.getGuild().getSelfMember().getAsMention().replace("@", "@!") + " ",
|
||||
e.getGuild().getSelfMember().getAsMention().replace("@", "@!")
|
||||
};
|
||||
for (String prefix : prefixes) {
|
||||
if (e.getMessage().getContentRaw().startsWith(prefix)) {
|
||||
handler.handle(e, mongo, prefix, audioManager, mongoUser, mongoServer);
|
||||
handler.handle(e, rethink, prefix, audioManager, rethinkUser, rethinkServer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder()
|
||||
.setTitle("No permission")
|
||||
.setDescription("I need the `MESSAGE EMBED LINKS` permission in order to work!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
} catch (ErrorResponseException ex) {
|
||||
e.getTextChannel().sendMessage("I need the `MESSAGE EMBED LINKS` permission in order to work!").queue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder()
|
||||
.setTitle("No permission")
|
||||
.setDescription("I need the `MESSAGE WRITE` permission in order to work!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
} catch (ErrorResponseException ignore) {}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,12 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.core.Config;
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.utils.BotList;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.utils.BotList;
|
||||
import com.bbn.hadder.utils.MessageEditor;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
|
||||
import net.dv8tion.jda.api.events.guild.GuildLeaveEvent;
|
||||
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
|
||||
|
|
@ -29,17 +30,25 @@ import java.time.Instant;
|
|||
|
||||
public class GuildListener extends ListenerAdapter {
|
||||
|
||||
private final Mongo mongo;
|
||||
private final Config config;
|
||||
private Rethink rethink;
|
||||
private Config config;
|
||||
|
||||
public GuildListener(Mongo mongo, Config config) {
|
||||
this.mongo = mongo;
|
||||
public GuildListener(Rethink rethink, Config config) {
|
||||
this.rethink = rethink;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void onGuildJoin(GuildJoinEvent e) {
|
||||
mongo.insertGuild(e.getGuild().getId());
|
||||
e.getJDA().getTextChannelById("759783393230979142").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
||||
new Thread(() -> {
|
||||
for (Member member : e.getGuild().getMembers()) {
|
||||
if (!member.getUser().getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||
rethink.insertUser(member.getUser().getId());
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
rethink.insertGuild(e.getGuild().getId());
|
||||
e.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Joined Server")
|
||||
.setThumbnail(e.getGuild().getIconUrl())
|
||||
.addField("Name", e.getGuild().getName(), true)
|
||||
|
|
@ -54,7 +63,7 @@ public class GuildListener extends ListenerAdapter {
|
|||
}
|
||||
|
||||
public void onGuildLeave(GuildLeaveEvent e) {
|
||||
e.getJDA().getTextChannelById("759783393230979142").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
||||
e.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("Left Server")
|
||||
.setThumbnail(e.getGuild().getIconUrl())
|
||||
.addField("Name", e.getGuild().getName(), true)
|
||||
|
|
@ -70,7 +79,7 @@ public class GuildListener extends ListenerAdapter {
|
|||
|
||||
public void onGuildMemberJoin(GuildMemberJoinEvent e) {
|
||||
if (!e.getUser().getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||
mongo.insertUser(e.getUser().getId());
|
||||
rethink.insertUser(e.getUser().getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,14 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.db.MongoServer;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.events.message.MessageUpdateEvent;
|
||||
|
|
@ -35,22 +33,29 @@ import javax.annotation.Nonnull;
|
|||
|
||||
public class InviteLinkListener extends ListenerAdapter {
|
||||
|
||||
private Mongo mongo;
|
||||
private Rethink rethink;
|
||||
|
||||
public InviteLinkListener(Mongo mongo) {
|
||||
this.mongo = mongo;
|
||||
public InviteLinkListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(@Nonnull MessageReceivedEvent e) {
|
||||
if (e.isFromType(ChannelType.TEXT)) scanMessage(e.getGuild(), e.getMessage(), e.getMember());
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
if (e.isFromType(ChannelType.TEXT)) {
|
||||
if (e.getMessage().getContentRaw().contains("discord.gg/") && (!e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect())) {
|
||||
checkInvite(e.getMessage(), "discord.gg/");
|
||||
} else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && (!e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect())) {
|
||||
checkInvite(e.getMessage(), "discordapp.com/invite/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkInvite(Message message, String regex) {
|
||||
String split = message.getContentRaw().split(regex, 10)[1];
|
||||
String invite = split.split(" ")[0];
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url("https://canary.discord.com/api/v8/invites/" + invite).build();
|
||||
Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/invites/" + invite).build();
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
|
|
@ -64,17 +69,13 @@ public class InviteLinkListener extends ListenerAdapter {
|
|||
|
||||
@Override
|
||||
public void onMessageUpdate(@Nonnull MessageUpdateEvent e) {
|
||||
if (e.isFromType(ChannelType.TEXT)) scanMessage(e.getGuild(), e.getMessage(), e.getMember());
|
||||
}
|
||||
|
||||
public void scanMessage(Guild guild, Message message, Member member) {
|
||||
MongoServer mongoServer = new MongoServer(mongo.getObjectByID("server", guild.getId()), mongo);
|
||||
if (message.getContentRaw().contains("discord.gg/") && !member.hasPermission(Permission.ADMINISTRATOR) && mongoServer.hasInviteDetect()) {
|
||||
checkInvite(message, "discord.gg/");
|
||||
} else if (message.getContentRaw().contains("discord.com/invite") && !member.hasPermission(Permission.ADMINISTRATOR) && mongoServer.hasInviteDetect()) {
|
||||
checkInvite(message, "discord.com/invite/");
|
||||
} else if (message.getContentRaw().contains("discordapp.com/invite") && !member.hasPermission(Permission.ADMINISTRATOR) && mongoServer.hasInviteDetect()) {
|
||||
checkInvite(message, "discordapp.com/invite/");
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
if (e.isFromType(ChannelType.TEXT)) {
|
||||
if (e.getMessage().getContentRaw().contains("discord.gg/") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect()) {
|
||||
checkInvite(e.getMessage(), "discord.gg/");
|
||||
} else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect()) {
|
||||
checkInvite(e.getMessage(), "discordapp.com/invite/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
85
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
85
src/main/java/com/bbn/hadder/listener/MentionListener.java
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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 com.bbn.hadder.listener;
|
||||
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import com.bbn.hadder.RethinkUser;
|
||||
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 org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
public class MentionListener extends ListenerAdapter {
|
||||
|
||||
private Rethink rethink;
|
||||
|
||||
public MentionListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(@Nonnull MessageReceivedEvent e) {
|
||||
if (!e.getAuthor().isBot()) {
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
RethinkUser rethinkUser = new RethinkUser(rethink.getObjectByID("user", e.getAuthor().getId()), rethink);
|
||||
if (e.isFromType(ChannelType.TEXT) && (e.getMessage().getContentRaw().equals(e.getGuild().getSelfMember().getAsMention()) ||
|
||||
e.getMessage().getContentRaw().equals(e.getGuild().getSelfMember().getAsMention().replace("@", "@!")))) {
|
||||
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
Model model = null;
|
||||
try {
|
||||
model = reader.read(this.getClass().getClassLoader().getResourceAsStream("pom.xml"));
|
||||
} catch (IOException | XmlPullParserException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
EmbedBuilder builder = new EmbedBuilder()
|
||||
.setTitle("Hi!")
|
||||
.addField("Version", model.getVersion(), false)
|
||||
.addField("User-Prefix", rethinkUser.getPrefix(), true)
|
||||
.addField("Guild-Prefix", rethinkServer.getPrefix(), true);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
model.getDependencies().forEach(
|
||||
dependency -> stringBuilder.append(dependency.getArtifactId()).append(" - ").append(dependency.getVersion()).append("\n")
|
||||
);
|
||||
builder.addField("Dependencies", stringBuilder.toString(), false);
|
||||
StringBuilder devs = new StringBuilder();
|
||||
//TODO: Fix Mail stuff
|
||||
model.getDevelopers().forEach(
|
||||
developer -> devs.append(developer.getId()).append(" - [Website](").append(developer.getUrl()).append("), [E-Mail](https://hax.bigbotnetwork.de/redirect.html?url=mailto:").append(developer.getEmail()).append(")\n")
|
||||
);
|
||||
builder.addField("Developer", devs.toString(), false);
|
||||
builder.addField("Join our Dev Server!", "[Click here!](https://discord.gg/58My2dM)", true);
|
||||
builder.addField("Github", "[Click here!](https://github.com/BigBotNetwork/Hadder)",false);
|
||||
builder.addField("Twitch", "[Click here!](https://www.twitch.tv/bigbotnetwork)", false);
|
||||
e.getChannel().sendMessage(builder.build()).queue();
|
||||
} else if (e.getMessage().getContentRaw().equalsIgnoreCase("@someone")) {
|
||||
int member = new Random().nextInt(e.getGuild().getMembers().size() - 1);
|
||||
if (member > 0 && member < e.getGuild().getMembers().size()) {
|
||||
e.getChannel().sendMessage(e.getGuild().getMembers().get(member).getAsMention() + " (Executed by: " + e.getAuthor().getAsTag() + ")").queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.db.MongoUser;
|
||||
import one.bbn.hadder.utils.MessageEditor;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkUser;
|
||||
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;
|
||||
|
|
@ -30,26 +30,25 @@ import java.time.Instant;
|
|||
|
||||
public class PrivateMessageListener extends ListenerAdapter {
|
||||
|
||||
private final Mongo mongo;
|
||||
private Rethink rethink;
|
||||
|
||||
public PrivateMessageListener(Mongo mongo) {
|
||||
this.mongo = mongo;
|
||||
public PrivateMessageListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
public void onMessageReceived(MessageReceivedEvent e) {
|
||||
if (e.isFromType(ChannelType.PRIVATE) && !e.getAuthor().getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||
PrivateChannel Skidder = e.getJDA().getUserById("401817301919465482").openPrivateChannel().complete();
|
||||
PrivateChannel Skidder = e.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
|
||||
PrivateChannel Hax = e.getJDA().getUserById("261083609148948488").openPrivateChannel().complete();
|
||||
MongoUser HaxUser = new MongoUser(mongo.getObjectByID("user", "261083609148948488"), mongo);
|
||||
MongoUser SkidderUser = new MongoUser(mongo.getObjectByID("user", "261083609148948488"), mongo);
|
||||
RethinkUser rethinkUser = new RethinkUser(rethink.getObjectByID("user", "261083609148948488"), rethink);
|
||||
|
||||
Skidder.sendMessage(new MessageEditor(SkidderUser, e.getJDA().getUserById("401817301919465482")).getMessage(MessageEditor.MessageType.INFO)
|
||||
Skidder.sendMessage(new MessageEditor(rethinkUser, e.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("New DM by " + e.getAuthor().getAsTag())
|
||||
.setAuthor(e.getAuthor().getName(), e.getAuthor().getAvatarUrl(), e.getAuthor().getAvatarUrl())
|
||||
.setDescription(e.getMessage().getContentRaw())
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
Hax.sendMessage(new MessageEditor(HaxUser, e.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
||||
Hax.sendMessage(new MessageEditor(rethinkUser, e.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
||||
.setTitle("New DM by " + e.getAuthor().getAsTag())
|
||||
.setAuthor(e.getAuthor().getName(), e.getAuthor().getAvatarUrl(), e.getAuthor().getAvatarUrl())
|
||||
.setDescription(e.getMessage().getContentRaw())
|
||||
|
|
@ -58,9 +57,9 @@ public class PrivateMessageListener extends ListenerAdapter {
|
|||
|
||||
e.getChannel().sendMessage(new EmbedBuilder()
|
||||
.setTitle("No DM support")
|
||||
.setDescription("You have to execute your commands on a guild! For further support join our Discord server [here](https://discord.gg/nPwjaJk)")
|
||||
.setDescription("You have to execute your commands on a guild!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now())
|
||||
.build()).queue();
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,25 +14,42 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import com.bbn.hadder.utils.BotList;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.ReadyEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import one.bbn.hadder.utils.BotList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ReadyListener extends ListenerAdapter {
|
||||
|
||||
private final Config config;
|
||||
private Rethink rethink;
|
||||
private Config config;
|
||||
|
||||
public ReadyListener(Config config) {
|
||||
public ReadyListener(Rethink rethink, Config config) {
|
||||
this.rethink = rethink;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady(@Nonnull ReadyEvent e) {
|
||||
rethink.setup();
|
||||
new Thread(() -> {
|
||||
for (User user : e.getJDA().getUsers()) {
|
||||
if (!user.getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||
rethink.insertUser(user.getId());
|
||||
}
|
||||
}
|
||||
for (Guild g : e.getJDA().getGuilds()) {
|
||||
rethink.insertGuild(g.getId());
|
||||
}
|
||||
}).start();
|
||||
|
||||
new BotList(config).post();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,39 +14,39 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.db.MongoServer;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class RulesListener extends ListenerAdapter {
|
||||
|
||||
private final Mongo mongo;
|
||||
private Rethink rethink;
|
||||
|
||||
public RulesListener(Mongo mongo) {
|
||||
this.mongo = mongo;
|
||||
public RulesListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReactionAdd(MessageReactionAddEvent e) {
|
||||
MongoServer mongoServer = new MongoServer(mongo.getObjectByID("server", e.getGuild().getId()), mongo);
|
||||
if (e.getMessageId().equals(mongoServer.getMessageID()) && !e.getUser().isBot()) {
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
if (e.getMessageId().equals(rethinkServer.getMessageID()) && !e.getUser().isBot()) {
|
||||
if (e.getReactionEmote().isEmote()) {
|
||||
if (mongoServer.getAcceptEmote().equals(e.getReactionEmote().getId())) {
|
||||
if (rethinkServer.getAcceptEmote().equals(e.getReactionEmote().getId())) {
|
||||
addRole(e);
|
||||
} else if (mongoServer.getDeclineEmote().equals(e.getReactionEmote().getId())) {
|
||||
} else if (rethinkServer.getDeclineEmote().equals(e.getReactionEmote().getId())) {
|
||||
e.getReaction().removeReaction(e.getUser()).queue();
|
||||
if (e.getGuild().getSelfMember().canInteract(e.getMember())) {
|
||||
e.getMember().kick().reason("Declined the rules");
|
||||
}
|
||||
}
|
||||
} else if (e.getReactionEmote().isEmoji()) {
|
||||
if (mongoServer.getAcceptEmote().equals(e.getReactionEmote().getEmoji())) {
|
||||
if (rethinkServer.getAcceptEmote().equals(e.getReactionEmote().getEmoji())) {
|
||||
addRole(e);
|
||||
} else if (mongoServer.getDeclineEmote().equals(e.getReactionEmote().getEmoji())) {
|
||||
} else if (rethinkServer.getDeclineEmote().equals(e.getReactionEmote().getEmoji())) {
|
||||
e.getReaction().removeReaction(e.getUser()).queue();
|
||||
if (e.getGuild().getSelfMember().canInteract(e.getMember())) {
|
||||
e.getMember().kick().reason("Declined the rules");
|
||||
|
|
@ -57,18 +57,17 @@ public class RulesListener extends ListenerAdapter {
|
|||
}
|
||||
|
||||
private void addRole(MessageReactionAddEvent e) {
|
||||
MongoServer mongoServer = new MongoServer(mongo.getObjectByID("server", e.getGuild().getId()), mongo);
|
||||
if (e.getMember().getRoles().contains(e.getGuild().getRoleById(mongoServer.getRoleID()))) {
|
||||
e.getGuild().removeRoleFromMember(e.getMember(), e.getGuild().getRoleById(mongoServer.getRoleID())).reason("Accepted rules").queue();
|
||||
} else
|
||||
e.getGuild().addRoleToMember(e.getMember(), e.getGuild().getRoleById(mongoServer.getRoleID())).reason("Accepted rules").queue();
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
if (e.getMember().getRoles().contains(e.getGuild().getRoleById(rethinkServer.getRoleID()))) {
|
||||
e.getGuild().removeRoleFromMember(e.getMember(), e.getGuild().getRoleById(rethinkServer.getRoleID())).reason("Accepted rules").queue();
|
||||
} else e.getGuild().addRoleToMember(e.getMember(), e.getGuild().getRoleById(rethinkServer.getRoleID())).reason("Accepted rules").queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReactionRemove(MessageReactionRemoveEvent e) {
|
||||
MongoServer mongoServer = new MongoServer(mongo.getObjectByID("server", e.getGuild().getId()), mongo);
|
||||
if (e.getMessageId().equals(mongoServer.getMessageID()) && !e.getUser().isBot()) {
|
||||
e.getGuild().removeRoleFromMember(e.getMember(), e.getGuild().getRoleById(mongoServer.getRoleID())).reason("Withdrawal of the acceptance of the rules").queue();
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
if (e.getMessageId().equals(rethinkServer.getMessageID()) && !e.getUser().isBot()) {
|
||||
e.getGuild().removeRoleFromMember(e.getMember(), e.getGuild().getRoleById(rethinkServer.getRoleID())).reason("Withdrawal of the acceptance of the rules").queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.db.Mongo;
|
||||
import one.bbn.hadder.db.MongoServer;
|
||||
import com.bbn.hadder.Rethink;
|
||||
import com.bbn.hadder.RethinkServer;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.MessageBuilder;
|
||||
import net.dv8tion.jda.api.entities.MessageReaction;
|
||||
|
|
@ -30,10 +30,10 @@ import javax.annotation.Nonnull;
|
|||
|
||||
public class StarboardListener extends ListenerAdapter {
|
||||
|
||||
private final Mongo mongo;
|
||||
private Rethink rethink;
|
||||
|
||||
public StarboardListener(Mongo mongo) {
|
||||
this.mongo = mongo;
|
||||
public StarboardListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -48,9 +48,9 @@ public class StarboardListener extends ListenerAdapter {
|
|||
|
||||
public void update(GenericMessageReactionEvent e) {
|
||||
if (e.getReaction().getReactionEmote().getName().equals("⭐")) {
|
||||
MongoServer mongoServer = new MongoServer(mongo.getObjectByID("server", e.getGuild().getId()), mongo);
|
||||
if (!mongo.hasStarboardMessage(e.getMessageId())) {
|
||||
if (mongoServer.hasStarboardChannel()) {
|
||||
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||
if (!rethink.hasStarboardMessage(e.getMessageId())) {
|
||||
if (rethink.hasStarboardChannel(e.getGuild().getId())) {
|
||||
e.getTextChannel().retrieveMessageById(e.getMessageId()).queue(
|
||||
msg -> {
|
||||
int stars = 0;
|
||||
|
|
@ -60,8 +60,8 @@ public class StarboardListener extends ListenerAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
if (Integer.parseInt(mongoServer.getNeededStars()) <= stars) {
|
||||
e.getGuild().getTextChannelById(mongoServer.getStarboard())
|
||||
if (Integer.parseInt(rethinkServer.getNeededStars()) <= stars) {
|
||||
e.getGuild().getTextChannelById(rethinkServer.getStarboard())
|
||||
.sendMessage(new MessageBuilder()
|
||||
.setContent("⭐ 1" + " " + e.getTextChannel().getAsMention())
|
||||
.setEmbed(
|
||||
|
|
@ -70,7 +70,7 @@ public class StarboardListener extends ListenerAdapter {
|
|||
.setDescription(msg.getContentRaw())
|
||||
.setTimestamp(msg.getTimeCreated()).build()).build()).queue(
|
||||
starboardmsg -> {
|
||||
mongo.insertStarboardMessage(msg.getId(), e.getGuild().getId(), starboardmsg.getId());
|
||||
rethink.insertStarboardMessage(msg.getId(), e.getGuild().getId(), starboardmsg.getId());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -90,11 +90,11 @@ public class StarboardListener extends ListenerAdapter {
|
|||
}
|
||||
|
||||
int finalStars = stars;
|
||||
e.getGuild().getTextChannelById(mongoServer.getStarboard())
|
||||
.retrieveMessageById(mongo.getStarboardMessage(e.getMessageId())).queue(
|
||||
e.getGuild().getTextChannelById(rethinkServer.getStarboard())
|
||||
.retrieveMessageById(rethink.getStarboardMessage(e.getMessageId())).queue(
|
||||
msg2 -> {
|
||||
|
||||
if (Integer.parseInt(mongoServer.getNeededStars()) <= finalStars) {
|
||||
if (Integer.parseInt(rethinkServer.getNeededStars()) <= finalStars) {
|
||||
msg2.editMessage(new MessageBuilder()
|
||||
.setContent("⭐ " + finalStars + " " + e.getTextChannel().getAsMention())
|
||||
.setEmbed(
|
||||
|
|
@ -104,7 +104,7 @@ public class StarboardListener extends ListenerAdapter {
|
|||
.setTimestamp(msg.getTimeCreated()).build()).build()).queue();
|
||||
} else {
|
||||
msg2.delete().queue();
|
||||
mongo.removeStarboardMessage(msg.getId());
|
||||
rethink.removeStarboardMessage(msg.getId());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,15 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.listener;
|
||||
package com.bbn.hadder.listener;
|
||||
|
||||
import one.bbn.hadder.audio.AudioManager;
|
||||
import com.bbn.hadder.audio.AudioManager;
|
||||
import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class VoiceLeaveListener extends ListenerAdapter {
|
||||
|
||||
private final AudioManager audioManager;
|
||||
private AudioManager audioManager;
|
||||
|
||||
public VoiceLeaveListener(AudioManager audioManager) {
|
||||
this.audioManager = audioManager;
|
||||
|
|
@ -30,7 +30,7 @@ public class VoiceLeaveListener extends ListenerAdapter {
|
|||
|
||||
@Override
|
||||
public void onGuildVoiceLeave(GuildVoiceLeaveEvent e) {
|
||||
if (!e.getMember().getUser().isBot() && audioManager.hasPlayer(e.getGuild()) && e.getChannelLeft().getMembers().size() == 1 && e.getChannelLeft().getMembers().get(0).equals(e.getGuild().getSelfMember())) {
|
||||
if (audioManager.hasPlayer(e.getGuild()) && e.getChannelLeft().getMembers().equals(e.getGuild().getSelfMember())) {
|
||||
audioManager.players.remove(e.getGuild().getId());
|
||||
audioManager.getPlayer(e.getGuild()).destroy();
|
||||
audioManager.getTrackManager(e.getGuild()).purgeQueue();
|
||||
230
src/main/java/com/bbn/hadder/utils/BotList.java
Normal file
230
src/main/java/com/bbn/hadder/utils/BotList.java
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* 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 com.bbn.hadder.utils;
|
||||
|
||||
import com.bbn.hadder.Hadder;
|
||||
import com.bbn.hadder.core.Config;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class BotList {
|
||||
|
||||
private static String MythicalBotList = "https://mythicalbots.xyz/api/bot/637002314162372639";
|
||||
private static String BotsForDiscord = "https://botsfordiscord.com/api/bot/637002314162372639";
|
||||
private static String DiscordBotList = "https://discordbotlist.com/api/bots/637002314162372639/stats";
|
||||
private static String DiscordBoats = "https://discord.boats/api/bot/637002314162372639";
|
||||
private static String YetAnotherBotList = "https://yabl.xyz/api/bot/637002314162372639/stats";
|
||||
private static String DiscordExtremeList = "https://api.discordextremelist.xyz/v1/bot/637002314162372639";
|
||||
private static String DiscordBotReviews = "https://discordbotreviews.xyz/api/bot/637002314162372639/stats";
|
||||
private static String DiscordBots = "https://top.gg/api/bots/637002314162372639/stats";
|
||||
private static String BotListSpace = "https://api.botlist.space/v1/bots/637002314162372639";
|
||||
private static String DiscordBots2 = "https://discord.bots.gg/api/v1/bots/637002314162372639/stats";
|
||||
private static String CloudList = "https://www.cloudlist.xyz/api/stats/637002314162372639";
|
||||
|
||||
private Config config;
|
||||
|
||||
public BotList(Config config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void post() {
|
||||
if (Files.notExists(Paths.get("./DEBUG"))) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("server_count", Hadder.shardManager.getGuilds().size());
|
||||
json.put("guildCount", Hadder.shardManager.getGuilds().size());
|
||||
json.put("guilds", Hadder.shardManager.getGuilds().size());
|
||||
json.put("count", Hadder.shardManager.getGuilds().size());
|
||||
json.put("users", Hadder.shardManager.getUsers().size());
|
||||
json.put("shard_count", Hadder.shardManager.getShards().size());
|
||||
json.put("shardCount", Hadder.shardManager.getShards().size());
|
||||
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), json.toString());
|
||||
|
||||
// Mythical Bot List
|
||||
|
||||
Request mythicalbotlist = new Request.Builder()
|
||||
.url(MythicalBotList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getMythicalBotListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(mythicalbotlist).execute().close();
|
||||
System.out.println("Successfully posted count for the Mythical Bot List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// BotsForDiscord
|
||||
|
||||
Request botsfordiscord = new Request.Builder()
|
||||
.url(BotsForDiscord)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getBotsForDiscordToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(botsfordiscord).execute().close();
|
||||
System.out.println("Successfully posted count to Bots For Discord!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Bot List
|
||||
|
||||
Request discordbotlist = new Request.Builder()
|
||||
.url(DiscordBotList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", "Bot " + config.getDiscordBotListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbotlist).execute().close();
|
||||
System.out.println("Successfully posted count for the Discord Bot List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Boats
|
||||
|
||||
Request discordboats = new Request.Builder()
|
||||
.url(DiscordBoats)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBoatsToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordboats).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Boats!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Yet Another Bot List
|
||||
|
||||
Request yetanotherbotlist = new Request.Builder()
|
||||
.url(YetAnotherBotList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getYetAnotherBotListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(yetanotherbotlist).execute().close();
|
||||
System.out.println("Successfully posted count to Yet Another Bot List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Extreme List
|
||||
|
||||
Request discordextremelist = new Request.Builder()
|
||||
.url(DiscordExtremeList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordExtremeListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordextremelist).execute().close();
|
||||
System.out.println("Successfully posted count for the Discord Extreme List!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Bot Reviews
|
||||
|
||||
Request discordbotreviews = new Request.Builder()
|
||||
.url(DiscordBotReviews)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBotReviewsToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbotreviews).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Bot Reviews!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Bots
|
||||
|
||||
Request discordbots = new Request.Builder()
|
||||
.url(DiscordBots)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBotsToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbots).execute().close();
|
||||
System.out.println("Successfully posted count to Discord Bots!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// BotListSpace
|
||||
|
||||
Request botlistspace = new Request.Builder()
|
||||
.url(BotListSpace)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getBotListSpaceToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(botlistspace).execute().close();
|
||||
System.out.println("Successfully posted count to BotList.Space!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Discord Bots 2
|
||||
|
||||
Request discordbots2 = new Request.Builder()
|
||||
.url(DiscordBots2)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getDiscordBots2Token())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(discordbots2).execute().close();
|
||||
System.out.println("Successfully posted count to discord.bots.gg!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// CloudList
|
||||
|
||||
Request cloudlist = new Request.Builder()
|
||||
.url(CloudList)
|
||||
.post(body)
|
||||
.addHeader("Authorization", config.getCloudListToken())
|
||||
.build();
|
||||
|
||||
try {
|
||||
new OkHttpClient().newCall(cloudlist).execute().close();
|
||||
System.out.println("Successfully posted count to the CloudList!");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.utils;
|
||||
package com.bbn.hadder.utils;
|
||||
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.utils;
|
||||
package com.bbn.hadder.utils;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Response;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2019-2021 GregTCLTK and Schlauer-Hax
|
||||
* 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.
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package one.bbn.hadder.utils;
|
||||
package com.bbn.hadder.utils;
|
||||
|
||||
import one.bbn.hadder.db.MongoUser;
|
||||
import com.bbn.hadder.RethinkUser;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
|
|
@ -27,11 +27,11 @@ import java.util.ResourceBundle;
|
|||
|
||||
public class MessageEditor {
|
||||
|
||||
private final MongoUser mongoUser;
|
||||
private final User user;
|
||||
private RethinkUser rethinkUser;
|
||||
private User user;
|
||||
|
||||
public MessageEditor(MongoUser mongoUser, User user) {
|
||||
this.mongoUser = mongoUser;
|
||||
public MessageEditor(RethinkUser rethinkUser, User user) {
|
||||
this.rethinkUser = rethinkUser;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
|
@ -50,11 +50,10 @@ public class MessageEditor {
|
|||
|
||||
public EmbedBuilder getMessage(MessageType type, String title, String title_extra, String title_extra_two,
|
||||
String description, String description_extra, String description_extra_two) {
|
||||
String language = (this.user != null) ? mongoUser.getLanguage() : null;
|
||||
String language = (this.user!=null) ? rethinkUser.getLanguage() : null;
|
||||
EmbedBuilder eb = this.getDefaultSettings(type);
|
||||
if (!"".equals(title)) eb.setTitle(this.handle(language, title, title_extra, title_extra_two));
|
||||
if (!"".equals(description))
|
||||
eb.setDescription(this.handle(language, description, description_extra, description_extra_two));
|
||||
if (!"".equals(description)) eb.setDescription(this.handle(language, description, description_extra, description_extra_two));
|
||||
return eb;
|
||||
}
|
||||
|
||||
|
|
@ -73,21 +72,21 @@ public class MessageEditor {
|
|||
case INFO:
|
||||
builder
|
||||
.setColor(new Color(78, 156, 174))
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
builder
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
builder
|
||||
.setColor(Color.ORANGE)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
|
|
@ -96,7 +95,7 @@ public class MessageEditor {
|
|||
.setTitle("⛔ No Permission ⛔")
|
||||
.setDescription("You are not authorized to execute this command!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
|
|
@ -105,7 +104,7 @@ public class MessageEditor {
|
|||
.setTitle("⛔ No Permission ⛔")
|
||||
.setDescription("Unfortunately, I do not have the required rights to perform this action!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
|
||||
|
|
@ -114,7 +113,7 @@ public class MessageEditor {
|
|||
.setTitle("⛔ No NSFW ⛔")
|
||||
.setDescription("You can only execute this command in NSFW channels!")
|
||||
.setColor(Color.RED)
|
||||
.setFooter("Hadder", "https://bbn.one/images/Hadder.png")
|
||||
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||
.setTimestamp(Instant.now());
|
||||
break;
|
||||
}
|
||||
|
|
@ -122,11 +121,11 @@ public class MessageEditor {
|
|||
}
|
||||
|
||||
public String getTerm(String string) {
|
||||
return this.handle(mongoUser.getLanguage(), string, "", "");
|
||||
return this.handle(rethinkUser.getLanguage(), string, "", "");
|
||||
}
|
||||
|
||||
public String getTerm(String string, String extra, String extra_two) {
|
||||
return this.handle(mongoUser.getLanguage(), string, extra, extra_two);
|
||||
return this.handle(rethinkUser.getLanguage(), string, extra, extra_two);
|
||||
}
|
||||
|
||||
private String handle(String language_code, String string, String extra, String extra_two) {
|
||||
|
|
@ -134,7 +133,6 @@ public class MessageEditor {
|
|||
ResourceBundle resourceBundle = ResourceBundle.getBundle("Translations/Translations", locale);
|
||||
if (resourceBundle.containsKey(string))
|
||||
return resourceBundle.getString(string).replaceAll("%extra%", extra).replaceAll("%extra_two%", extra_two);
|
||||
else
|
||||
return "This key doesn't exist. Please report this to the Bot Developers. Key: `" + string + "` Language_code: `" + language_code + "`";
|
||||
else return "This key doesn't exist. Please report this to the Bot Developers. Key: " + string + " Language_code: " + language_code;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue