commit
6060f53e00
95 changed files with 2961 additions and 1583 deletions
|
|
@ -69,7 +69,7 @@ further defined and clarified by project maintainers.
|
||||||
### Enforcement
|
### Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported by contacting the project team on [Discord](https://discordapp.com/invite/Vf4zCYn). 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
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
|
|
||||||
4
pom.xml
4
pom.xml
|
|
@ -27,7 +27,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dv8tion</groupId>
|
<groupId>net.dv8tion</groupId>
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>4.1.0_99</version>
|
<version>4.1.1_101</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.kohsuke</groupId>
|
<groupId>org.kohsuke</groupId>
|
||||||
<artifactId>github-api</artifactId>
|
<artifactId>github-api</artifactId>
|
||||||
<version>1.101</version>
|
<version>1.103</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sedmelluq</groupId>
|
<groupId>com.sedmelluq</groupId>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder;
|
||||||
|
|
||||||
import com.bbn.hadder.audio.AudioManager;
|
import com.bbn.hadder.audio.AudioManager;
|
||||||
|
|
@ -103,7 +119,8 @@ public class Hadder {
|
||||||
new BlacklistCommand(),
|
new BlacklistCommand(),
|
||||||
new PauseCommand(),
|
new PauseCommand(),
|
||||||
new LoopCommand(),
|
new LoopCommand(),
|
||||||
new BassCommand()), config, helpCommand);
|
new BassCommand(),
|
||||||
|
new EchoCommand()), config, helpCommand);
|
||||||
|
|
||||||
builder.addEventListeners(
|
builder.addEventListeners(
|
||||||
new MentionListener(rethink),
|
new MentionListener(rethink),
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder;
|
||||||
|
|
||||||
import com.bbn.hadder.core.Config;
|
import com.bbn.hadder.core.Config;
|
||||||
|
|
@ -5,12 +21,11 @@ import com.rethinkdb.RethinkDB;
|
||||||
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
||||||
import com.rethinkdb.net.Connection;
|
import com.rethinkdb.net.Connection;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
/*
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Rethink {
|
public class Rethink {
|
||||||
private RethinkDB r = RethinkDB.r;
|
private RethinkDB r = RethinkDB.r;
|
||||||
|
|
@ -62,28 +77,13 @@ public class Rethink {
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(String table, String where, String what, String value) {
|
public Object getByID(String table, String wherevalue, String column) {
|
||||||
try {
|
return r.table(table).get(wherevalue).getField(column).run(conn);
|
||||||
r.table(table).get(where).update(r.hashMap(what, value)).run(conn);
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(String table, String where, String what, int value) {
|
public JSONObject getObjectByID(String table, String id) {
|
||||||
try {
|
String response = r.table(table).get(id).toJson().run(conn);
|
||||||
r.table(table).get(where).update(r.hashMap(what, value)).run(conn);
|
return new JSONObject(response);
|
||||||
} catch (ClassCastException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(String table, String where, String what, boolean value) {
|
|
||||||
try {
|
|
||||||
r.table(table).get(where).update(r.hashMap(what, value)).run(conn);
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insert(String table, Object object) {
|
public void insert(String table, Object object) {
|
||||||
|
|
@ -121,22 +121,6 @@ public class Rethink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserPrefix(String prefix, String user_id) {
|
|
||||||
this.update("user", user_id, "prefix", prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserPrefix(String id) {
|
|
||||||
return (String) this.get("user", "id", id, "prefix");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGuildPrefix(String prefix, String guild_id) {
|
|
||||||
this.update("server", guild_id, "prefix", prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGuildPrefix(String id) {
|
|
||||||
return (String) this.get("server", "id", id, "prefix");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void insertGuild(String id) {
|
public void insertGuild(String id) {
|
||||||
this.insert("server", r
|
this.insert("server", r
|
||||||
.hashMap("id", id)
|
.hashMap("id", id)
|
||||||
|
|
@ -157,87 +141,54 @@ public class Rethink {
|
||||||
.with("blacklisted", "none"));
|
.with("blacklisted", "none"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlackListed(String id, String commands) {
|
// TODO
|
||||||
this.update("user", id, "blacklisted", commands);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBlackListed(String id) {
|
|
||||||
return (String) this.get("user", "id", id, "blacklisted");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNeededStars(String stars, String guild_id) {
|
|
||||||
this.update("server", guild_id, "neededstars", stars);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNeededStars(String guild_id) {
|
|
||||||
return (String) this.get("server", "id", guild_id, "neededstars");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStarboardChannel(String guild_id, String channel_id) {
|
|
||||||
this.update("server", guild_id, "starboard", channel_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStarboardChannel(String guild_id) {
|
|
||||||
return (String) this.get("server", "id", guild_id, "starboard");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasStarboardChannel(String guild_id) {
|
public boolean hasStarboardChannel(String guild_id) {
|
||||||
return !this.get("server", "id", guild_id, "starboard").equals("");
|
return !this.getByID("server", guild_id, "starboard").equals("");
|
||||||
}
|
}
|
||||||
|
// TODO
|
||||||
public void insertStarboardMessage(String message_id, String guild_id, String starboard_message_id) {
|
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));
|
this.insert("stars", r.hashMap("id", message_id).with("guild", guild_id).with("starboardmsg", starboard_message_id));
|
||||||
}
|
}
|
||||||
|
// TODO
|
||||||
public String getStarboardMessage(String message_id) {
|
public String getStarboardMessage(String message_id) {
|
||||||
return (String) this.get("stars", "id", message_id, "starboardmsg");
|
return (String) this.getByID("stars", message_id, "starboardmsg");
|
||||||
}
|
}
|
||||||
|
// TODO
|
||||||
public void removeStarboardMessage(String message_id) {
|
public void removeStarboardMessage(String message_id) {
|
||||||
this.remove("stars", "id", message_id);
|
this.remove("stars", "id", message_id);
|
||||||
}
|
}
|
||||||
|
// TODO
|
||||||
public boolean hasStarboardMessage(String message_id) {
|
public boolean hasStarboardMessage(String message_id) {
|
||||||
return this.get("stars", "id", message_id, "guild") != null;
|
return this.getByID("stars", message_id, "guild") != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRules(String guild_id, String message_id, String role_id, String accept_emote, String decline_emote) {
|
|
||||||
this.update("server", guild_id, "message_id", message_id);
|
public void pushServer(RethinkServer server) {
|
||||||
this.update("server", guild_id, "role_id", role_id);
|
JSONObject object = new JSONObject();
|
||||||
this.update("server", guild_id, "accept_emote", accept_emote);
|
for (Field field : server.getClass().getDeclaredFields()) {
|
||||||
this.update("server", guild_id, "decline_emote", decline_emote);
|
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).run(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRulesMID(String guild_id) {
|
public void pushUser(RethinkUser user) {
|
||||||
return (String) this.get("server", "id", guild_id, "message_id");
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRulesRID(String guild_id) {
|
|
||||||
return (String) this.get("server", "id", guild_id, "role_id");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRulesAEmote(String guild_id) {
|
|
||||||
return (String) this.get("server", "id", guild_id, "accept_emote");
|
|
||||||
}
|
}
|
||||||
|
r.table("user").get(user.getId()).update(object).run(conn);
|
||||||
public String getRulesDEmote(String guild_id) {
|
|
||||||
return (String) this.get("server", "id", guild_id, "decline_emote");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInviteDetection(String guild_id, boolean b) {
|
|
||||||
this.update("server", guild_id, "invite_detect", b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getInviteDetection(String guild_id) {
|
|
||||||
return (Boolean) this.get("server", "id", guild_id, "invite_detect");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String user_id, String language) {
|
|
||||||
this.update("user", user_id, "language", language);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage(String user_id) {
|
|
||||||
return (String) this.get("user", "id", user_id, "language");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
129
src/main/java/com/bbn/hadder/RethinkServer.java
Normal file
129
src/main/java/com/bbn/hadder/RethinkServer.java
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* 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 org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class RethinkServer {
|
||||||
|
|
||||||
|
private Rethink rethink;
|
||||||
|
|
||||||
|
private String accept_emote = "";
|
||||||
|
private String decline_emote = "";
|
||||||
|
private String id;
|
||||||
|
private boolean invite_detect = false;
|
||||||
|
private String message_id = "";
|
||||||
|
private String neededstars = "3";
|
||||||
|
private String prefix = "h.";
|
||||||
|
private String role_id = "";
|
||||||
|
private String starboard = "";
|
||||||
|
|
||||||
|
public RethinkServer(JSONObject object, Rethink rethink) {
|
||||||
|
for (Field field : this.getClass().getDeclaredFields()) {
|
||||||
|
if (!field.getName().equals("rethink")) {
|
||||||
|
try {
|
||||||
|
if (object.has(field.getName()))
|
||||||
|
field.set(this, object.get(field.getName()));
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.rethink = rethink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAcceptEmote() {
|
||||||
|
return accept_emote;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAcceptEmote(String accept_emote) {
|
||||||
|
this.accept_emote = accept_emote;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeclineEmote() {
|
||||||
|
return decline_emote;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeclineEmote(String decline_emote) {
|
||||||
|
this.decline_emote = decline_emote;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInviteDetect() {
|
||||||
|
return invite_detect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviteDetect(boolean invite_detect) {
|
||||||
|
this.invite_detect = invite_detect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessageID() {
|
||||||
|
return message_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageID(String message_id) {
|
||||||
|
this.message_id = message_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNeededStars() {
|
||||||
|
return neededstars;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNeededStars(String neededstars) {
|
||||||
|
this.neededstars = neededstars;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrefix() {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrefix(String prefix) {
|
||||||
|
this.prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleID() {
|
||||||
|
return role_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleID(String role_id) {
|
||||||
|
this.role_id = role_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStarboard() {
|
||||||
|
return starboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStarboard(String starboard) {
|
||||||
|
this.starboard = starboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateRules(String message_id, String role_id, String accept_emote, String decline_emote) {
|
||||||
|
this.setMessageID(message_id);
|
||||||
|
this.setRoleID(role_id);
|
||||||
|
this.setAcceptEmote(accept_emote);
|
||||||
|
this.setDeclineEmote(decline_emote);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push() {
|
||||||
|
rethink.pushServer(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
89
src/main/java/com/bbn/hadder/RethinkUser.java
Normal file
89
src/main/java/com/bbn/hadder/RethinkUser.java
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* 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 org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class RethinkUser {
|
||||||
|
|
||||||
|
private Rethink rethink;
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String prefix = "h.";
|
||||||
|
private String language = "en";
|
||||||
|
private String blacklisted = "none";
|
||||||
|
|
||||||
|
public RethinkUser(JSONObject object, Rethink rethink) {
|
||||||
|
for (Field field : this.getClass().getDeclaredFields()) {
|
||||||
|
if (!field.getName().equals("rethink")) {
|
||||||
|
try {
|
||||||
|
if (object.has(field.getName()))
|
||||||
|
field.set(this, object.getString(field.getName()));
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.rethink = rethink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RethinkUser(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rethink getRethink() {
|
||||||
|
return rethink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRethink(Rethink rethink) {
|
||||||
|
this.rethink = rethink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrefix() {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrefix(String prefix) {
|
||||||
|
this.prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBlacklisted() {
|
||||||
|
return blacklisted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlacklisted(String blacklisted) {
|
||||||
|
this.blacklisted = blacklisted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push() {
|
||||||
|
rethink.pushUser(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.audio;
|
||||||
|
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AudioInfo {
|
public class AudioInfo {
|
||||||
|
|
||||||
private final AudioTrack track;
|
private final AudioTrack track;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.audio;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
|
|
@ -19,10 +35,6 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AudioManager {
|
public class AudioManager {
|
||||||
|
|
||||||
public Map<String, Map.Entry<AudioPlayer, TrackManager>> players = new HashMap<>();
|
public Map<String, Map.Entry<AudioPlayer, TrackManager>> players = new HashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.audio;
|
||||||
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||||
|
|
@ -7,10 +23,6 @@ import net.dv8tion.jda.api.audio.AudioSendHandler;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AudioPlayerSendHandler implements AudioSendHandler {
|
public class AudioPlayerSendHandler implements AudioSendHandler {
|
||||||
|
|
||||||
private final AudioPlayer audioPlayer;
|
private final AudioPlayer audioPlayer;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.audio;
|
||||||
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||||
|
|
@ -11,15 +27,12 @@ import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class TrackManager extends AudioEventAdapter {
|
public class TrackManager extends AudioEventAdapter {
|
||||||
|
|
||||||
private final AudioPlayer player;
|
private final AudioPlayer player;
|
||||||
private final AudioManager manager;
|
private final AudioManager manager;
|
||||||
private final Queue<AudioInfo> queue;
|
private final Queue<AudioInfo> queue;
|
||||||
|
private AudioTrack lastTrack;
|
||||||
private boolean loop = false;
|
private boolean loop = false;
|
||||||
|
|
||||||
public TrackManager(AudioPlayer player, AudioManager manager) {
|
public TrackManager(AudioPlayer player, AudioManager manager) {
|
||||||
|
|
@ -51,8 +64,9 @@ public class TrackManager extends AudioEventAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
|
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
|
||||||
Guild g = queue.poll().getAuthor().getGuild();
|
Guild g = queue.poll().getAuthor().getGuild();
|
||||||
|
this.lastTrack = track;
|
||||||
if (loop) {
|
if (loop) {
|
||||||
player.playTrack(track.makeClone());
|
player.playTrack(lastTrack.makeClone());
|
||||||
} else if (queue.isEmpty()) {
|
} else if (queue.isEmpty()) {
|
||||||
manager.players.remove(g.getId());
|
manager.players.remove(g.getId());
|
||||||
manager.getPlayer(g).destroy();
|
manager.getPlayer(g).destroy();
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
package com.bbn.hadder.commands;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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;
|
||||||
|
|
||||||
public interface Command {
|
public interface Command {
|
||||||
void executed(String[] args, CommandEvent event);
|
void executed(String[] args, CommandEvent e);
|
||||||
|
|
||||||
String[] labels();
|
String[] labels();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands;
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
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.audio.AudioManager;
|
||||||
import com.bbn.hadder.commands.general.HelpCommand;
|
import com.bbn.hadder.commands.general.HelpCommand;
|
||||||
import com.bbn.hadder.core.CommandHandler;
|
import com.bbn.hadder.core.CommandHandler;
|
||||||
|
|
@ -22,8 +40,13 @@ public class CommandEvent extends MessageReceivedEvent {
|
||||||
private MessageEditor messageEditor;
|
private MessageEditor messageEditor;
|
||||||
private EventWaiter eventWaiter;
|
private EventWaiter eventWaiter;
|
||||||
private AudioManager audioManager;
|
private AudioManager audioManager;
|
||||||
|
private RethinkUser rethinkUser;
|
||||||
|
private RethinkServer rethinkServer;
|
||||||
|
|
||||||
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Rethink rethink, Config config, CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor, EventWaiter eventWaiter, AudioManager audioManager) {
|
public CommandEvent(@Nonnull JDA api, long responseNumber, @Nonnull Message message, Rethink rethink, Config config,
|
||||||
|
CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor,
|
||||||
|
EventWaiter eventWaiter, AudioManager audioManager, RethinkUser rethinkUser,
|
||||||
|
RethinkServer rethinkServer) {
|
||||||
super(api, responseNumber, message);
|
super(api, responseNumber, message);
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
@ -32,17 +55,8 @@ public class CommandEvent extends MessageReceivedEvent {
|
||||||
this.messageEditor = messageEditor;
|
this.messageEditor = messageEditor;
|
||||||
this.eventWaiter = eventWaiter;
|
this.eventWaiter = eventWaiter;
|
||||||
this.audioManager = audioManager;
|
this.audioManager = audioManager;
|
||||||
}
|
this.rethinkUser = rethinkUser;
|
||||||
|
this.rethinkServer = rethinkServer;
|
||||||
public CommandEvent(MessageReceivedEvent event, Rethink rethink, Config config, CommandHandler commandHandler, HelpCommand helpCommand, MessageEditor messageEditor, EventWaiter eventWaiter, AudioManager audioManager) {
|
|
||||||
super(event.getJDA(), event.getResponseNumber(), event.getMessage());
|
|
||||||
this.rethink = rethink;
|
|
||||||
this.config = config;
|
|
||||||
this.commandHandler = commandHandler;
|
|
||||||
this.helpCommand = helpCommand;
|
|
||||||
this.messageEditor = messageEditor;
|
|
||||||
this.eventWaiter = eventWaiter;
|
|
||||||
this.audioManager = audioManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rethink getRethink() {
|
public Rethink getRethink() {
|
||||||
|
|
@ -72,4 +86,12 @@ public class CommandEvent extends MessageReceivedEvent {
|
||||||
public AudioManager getAudioManager() {
|
public AudioManager getAudioManager() {
|
||||||
return audioManager;
|
return audioManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RethinkServer getRethinkServer() {
|
||||||
|
return rethinkServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RethinkUser getRethinkUser() {
|
||||||
|
return rethinkUser;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,56 +1,101 @@
|
||||||
package com.bbn.hadder.commands.fun;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.fun;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class AvatarCommand implements Command {
|
public class AvatarCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
Member member = event.getMember();
|
User u = e.getAuthor();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.fun.avatar.success.title",
|
"commands.fun.avatar.success.title",
|
||||||
member.getUser().getAsTag(),
|
u.getAsTag(),
|
||||||
"",
|
"",
|
||||||
"")
|
"")
|
||||||
.setImage(member.getUser().getAvatarUrl())
|
.setImage(u.getAvatarUrl())
|
||||||
.setFooter(member.getUser().getAsTag())
|
.setFooter(u.getAsTag())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} else if (event.getMessage().getMentionedMembers().size() == 1) {
|
} else if (e.getMessage().getMentionedUsers().size() == 1) {
|
||||||
Member member = event.getMessage().getMentionedMembers().get(0);
|
User u = e.getMessage().getMentionedUsers().get(0);
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.fun.avatar.success.title",
|
"commands.fun.avatar.success.title",
|
||||||
member.getUser().getAsTag(),
|
u.getAsTag(),
|
||||||
"",
|
"",
|
||||||
"")
|
"")
|
||||||
.setImage(member.getUser().getAvatarUrl())
|
.setImage(u.getAvatarUrl())
|
||||||
.setFooter(member.getUser().getAsTag())
|
.setFooter(u.getAsTag())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} else if (args[0].length() == 18) {
|
} else if (args[0].length() == 18) {
|
||||||
Member member = event.getGuild().getMemberById(args[0]);
|
try {
|
||||||
event.getTextChannel().sendMessage(
|
User u = e.getJDA().getUserById(args[0]);
|
||||||
event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(
|
||||||
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.fun.avatar.success.title",
|
"commands.fun.avatar.success.title",
|
||||||
member.getUser().getAsTag(),
|
u.getAsTag(),
|
||||||
"",
|
"",
|
||||||
"")
|
"")
|
||||||
.setImage(member.getUser().getAvatarUrl())
|
.setImage(u.getAvatarUrl())
|
||||||
.setFooter(member.getUser().getAsTag())
|
.setFooter(u.getAsTag())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
} catch (NullPointerException ignore) {
|
||||||
|
|
||||||
|
OkHttpClient client = new OkHttpClient();
|
||||||
|
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();
|
||||||
|
JSONObject json = new JSONObject(response.body().string());
|
||||||
|
String url = "https://cdn.discordapp.com/avatars/" + args[0] + "/" + json.getString("avatar") + ".png";
|
||||||
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
|
MessageEditor.MessageType.INFO,
|
||||||
|
"commands.fun.avatar.success.title",
|
||||||
|
json.getString("username") + "#" + json.getString("discriminator"),
|
||||||
|
"",
|
||||||
|
"")
|
||||||
|
.setImage(url)
|
||||||
|
.setFooter(json.getString("username") + "#" + json.getString("discriminator"))
|
||||||
|
.build()).queue();
|
||||||
|
} catch (JSONException ex) {
|
||||||
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
|
"commands.fun.avatar.error.title",
|
||||||
|
"commands.fun.avatar.error.description"
|
||||||
|
).build()).queue();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.fun;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.fun;
|
||||||
|
|
||||||
import club.minnced.discord.webhook.WebhookClient;
|
import club.minnced.discord.webhook.WebhookClient;
|
||||||
import club.minnced.discord.webhook.WebhookClientBuilder;
|
import club.minnced.discord.webhook.WebhookClientBuilder;
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -24,13 +36,13 @@ import java.util.concurrent.TimeUnit;
|
||||||
public class ClydeCommand implements Command {
|
public class ClydeCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) {
|
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_WEBHOOKS)) {
|
||||||
TextChannel channel = event.getMessage().getTextChannel();
|
TextChannel channel = e.getMessage().getTextChannel();
|
||||||
String content = event.getMessage().getContentRaw().replace(event.getRethink().getGuildPrefix(event.getGuild().getId()), "").replace(event.getRethink().getUserPrefix(event.getAuthor().getId()), "").replace("clyde", "");
|
String content = e.getMessage().getContentRaw().replace(e.getRethinkServer().getPrefix(), "").replace(e.getRethinkUser().getPrefix(), "").replace("clyde", "");
|
||||||
|
|
||||||
Webhook webhook = channel.createWebhook(event.getConfig().getClydeName()).complete();
|
Webhook webhook = channel.createWebhook(e.getConfig().getClydeName()).complete();
|
||||||
try {
|
try {
|
||||||
InputStream s = new URL("https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png").openStream();
|
InputStream s = new URL("https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png").openStream();
|
||||||
webhook.getManager().setAvatar(Icon.from(s)).queue();
|
webhook.getManager().setAvatar(Icon.from(s)).queue();
|
||||||
|
|
@ -40,24 +52,24 @@ public class ClydeCommand implements Command {
|
||||||
WebhookClient client = builder.build();
|
WebhookClient client = builder.build();
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(1);
|
TimeUnit.SECONDS.sleep(1);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException ex) {
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
client.send(content);
|
client.send(content);
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(2);
|
TimeUnit.SECONDS.sleep(2);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException ex) {
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
webhook.delete().queue();
|
webhook.delete().queue();
|
||||||
event.getMessage().delete().queue();
|
e.getMessage().delete().queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else event.getHelpCommand().sendHelp(this, event);
|
} else e.getHelpCommand().sendHelp(this, e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.fun;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.fun;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
@ -18,7 +30,7 @@ import java.util.Random;
|
||||||
public class GifCommand implements Command {
|
public class GifCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
StringBuilder query = new StringBuilder();
|
StringBuilder query = new StringBuilder();
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
|
|
@ -27,7 +39,7 @@ public class GifCommand implements Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + event.getConfig().getGiphyToken()).build();
|
Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + e.getConfig().getGiphyToken()).build();
|
||||||
try {
|
try {
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
|
|
@ -35,15 +47,15 @@ public class GifCommand implements Command {
|
||||||
JSONArray array = json.getJSONArray("data");
|
JSONArray array = json.getJSONArray("data");
|
||||||
int gifIndex = rand.nextInt(array.length());
|
int gifIndex = rand.nextInt(array.length());
|
||||||
String url = array.getJSONObject(gifIndex).get("url").toString();
|
String url = array.getJSONObject(gifIndex).get("url").toString();
|
||||||
event.getTextChannel().sendMessage(url).queue();
|
e.getTextChannel().sendMessage(url).queue();
|
||||||
} catch (Exception e) {
|
} catch (Exception ignore) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"error",
|
"error",
|
||||||
"commands.fun.gif.error.description").build()).queue();
|
"commands.fun.gif.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else event.getHelpCommand().sendHelp(this, event);
|
} else e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.fun;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.fun;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
@ -18,7 +30,7 @@ import java.io.IOException;
|
||||||
public class MemeCommand implements Command {
|
public class MemeCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
Request request = new Request.Builder().url("https://meme-api.herokuapp.com/gimme").build();
|
Request request = new Request.Builder().url("https://meme-api.herokuapp.com/gimme").build();
|
||||||
|
|
@ -27,16 +39,15 @@ public class MemeCommand implements Command {
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
JSONObject json = new JSONObject(response.body().string());
|
||||||
String url = json.getString("url");
|
String url = json.getString("url");
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.fun.meme.success.title", "")
|
"commands.fun.meme.success.title", "")
|
||||||
.setImage(url)
|
.setImage(url)
|
||||||
.setAuthor("Subreddit: " + json.getString("subreddit"))
|
.setAuthor("Subreddit: " + json.getString("subreddit"))
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (IOException e) {
|
} catch (IOException ignore) {
|
||||||
e.printStackTrace();
|
e.getTextChannel().sendMessage(
|
||||||
event.getTextChannel().sendMessage(
|
e.getMessageEditor().getMessage(
|
||||||
event.getMessageEditor().getMessage(
|
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"error",
|
"error",
|
||||||
"commands.fun.meme.api.error")
|
"commands.fun.meme.api.error")
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.general;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.general;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
@ -11,13 +23,13 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
public class AboutCommand implements Command {
|
public class AboutCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.general.about.success.title",
|
"commands.general.about.success.title",
|
||||||
"commands.general.about.success.description")
|
"commands.general.about.success.description")
|
||||||
.addField(event.getMessageEditor().getTerm("commands.general.about.success.field.one.title"), event.getMessageEditor().getTerm("commands.general.about.success.field.one.description", "(https://donatebot.io/checkout/448554629282922527?buyer=" + event.getAuthor().getId() + "). :smiley:", ""), true)
|
.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://bigbotnetwork.com/images/Hadder.png")
|
.setThumbnail("https://bigbotnetwork.com/images/Hadder.png")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.general;
|
package com.bbn.hadder.commands.general;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -5,37 +21,33 @@ import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.EventWaiter;
|
import com.bbn.hadder.utils.EventWaiter;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
/*
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class EqualsCommand implements Command {
|
public class EqualsCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
event.getChannel().sendMessage(
|
e.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.general.equals.string.first.request", "")
|
"commands.general.equals.string.first.request", "")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
|
new EventWaiter().newOnMessageEventWaiter(msge -> {
|
||||||
String firstString = msgevent.getMessage().getContentRaw();
|
String firstString = msge.getMessage().getContentRaw();
|
||||||
event.getChannel().sendMessage(
|
e.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.general.equals.string.second.request",
|
"commands.general.equals.string.second.request",
|
||||||
"").build()).queue();
|
"").build()).queue();
|
||||||
new EventWaiter().newOnMessageEventWaiter(msgevent2 -> {
|
new EventWaiter().newOnMessageEventWaiter(msge2 -> {
|
||||||
String secondString = msgevent2.getMessage().getContentRaw();
|
String secondString = msge2.getMessage().getContentRaw();
|
||||||
event.getChannel().sendMessage(
|
e.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle((firstString.equals(secondString)) ? event.getMessageEditor().getTerm( "commands.general.equals.string.equals.true") : event.getMessageEditor().getTerm( "commands.general.equals.string.equals.false"))
|
.setTitle((firstString.equals(secondString)) ? e.getMessageEditor().getTerm( "commands.general.equals.string.equals.true") : e.getMessageEditor().getTerm( "commands.general.equals.string.equals.false"))
|
||||||
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.first"), firstString, false)
|
.addField(e.getMessageEditor().getTerm( "commands.general.equals.string.first"), firstString, false)
|
||||||
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.second"), secondString, false)
|
.addField(e.getMessageEditor().getTerm( "commands.general.equals.string.second"), secondString, false)
|
||||||
.addField(event.getMessageEditor().getTerm( "commands.general.equals.string.result"), String.valueOf(firstString.equals(secondString)), false)
|
.addField(e.getMessageEditor().getTerm( "commands.general.equals.string.result"), String.valueOf(firstString.equals(secondString)), false)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.general;
|
package com.bbn.hadder.commands.general;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -13,11 +29,11 @@ import java.util.Map;
|
||||||
public class HelpCommand implements Command {
|
public class HelpCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
|
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
HashMap<String, ArrayList<Command>> hashMap = new HashMap<>();
|
HashMap<String, ArrayList<Command>> hashMap = new HashMap<>();
|
||||||
for (Command cmd : event.getCommandHandler().getCommandList()) {
|
for (Command cmd : e.getCommandHandler().getCommandList()) {
|
||||||
if (!hashMap.containsKey(cmd.getClass().getPackageName())) {
|
if (!hashMap.containsKey(cmd.getClass().getPackageName())) {
|
||||||
ArrayList<Command> cmdlist = new ArrayList<>();
|
ArrayList<Command> cmdlist = new ArrayList<>();
|
||||||
cmdlist.add(cmd);
|
cmdlist.add(cmd);
|
||||||
|
|
@ -28,8 +44,8 @@ public class HelpCommand implements Command {
|
||||||
}
|
}
|
||||||
EmbedBuilder eb = new EmbedBuilder();
|
EmbedBuilder eb = new EmbedBuilder();
|
||||||
for (Map.Entry<String, ArrayList<Command>> entry : hashMap.entrySet()) {
|
for (Map.Entry<String, ArrayList<Command>> entry : hashMap.entrySet()) {
|
||||||
if (!entry.getKey().endsWith("owner") || (entry.getKey().endsWith("owner") && (event.getAuthor().getId().equals("477141528981012511") ||
|
if (!entry.getKey().endsWith("owner") || (entry.getKey().endsWith("owner") && (e.getAuthor().getId().equals("477141528981012511") ||
|
||||||
event.getAuthor().getId().equals("261083609148948488")))) {
|
e.getAuthor().getId().equals("261083609148948488")))) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < entry.getValue().size(); i++) {
|
for (int i = 0; i < entry.getValue().size(); i++) {
|
||||||
Command cmd = entry.getValue().get(i);
|
Command cmd = entry.getValue().get(i);
|
||||||
|
|
@ -40,35 +56,35 @@ public class HelpCommand implements Command {
|
||||||
eb.addField(ps[ps.length - 1], sb.toString(), false);
|
eb.addField(ps[ps.length - 1], sb.toString(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO);
|
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO);
|
||||||
event.getChannel().sendMessage(eb.build()).queue();
|
e.getChannel().sendMessage(eb.build()).queue();
|
||||||
} else {
|
} else {
|
||||||
for (Command cmd : event.getCommandHandler().getCommandList()) {
|
for (Command cmd : e.getCommandHandler().getCommandList()) {
|
||||||
for (String label : cmd.labels()) {
|
for (String label : cmd.labels()) {
|
||||||
if (label.equalsIgnoreCase(args[0])) {
|
if (label.equalsIgnoreCase(args[0])) {
|
||||||
sendHelp(cmd, event);
|
sendHelp(cmd, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getTerm("commands.general.help.error.description")).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getTerm("commands.general.help.error.description")).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendHelp(Command cmd, CommandEvent event) {
|
public void sendHelp(Command cmd, CommandEvent e) {
|
||||||
if (!cmd.getClass().getPackageName().endsWith("owner") || (cmd.getClass().getPackageName().endsWith("owner") &&
|
if (!cmd.getClass().getPackageName().endsWith("owner") || (cmd.getClass().getPackageName().endsWith("owner") &&
|
||||||
(event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().getId().equals("261083609148948488")))) {
|
(e.getAuthor().getId().equals("477141528981012511") || e.getAuthor().getId().equals("261083609148948488")))) {
|
||||||
String name = cmd.labels()[0];
|
String name = cmd.labels()[0];
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append(event.getMessageEditor().getTerm("commands.general.help.description")).append(" ").append(event.getMessageEditor().getTerm(cmd.description())).append("\n");
|
b.append(e.getMessageEditor().getTerm("commands.general.help.description")).append(" ").append(e.getMessageEditor().getTerm(cmd.description())).append("\n");
|
||||||
if (cmd.usage() != null) {
|
if (cmd.usage() != null) {
|
||||||
b.append(event.getMessageEditor().getTerm("commands.general.help.usage")).append(" ").append(event.getRethink().getGuildPrefix(event.getGuild().getId())).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) {
|
if (cmd.example() != null) {
|
||||||
b.append(event.getMessageEditor().getTerm("commands.general.help.example")).append(" ").append(event.getRethink().getGuildPrefix(event.getGuild().getId())).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());
|
||||||
}
|
}
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO)
|
MessageEditor.MessageType.INFO)
|
||||||
.setTitle(cmd.labels()[0])
|
.setTitle(cmd.labels()[0])
|
||||||
.setDescription(b.toString())
|
.setDescription(b.toString())
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.general;
|
package com.bbn.hadder.commands.general;
|
||||||
|
|
||||||
import com.bbn.hadder.Hadder;
|
import com.bbn.hadder.Hadder;
|
||||||
|
|
@ -5,16 +21,12 @@ import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
/*
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class InviteCommand implements Command {
|
public class InviteCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.general.invite.success.title",
|
"commands.general.invite.success.title",
|
||||||
"",
|
"",
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.general;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.general;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
@ -11,8 +23,8 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
public class PingCommand implements Command {
|
public class PingCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
event.getJDA().getRestPing().queue(ping -> event.getTextChannel().sendMessage(event.getMessageEditor()
|
e.getJDA().getRestPing().queue(ping -> e.getTextChannel().sendMessage(e.getMessageEditor()
|
||||||
.getMessage(MessageEditor.MessageType.INFO)
|
.getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Ping")
|
.setTitle("Ping")
|
||||||
.setDescription(String.valueOf(ping))
|
.setDescription(String.valueOf(ping))
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.misc;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.misc;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.EventWaiter;
|
import com.bbn.hadder.utils.EventWaiter;
|
||||||
|
|
@ -17,39 +29,39 @@ import java.io.IOException;
|
||||||
public class FeedbackCommand implements Command {
|
public class FeedbackCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.misc.feedback.title.request.title",
|
"commands.misc.feedback.title.request.title",
|
||||||
"commands.misc.feedback.title.request.description")
|
"commands.misc.feedback.title.request.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
new EventWaiter().newOnMessageEventWaiter(event1 -> {
|
new EventWaiter().newOnMessageEventWaiter(e1 -> {
|
||||||
String title = event1.getMessage().getContentDisplay();
|
String title = e1.getMessage().getContentDisplay();
|
||||||
event1.getChannel().sendMessage(event.getMessageEditor().getMessage(
|
e1.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.misc.feedback.description.request.title",
|
"commands.misc.feedback.description.request.title",
|
||||||
"commands.misc.feedback.description.request.description")
|
"commands.misc.feedback.description.request.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
new EventWaiter().newOnMessageEventWaiter(event2 -> {
|
new EventWaiter().newOnMessageEventWaiter(e2 -> {
|
||||||
String description = event2.getMessage().getContentDisplay();
|
String description = e2.getMessage().getContentDisplay();
|
||||||
try {
|
try {
|
||||||
GitHub connection = GitHub.connectUsingOAuth(event.getConfig().getGitHubToken());
|
GitHub connection = GitHub.connectUsingOAuth(e.getConfig().getGitHubToken());
|
||||||
GHRepository Hadder = connection.getOrganization("BigBotNetwork").getRepository("Hadder");
|
GHRepository Hadder = connection.getOrganization("BigBotNetwork").getRepository("Hadder");
|
||||||
GHIssue issue = Hadder.createIssue(title).body("<strong>Feedback by " + event.getAuthor().getAsTag() + "</strong><br>" + description).label("feedback").create();
|
GHIssue issue = Hadder.createIssue(title).body("<strong>Feedback by " + e.getAuthor().getAsTag() + "</strong><br>" + description).label("feedback").create();
|
||||||
issue.addLabels("feedback");
|
issue.addLabels("feedback");
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.misc.feedback.success.title",
|
"commands.misc.feedback.success.title",
|
||||||
"")
|
"")
|
||||||
.setDescription(issue.getHtmlUrl().toString())
|
.setDescription(issue.getHtmlUrl().toString())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (IOException e) {
|
} catch (IOException ex) {
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.misc;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.misc;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
@ -18,11 +30,11 @@ import java.io.IOException;
|
||||||
public class GitHubCommand implements Command {
|
public class GitHubCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (args[0].equals("link")) {
|
if (args[0].equals("link")) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.misc.github.link.title",
|
"commands.misc.github.link.title",
|
||||||
"")
|
"")
|
||||||
|
|
@ -51,39 +63,39 @@ public class GitHubCommand implements Command {
|
||||||
|
|
||||||
if (!json.getString("blog").equals("")) website = json.getString("blog");
|
if (!json.getString("blog").equals("")) website = json.getString("blog");
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.misc.github.success.title", nickname + " (" + args[0] + ")", ""), "https://github.com/" + args[0] + "", "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
|
.setAuthor(e.getMessageEditor().getTerm("commands.misc.github.success.title", nickname + " (" + args[0] + ")", ""), "https://github.com/" + args[0] + "", "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
|
||||||
.setThumbnail(json.getString("avatar_url"))
|
.setThumbnail(json.getString("avatar_url"))
|
||||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.bio"), bio, false)
|
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.bio"), bio, false)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.location"), location, true)
|
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.location"), location, true)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.website"), website, true)
|
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.website"), website, true)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.repositories"), String.valueOf(json.getInt("public_repos")), true)
|
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.repositories"), String.valueOf(json.getInt("public_repos")), true)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.gists"), String.valueOf(json.getInt("public_gists")), true)
|
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.gists"), String.valueOf(json.getInt("public_gists")), true)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.followers"), String.valueOf(json.getInt("followers")), true)
|
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.followers"), String.valueOf(json.getInt("followers")), true)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.misc.github.success.following"), String.valueOf(json.getInt("following")), true)
|
.addField(e.getMessageEditor().getTerm("commands.misc.github.success.following"), String.valueOf(json.getInt("following")), true)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException | NullPointerException e) {
|
} catch (IOException | NullPointerException ex) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.misc.github.api.error.title",
|
"commands.misc.github.api.error.title",
|
||||||
"commands.misc.github.api.error.description")
|
"commands.misc.github.api.error.description")
|
||||||
.build()
|
.build()
|
||||||
).queue();
|
).queue();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.misc.github.user.error.title",
|
"commands.misc.github.user.error.title",
|
||||||
"commands.misc.github.user.error.description").build()).queue();
|
"commands.misc.github.user.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
/*
|
/*
|
||||||
TODO: THIS
|
TODO: THIS
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.misc.github.connect.title",
|
"commands.misc.github.connect.title",
|
||||||
"",
|
"",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.misc;
|
package com.bbn.hadder.commands.misc;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -14,52 +30,52 @@ import java.util.List;
|
||||||
public class ScreenShareCommand implements Command {
|
public class ScreenShareCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length>0) {
|
if (args.length>0) {
|
||||||
if (args[0].matches("[0-9]*") && args.length==1 && args[0].length() == 18) {
|
if (args[0].matches("[0-9]*") && args.length==1 && args[0].length() == 18) {
|
||||||
if (event.getGuild().getVoiceChannelById(args[0]) != null) {
|
if (e.getGuild().getVoiceChannelById(args[0]) != null) {
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.misc.screenshare.success.title", "")
|
"commands.misc.screenshare.success.title", "")
|
||||||
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + args[0] + "/").build()).queue();
|
.setDescription("http://discordapp.com/channels/" + e.getGuild().getId() + "/" + args[0] + "/").build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.id.error.description").build()).queue();
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.id.error.description").build()).queue();
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<VoiceChannel> vcs = event.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
|
List<VoiceChannel> vcs = e.getGuild().getVoiceChannelsByName(String.join(" ", args), true);
|
||||||
if (vcs.size() > 1) {
|
if (vcs.size() > 1) {
|
||||||
EmbedBuilder eb = event.getMessageEditor().getMessage(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++) {
|
for (int i = 0; i < vcs.size(); i++) {
|
||||||
VoiceChannel voiceChannel = vcs.get(i);
|
VoiceChannel voiceChannel = vcs.get(i);
|
||||||
eb.addField(i + ": " + voiceChannel.getName(), voiceChannel.getId(), false);
|
eb.addField(i + ": " + voiceChannel.getName(), voiceChannel.getId(), false);
|
||||||
}
|
}
|
||||||
event.getChannel().sendMessage(eb.build()).queue();
|
e.getChannel().sendMessage(eb.build()).queue();
|
||||||
new EventWaiter().newOnMessageEventWaiter(msgevent -> {
|
new EventWaiter().newOnMessageEventWaiter(msge -> {
|
||||||
try {
|
try {
|
||||||
int i = Integer.parseInt(msgevent.getMessage().getContentRaw());
|
int i = Integer.parseInt(msge.getMessage().getContentRaw());
|
||||||
if (vcs.size() > i) {
|
if (vcs.size() > i) {
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||||
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
|
.setDescription("http://discordapp.com/channels/" + e.getGuild().getId() + "/" + vcs.get(i).getId() + "/").build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.number.error.title", "").build()).queue();
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.number.error.title", "").build()).queue();
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException ex) {
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.number.error.description").build()).queue();
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.id.error.title", "commands.misc.screenshare.number.error.description").build()).queue();
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
} else if (vcs.size()==0) {
|
} else if (vcs.size()==0) {
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.channel.existing.error", "commands.misc.screenshare.channel.existing.description").build()).queue();
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.screenshare.channel.existing.error", "commands.misc.screenshare.channel.existing.description").build()).queue();
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
} else {
|
} else {
|
||||||
event.getChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.screenshare.success.title", "")
|
||||||
.setDescription("http://discordapp.com/channels/" + event.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
|
.setDescription("http://discordapp.com/channels/" + e.getGuild().getId() + "/" + vcs.get(0).getId() + "/").build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.moderation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -15,68 +27,68 @@ import net.dv8tion.jda.api.entities.Member;
|
||||||
public class BanCommand implements Command {
|
public class BanCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getMessage().getMentionedMembers().size() == 1) {
|
if (e.getMessage().getMentionedMembers().size() == 1) {
|
||||||
Member victim = event.getMessage().getMentionedMembers().get(0);
|
Member victim = e.getMessage().getMentionedMembers().get(0);
|
||||||
if (!event.getAuthor().getId().equals(victim.getId())) {
|
if (!e.getAuthor().getId().equals(victim.getId())) {
|
||||||
if (!event.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
if (!e.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(victim)) {
|
if (e.getGuild().getSelfMember().canInteract(victim)) {
|
||||||
event.getGuild().ban(victim, 0, "Banned by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().ban(victim, 0, "Banned by " + e.getAuthor().getAsTag()).queue();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.ban.success.title",
|
"commands.moderation.ban.success.title",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.ban.success.description",
|
"commands.moderation.ban.success.description",
|
||||||
victim.getUser().getName() + ".").build()).queue();
|
victim.getUser().getName() + ".").build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.ban.error.title",
|
"commands.moderation.ban.error.title",
|
||||||
"commands.moderation.ban.myself.error.description").build()).queue();
|
"commands.moderation.ban.myself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage
|
e.getTextChannel().sendMessage
|
||||||
(event.getMessageEditor().getMessage(
|
(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.ban.error.title",
|
"commands.moderation.ban.error.title",
|
||||||
"commands.moderation.ban.yourself.error.description").build()).queue();
|
"commands.moderation.ban.yourself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
} else if (e.getMessage().getMentionedMembers().size() == 0) {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
} else if (event.getMessage().getMentionedMembers().size() > 1) {
|
} else if (e.getMessage().getMentionedMembers().size() > 1) {
|
||||||
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
|
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||||
Member member = event.getMessage().getMentionedMembers().get(i);
|
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||||
if (!event.getAuthor().getId().equals(member.getId())) {
|
if (!e.getAuthor().getId().equals(member.getId())) {
|
||||||
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
|
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||||
event.getGuild().ban(member, 0).reason("Mass Ban by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().ban(member, 0).reason("Mass Ban by " + e.getAuthor().getAsTag()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.ban.error.title",
|
"commands.moderation.ban.error.title",
|
||||||
"commands.moderation.ban.myself.error.description").build()).queue();
|
"commands.moderation.ban.myself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.ban.error.title",
|
"commands.moderation.ban.error.title",
|
||||||
"commands.moderation.ban.yourself.error.description").build()).queue();
|
"commands.moderation.ban.yourself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.ban.success.title",
|
"commands.moderation.ban.success.title",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.ban.massban.success.description",
|
"commands.moderation.ban.massban.success.description",
|
||||||
String.valueOf(event.getMessage().getMentionedMembers().size())).build()).queue();
|
String.valueOf(e.getMessage().getMentionedMembers().size())).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.moderation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -20,15 +32,15 @@ import java.util.concurrent.TimeUnit;
|
||||||
public class ClearCommand implements Command {
|
public class ClearCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
|
if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
|
||||||
if (args[0].equals("all")) {
|
if (args[0].equals("all")) {
|
||||||
List<Message> msg = event.getTextChannel().getIterableHistory().complete();
|
List<Message> msg = e.getTextChannel().getIterableHistory().complete();
|
||||||
for (Message message : msg) {
|
for (Message message : msg) {
|
||||||
message.delete().queue();
|
message.delete().queue();
|
||||||
}
|
}
|
||||||
Message message = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
Message message = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.clear.all.success.title",
|
"commands.moderation.clear.all.success.title",
|
||||||
"",
|
"",
|
||||||
|
|
@ -37,51 +49,51 @@ public class ClearCommand implements Command {
|
||||||
.build()).complete();
|
.build()).complete();
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(3);
|
TimeUnit.SECONDS.sleep(3);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException ex) {
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
message.delete().queue();
|
message.delete().queue();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
int nbToDelete = Integer.parseInt(args[0]);
|
int nbToDelete = Integer.parseInt(args[0]);
|
||||||
if (nbToDelete < 1 || nbToDelete > 99) {
|
if (nbToDelete < 1 || nbToDelete > 99) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.number.error.title", "commands.moderation.clear.number.error.description").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.number.error.title", "commands.moderation.clear.number.error.description").build()).queue();
|
||||||
} else {
|
} else {
|
||||||
List<Message> history = event.getTextChannel().getHistory().retrievePast(nbToDelete + 1).complete();
|
List<Message> history = e.getTextChannel().getHistory().retrievePast(nbToDelete + 1).complete();
|
||||||
List<Message> msgToDelete = new ArrayList<>(history);
|
List<Message> msgToDelete = new ArrayList<>(history);
|
||||||
event.getTextChannel().deleteMessages(msgToDelete).queue();
|
e.getTextChannel().deleteMessages(msgToDelete).queue();
|
||||||
if (nbToDelete == 1) {
|
if (nbToDelete == 1) {
|
||||||
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title",
|
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title",
|
||||||
"commands.moderation.clear.success.description.singular").build()).complete();
|
"commands.moderation.clear.success.description.singular").build()).complete();
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(2);
|
TimeUnit.SECONDS.sleep(2);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException ex) {
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
msg.delete().queue();
|
msg.delete().queue();
|
||||||
} else {
|
} else {
|
||||||
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title", "",
|
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.clear.success.title", "",
|
||||||
"commands.moderation.clear.success.description.plural", String.valueOf(nbToDelete)).build()).complete();
|
"commands.moderation.clear.success.description.plural", String.valueOf(nbToDelete)).build()).complete();
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(2);
|
TimeUnit.SECONDS.sleep(2);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException ex) {
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
msg.delete().queue();
|
msg.delete().queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException ex) {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.message.error.title", "commands.moderation.clear.message.error.description")
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.clear.message.error.title", "commands.moderation.clear.message.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.moderation;
|
package com.bbn.hadder.commands.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -7,75 +23,71 @@ import com.bbn.hadder.core.Perms;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.entities.TextChannel;
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Perms(Perm.MANAGE_SERVER)
|
@Perms(Perm.MANAGE_SERVER)
|
||||||
public class EditRulesCommand implements Command {
|
public class EditRulesCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getRethink().getRulesMID(event.getGuild().getId()).length() == 18) {
|
if (e.getRethinkServer().getMessageID().length() == 18) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.editrules.message.title",
|
"commands.moderation.editrules.message.title",
|
||||||
"commands.moderation.editrules.message.description").build()).queue();
|
"commands.moderation.editrules.message.description").build()).queue();
|
||||||
|
|
||||||
event.getEventWaiter().newOnMessageEventWaiter(event1 -> {
|
e.getEventWaiter().newOnMessageEventWaiter(e1 -> {
|
||||||
String rules = event1.getMessage().getContentRaw();
|
String rules = e1.getMessage().getContentRaw();
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.editrules.channel.title",
|
"commands.moderation.editrules.channel.title",
|
||||||
"commands.moderation.editrules.channel.description").build()).queue();
|
"commands.moderation.editrules.channel.description").build()).queue();
|
||||||
|
|
||||||
event.getEventWaiter().newOnMessageEventWaiter(event2 -> {
|
e.getEventWaiter().newOnMessageEventWaiter(e2 -> {
|
||||||
if (event2.getMessage().getMentionedChannels().size() == 1) {
|
if (e2.getMessage().getMentionedChannels().size() == 1) {
|
||||||
try {
|
try {
|
||||||
TextChannel channel = event2.getMessage().getMentionedChannels().get(0);
|
TextChannel channel = e2.getMessage().getMentionedChannels().get(0);
|
||||||
checkChannel(event, rules, channel);
|
checkChannel(e, rules, channel);
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.editrules.channel.error.title",
|
"commands.moderation.editrules.channel.error.title",
|
||||||
"commands.moderation.editrules.channel.error.description")
|
"commands.moderation.editrules.channel.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
TextChannel channel = event1.getGuild().getTextChannelsByName(event2.getMessage().getContentRaw(), true).get(0);
|
TextChannel channel = e1.getGuild().getTextChannelsByName(e2.getMessage().getContentRaw(), true).get(0);
|
||||||
checkChannel(event, rules, channel);
|
checkChannel(e, rules, channel);
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.editrules.channel.error.title",
|
"commands.moderation.editrules.channel.error.title",
|
||||||
"commands.moderation.editrules.channel.error.description")
|
"commands.moderation.editrules.channel.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.editrules.error.title", "",
|
"commands.moderation.editrules.error.title", "",
|
||||||
"commands.moderation.editrules.error.description", event.getRethink().getGuildPrefix(event.getGuild().getId())).build()).queue();
|
"commands.moderation.editrules.error.description", e.getRethinkServer().getPrefix()).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkChannel(CommandEvent event, String rules, TextChannel channel) {
|
public void checkChannel(CommandEvent e, String rules, TextChannel channel) {
|
||||||
try {
|
try {
|
||||||
channel.retrieveMessageById(event.getRethink().getRulesMID(event.getGuild().getId())).queue();
|
channel.retrieveMessageById(e.getRethinkServer().getMessageID()).queue();
|
||||||
setRules(event, rules, channel);
|
setRules(e, rules, channel);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.editrules.success.title",
|
"commands.moderation.editrules.success.title",
|
||||||
"commands.moderation.editrules.success.description").build()).queue();
|
"commands.moderation.editrules.success.description").build()).queue();
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.editrules.channel.message.error.title",
|
"commands.moderation.editrules.channel.message.error.title",
|
||||||
"commands.moderation.editrules.channel.message.error.description").build()).queue();
|
"commands.moderation.editrules.channel.message.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRules(CommandEvent event, String rules, TextChannel channel) {
|
public void setRules(CommandEvent e, String rules, TextChannel channel) {
|
||||||
channel.retrieveMessageById(event.getRethink().getRulesMID(event.getGuild().getId())).complete().editMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
channel.retrieveMessageById(e.getRethinkServer().getMessageID()).complete().editMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Rules")
|
.setTitle("Rules")
|
||||||
.setDescription(rules)
|
.setDescription(rules)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.moderation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -14,21 +26,22 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
public class InviteDetectCommand implements Command {
|
public class InviteDetectCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
String opinion = args[0].toLowerCase();
|
String opinion = args[0].toLowerCase();
|
||||||
switch (opinion) {
|
switch (opinion) {
|
||||||
case "on":
|
case "on":
|
||||||
if (!event.getRethink().getInviteDetection(event.getGuild().getId())) {
|
if (!e.getRethinkServer().isInviteDetect()) {
|
||||||
event.getRethink().setInviteDetection(event.getGuild().getId(), true);
|
e.getRethinkServer().setInviteDetect(true);
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.invitedetect.activate.success.title",
|
"commands.moderation.invitedetect.activate.success.title",
|
||||||
"commands.moderation.invitedetect.activate.success.description")
|
"commands.moderation.invitedetect.activate.success.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
e.getRethinkServer().push();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.invitedetect.activate.error.title",
|
"commands.moderation.invitedetect.activate.error.title",
|
||||||
"commands.moderation.invitedetect.activate.error.description")
|
"commands.moderation.invitedetect.activate.error.description")
|
||||||
|
|
@ -37,15 +50,16 @@ public class InviteDetectCommand implements Command {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "off":
|
case "off":
|
||||||
if (event.getRethink().getInviteDetection(event.getGuild().getId())) {
|
if (e.getRethinkServer().isInviteDetect()) {
|
||||||
event.getRethink().setInviteDetection(event.getGuild().getId(), false);
|
e.getRethinkServer().setInviteDetect(false);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.invitedetect.deactivate.success.title",
|
"commands.moderation.invitedetect.deactivate.success.title",
|
||||||
"commands.moderation.invitedetect.deactivate.success.description")
|
"commands.moderation.invitedetect.deactivate.success.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
e.getRethinkServer().push();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.invitedetect.deactivate.error.title",
|
"commands.moderation.invitedetect.deactivate.error.title",
|
||||||
"commands.moderation.invitedetect.deactivate.error.description")
|
"commands.moderation.invitedetect.deactivate.error.description")
|
||||||
|
|
@ -53,10 +67,10 @@ public class InviteDetectCommand implements Command {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.moderation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -15,53 +27,53 @@ import net.dv8tion.jda.api.entities.Member;
|
||||||
public class KickCommand implements Command {
|
public class KickCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getMessage().getMentionedMembers().size() == 1) {
|
if (e.getMessage().getMentionedMembers().size() == 1) {
|
||||||
Member victim = event.getMessage().getMentionedMembers().get(0);
|
Member victim = e.getMessage().getMentionedMembers().get(0);
|
||||||
if (!event.getAuthor().getId().equals(victim.getId())) {
|
if (!e.getAuthor().getId().equals(victim.getId())) {
|
||||||
if (!event.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
if (!e.getJDA().getSelfUser().getId().equals(victim.getId())) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(victim)) {
|
if (e.getGuild().getSelfMember().canInteract(victim)) {
|
||||||
event.getGuild().kick(victim, "Kicked by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().kick(victim, "Kicked by " + e.getAuthor().getAsTag()).queue();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.kick.success.title",
|
"commands.moderation.kick.success.title",
|
||||||
"✅",
|
"✅",
|
||||||
"commands.moderation.kick.success.description",
|
"commands.moderation.kick.success.description",
|
||||||
victim.getUser().getName()).build()).queue();
|
victim.getUser().getName()).build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.kick.error.title",
|
"commands.moderation.kick.error.title",
|
||||||
"commands.moderation.kick.myself.error.description").build()).queue();
|
"commands.moderation.kick.myself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
} else if (e.getMessage().getMentionedMembers().size() == 0) {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
} else if (event.getMessage().getMentionedMembers().size() > 1) {
|
} else if (e.getMessage().getMentionedMembers().size() > 1) {
|
||||||
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
|
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||||
Member member = event.getMessage().getMentionedMembers().get(i);
|
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||||
if (!event.getAuthor().getId().equals(member.getId())) {
|
if (!e.getAuthor().getId().equals(member.getId())) {
|
||||||
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
|
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||||
event.getGuild().kick(member).reason("Mass Kicked by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().kick(member).reason("Mass Kicked by " + e.getAuthor().getAsTag()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.myself.error.description").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.myself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.moderation.kick.error.title", "commands.moderation.kick.yourself.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.moderation.kick.success.title", "✅", "commands.moderation.kick.masskick.success.description", String.valueOf(event.getMessage().getMentionedMembers().size())).build()).queue();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.moderation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -16,52 +28,52 @@ import net.dv8tion.jda.api.entities.Member;
|
||||||
public class NickCommand implements Command {
|
public class NickCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(Permission.NICKNAME_MANAGE)) {
|
if (e.getGuild().getSelfMember().hasPermission(Permission.NICKNAME_MANAGE)) {
|
||||||
if (event.getMessage().getMentionedMembers().size() == 1) {
|
if (e.getMessage().getMentionedMembers().size() == 1) {
|
||||||
if (!event.getMessage().getMentionedMembers().get(0).getId().equals(event.getGuild().getSelfMember().getId())) {
|
if (!e.getMessage().getMentionedMembers().get(0).getId().equals(e.getGuild().getSelfMember().getId())) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(event.getMessage().getMentionedMembers().get(0))) {
|
if (e.getGuild().getSelfMember().canInteract(e.getMessage().getMentionedMembers().get(0))) {
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
if (event.getMessage().getContentRaw().startsWith(event.getRethink().getUserPrefix(event.getMember().getId()))) {
|
if (e.getMessage().getContentRaw().startsWith(e.getRethinkUser().getPrefix())) {
|
||||||
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethink().getUserPrefix(event.getMember().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
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();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.nick.success.title",
|
"commands.moderation.nick.success.title",
|
||||||
"✅",
|
"✅",
|
||||||
"commands.moderation.nick.success.description",
|
"commands.moderation.nick.success.description",
|
||||||
event.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
e.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
||||||
).build()).queue();
|
).build()).queue();
|
||||||
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getGuildPrefix(event.getGuild().getId()))) {
|
} else if (e.getMessage().getContentRaw().startsWith(e.getRethinkServer().getPrefix())) {
|
||||||
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethink().getGuildPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
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();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.nick.success.title",
|
"commands.moderation.nick.success.title",
|
||||||
"✅",
|
"✅",
|
||||||
"commands.moderation.nick.success.description", event.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
"commands.moderation.nick.success.description", e.getMessage().getMentionedMembers().get(0).getUser().getAsTag()
|
||||||
).build()).queue();
|
).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (event.getMessage().getContentRaw().startsWith(event.getRethink().getUserPrefix(event.getMember().getId()))) {
|
if (e.getMessage().getContentRaw().startsWith(e.getRethinkUser().getPrefix())) {
|
||||||
event.getGuild().getSelfMember().modifyNickname(event.getMessage().getContentRaw().replaceFirst(event.getRethink().getUserPrefix(event.getMember().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().getSelfMember().modifyNickname(e.getMessage().getContentRaw().replaceFirst(e.getRethinkUser().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.nick.success.title",
|
"commands.moderation.nick.success.title",
|
||||||
"✅",
|
"✅",
|
||||||
"commands.moderation.nick.myself.success.description",
|
"commands.moderation.nick.myself.success.description",
|
||||||
"").build()).queue();
|
"").build()).queue();
|
||||||
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getGuildPrefix(event.getGuild().getId()))) {
|
} else if (e.getMessage().getContentRaw().startsWith(e.getRethinkServer().getPrefix())) {
|
||||||
event.getGuild().getSelfMember().modifyNickname(event.getMessage().getContentRaw().replaceFirst(event.getRethink().getGuildPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().getSelfMember().modifyNickname(e.getMessage().getContentRaw().replaceFirst(e.getRethinkServer().getPrefix() + "nick " + args[0], "")).reason("Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.nick.success.title",
|
"commands.moderation.nick.success.title",
|
||||||
"✅",
|
"✅",
|
||||||
|
|
@ -69,27 +81,27 @@ public class NickCommand implements Command {
|
||||||
).build()).queue();
|
).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.getMessage().getMentionedMembers().size() == 0) {
|
} else if (e.getMessage().getMentionedMembers().size() == 0) {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
|
for (int i = 0; i < e.getMessage().getMentionedMembers().size(); i++) {
|
||||||
Member member = event.getMessage().getMentionedMembers().get(i);
|
Member member = e.getMessage().getMentionedMembers().get(i);
|
||||||
if (!event.getJDA().getSelfUser().getId().equals(member.getId())) {
|
if (!e.getJDA().getSelfUser().getId().equals(member.getId())) {
|
||||||
event.getGuild().modifyNickname(member, args[args.length - 1]).reason("Mass Nicked by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().modifyNickname(member, args[args.length - 1]).reason("Mass Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getGuild().getSelfMember().modifyNickname(args[args.length - 1]).reason("Mass Nicked by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().getSelfMember().modifyNickname(args[args.length - 1]).reason("Mass Nicked by " + e.getAuthor().getAsTag()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.nick.success.title",
|
"commands.moderation.nick.success.title",
|
||||||
"✅",
|
"✅",
|
||||||
"commands.moderation.nick.myself.success.description", String.valueOf(event.getMessage().getMentionedMembers().size())
|
"commands.moderation.nick.myself.success.description", String.valueOf(e.getMessage().getMentionedMembers().size())
|
||||||
).build()).queue();
|
).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.moderation;
|
package com.bbn.hadder.commands.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -10,11 +26,12 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
public class PrefixCommand implements Command {
|
public class PrefixCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (!args[0].contains("\"")) {
|
if (!args[0].contains("\"")) {
|
||||||
event.getRethink().setGuildPrefix(args[0], event.getGuild().getId());
|
e.getRethinkServer().setPrefix(args[0]);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getRethinkServer().push();
|
||||||
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.prefix.success.title",
|
"commands.moderation.prefix.success.title",
|
||||||
"✅",
|
"✅",
|
||||||
|
|
@ -22,14 +39,14 @@ public class PrefixCommand implements Command {
|
||||||
args[0]).build()
|
args[0]).build()
|
||||||
).queue();
|
).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.WARNING,
|
MessageEditor.MessageType.WARNING,
|
||||||
"",
|
"",
|
||||||
"commands.moderation.prefix.error.description").build()).queue();
|
"commands.moderation.prefix.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.moderation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -16,67 +28,67 @@ import net.dv8tion.jda.api.Region;
|
||||||
public class RegionChangeCommand implements Command {
|
public class RegionChangeCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER)) {
|
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER)) {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "amsterdam":
|
case "amsterdam":
|
||||||
setRegion(Region.AMSTERDAM, "Amsterdam", event);
|
setRegion(Region.AMSTERDAM, "Amsterdam", e);
|
||||||
break;
|
break;
|
||||||
case "frankfurt":
|
case "frankfurt":
|
||||||
setRegion(Region.FRANKFURT, "Frankfurt", event);
|
setRegion(Region.FRANKFURT, "Frankfurt", e);
|
||||||
break;
|
break;
|
||||||
case "eu-west":
|
case "eu-west":
|
||||||
setRegion(Region.EU_WEST, "EU West", event);
|
setRegion(Region.EU_WEST, "EU West", e);
|
||||||
break;
|
break;
|
||||||
case "eu-central":
|
case "eu-central":
|
||||||
setRegion(Region.EU_CENTRAL, "EU Central", event);
|
setRegion(Region.EU_CENTRAL, "EU Central", e);
|
||||||
break;
|
break;
|
||||||
case "europe":
|
case "europe":
|
||||||
setRegion(Region.EUROPE, "EUROPE", event);
|
setRegion(Region.EUROPE, "EUROPE", e);
|
||||||
break;
|
break;
|
||||||
case "brazil":
|
case "brazil":
|
||||||
setRegion(Region.BRAZIL, "Brazil", event);
|
setRegion(Region.BRAZIL, "Brazil", e);
|
||||||
break;
|
break;
|
||||||
case "hongkong":
|
case "hongkong":
|
||||||
setRegion(Region.HONG_KONG, "Hong Kong", event);
|
setRegion(Region.HONG_KONG, "Hong Kong", e);
|
||||||
break;
|
break;
|
||||||
case "india":
|
case "india":
|
||||||
setRegion(Region.INDIA, "India", event);
|
setRegion(Region.INDIA, "India", e);
|
||||||
break;
|
break;
|
||||||
case "japan":
|
case "japan":
|
||||||
setRegion(Region.JAPAN, "Japan", event);
|
setRegion(Region.JAPAN, "Japan", e);
|
||||||
break;
|
break;
|
||||||
case "london":
|
case "london":
|
||||||
setRegion(Region.LONDON, "London", event);
|
setRegion(Region.LONDON, "London", e);
|
||||||
break;
|
break;
|
||||||
case "russia":
|
case "russia":
|
||||||
setRegion(Region.RUSSIA, "Russia", event);
|
setRegion(Region.RUSSIA, "Russia", e);
|
||||||
break;
|
break;
|
||||||
case "singapore":
|
case "singapore":
|
||||||
setRegion(Region.SINGAPORE, "Singapore", event);
|
setRegion(Region.SINGAPORE, "Singapore", e);
|
||||||
break;
|
break;
|
||||||
case "south-africa":
|
case "south-africa":
|
||||||
setRegion(Region.SOUTH_AFRICA, "South Africa", event);
|
setRegion(Region.SOUTH_AFRICA, "South Africa", e);
|
||||||
break;
|
break;
|
||||||
case "sydney":
|
case "sydney":
|
||||||
setRegion(Region.SYDNEY, "Sydney", event);
|
setRegion(Region.SYDNEY, "Sydney", e);
|
||||||
break;
|
break;
|
||||||
case "us-central":
|
case "us-central":
|
||||||
setRegion(Region.US_CENTRAL, "US Central", event);
|
setRegion(Region.US_CENTRAL, "US Central", e);
|
||||||
break;
|
break;
|
||||||
case "us-east":
|
case "us-east":
|
||||||
setRegion(Region.US_EAST, "US East", event);
|
setRegion(Region.US_EAST, "US East", e);
|
||||||
break;
|
break;
|
||||||
case "us-west":
|
case "us-west":
|
||||||
setRegion(Region.US_WEST, "US West", event);
|
setRegion(Region.US_WEST, "US West", e);
|
||||||
break;
|
break;
|
||||||
case "us-south":
|
case "us-south":
|
||||||
setRegion(Region.US_SOUTH, "US South", event);
|
setRegion(Region.US_SOUTH, "US South", e);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.regionchange.regions.title",
|
"commands.moderation.regionchange.regions.title",
|
||||||
"")
|
"")
|
||||||
|
|
@ -84,10 +96,12 @@ public class RegionChangeCommand implements Command {
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Maybe South Korea. Check the geo restricted discussion
|
||||||
} else
|
} else
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
} else event.getTextChannel().sendMessage(
|
} else e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.regionchange.regions.title",
|
"commands.moderation.regionchange.regions.title",
|
||||||
"")
|
"")
|
||||||
|
|
@ -95,10 +109,10 @@ public class RegionChangeCommand implements Command {
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegion (Region region, String region_name, CommandEvent event) {
|
public void setRegion (Region region, String region_name, CommandEvent e) {
|
||||||
event.getGuild().getManager().setRegion(region).reason("Region changed by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().getManager().setRegion(region).reason("Region changed by " + e.getAuthor().getAsTag()).queue();
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.regionchange.success.title", "",
|
"commands.moderation.regionchange.success.title", "",
|
||||||
"commands.moderation.regionchange.success.description", region_name)
|
"commands.moderation.regionchange.success.description", region_name)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.moderation;
|
package com.bbn.hadder.commands.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -13,74 +29,74 @@ import net.dv8tion.jda.api.entities.Role;
|
||||||
public class RoleCommand implements Command {
|
public class RoleCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "add":
|
case "add":
|
||||||
if (event.getMessage().getMentionedMembers().size() > 0 && event.getMessage().getMentionedRoles().size() > 0) {
|
if (e.getMessage().getMentionedMembers().size() > 0 && e.getMessage().getMentionedRoles().size() > 0) {
|
||||||
for (Member member : event.getMessage().getMentionedMembers()) {
|
for (Member member : e.getMessage().getMentionedMembers()) {
|
||||||
for (Role role : event.getMessage().getMentionedRoles()) {
|
for (Role role : e.getMessage().getMentionedRoles()) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(role)) {
|
if (e.getGuild().getSelfMember().canInteract(role)) {
|
||||||
event.getGuild().addRoleToMember(member, role).reason("Role added by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().addRoleToMember(member, role).reason("Role added by " + e.getAuthor().getAsTag()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getChannel().sendMessage(
|
e.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.role.add.success.title",
|
"commands.moderation.role.add.success.title",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.role.add.success.description",
|
"commands.moderation.role.add.success.description",
|
||||||
String.valueOf(event.getMessage().getMentionedRoles().size()),
|
String.valueOf(e.getMessage().getMentionedRoles().size()),
|
||||||
String.valueOf(event.getMessage().getMentionedMembers().size()))
|
String.valueOf(e.getMessage().getMentionedMembers().size()))
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "remove":
|
case "remove":
|
||||||
if (event.getMessage().getMentionedMembers().size() > 0 && event.getMessage().getMentionedRoles().size() > 0) {
|
if (e.getMessage().getMentionedMembers().size() > 0 && e.getMessage().getMentionedRoles().size() > 0) {
|
||||||
for (Member member : event.getMessage().getMentionedMembers()) {
|
for (Member member : e.getMessage().getMentionedMembers()) {
|
||||||
for (Role role : event.getMessage().getMentionedRoles()) {
|
for (Role role : e.getMessage().getMentionedRoles()) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(member)) {
|
if (e.getGuild().getSelfMember().canInteract(member)) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(role)) {
|
if (e.getGuild().getSelfMember().canInteract(role)) {
|
||||||
event.getGuild().removeRoleFromMember(member, role).reason("Role removed by " + event.getAuthor().getAsTag()).queue();
|
e.getGuild().removeRoleFromMember(member, role).reason("Role removed by " + e.getAuthor().getAsTag()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getChannel().sendMessage(
|
e.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.role.remove.success.title",
|
"commands.moderation.role.remove.success.title",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.role.remove.success.description",
|
"commands.moderation.role.remove.success.description",
|
||||||
String.valueOf(event.getMessage().getMentionedRoles().size()),
|
String.valueOf(e.getMessage().getMentionedRoles().size()),
|
||||||
String.valueOf(event.getMessage().getMentionedMembers().size()))
|
String.valueOf(e.getMessage().getMentionedMembers().size()))
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.moderation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -21,92 +33,94 @@ import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||||
public class RulesCommand implements Command {
|
public class RulesCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
if (e.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.setup.title",
|
"commands.moderation.rules.setup.title",
|
||||||
"commands.moderation.rules.setup.description")
|
"commands.moderation.rules.setup.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
event.getEventWaiter().newOnMessageEventWaiter(event1 -> {
|
e.getEventWaiter().newOnMessageEventWaiter(e1 -> {
|
||||||
if (event1.getMessage().getMentionedChannels().size() == 1) {
|
if (e1.getMessage().getMentionedChannels().size() == 1) {
|
||||||
try {
|
try {
|
||||||
TextChannel channel = event1.getMessage().getMentionedChannels().get(0);
|
TextChannel channel = e1.getMessage().getMentionedChannels().get(0);
|
||||||
createRules(event, event1, channel);
|
createRules(e, e1, channel);
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.channel.error.title",
|
"commands.moderation.rules.channel.error.title",
|
||||||
"commands.moderation.rules.channel.error.description")
|
"commands.moderation.rules.channel.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
TextChannel channel = event1.getGuild().getTextChannelsByName(event1.getMessage().getContentRaw(), true).get(0);
|
TextChannel channel = e1.getGuild().getTextChannelsByName(e1.getMessage().getContentRaw(), true).get(0);
|
||||||
createRules(event, event1, channel);
|
createRules(e, e1, channel);
|
||||||
} catch (Exception e) {
|
} catch (NullPointerException ex) {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.channel.error.title",
|
"commands.moderation.rules.channel.error.title",
|
||||||
"commands.moderation.rules.channel.error.description")
|
"commands.moderation.rules.channel.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.error.permission.title",
|
"commands.moderation.rules.error.permission.title",
|
||||||
"commands.moderation.rules.error.permission.description")
|
"commands.moderation.rules.error.permission.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createRules(CommandEvent event, GuildMessageReceivedEvent event1, TextChannel channel) {
|
public void createRules(CommandEvent e, GuildMessageReceivedEvent e1, TextChannel channel) {
|
||||||
if (channel.getGuild().getId().equals(event1.getGuild().getId())) {
|
if (channel.getGuild().getId().equals(e1.getGuild().getId())) {
|
||||||
if (event.getGuild().getSelfMember().hasPermission(channel, Permission.MESSAGE_WRITE)) {
|
if (e.getGuild().getSelfMember().hasPermission(channel, Permission.MESSAGE_WRITE)) {
|
||||||
event1.getChannel().sendMessage(
|
e1.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.rules.title",
|
"commands.moderation.rules.rules.title",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.rules.rules.description",
|
"commands.moderation.rules.rules.description",
|
||||||
channel.getName())
|
channel.getName())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
event.getEventWaiter().newOnMessageEventWaiter(event2 -> {
|
e.getEventWaiter().newOnMessageEventWaiter(e2 -> {
|
||||||
String message = event2.getMessage().getContentRaw();
|
String message = e2.getMessage().getContentRaw();
|
||||||
event2.getChannel().sendMessage(
|
e2.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.role.title",
|
"commands.moderation.rules.role.title",
|
||||||
"commands.moderation.rules.role.description")
|
"commands.moderation.rules.role.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
new EventWaiter().newOnMessageEventWaiter(event3 -> {
|
new EventWaiter().newOnMessageEventWaiter(e3 -> {
|
||||||
if (event3.getMessage().getMentionedRoles().size() == 1) {
|
if (e3.getMessage().getMentionedRoles().size() == 1) {
|
||||||
Role role = event3.getMessage().getMentionedRoles().get(0);
|
Role role = e3.getMessage().getMentionedRoles().get(0);
|
||||||
setRole(event, channel, message, event3, role);
|
setRole(e, channel, message, e3, role);
|
||||||
} else if (event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).size() > 0) {
|
} else if (e3.getGuild().getRolesByName(e3.getMessage().getContentRaw(), true).size() > 0) {
|
||||||
Role role = event3.getGuild().getRolesByName(event3.getMessage().getContentRaw(), true).get(0);
|
Role role = e3.getGuild().getRolesByName(e3.getMessage().getContentRaw(), true).get(0);
|
||||||
setRole(event, channel, message, event3, role);
|
setRole(e, channel, message, e3, role);
|
||||||
} else {
|
} else {
|
||||||
event3.getChannel().sendMessage(
|
e3.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.role.error.title",
|
"commands.moderation.rules.role.error.title",
|
||||||
"commands.moderation.rules.role.error.description")
|
"commands.moderation.rules.role.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.error.message.title",
|
"commands.moderation.rules.error.message.title",
|
||||||
"commands.moderation.rules.error.message.description")
|
"commands.moderation.rules.error.message.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.guild.error.title",
|
"commands.moderation.rules.guild.error.title",
|
||||||
"commands.moderation.rules.guild.error.description")
|
"commands.moderation.rules.guild.error.description")
|
||||||
|
|
@ -114,117 +128,119 @@ public class RulesCommand implements Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRole(CommandEvent event, TextChannel channel, String message, GuildMessageReceivedEvent event3, Role role) {
|
public void setRole(CommandEvent e, TextChannel channel, String message, GuildMessageReceivedEvent e3, Role role) {
|
||||||
if (event3.getGuild().getSelfMember().canInteract(role)) {
|
if (e3.getGuild().getSelfMember().canInteract(role)) {
|
||||||
if (event3.getMember().canInteract(role)) {
|
if (e3.getMember().canInteract(role)) {
|
||||||
event3.getChannel().sendMessage(
|
e3.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.emote.accept.title",
|
"commands.moderation.rules.emote.accept.title",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.rules.emote.accept.description", role.getName())
|
"commands.moderation.rules.emote.accept.description", role.getName())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
event.getEventWaiter().newOnMessageEventWaiter(event4 -> {
|
e.getEventWaiter().newOnMessageEventWaiter(e4 -> {
|
||||||
if (event4.getMessage().getEmotes().size() == 1) {
|
if (e4.getMessage().getEmotes().size() == 1) {
|
||||||
Emote aemote = event4.getMessage().getEmotes().get(0);
|
Emote aemote = e4.getMessage().getEmotes().get(0);
|
||||||
event4.getChannel().sendMessage(
|
e4.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.emote.decline.title", "",
|
"commands.moderation.rules.emote.decline.title", "",
|
||||||
"commands.moderation.rules.emote.decline.description", String.valueOf(aemote))
|
"commands.moderation.rules.emote.decline.description", String.valueOf(aemote))
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
event.getEventWaiter().newOnMessageEventWaiter(event5 -> {
|
e.getEventWaiter().newOnMessageEventWaiter(e5 -> {
|
||||||
Emote demote = event5.getMessage().getEmotes().get(0);
|
Emote demote = e5.getMessage().getEmotes().get(0);
|
||||||
if (!aemote.equals(demote)) {
|
if (!aemote.equals(demote)) {
|
||||||
Message rules = channel.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
Message rules = channel.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Rules")
|
.setTitle("Rules")
|
||||||
.setDescription(message)
|
.setDescription(message)
|
||||||
.build()).complete();
|
.build()).complete();
|
||||||
try {
|
try {
|
||||||
rules.addReaction(aemote).queue();
|
rules.addReaction(aemote).queue();
|
||||||
rules.addReaction(demote).queue();
|
rules.addReaction(demote).queue();
|
||||||
event5.getChannel().sendMessage(
|
e5.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.success.title",
|
"commands.moderation.rules.success.title",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.rules.success.description",
|
"commands.moderation.rules.success.description",
|
||||||
channel.getAsMention())
|
channel.getAsMention())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
event5.getChannel().sendMessage(
|
e5.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"error",
|
"error",
|
||||||
"commands.moderation.rules.emote.error.access.description")
|
"commands.moderation.rules.emote.error.access.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
event.getRethink().updateRules(event.getGuild().getId(), rules.getId(), role.getId(), aemote.toString(), demote.toString());
|
e.getRethinkServer().updateRules(rules.getId(), role.getId(), aemote.toString(), demote.toString());
|
||||||
|
e.getRethinkServer().push();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.emote.error.equal.title",
|
"commands.moderation.rules.emote.error.equal.title",
|
||||||
"commands.moderation.rules.emote.error.equal.description")
|
"commands.moderation.rules.emote.error.equal.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
} else {
|
} else {
|
||||||
String aemote = event4.getMessage().getContentRaw();
|
String aemote = e4.getMessage().getContentRaw();
|
||||||
event4.getChannel().sendMessage(
|
e4.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.emote.decline.title",
|
"commands.moderation.rules.emote.decline.title",
|
||||||
"commands.moderation.rules.emoji.decline.description")
|
"commands.moderation.rules.emoji.decline.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
event.getEventWaiter().newOnMessageEventWaiter(event5 -> {
|
e.getEventWaiter().newOnMessageEventWaiter(e5 -> {
|
||||||
String demote = event5.getMessage().getContentRaw();
|
String demote = e5.getMessage().getContentRaw();
|
||||||
if (!aemote.equals(demote)) {
|
if (!aemote.equals(demote)) {
|
||||||
Message rules = channel.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
Message rules = channel.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Rules")
|
.setTitle("Rules")
|
||||||
.setDescription(message)
|
.setDescription(message)
|
||||||
.build()).complete();
|
.build()).complete();
|
||||||
try {
|
try {
|
||||||
rules.addReaction(aemote).queue();
|
rules.addReaction(aemote).queue();
|
||||||
rules.addReaction(demote).queue();
|
rules.addReaction(demote).queue();
|
||||||
event5.getChannel().sendMessage(
|
e5.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.rules.success.title",
|
"commands.moderation.rules.success.title",
|
||||||
"",
|
"",
|
||||||
"commands.moderation.rules.success.description",
|
"commands.moderation.rules.success.description",
|
||||||
channel.getAsMention())
|
channel.getAsMention())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
event5.getChannel().sendMessage(
|
e5.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"error",
|
"error",
|
||||||
"commands.moderation.rules.emoji.error.description")
|
"commands.moderation.rules.emoji.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
e.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
event.getRethink().updateRules(event.getGuild().getId(), rules.getId(), role.getId(), aemote, demote);
|
e.getRethinkServer().updateRules(rules.getId(), role.getId(), aemote, demote);
|
||||||
|
e.getRethinkServer().push();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.emote.error.equal.title",
|
"commands.moderation.rules.emote.error.equal.title",
|
||||||
"commands.moderation.rules.emote.error.equal.description")
|
"commands.moderation.rules.emote.error.equal.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
}
|
}
|
||||||
}, event.getJDA(), event.getAuthor());
|
}, e.getJDA(), e.getAuthor());
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.role.permission.error.title",
|
"commands.moderation.rules.role.permission.error.title",
|
||||||
"commands.moderation.rules.role.permission.error.description")
|
"commands.moderation.rules.role.permission.error.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.moderation.rules.error.interact.title",
|
"commands.moderation.rules.error.interact.title",
|
||||||
"commands.moderation.rules.error.interact.description")
|
"commands.moderation.rules.error.interact.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.moderation;
|
package com.bbn.hadder.commands.moderation;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -8,29 +24,31 @@ import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
public class StarboardCommand implements Command {
|
public class StarboardCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getMessage().getMentionedChannels().size()==1) {
|
if (e.getMessage().getMentionedChannels().size()==1) {
|
||||||
event.getRethink().setStarboardChannel(event.getGuild().getId(), event.getMessage().getMentionedChannels().get(0).getId());
|
e.getRethinkServer().setStarboard(e.getMessage().getMentionedChannels().get(0).getId());
|
||||||
event.getChannel().sendMessage(
|
e.getChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.moderation.starboard.success.title","")
|
"commands.moderation.starboard.success.title","")
|
||||||
.build())
|
.build())
|
||||||
.queue();
|
.queue();
|
||||||
} else {
|
} else {
|
||||||
if (args.length>0) {
|
if (args.length>0) {
|
||||||
TextChannel channel = event.getGuild().getTextChannelById(args[0]);
|
TextChannel channel = e.getGuild().getTextChannelById(args[0]);
|
||||||
if (channel!=null) {
|
if (channel!=null) {
|
||||||
event.getRethink().setStarboardChannel(event.getGuild().getId(), channel.getId());
|
e.getRethinkServer().setStarboard(channel.getId());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length==2) {
|
if (args.length==2) {
|
||||||
event.getRethink().setNeededStars(args[1], event.getGuild().getId());
|
e.getRethinkServer().setNeededStars(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.getRethinkServer().push();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
/*
|
/*
|
||||||
@author Hax / Hax6775 / 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.
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
@ -14,29 +26,29 @@ public class BassCommand implements Command {
|
||||||
-0.1f, -0.1f, -0.1f, -0.1f };
|
-0.1f, -0.1f, -0.1f, -0.1f };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
|
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
float value = Float.parseFloat(args[0]);
|
float value = Float.parseFloat(args[0]);
|
||||||
EqualizerFactory equalizer = new EqualizerFactory();
|
EqualizerFactory equalizer = new EqualizerFactory();
|
||||||
for (int i = 0; i < BASS_BOOST.length; i++) {
|
for (int i = 0; i < BASS_BOOST.length; i++) {
|
||||||
equalizer.setGain(i, BASS_BOOST[i] + value);
|
equalizer.setGain(i, BASS_BOOST[i] + value);
|
||||||
}
|
}
|
||||||
event.getAudioManager().getPlayer(event.getGuild()).setFrameBufferDuration(500);
|
e.getAudioManager().getPlayer(e.getGuild()).setFrameBufferDuration(500);
|
||||||
event.getAudioManager().getPlayer(event.getGuild()).setFilterFactory(equalizer);
|
e.getAudioManager().getPlayer(e.getGuild()).setFilterFactory(equalizer);
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.bass.error.connected.title",
|
"commands.music.bass.error.connected.title",
|
||||||
"commands.music.bass.error.connected.description")
|
"commands.music.bass.error.connected.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.info.error.title",
|
"commands.music.info.error.title",
|
||||||
"commands.music.info.error.description").build()).queue();
|
"commands.music.info.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else event.getHelpCommand().sendHelp(this, event);
|
} else e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
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,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -5,24 +21,20 @@ import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class InfoCommand implements Command {
|
public class InfoCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
|
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||||
AudioTrack track = event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack();
|
AudioTrack track = e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack();
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.info.success.title", "")
|
"commands.music.info.success.title", "")
|
||||||
.setAuthor(track.getInfo().author)
|
.setAuthor(track.getInfo().author)
|
||||||
.addField("Title", track.getInfo().title, true)
|
.addField("Title", track.getInfo().title, true)
|
||||||
.addField("Progress", "`[ " + event.getAudioManager().getTimestamp(track.getPosition()) + " / " + event.getAudioManager().getTimestamp(track.getInfo().length) + " ]`", false)
|
.addField("Progress", "`[ " + e.getAudioManager().getTimestamp(track.getPosition()) + " / " + e.getAudioManager().getTimestamp(track.getInfo().length) + " ]`", false)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.info.error.title",
|
"commands.music.info.error.title",
|
||||||
"commands.music.info.error.description").build()).queue();
|
"commands.music.info.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -7,39 +23,35 @@ import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||||
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
||||||
import net.dv8tion.jda.api.managers.AudioManager;
|
import net.dv8tion.jda.api.managers.AudioManager;
|
||||||
|
|
||||||
/*
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class JoinCommand implements Command {
|
public class JoinCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel()) {
|
if (e.getMember().getVoiceState().inVoiceChannel()) {
|
||||||
AudioManager audioManager = event.getGuild().getAudioManager();
|
AudioManager audioManager = e.getGuild().getAudioManager();
|
||||||
if(!audioManager.isAttemptingToConnect()) {
|
if(!audioManager.isAttemptingToConnect()) {
|
||||||
VoiceChannel vc = event.getMember().getVoiceState().getChannel();
|
VoiceChannel vc = e.getMember().getVoiceState().getChannel();
|
||||||
if (event.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
if (e.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
||||||
if (!event.getGuild().getSelfMember().getVoiceState().getChannel().getId().equals(vc.getId())) {
|
if (!e.getGuild().getSelfMember().getVoiceState().getChannel().getId().equals(vc.getId())) {
|
||||||
try {
|
try {
|
||||||
event.getGuild().getAudioManager().openAudioConnection(vc);
|
e.getGuild().getAudioManager().openAudioConnection(vc);
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.music.join.success.title",
|
"commands.music.join.success.title",
|
||||||
"",
|
"",
|
||||||
"commands.music.join.success.description",
|
"commands.music.join.success.description",
|
||||||
vc.getName())
|
vc.getName())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (InsufficientPermissionException e) {
|
} catch (InsufficientPermissionException ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.join.error.permission.title",
|
"commands.music.join.error.permission.title",
|
||||||
"commands.music.join.error.permission.description")
|
"commands.music.join.error.permission.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(
|
e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.WARNING,
|
MessageEditor.MessageType.WARNING,
|
||||||
"commands.music.join.error.connecting.already.title",
|
"commands.music.join.error.connecting.already.title",
|
||||||
"commands.music.join.error.connecting.already.description")
|
"commands.music.join.error.connecting.already.description")
|
||||||
|
|
@ -47,28 +59,28 @@ public class JoinCommand implements Command {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
event.getGuild().getAudioManager().openAudioConnection(vc);
|
e.getGuild().getAudioManager().openAudioConnection(vc);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.music.join.success.title", "",
|
"commands.music.join.success.title", "",
|
||||||
"commands.music.join.success.description", vc.getName())
|
"commands.music.join.success.description", vc.getName())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (InsufficientPermissionException e) {
|
} catch (InsufficientPermissionException ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.join.error.permission.title",
|
"commands.music.join.error.permission.title",
|
||||||
"commands.music.join.error.permission.description")
|
"commands.music.join.error.permission.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.WARNING,
|
MessageEditor.MessageType.WARNING,
|
||||||
"commands.music.join.error.connecting.trying.title",
|
"commands.music.join.error.connecting.trying.title",
|
||||||
"commands.music.join.error.connecting.trying.description")
|
"commands.music.join.error.connecting.trying.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.join.error.channel.title",
|
"commands.music.join.error.channel.title",
|
||||||
"commands.music.join.error.channel.description")
|
"commands.music.join.error.channel.description")
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.music;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
@ -11,23 +23,23 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
public class LeaveCommand implements Command {
|
public class LeaveCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
if (e.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
event.getGuild().getAudioManager().closeAudioConnection();
|
e.getGuild().getAudioManager().closeAudioConnection();
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.INFO,
|
MessageEditor.MessageType.INFO,
|
||||||
"commands.music.leave.success.title",
|
"commands.music.leave.success.title",
|
||||||
"commands.music.leave.success.description")
|
"commands.music.leave.success.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.leave.error.channel.title",
|
"commands.music.leave.error.channel.title",
|
||||||
"commands.music.leave.error.channel.description")
|
"commands.music.leave.error.channel.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.leave.error.connected.tile",
|
"commands.music.leave.error.connected.tile",
|
||||||
"commands.music.leave.error.connected.description")
|
"commands.music.leave.error.connected.description")
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class LoopCommand implements Command {
|
public class LoopCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
|
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
if (event.getAudioManager().getTrackManager(event.getGuild()).isLoop()) {
|
if (e.getAudioManager().getTrackManager(e.getGuild()).isLoop()) {
|
||||||
event.getAudioManager().getTrackManager(event.getGuild()).setLoop(false);
|
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(false);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getAudioManager().getTrackManager(event.getGuild()).setLoop(true);
|
e.getAudioManager().getTrackManager(e.getGuild()).setLoop(true);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.loop.error.connected.title",
|
"commands.music.loop.error.connected.title",
|
||||||
"commands.music.loop.error.connected.description")
|
"commands.music.loop.error.connected.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.info.error.title",
|
"commands.music.info.error.title",
|
||||||
"commands.music.info.error.description").build()).queue();
|
"commands.music.info.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.music;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
@ -11,29 +23,29 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
public class PauseCommand implements Command {
|
public class PauseCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
|
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
if (!event.getAudioManager().getPlayer(event.getGuild()).isPaused()) {
|
if (!e.getAudioManager().getPlayer(e.getGuild()).isPaused()) {
|
||||||
event.getAudioManager().getPlayer(event.getGuild()).setPaused(true);
|
e.getAudioManager().getPlayer(e.getGuild()).setPaused(true);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.pause.success.title",
|
"commands.music.pause.success.title",
|
||||||
"commands.music.pause.success.description")
|
"commands.music.pause.success.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.pause.error.paused.title",
|
"commands.music.pause.error.paused.title",
|
||||||
"commands.music.pause.error.paused.description")
|
"commands.music.pause.error.paused.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.pause.error.connected.title",
|
"commands.music.pause.error.connected.title",
|
||||||
"commands.music.pause.error.connected.description")
|
"commands.music.pause.error.connected.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.info.error.title",
|
"commands.music.info.error.title",
|
||||||
"commands.music.info.error.description").build()).queue();
|
"commands.music.info.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
|
|
@ -8,55 +24,51 @@ import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PlayCommand implements Command {
|
public class PlayCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel()) {
|
if (e.getMember().getVoiceState().inVoiceChannel()) {
|
||||||
String input = event.getMessage().getContentRaw().replaceFirst(event.getRethink().getGuildPrefix(event.getGuild().getId()) + "play ", "").replaceFirst(event.getRethink().getUserPrefix(event.getAuthor().getId()) + "play ", "");
|
String input = e.getMessage().getContentRaw().replaceFirst(e.getRethinkServer().getPrefix() + "play ", "").replaceFirst(e.getRethinkUser().getPrefix() + "play ", "");
|
||||||
try {
|
try {
|
||||||
new URL(input).toURI();
|
new URL(input).toURI();
|
||||||
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.play.load.title", "⭕",
|
"commands.music.play.load.title", "⭕",
|
||||||
"commands.music.play.load.description", "").build()).complete();
|
"commands.music.play.load.description", "").build()).complete();
|
||||||
event.getAudioManager().loadTrack(input, event, msg);
|
e.getAudioManager().loadTrack(input, e, msg);
|
||||||
} catch (InsufficientPermissionException e) {
|
} catch (InsufficientPermissionException ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.join.error.permission.title",
|
"commands.music.join.error.permission.title",
|
||||||
"commands.music.join.error.permission.description")
|
"commands.music.join.error.permission.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
Message msg = event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
Message msg = e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.play.load.title", "⭕",
|
"commands.music.play.load.title", "⭕",
|
||||||
"commands.music.play.load.description", "").build()).complete();
|
"commands.music.play.load.description", "").build()).complete();
|
||||||
event.getAudioManager().loadTrack("ytsearch: " + input, event, msg);
|
e.getAudioManager().loadTrack("ytsearch: " + input, e, msg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(
|
||||||
MessageEditor.MessageType.ERROR,
|
MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.join.error.channel.title",
|
"commands.music.join.error.channel.title",
|
||||||
"commands.music.join.error.channel.description")
|
"commands.music.join.error.channel.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else if (event.getAudioManager().getPlayer(event.getGuild()).isPaused()) {
|
} else if (e.getAudioManager().getPlayer(e.getGuild()).isPaused()) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
event.getAudioManager().getPlayer(event.getGuild()).setPaused(false);
|
e.getAudioManager().getPlayer(e.getGuild()).setPaused(false);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.play.success.unpause.title",
|
"commands.music.play.success.unpause.title",
|
||||||
"commands.music.play.success.unpause.description")
|
"commands.music.play.success.unpause.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.play.error.connected.title",
|
"commands.music.play.error.connected.title",
|
||||||
"commands.music.play.error.connected.description")
|
"commands.music.play.error.connected.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else event.getHelpCommand().sendHelp(this, event);
|
} else e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.audio.AudioInfo;
|
import com.bbn.hadder.audio.AudioInfo;
|
||||||
|
|
@ -7,29 +23,25 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class QueueCommand implements Command {
|
public class QueueCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (!event.getAudioManager().hasPlayer(event.getGuild()) || event.getAudioManager().getTrackManager(event.getGuild()).getQueuedTracks().isEmpty()) {
|
if (!e.getAudioManager().hasPlayer(e.getGuild()) || e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.queue.error.title",
|
"commands.music.queue.error.title",
|
||||||
"commands.music.queue.error.description"
|
"commands.music.queue.error.description"
|
||||||
).build()).queue();
|
).build()).queue();
|
||||||
} else {
|
} else {
|
||||||
Set<AudioInfo> queue = event.getAudioManager().getTrackManager(event.getGuild()).getQueuedTracks();
|
Set<AudioInfo> queue = e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks();
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
long queuelength = 0;
|
long queuelength = 0;
|
||||||
for (AudioInfo g : queue) {
|
for (AudioInfo g : queue) {
|
||||||
queuelength = queuelength + g.getTrack().getInfo().length;
|
queuelength = queuelength + g.getTrack().getInfo().length;
|
||||||
builder.append("("+event.getAudioManager().getTimestamp(g.getTrack().getInfo().length)+") **").append(g.getTrack().getInfo().author).append("**: `").append(g.getTrack().getInfo().title).append("` \n");
|
builder.append("("+e.getAudioManager().getTimestamp(g.getTrack().getInfo().length)+") **").append(g.getTrack().getInfo().author).append("**: `").append(g.getTrack().getInfo().title).append("` \n");
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.queue.success.title", "("+String.valueOf(event.getAudioManager().getTimestamp(queuelength))+")",
|
"commands.music.queue.success.title", "("+String.valueOf(e.getAudioManager().getTimestamp(queuelength))+")",
|
||||||
"commands.music.queue.success.description", builder.toString())
|
"commands.music.queue.success.description", builder.toString())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
104
src/main/java/com/bbn/hadder/commands/music/RecordCommand.java
Normal file
104
src/main/java/com/bbn/hadder/commands/music/RecordCommand.java
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
* @author Hax / Hax6775 / Schlauer_Hax
|
||||||
|
*/
|
||||||
|
|
||||||
|
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.AudioReceiveHandler;
|
||||||
|
import net.dv8tion.jda.api.audio.AudioSendHandler;
|
||||||
|
import net.dv8tion.jda.api.audio.UserAudio;
|
||||||
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.managers.AudioManager;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
|
@Perms(Perm.BOT_OWNER)
|
||||||
|
public class RecordCommand implements Command {
|
||||||
|
|
||||||
|
private final HashMap<String, Queue<byte[]>> queue = new HashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
Guild guild = event.getMember().getVoiceState().getChannel().getGuild();
|
||||||
|
AudioManager audioManager = guild.getAudioManager();
|
||||||
|
EchoHandler handler = new EchoHandler(queue);
|
||||||
|
if (!audioManager.isConnected()) {
|
||||||
|
audioManager.setSendingHandler(handler);
|
||||||
|
audioManager.setReceivingHandler(handler);
|
||||||
|
audioManager.openAudioConnection(event.getMember().getVoiceState().getChannel());
|
||||||
|
} else {
|
||||||
|
for (Map.Entry<String, Queue<byte[]>> key : queue.entrySet()) {
|
||||||
|
File file = new File("./"+event.getJDA().getUserById(key.getKey())+".wav");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class EchoHandler implements AudioSendHandler, AudioReceiveHandler {
|
||||||
|
|
||||||
|
private HashMap<String, Queue<byte[]>> queue;
|
||||||
|
|
||||||
|
public EchoHandler(HashMap<String, Queue<byte[]>> queue) {
|
||||||
|
this.queue = queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvide() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ByteBuffer provide20MsAudio() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleUserAudio(@Nonnull UserAudio userAudio) {
|
||||||
|
if (queue.containsKey(userAudio.getUser().getId())) {
|
||||||
|
queue.get(userAudio.getUser().getId()).add(userAudio.getAudioData(1.0f));
|
||||||
|
} else {
|
||||||
|
Queue<byte[]> newqueue = new ConcurrentLinkedQueue<>();
|
||||||
|
newqueue.add(userAudio.getAudioData(1.0f));
|
||||||
|
queue.put(userAudio.getUser().getId(), newqueue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Queue<byte[]>> getQueue() {
|
||||||
|
return queue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] labels() {
|
||||||
|
return new String[]{"echo"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String example() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,30 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class SkipCommand implements Command {
|
public class SkipCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getAudioManager().hasPlayer(event.getGuild()) && !event.getAudioManager().getTrackManager(event.getGuild()).getQueuedTracks().isEmpty()) {
|
if (e.getAudioManager().hasPlayer(e.getGuild()) && !e.getAudioManager().getTrackManager(e.getGuild()).getQueuedTracks().isEmpty()) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
event.getAudioManager().forceSkipTrack(event);
|
e.getAudioManager().forceSkipTrack(e);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.skip.success.title",
|
"commands.music.skip.success.title",
|
||||||
"commands.music.skip.success.description").build()).queue();
|
"commands.music.skip.success.description").build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.skip.error.connected.title",
|
"commands.music.skip.error.connected.title",
|
||||||
"commands.music.skip.error.connected.description ").build()).queue();
|
"commands.music.skip.error.connected.description ").build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.info.error.title",
|
"commands.music.info.error.title",
|
||||||
"commands.music.info.error.description").build()).queue();
|
"commands.music.info.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class StopCommand implements Command {
|
public class StopCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
|
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
event.getAudioManager().players.remove(event.getGuild().getId());
|
e.getAudioManager().players.remove(e.getGuild().getId());
|
||||||
event.getAudioManager().getPlayer(event.getGuild()).destroy();
|
e.getAudioManager().getPlayer(e.getGuild()).destroy();
|
||||||
event.getAudioManager().getTrackManager(event.getGuild()).purgeQueue();
|
e.getAudioManager().getTrackManager(e.getGuild()).purgeQueue();
|
||||||
event.getGuild().getAudioManager().closeAudioConnection();
|
e.getGuild().getAudioManager().closeAudioConnection();
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.stop.success.title",
|
"commands.music.stop.success.title",
|
||||||
"commands.music.stop.success.description").build()).queue();
|
"commands.music.stop.success.description").build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.stop.error.connected.title",
|
"commands.music.stop.error.connected.title",
|
||||||
"commands.music.stop.error.connected.description")
|
"commands.music.stop.error.connected.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.info.error.title",
|
"commands.music.info.error.title",
|
||||||
"commands.music.info.error.description").build()).queue();
|
"commands.music.info.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.commands.music;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class VolumeCommand implements Command {
|
public class VolumeCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) {
|
if (e.getAudioManager().hasPlayer(e.getGuild()) && e.getAudioManager().getPlayer(e.getGuild()).getPlayingTrack() != null) {
|
||||||
if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) {
|
if (e.getMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && e.getGuild().getSelfMember().getVoiceState().getChannel().equals(e.getMember().getVoiceState().getChannel())) {
|
||||||
try {
|
try {
|
||||||
int volume = Integer.parseInt(args[0]);
|
int volume = Integer.parseInt(args[0]);
|
||||||
if (volume < 201 && volume > 0 || event.getConfig().getOwners().contains(event.getAuthor().getIdLong())) {
|
if (volume < 201 && volume > 0 || e.getConfig().getOwners().contains(e.getAuthor().getIdLong())) {
|
||||||
event.getAudioManager().getPlayer(event.getGuild()).setVolume(volume);
|
e.getAudioManager().getPlayer(e.getGuild()).setVolume(volume);
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
"commands.music.volume.success.title", "",
|
"commands.music.volume.success.title", "",
|
||||||
"commands.music.volume.success.description", String.valueOf(volume)).build()).queue();
|
"commands.music.volume.success.description", String.valueOf(volume)).build()).queue();
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.volume.error.int.title",
|
"commands.music.volume.error.int.title",
|
||||||
"commands.music.volume.error.int.description").build()).queue();
|
"commands.music.volume.error.int.description").build()).queue();
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException ex) {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.volume.error.connected.title",
|
"commands.music.volume.error.connected.title",
|
||||||
"commands.music.volume.error.connected.description")
|
"commands.music.volume.error.connected.description")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.music.info.error.title",
|
"commands.music.info.error.title",
|
||||||
"commands.music.info.error.description").build()).queue();
|
"commands.music.info.error.description").build()).queue();
|
||||||
}
|
}
|
||||||
} else event.getHelpCommand().sendHelp(this, event);
|
} else e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,39 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class AnalCommand implements Command {
|
public class AnalCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/anal/");
|
||||||
OkHttpClient caller = new OkHttpClient();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/anal/").build();
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
|
.setImage(url)
|
||||||
try {
|
|
||||||
Response response = caller.newCall(request).execute();
|
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Anal")
|
.setFooter("Anal")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class BDSMCommand implements Command {
|
public class BDSMCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/img/bdsm_lewd");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/img/bdsm_lewd").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
Response response = caller.newCall(request).execute();
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
.setImage(url)
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("BDSM")
|
.setFooter("BDSM")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class BlowjobCommand implements Command {
|
public class BlowjobCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://nekos.life/api/v2/img/blowjob");
|
||||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/blowjob").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
String url = response.body().string().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Blowjob")
|
.setFooter("Blowjob")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class BoobsCommand implements Command {
|
public class BoobsCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/tits/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/tits/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Boobs")
|
.setFooter("Boobs")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class CumCommand implements Command {
|
public class CumCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/cum/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/cum/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Cum")
|
.setFooter("Cum")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class EroticCommand implements Command {
|
public class EroticCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://nekos.life/api/v2/img/erok");
|
||||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/erok").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
String url = response.body().string().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Erotic")
|
.setFooter("Erotic")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class FeetCommand implements Command {
|
public class FeetCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/feet/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/feet/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Feet")
|
.setFooter("Feet")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class FingeringCommand implements Command {
|
public class FingeringCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/pussy_wank/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/pussy_wank/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Fingering")
|
.setFooter("Fingering")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class LickingCommand implements Command {
|
public class LickingCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/kuni/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/kuni/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Licking")
|
.setFooter("Licking")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class PornCommand implements Command {
|
public class PornCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/classic/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/classic/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Porn")
|
.setFooter("Porn")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class PussyCommand implements Command {
|
public class PussyCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://nekos.life/api/v2/img/pussy/");
|
||||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/pussy").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
String url = response.body().string().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Pussy")
|
.setFooter("Pussy")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,44 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class RandomPornCommand implements Command {
|
public class RandomPornCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/all_tags/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/all_tags/")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel()
|
||||||
|
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
Response response = caller.newCall(request).execute();
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
.setImage(url)
|
||||||
JSONObject data = json.getJSONObject("data");
|
.setFooter("Random Porn")
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
.build()).queue();
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel()
|
|
||||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
|
|
||||||
url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", "")).setFooter("Random Porn").build())
|
|
||||||
.queue();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel()
|
e.getTextChannel()
|
||||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
|
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
.queue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class SoloCommand implements Command {
|
public class SoloCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/girls_solo/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/girls_solo/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
|
||||||
JSONObject data = json.getJSONObject("data");
|
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", ""))
|
|
||||||
.setFooter("Solo")
|
.setFooter("Solo")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,42 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class SpankCommand implements Command {
|
public class SpankCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://api.nekos.dev/api/v3/images/nsfw/gif/spank/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/spank/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
.setFooter("Spank")
|
||||||
JSONObject data = json.getJSONObject("data");
|
.build()).queue();
|
||||||
JSONObject response1 = data.getJSONObject("response");
|
|
||||||
String url = response1.toString().replace("{\"url\":\"", "");
|
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
|
|
||||||
url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", "")).setFooter("Spank").build()).queue();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel()
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
|
|
||||||
.queue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,43 @@
|
||||||
package com.bbn.hadder.commands.nsfw;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.nsfw;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import okhttp3.OkHttpClient;
|
import com.bbn.hadder.utils.Http;
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class TransCommand implements Command {
|
public class TransCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (event.getTextChannel().isNSFW()) {
|
if (e.getTextChannel().isNSFW()) {
|
||||||
|
|
||||||
OkHttpClient caller = new OkHttpClient();
|
String url = Http.getNSFW("https://nekos.life/api/v2/img/trap/");
|
||||||
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/trap").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
String url = response.body().string().replace("{\"url\":\"", "");
|
.setFooter("Trans")
|
||||||
|
.build()).queue();
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
|
||||||
.setAuthor(event.getMessageEditor().getTerm("commands.nsfw.gif.error.title"),
|
|
||||||
url.replace("\"}", ""))
|
|
||||||
.setImage(url.replace("\"}", "")).setFooter("Trans").build()).queue();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getTextChannel()
|
e.getTextChannel()
|
||||||
.sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build())
|
.sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();
|
||||||
.queue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.owner;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Hax / Hax6775 / 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.
|
||||||
|
* 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.owner;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -21,15 +33,14 @@ import java.util.List;
|
||||||
public class BlacklistCommand implements Command {
|
public class BlacklistCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
} else {
|
} else {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "add":
|
case "add":
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
Member member = event.getMessage().getMentionedMembers().get(0);
|
String blacklisted = e.getRethinkUser().getBlacklisted();
|
||||||
String blacklisted = event.getRethink().getBlackListed(member.getId());
|
|
||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = new ArrayList<>();
|
||||||
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
|
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
|
||||||
commands.addAll(Arrays.asList(args[1].split(",")));
|
commands.addAll(Arrays.asList(args[1].split(",")));
|
||||||
|
|
@ -37,19 +48,19 @@ public class BlacklistCommand implements Command {
|
||||||
|
|
||||||
ArrayList<String> commandsWithoutDuplicates = new ArrayList<>(hashSet);
|
ArrayList<String> commandsWithoutDuplicates = new ArrayList<>(hashSet);
|
||||||
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
||||||
event.getRethink().setBlackListed(member.getId(), newblacklisted);
|
e.getRethinkUser().setBlacklisted(newblacklisted);
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Removed Blacklisted Commands from User")
|
.setTitle("Removed Blacklisted Commands from User")
|
||||||
.setDescription("Blacklisted commands: "+newblacklisted)
|
.setDescription("Blacklisted commands: "+newblacklisted)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
e.getRethinkUser().push();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "remove":
|
case "remove":
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
Member member = event.getMessage().getMentionedMembers().get(0);
|
String blacklisted = e.getRethinkUser().getBlacklisted();
|
||||||
String blacklisted = event.getRethink().getBlackListed(member.getId());
|
|
||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = new ArrayList<>();
|
||||||
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
|
if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(",")));
|
||||||
commands.removeAll(Arrays.asList(args[1].split(",")));
|
commands.removeAll(Arrays.asList(args[1].split(",")));
|
||||||
|
|
@ -57,34 +68,35 @@ public class BlacklistCommand implements Command {
|
||||||
|
|
||||||
ArrayList<String> commandsWithoutDuplicates = new ArrayList<>(hashSet);
|
ArrayList<String> commandsWithoutDuplicates = new ArrayList<>(hashSet);
|
||||||
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none");
|
||||||
event.getRethink().setBlackListed(member.getId(), newblacklisted);
|
e.getRethinkUser().setBlacklisted(newblacklisted);
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Removed Blacklisted Commands from User")
|
.setTitle("Removed Blacklisted Commands from User")
|
||||||
.setDescription("Blacklisted commands: "+newblacklisted)
|
.setDescription("Blacklisted commands: "+newblacklisted)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
e.getRethinkUser().push();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "list":
|
case "list":
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
for (User user : event.getJDA().getUsers()) {
|
for (User user : e.getJDA().getUsers()) {
|
||||||
if (!user.getId().equals(event.getJDA().getSelfUser().getId())) {
|
if (!user.getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||||
String blacklisted = event.getRethink().getBlackListed(user.getId());
|
String blacklisted = e.getRethinkUser().getBlacklisted();
|
||||||
if (!"none".equals(blacklisted)) {
|
if (!"none".equals(blacklisted)) {
|
||||||
stringBuilder.append(user.getAsTag()).append(" (").append(user.getId()).append(") - ").append(blacklisted).append("\n");
|
stringBuilder.append(user.getAsTag()).append(" (").append(user.getId()).append(") - ").append(blacklisted).append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.getTextChannel().sendMessage(
|
e.getTextChannel().sendMessage(
|
||||||
event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Blacklisted Users:")
|
.setTitle("Blacklisted Users:")
|
||||||
.setDescription((stringBuilder.length()!=0) ? ("``" + stringBuilder.toString() + "``") : "No blacklisted Users")
|
.setDescription((stringBuilder.length()!=0) ? ("``" + stringBuilder.toString() + "``") : "No blacklisted Users")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.owner;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.owner;
|
||||||
|
|
||||||
import com.bbn.hadder.Hadder;
|
import com.bbn.hadder.Hadder;
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
|
|
@ -22,7 +34,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
public class EvalCommand implements Command {
|
public class EvalCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
|
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
|
||||||
|
|
||||||
|
|
@ -32,18 +44,18 @@ public class EvalCommand implements Command {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.put("msg".toLowerCase(), event.getMessage());
|
engine.put("msg".toLowerCase(), e.getMessage());
|
||||||
engine.put("shardmanager".toLowerCase(), Hadder.shardManager);
|
engine.put("shardmanager".toLowerCase(), Hadder.shardManager);
|
||||||
engine.put("rethink".toLowerCase(), event.getRethink());
|
engine.put("rethink".toLowerCase(), e.getRethink());
|
||||||
engine.put("event".toLowerCase(), event);
|
engine.put("e".toLowerCase(), e);
|
||||||
engine.put("jda".toLowerCase(), event.getJDA());
|
engine.put("jda".toLowerCase(), e.getJDA());
|
||||||
engine.put("message".toLowerCase(), event.getMessage());
|
engine.put("message".toLowerCase(), e.getMessage());
|
||||||
engine.put("guild".toLowerCase(), event.getGuild());
|
engine.put("guild".toLowerCase(), e.getGuild());
|
||||||
engine.put("channel".toLowerCase(), event.getChannel());
|
engine.put("channel".toLowerCase(), e.getChannel());
|
||||||
engine.put("author".toLowerCase(), event.getAuthor());
|
engine.put("author".toLowerCase(), e.getAuthor());
|
||||||
engine.put("member".toLowerCase(), event.getMember());
|
engine.put("member".toLowerCase(), e.getMember());
|
||||||
engine.put("self".toLowerCase(), event.getGuild().getSelfMember());
|
engine.put("self".toLowerCase(), e.getGuild().getSelfMember());
|
||||||
engine.put("audio".toLowerCase(), event.getAudioManager());
|
engine.put("audio".toLowerCase(), e.getAudioManager());
|
||||||
engine.put("out".toLowerCase(), System.out);
|
engine.put("out".toLowerCase(), System.out);
|
||||||
|
|
||||||
ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
|
ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
|
||||||
|
|
@ -61,21 +73,21 @@ public class EvalCommand implements Command {
|
||||||
}
|
}
|
||||||
out = engine.eval(script.toString());
|
out = engine.eval(script.toString());
|
||||||
|
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor()
|
e.getTextChannel().sendMessage(e.getMessageEditor()
|
||||||
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
|
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
|
||||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.input"),
|
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.input"),
|
||||||
"```java\n\n" + script + "```", false)
|
"```java\n\n" + script + "```", false)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.output"),
|
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.output"),
|
||||||
"```java\n\n" + out.toString() + "```", false)
|
"```java\n\n" + out.toString() + "```", false)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
|
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
|
||||||
System.currentTimeMillis() - startExec + " milliseconds", false)
|
System.currentTimeMillis() - startExec + " milliseconds", false)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor()
|
e.getTextChannel().sendMessage(e.getMessageEditor()
|
||||||
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
|
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "")
|
||||||
.addField(event.getMessageEditor().getTerm("error"),
|
.addField(e.getMessageEditor().getTerm("error"),
|
||||||
"```java\n\n" + ex.getMessage() + "```", false)
|
"```java\n\n" + ex.getMessage() + "```", false)
|
||||||
.addField(event.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
|
.addField(e.getMessageEditor().getTerm("commands.owner.eval.success.timing"),
|
||||||
System.currentTimeMillis() - startExec + " milliseconds", false)
|
System.currentTimeMillis() - startExec + " milliseconds", false)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
|
|
@ -86,7 +98,7 @@ public class EvalCommand implements Command {
|
||||||
}, 0, TimeUnit.MILLISECONDS);
|
}, 0, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.owner;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.owner;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -15,22 +27,22 @@ import net.dv8tion.jda.api.entities.Guild;
|
||||||
public class GuildLeaveCommand implements Command {
|
public class GuildLeaveCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
Guild guild = event.getJDA().getGuildById(args[0]);
|
Guild guild = e.getJDA().getGuildById(args[0]);
|
||||||
try {
|
try {
|
||||||
guild.leave().queue();
|
guild.leave().queue();
|
||||||
event.getTextChannel()
|
e.getTextChannel()
|
||||||
.sendMessage(event.getMessageEditor()
|
.sendMessage(e.getMessageEditor()
|
||||||
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.guildleave.success.title",
|
.getMessage(MessageEditor.MessageType.INFO, "commands.owner.guildleave.success.title",
|
||||||
"", "commands.owner.guildleave.success.description", guild.getName())
|
"", "commands.owner.guildleave.success.description", guild.getName())
|
||||||
.build())
|
.build())
|
||||||
.queue();
|
.queue();
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.owner.guildleave.error.title", "", "commands.owner.guildleave.help.description", guild.getName()).build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.owner.guildleave.error.title", "", "commands.owner.guildleave.help.description", guild.getName()).build()).queue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.owner;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.owner;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -13,7 +25,7 @@ import com.bbn.hadder.core.Perms;
|
||||||
public class RebootCommand implements Command {
|
public class RebootCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
Runtime.getRuntime().exit(69);
|
Runtime.getRuntime().exit(69);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.commands.owner;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.owner;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.Perm;
|
import com.bbn.hadder.core.Perm;
|
||||||
|
|
@ -14,9 +26,9 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
public class ShutdownCommand implements Command {
|
public class ShutdownCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO).setTitle("Shutdown").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO).setTitle("Shutdown").build()).queue();
|
||||||
event.getJDA().getShardManager().shutdown();
|
e.getJDA().getShardManager().shutdown();
|
||||||
System.out.println("Bot shut down via Command...");
|
System.out.println("Bot shut down via Command...");
|
||||||
Runtime.getRuntime().exit(69);
|
Runtime.getRuntime().exit(69);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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.owner;
|
package com.bbn.hadder.commands.owner;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor.MessageType;
|
import com.bbn.hadder.utils.MessageEditor.MessageType;
|
||||||
|
|
||||||
/*
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class TestCommand implements Command {
|
public class TestCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageType.INFO, "commands.owner.test.success", "").build()).queue();
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageType.INFO, "commands.owner.test.success", "").build()).queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,74 @@
|
||||||
package com.bbn.hadder.commands.settings;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.settings;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
|
||||||
public class LanguageCommand implements Command {
|
public class LanguageCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "de":
|
case "de":
|
||||||
setLanguage("de", "German", event);
|
setLanguage("de", "German", e);
|
||||||
break;
|
break;
|
||||||
case "en":
|
case "en":
|
||||||
setLanguage("en", "English", event);
|
setLanguage("en", "English", e);
|
||||||
break;
|
break;
|
||||||
case "es":
|
case "es":
|
||||||
setLanguage("es", "Spanish", event);
|
setLanguage("es", "Spanish", e);
|
||||||
break;
|
break;
|
||||||
case "fr":
|
case "fr":
|
||||||
setLanguage("fr", "French", event);
|
setLanguage("fr", "French", e);
|
||||||
break;
|
break;
|
||||||
case "ru":
|
case "ru":
|
||||||
setLanguage("ru", "Russian", event);
|
setLanguage("ru", "Russian", e);
|
||||||
break;
|
break;
|
||||||
case "tr":
|
case "tr":
|
||||||
setLanguage("tr", "Turkish", event);
|
setLanguage("tr", "Turkish", e);
|
||||||
break;
|
break;
|
||||||
case "zh":
|
case "zh":
|
||||||
setLanguage("zh", "Chinese", event);
|
setLanguage("zh", "Chinese", e);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO,
|
||||||
|
"List",
|
||||||
|
"`de`, `en`, `es`, `fr`, `ru`, `tr`, `zh`")
|
||||||
|
.build()).queue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLanguage(String language_code, String language, CommandEvent event) {
|
public void setLanguage(String language_code, String language, CommandEvent e) {
|
||||||
event.getRethink().setLanguage(event.getAuthor().getId(), language_code);
|
e.getRethinkUser().setLanguage(language_code);
|
||||||
event.getTextChannel()
|
e.getTextChannel()
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
event.getMessageEditor()
|
e.getMessageEditor()
|
||||||
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.language.success.title",
|
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.language.success.title",
|
||||||
"", "commands.settings.language.success.description", language)
|
"", "commands.settings.language.success.description", language)
|
||||||
.build())
|
.build()).queue();
|
||||||
.queue();
|
e.getRethinkUser().push();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,39 @@
|
||||||
package com.bbn.hadder.commands.settings;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.settings;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
|
|
||||||
public class UserPrefixCommand implements Command {
|
public class UserPrefixCommand implements Command {
|
||||||
|
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
event.getRethink().setUserPrefix(args[0], event.getAuthor().getId());
|
e.getRethinkUser().setPrefix(args[0]);
|
||||||
event.getTextChannel()
|
e.getTextChannel()
|
||||||
.sendMessage(event.getMessageEditor()
|
.sendMessage(e.getMessageEditor()
|
||||||
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.prefix.success.title", "",
|
.getMessage(MessageEditor.MessageType.INFO, "commands.settings.prefix.success.title", "",
|
||||||
"commands.settings.prefix.success.description", args[0])
|
"commands.settings.prefix.success.description", args[0])
|
||||||
.build())
|
.build())
|
||||||
.queue();
|
.queue();
|
||||||
|
e.getRethinkUser().push();
|
||||||
} else {
|
} else {
|
||||||
event.getHelpCommand().sendHelp(this, event);
|
e.getHelpCommand().sendHelp(this, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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.core;
|
package com.bbn.hadder.core;
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
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.audio.AudioManager;
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
|
|
@ -24,7 +42,7 @@ public class CommandHandler {
|
||||||
this.helpCommand = helpCommand;
|
this.helpCommand = helpCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(MessageReceivedEvent event, Rethink rethink, String prefix, AudioManager audioManager) {
|
public void handle(MessageReceivedEvent event, Rethink rethink, String prefix, AudioManager audioManager, RethinkUser rethinkUser, RethinkServer rethinkServer) {
|
||||||
String invoke = event.getMessage().getContentRaw().replaceFirst(prefix, "").split(" ")[0];
|
String invoke = event.getMessage().getContentRaw().replaceFirst(prefix, "").split(" ")[0];
|
||||||
for (Command cmd : commandList) {
|
for (Command cmd : commandList) {
|
||||||
for (String label : cmd.labels()) {
|
for (String label : cmd.labels()) {
|
||||||
|
|
@ -36,7 +54,7 @@ public class CommandHandler {
|
||||||
if (args.length > 0 && args[0].equals("")) args = new String[0];
|
if (args.length > 0 && args[0].equals("")) args = new String[0];
|
||||||
|
|
||||||
CommandEvent commandEvent = new CommandEvent(event.getJDA(), event.getResponseNumber(), event.getMessage(), rethink,
|
CommandEvent commandEvent = new CommandEvent(event.getJDA(), event.getResponseNumber(), event.getMessage(), rethink,
|
||||||
config, this, helpCommand, new MessageEditor(rethink, event.getAuthor()), new EventWaiter(), audioManager);
|
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)) {
|
if (cmd.getClass().getAnnotations().length > 0 && !Arrays.asList(cmd.getClass().getAnnotations()).contains(Perms.class)) {
|
||||||
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
|
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
|
||||||
if (!perm.check(commandEvent)) {
|
if (!perm.check(commandEvent)) {
|
||||||
|
|
@ -50,7 +68,7 @@ public class CommandHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean run = true;
|
boolean run = true;
|
||||||
String blacklisted = rethink.getBlackListed(event.getAuthor().getId());
|
String blacklisted = rethinkUser.getBlacklisted();
|
||||||
if (!"none".equals(blacklisted)) {
|
if (!"none".equals(blacklisted)) {
|
||||||
for (String BLLabel : blacklisted.split(",")) {
|
for (String BLLabel : blacklisted.split(",")) {
|
||||||
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
|
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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.core;
|
package com.bbn.hadder.core;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
|
||||||
|
|
@ -1,75 +1,86 @@
|
||||||
|
/*
|
||||||
|
* 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.core;
|
package com.bbn.hadder.core;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
* @author Hax / Hax6775 / Schlauer_Hax
|
|
||||||
*/
|
|
||||||
|
|
||||||
public enum Perm {
|
public enum Perm {
|
||||||
|
|
||||||
BOT_OWNER() {
|
BOT_OWNER() {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MANAGE_MESSAGES {
|
MANAGE_MESSAGES {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.MESSAGE_MANAGE) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.MESSAGE_MANAGE) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EMBED_MESSAGES {
|
EMBED_MESSAGES {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.MESSAGE_EMBED_LINKS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.MESSAGE_EMBED_LINKS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
BAN_MEMBERS {
|
BAN_MEMBERS {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.BAN_MEMBERS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.BAN_MEMBERS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
KICK_MEMBERS {
|
KICK_MEMBERS {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.KICK_MEMBERS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.KICK_MEMBERS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MANAGE_SERVER {
|
MANAGE_SERVER {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.MANAGE_SERVER) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MANAGE_ROLES {
|
MANAGE_ROLES {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.MANAGE_ROLES) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.MANAGE_ROLES) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MANAGE_NICKNAMES {
|
MANAGE_NICKNAMES {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.NICKNAME_MANAGE) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.NICKNAME_MANAGE) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ADMINISTRATOR {
|
ADMINISTRATOR {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.ADMINISTRATOR) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.ADMINISTRATOR) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MANAGE_WEBHOOKS {
|
MANAGE_WEBHOOKS {
|
||||||
@Override
|
@Override
|
||||||
public boolean check(CommandEvent event) {
|
public boolean check(CommandEvent e) {
|
||||||
return event.getMember().hasPermission(Permission.MANAGE_WEBHOOKS) || event.getConfig().getOwners().contains(event.getAuthor().getIdLong());
|
return e.getMember().hasPermission(Permission.MANAGE_WEBHOOKS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public abstract boolean check(CommandEvent event);
|
public abstract boolean check(CommandEvent e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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.core;
|
package com.bbn.hadder.core;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
* @author Hax / Hax6775 / Schlauer_Hax
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Perms {
|
public @interface Perms {
|
||||||
Perm[] value() default {};
|
Perm[] value() default {};
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,34 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.listener;
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
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.audio.AudioManager;
|
||||||
import com.bbn.hadder.core.CommandHandler;
|
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.entities.ChannelType;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
/*
|
import java.awt.*;
|
||||||
* @author Skidder / GregTCLTK
|
import java.time.Instant;
|
||||||
*/
|
|
||||||
|
|
||||||
public class CommandListener extends ListenerAdapter {
|
public class CommandListener extends ListenerAdapter {
|
||||||
|
|
||||||
|
|
@ -24,20 +43,44 @@ public class CommandListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(MessageReceivedEvent event) {
|
public void onMessageReceived(MessageReceivedEvent e) {
|
||||||
if (event.isFromType(ChannelType.TEXT) && !event.getAuthor().isBot()) {
|
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)) {
|
||||||
|
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 = {
|
String[] prefixes = {
|
||||||
rethink.getUserPrefix(event.getAuthor().getId()), rethink.getGuildPrefix(event.getGuild().getId()),
|
rethinkUser.getPrefix(), rethinkServer.getPrefix(),
|
||||||
event.getGuild().getSelfMember().getAsMention() + " ", event.getGuild().getSelfMember().getAsMention(),
|
e.getGuild().getSelfMember().getAsMention() + " ", e.getGuild().getSelfMember().getAsMention(),
|
||||||
event.getGuild().getSelfMember().getAsMention().replace("@", "@!") + " ",
|
e.getGuild().getSelfMember().getAsMention().replace("@", "@!") + " ",
|
||||||
event.getGuild().getSelfMember().getAsMention().replace("@", "@!")
|
e.getGuild().getSelfMember().getAsMention().replace("@", "@!")
|
||||||
};
|
};
|
||||||
for (String prefix : prefixes) {
|
for (String prefix : prefixes) {
|
||||||
if (event.getMessage().getContentRaw().startsWith(prefix)) {
|
if (e.getMessage().getContentRaw().startsWith(prefix)) {
|
||||||
handler.handle(event, rethink, prefix, audioManager);
|
handler.handle(e, rethink, prefix, audioManager, rethinkUser, rethinkServer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
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://bigbotnetwork.com/images/Hadder.png")
|
||||||
|
.setTimestamp(Instant.now())
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
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://bigbotnetwork.com/images/Hadder.png")
|
||||||
|
.setTimestamp(Instant.now())
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.listener;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.Rethink;
|
||||||
import com.bbn.hadder.core.Config;
|
import com.bbn.hadder.core.Config;
|
||||||
import com.bbn.hadder.utils.BotList;
|
import com.bbn.hadder.utils.BotList;
|
||||||
|
|
@ -26,48 +38,48 @@ public class GuildListener extends ListenerAdapter {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGuildJoin(GuildJoinEvent event) {
|
public void onGuildJoin(GuildJoinEvent e) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
for (Member member : event.getGuild().getMembers()) {
|
for (Member member : e.getGuild().getMembers()) {
|
||||||
if (!member.getUser().getId().equals(event.getJDA().getSelfUser().getId())) {
|
if (!member.getUser().getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||||
rethink.insertUser(member.getUser().getId());
|
rethink.insertUser(member.getUser().getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
rethink.insertGuild(event.getGuild().getId());
|
rethink.insertGuild(e.getGuild().getId());
|
||||||
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
e.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor(null, null).getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Joined Server")
|
.setTitle("Joined Server")
|
||||||
.setThumbnail(event.getGuild().getIconUrl())
|
.setThumbnail(e.getGuild().getIconUrl())
|
||||||
.addField("Name", event.getGuild().getName(), true)
|
.addField("Name", e.getGuild().getName(), true)
|
||||||
.addField("Guild ID", event.getGuild().getId(), true)
|
.addField("Guild ID", e.getGuild().getId(), true)
|
||||||
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
.addField("Guild Owner", e.getGuild().getOwner().getUser().getAsTag(), true)
|
||||||
.addField("Users", String.valueOf(event.getGuild().getMembers().size()), true)
|
.addField("Users", String.valueOf(e.getGuild().getMembers().size()), true)
|
||||||
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
|
.setFooter(e.getJDA().getSelfUser().getName(), e.getJDA().getSelfUser().getAvatarUrl())
|
||||||
.setTimestamp(Instant.now())
|
.setTimestamp(Instant.now())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
new BotList(config).post();
|
new BotList(config).post();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGuildLeave(GuildLeaveEvent event) {
|
public void onGuildLeave(GuildLeaveEvent e) {
|
||||||
event.getJDA().getTextChannelById("475722540140986369").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")
|
.setTitle("Left Server")
|
||||||
.setThumbnail(event.getGuild().getIconUrl())
|
.setThumbnail(e.getGuild().getIconUrl())
|
||||||
.addField("Name", event.getGuild().getName(), true)
|
.addField("Name", e.getGuild().getName(), true)
|
||||||
.addField("Guild ID", event.getGuild().getId(), true)
|
.addField("Guild ID", e.getGuild().getId(), true)
|
||||||
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
.addField("Guild Owner", e.getGuild().getOwner().getUser().getAsTag(), true)
|
||||||
.addField("Users", String.valueOf(event.getGuild().getMembers().size()), true)
|
.addField("Users", String.valueOf(e.getGuild().getMembers().size()), true)
|
||||||
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
|
.setFooter(e.getJDA().getSelfUser().getName(), e.getJDA().getSelfUser().getAvatarUrl())
|
||||||
.setTimestamp(Instant.now())
|
.setTimestamp(Instant.now())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
|
|
||||||
new BotList(config).post();
|
new BotList(config).post();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGuildMemberJoin(GuildMemberJoinEvent event) {
|
public void onGuildMemberJoin(GuildMemberJoinEvent e) {
|
||||||
if (!event.getUser().getId().equals(event.getJDA().getSelfUser().getId())) {
|
if (!e.getUser().getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||||
rethink.insertUser(event.getUser().getId());
|
rethink.insertUser(e.getUser().getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
package com.bbn.hadder.listener;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.Rethink;
|
||||||
|
import com.bbn.hadder.RethinkServer;
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.entities.ChannelType;
|
import net.dv8tion.jda.api.entities.ChannelType;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
|
@ -27,12 +40,13 @@ public class InviteLinkListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
public void onMessageReceived(@Nonnull MessageReceivedEvent e) {
|
||||||
if (event.isFromType(ChannelType.TEXT)) {
|
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||||
if (event.getMessage().getContentRaw().contains("discord.gg/") && (!event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId()))) {
|
if (e.isFromType(ChannelType.TEXT)) {
|
||||||
checkInvite(event.getMessage(), "discord.gg/");
|
if (e.getMessage().getContentRaw().contains("discord.gg/") && (!e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect())) {
|
||||||
} else if (event.getMessage().getContentRaw().contains("discordapp.com/invite") && (!event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId()))) {
|
checkInvite(e.getMessage(), "discord.gg/");
|
||||||
checkInvite(event.getMessage(), "discordapp.com/invite/");
|
} else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && (!e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect())) {
|
||||||
|
checkInvite(e.getMessage(), "discordapp.com/invite/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -54,12 +68,13 @@ public class InviteLinkListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageUpdate(@Nonnull MessageUpdateEvent event) {
|
public void onMessageUpdate(@Nonnull MessageUpdateEvent e) {
|
||||||
if (event.isFromType(ChannelType.TEXT)) {
|
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||||
if (event.getMessage().getContentRaw().contains("discord.gg/") && !event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
if (e.isFromType(ChannelType.TEXT)) {
|
||||||
checkInvite(event.getMessage(), "discord.gg/");
|
if (e.getMessage().getContentRaw().contains("discord.gg/") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect()) {
|
||||||
} else if (event.getMessage().getContentRaw().contains("discordapp.com/invite") && !event.getMember().hasPermission(Permission.ADMINISTRATOR) && rethink.getInviteDetection(event.getGuild().getId())) {
|
checkInvite(e.getMessage(), "discord.gg/");
|
||||||
checkInvite(event.getMessage(), "discordapp.com/invite/");
|
} else if (e.getMessage().getContentRaw().contains("discordapp.com/invite") && !e.getMember().hasPermission(Permission.ADMINISTRATOR) && rethinkServer.isInviteDetect()) {
|
||||||
|
checkInvite(e.getMessage(), "discordapp.com/invite/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.listener;
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
import com.bbn.hadder.Rethink;
|
||||||
|
import com.bbn.hadder.RethinkServer;
|
||||||
|
import com.bbn.hadder.RethinkUser;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.entities.ChannelType;
|
import net.dv8tion.jda.api.entities.ChannelType;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|
@ -18,21 +36,25 @@ public class MentionListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
public void onMessageReceived(@Nonnull MessageReceivedEvent e) {
|
||||||
if (event.isFromType(ChannelType.TEXT) && (event.getMessage().getContentRaw().equals(event.getGuild().getSelfMember().getAsMention())||
|
if (!e.getAuthor().isBot()) {
|
||||||
event.getMessage().getContentRaw().equals(event.getGuild().getSelfMember().getAsMention().replace("@", "@!")))) {
|
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||||
event.getChannel().sendMessage(new MessageEditor(rethink, event.getAuthor()).getMessage(MessageEditor.MessageType.INFO)
|
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("@", "@!")))) {
|
||||||
|
e.getChannel().sendMessage(new MessageEditor(rethinkUser, e.getAuthor()).getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("Hello I'm Hadder.")
|
.setTitle("Hello I'm Hadder.")
|
||||||
.setAuthor(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl(), event.getJDA().getSelfUser().getAvatarUrl())
|
.setAuthor(e.getJDA().getSelfUser().getName(), e.getJDA().getSelfUser().getAvatarUrl(), e.getJDA().getSelfUser().getAvatarUrl())
|
||||||
.addField("Users", String.valueOf(event.getJDA().getUsers().size()), false)
|
.addField("Users", String.valueOf(e.getJDA().getUsers().size()), false)
|
||||||
.addField("Guilds", String.valueOf(event.getJDA().getGuilds().size()), false)
|
.addField("Guilds", String.valueOf(e.getJDA().getGuilds().size()), false)
|
||||||
.addField("Prefix (User)", rethink.getUserPrefix(event.getAuthor().getId()), false)
|
.addField("Prefix (User)", rethinkUser.getPrefix(), false)
|
||||||
.addField("Prefix (Guild)", rethink.getGuildPrefix(event.getGuild().getId()), false)
|
.addField("Prefix (Guild)", rethinkServer.getPrefix(), false)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} else if (event.getMessage().getContentRaw().equalsIgnoreCase("@someone")) {
|
} else if (e.getMessage().getContentRaw().equalsIgnoreCase("@someone")) {
|
||||||
int member = new Random().nextInt(event.getGuild().getMembers().size()-1);
|
int member = new Random().nextInt(e.getGuild().getMembers().size() - 1);
|
||||||
if (member>0&&member<event.getGuild().getMembers().size()) {
|
if (member > 0 && member < e.getGuild().getMembers().size()) {
|
||||||
event.getChannel().sendMessage(event.getGuild().getMembers().get(member).getAsMention()+ " (Executed by: "+event.getAuthor().getAsTag()+")").queue();
|
e.getChannel().sendMessage(e.getGuild().getMembers().get(member).getAsMention() + " (Executed by: " + e.getAuthor().getAsTag() + ")").queue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,31 @@
|
||||||
package com.bbn.hadder.listener;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.Rethink;
|
||||||
|
import com.bbn.hadder.RethinkUser;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
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.ChannelType;
|
||||||
import net.dv8tion.jda.api.entities.PrivateChannel;
|
import net.dv8tion.jda.api.entities.PrivateChannel;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
public class PrivateMessageListener extends ListenerAdapter {
|
public class PrivateMessageListener extends ListenerAdapter {
|
||||||
|
|
@ -21,21 +36,30 @@ public class PrivateMessageListener extends ListenerAdapter {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMessageReceived(MessageReceivedEvent event) {
|
public void onMessageReceived(MessageReceivedEvent e) {
|
||||||
if (event.isFromType(ChannelType.PRIVATE) && !event.getAuthor().getId().equals(event.getJDA().getSelfUser().getId())) {
|
if (e.isFromType(ChannelType.PRIVATE) && !e.getAuthor().getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||||
PrivateChannel Skidder = event.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
|
PrivateChannel Skidder = e.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
|
||||||
PrivateChannel Hax = event.getJDA().getUserById("261083609148948488").openPrivateChannel().complete();
|
PrivateChannel Hax = e.getJDA().getUserById("261083609148948488").openPrivateChannel().complete();
|
||||||
|
RethinkUser rethinkUser = new RethinkUser(rethink.getObjectByID("user", "261083609148948488"), rethink);
|
||||||
|
|
||||||
Skidder.sendMessage(new MessageEditor(rethink, event.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
Skidder.sendMessage(new MessageEditor(rethinkUser, e.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("New DM by " + event.getAuthor().getAsTag())
|
.setTitle("New DM by " + e.getAuthor().getAsTag())
|
||||||
.setAuthor(event.getAuthor().getName(), event.getAuthor().getAvatarUrl(), event.getAuthor().getAvatarUrl())
|
.setAuthor(e.getAuthor().getName(), e.getAuthor().getAvatarUrl(), e.getAuthor().getAvatarUrl())
|
||||||
.setDescription(event.getMessage().getContentRaw())
|
.setDescription(e.getMessage().getContentRaw())
|
||||||
.setTimestamp(Instant.now())
|
.setTimestamp(Instant.now())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
Hax.sendMessage(new MessageEditor(rethink, event.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
Hax.sendMessage(new MessageEditor(rethinkUser, e.getJDA().getUserById("261083609148948488")).getMessage(MessageEditor.MessageType.INFO)
|
||||||
.setTitle("New DM by " + event.getAuthor().getAsTag())
|
.setTitle("New DM by " + e.getAuthor().getAsTag())
|
||||||
.setAuthor(event.getAuthor().getName(), event.getAuthor().getAvatarUrl(), event.getAuthor().getAvatarUrl())
|
.setAuthor(e.getAuthor().getName(), e.getAuthor().getAvatarUrl(), e.getAuthor().getAvatarUrl())
|
||||||
.setDescription(event.getMessage().getContentRaw())
|
.setDescription(e.getMessage().getContentRaw())
|
||||||
|
.setTimestamp(Instant.now())
|
||||||
|
.build()).queue();
|
||||||
|
|
||||||
|
e.getChannel().sendMessage(new EmbedBuilder()
|
||||||
|
.setTitle("No DM support")
|
||||||
|
.setDescription("You have to execute your commands on a guild!")
|
||||||
|
.setColor(Color.RED)
|
||||||
|
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
|
||||||
.setTimestamp(Instant.now())
|
.setTimestamp(Instant.now())
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.listener;
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
import com.bbn.hadder.Rethink;
|
||||||
|
|
@ -21,15 +37,15 @@ public class ReadyListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReady(@Nonnull ReadyEvent event) {
|
public void onReady(@Nonnull ReadyEvent e) {
|
||||||
rethink.setup();
|
rethink.setup();
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
for (User user : event.getJDA().getUsers()) {
|
for (User user : e.getJDA().getUsers()) {
|
||||||
if (!user.getId().equals(event.getJDA().getSelfUser().getId())) {
|
if (!user.getId().equals(e.getJDA().getSelfUser().getId())) {
|
||||||
rethink.insertUser(user.getId());
|
rethink.insertUser(user.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Guild g : event.getJDA().getGuilds()) {
|
for (Guild g : e.getJDA().getGuilds()) {
|
||||||
rethink.insertGuild(g.getId());
|
rethink.insertGuild(g.getId());
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
package com.bbn.hadder.listener;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.Rethink;
|
||||||
|
import com.bbn.hadder.RethinkServer;
|
||||||
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||||
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
@ -18,40 +31,43 @@ public class RulesListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReactionAdd(MessageReactionAddEvent event) {
|
public void onMessageReactionAdd(MessageReactionAddEvent e) {
|
||||||
if (event.getMessageId().equals(rethink.getRulesMID(event.getGuild().getId())) && !event.getMember().getUser().isBot()) {
|
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||||
if (event.getReactionEmote().isEmote()) {
|
if (e.getMessageId().equals(rethinkServer.getMessageID()) && !e.getUser().isBot()) {
|
||||||
if (rethink.getRulesAEmote(event.getGuild().getId()).equals(event.getReactionEmote().getId())) {
|
if (e.getReactionEmote().isEmote()) {
|
||||||
addRole(event);
|
if (rethinkServer.getAcceptEmote().equals(e.getReactionEmote().getId())) {
|
||||||
} else if (rethink.getRulesDEmote(event.getGuild().getId()).equals(event.getReactionEmote().getId())) {
|
addRole(e);
|
||||||
event.getReaction().removeReaction(event.getUser()).queue();
|
} else if (rethinkServer.getDeclineEmote().equals(e.getReactionEmote().getId())) {
|
||||||
if (event.getGuild().getSelfMember().canInteract(event.getMember())) {
|
e.getReaction().removeReaction(e.getUser()).queue();
|
||||||
event.getMember().kick().reason("Declined the rules");
|
if (e.getGuild().getSelfMember().canInteract(e.getMember())) {
|
||||||
|
e.getMember().kick().reason("Declined the rules");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.getReactionEmote().isEmoji()) {
|
} else if (e.getReactionEmote().isEmoji()) {
|
||||||
if (rethink.getRulesAEmote(event.getGuild().getId()).equals(event.getReactionEmote().getEmoji())) {
|
if (rethinkServer.getAcceptEmote().equals(e.getReactionEmote().getEmoji())) {
|
||||||
addRole(event);
|
addRole(e);
|
||||||
} else if (rethink.getRulesDEmote(event.getGuild().getId()).equals(event.getReactionEmote().getEmoji())) {
|
} else if (rethinkServer.getDeclineEmote().equals(e.getReactionEmote().getEmoji())) {
|
||||||
event.getReaction().removeReaction(event.getUser()).queue();
|
e.getReaction().removeReaction(e.getUser()).queue();
|
||||||
if (event.getGuild().getSelfMember().canInteract(event.getMember())) {
|
if (e.getGuild().getSelfMember().canInteract(e.getMember())) {
|
||||||
event.getMember().kick().reason("Declined the rules");
|
e.getMember().kick().reason("Declined the rules");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRole(MessageReactionAddEvent event) {
|
private void addRole(MessageReactionAddEvent e) {
|
||||||
if (event.getMember().getRoles().contains(event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId())))) {
|
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||||
event.getGuild().removeRoleFromMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
|
if (e.getMember().getRoles().contains(e.getGuild().getRoleById(rethinkServer.getRoleID()))) {
|
||||||
} else event.getGuild().addRoleToMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Accepted rules").queue();
|
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
|
@Override
|
||||||
public void onMessageReactionRemove(MessageReactionRemoveEvent event) {
|
public void onMessageReactionRemove(MessageReactionRemoveEvent e) {
|
||||||
if (event.getMessageId().equals(rethink.getRulesMID(event.getGuild().getId())) && !event.getMember().getUser().isBot()) {
|
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||||
event.getGuild().removeRoleFromMember(event.getMember(), event.getGuild().getRoleById(rethink.getRulesRID(event.getGuild().getId()))).reason("Withdrawal of the acceptance of the rules").queue();
|
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,6 +1,23 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.listener;
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
import com.bbn.hadder.Rethink;
|
||||||
|
import com.bbn.hadder.RethinkServer;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.MessageBuilder;
|
import net.dv8tion.jda.api.MessageBuilder;
|
||||||
import net.dv8tion.jda.api.entities.MessageReaction;
|
import net.dv8tion.jda.api.entities.MessageReaction;
|
||||||
|
|
@ -20,40 +37,40 @@ public class StarboardListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent event) {
|
public void onMessageReactionAdd(@Nonnull MessageReactionAddEvent e) {
|
||||||
update(event);
|
update(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReactionRemove(@Nonnull MessageReactionRemoveEvent event) {
|
public void onMessageReactionRemove(@Nonnull MessageReactionRemoveEvent e) {
|
||||||
update(event);
|
update(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(GenericMessageReactionEvent event) {
|
public void update(GenericMessageReactionEvent e) {
|
||||||
if (event.getReaction().getReactionEmote().getName().equals("⭐")) {
|
if (e.getReaction().getReactionEmote().getName().equals("⭐")) {
|
||||||
if (!rethink.hasStarboardMessage(event.getMessageId())) {
|
RethinkServer rethinkServer = new RethinkServer(rethink.getObjectByID("server", e.getGuild().getId()), rethink);
|
||||||
if (rethink.hasStarboardChannel(event.getGuild().getId())) {
|
if (!rethink.hasStarboardMessage(e.getMessageId())) {
|
||||||
|
if (rethink.hasStarboardChannel(e.getGuild().getId())) {
|
||||||
event.getTextChannel().retrieveMessageById(event.getMessageId()).queue(
|
e.getTextChannel().retrieveMessageById(e.getMessageId()).queue(
|
||||||
msg -> {
|
msg -> {
|
||||||
Integer stars = 0;
|
int stars = 0;
|
||||||
for (MessageReaction reaction : msg.getReactions()) {
|
for (MessageReaction reaction : msg.getReactions()) {
|
||||||
if (reaction.getReactionEmote().getName().equals("⭐")) {
|
if (reaction.getReactionEmote().getName().equals("⭐")) {
|
||||||
stars = reaction.getCount();
|
stars = reaction.getCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Integer.parseInt(rethink.getNeededStars(event.getGuild().getId())) <= stars) {
|
if (Integer.parseInt(rethinkServer.getNeededStars()) <= stars) {
|
||||||
event.getGuild().getTextChannelById(rethink.getStarboardChannel(event.getGuild().getId()))
|
e.getGuild().getTextChannelById(rethinkServer.getStarboard())
|
||||||
.sendMessage(new MessageBuilder()
|
.sendMessage(new MessageBuilder()
|
||||||
.setContent("⭐ 1" + " " + event.getTextChannel().getAsMention())
|
.setContent("⭐ 1" + " " + e.getTextChannel().getAsMention())
|
||||||
.setEmbed(
|
.setEmbed(
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(msg.getAuthor().getAsTag())
|
.setAuthor(msg.getAuthor().getAsTag())
|
||||||
.setDescription(msg.getContentRaw())
|
.setDescription(msg.getContentRaw())
|
||||||
.setTimestamp(msg.getTimeCreated()).build()).build()).queue(
|
.setTimestamp(msg.getTimeCreated()).build()).build()).queue(
|
||||||
starboardmsg -> {
|
starboardmsg -> {
|
||||||
rethink.insertStarboardMessage(msg.getId(), event.getGuild().getId(), starboardmsg.getId());
|
rethink.insertStarboardMessage(msg.getId(), e.getGuild().getId(), starboardmsg.getId());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -63,23 +80,23 @@ public class StarboardListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
event.getTextChannel().retrieveMessageById(event.getMessageId()).queue(
|
e.getTextChannel().retrieveMessageById(e.getMessageId()).queue(
|
||||||
msg -> {
|
msg -> {
|
||||||
Integer stars = 0;
|
int stars = 0;
|
||||||
for (MessageReaction reaction : msg.getReactions()) {
|
for (MessageReaction reaction : msg.getReactions()) {
|
||||||
if (reaction.getReactionEmote().getName().equals("⭐")) {
|
if (reaction.getReactionEmote().getName().equals("⭐")) {
|
||||||
stars = reaction.getCount();
|
stars = reaction.getCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer finalStars = stars;
|
int finalStars = stars;
|
||||||
event.getGuild().getTextChannelById(rethink.getStarboardChannel(event.getGuild().getId()))
|
e.getGuild().getTextChannelById(rethinkServer.getStarboard())
|
||||||
.retrieveMessageById(rethink.getStarboardMessage(event.getMessageId())).queue(
|
.retrieveMessageById(rethink.getStarboardMessage(e.getMessageId())).queue(
|
||||||
msg2 -> {
|
msg2 -> {
|
||||||
|
|
||||||
if (Integer.parseInt(rethink.getNeededStars(event.getGuild().getId())) <= finalStars) {
|
if (Integer.parseInt(rethinkServer.getNeededStars()) <= finalStars) {
|
||||||
msg2.editMessage(new MessageBuilder()
|
msg2.editMessage(new MessageBuilder()
|
||||||
.setContent("⭐ " + finalStars + " " + event.getTextChannel().getAsMention())
|
.setContent("⭐ " + finalStars + " " + e.getTextChannel().getAsMention())
|
||||||
.setEmbed(
|
.setEmbed(
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor(msg.getAuthor().getAsTag())
|
.setAuthor(msg.getAuthor().getAsTag())
|
||||||
|
|
@ -91,10 +108,8 @@ public class StarboardListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,25 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.listener;
|
||||||
|
|
||||||
import com.bbn.hadder.audio.AudioManager;
|
import com.bbn.hadder.audio.AudioManager;
|
||||||
import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent;
|
import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class VoiceLeaveListener extends ListenerAdapter {
|
public class VoiceLeaveListener extends ListenerAdapter {
|
||||||
|
|
||||||
private AudioManager audioManager;
|
private AudioManager audioManager;
|
||||||
|
|
@ -17,12 +29,12 @@ public class VoiceLeaveListener extends ListenerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) {
|
public void onGuildVoiceLeave(GuildVoiceLeaveEvent e) {
|
||||||
if (audioManager.hasPlayer(event.getGuild()) && event.getChannelLeft().getMembers().equals(event.getGuild().getSelfMember())) {
|
if (audioManager.hasPlayer(e.getGuild()) && e.getChannelLeft().getMembers().equals(e.getGuild().getSelfMember())) {
|
||||||
audioManager.players.remove(event.getGuild().getId());
|
audioManager.players.remove(e.getGuild().getId());
|
||||||
audioManager.getPlayer(event.getGuild()).destroy();
|
audioManager.getPlayer(e.getGuild()).destroy();
|
||||||
audioManager.getTrackManager(event.getGuild()).purgeQueue();
|
audioManager.getTrackManager(e.getGuild()).purgeQueue();
|
||||||
event.getGuild().getAudioManager().closeAudioConnection();
|
e.getGuild().getAudioManager().closeAudioConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
package com.bbn.hadder.utils;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* 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.Hadder;
|
||||||
import com.bbn.hadder.core.Config;
|
import com.bbn.hadder.core.Config;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.utils;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
|
|
|
||||||
47
src/main/java/com/bbn/hadder/utils/Http.java
Normal file
47
src/main/java/com/bbn/hadder/utils/Http.java
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* 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 okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Http {
|
||||||
|
|
||||||
|
public static String getNSFW(String url) {
|
||||||
|
|
||||||
|
OkHttpClient caller = new OkHttpClient();
|
||||||
|
okhttp3.Request request = new okhttp3.Request.Builder().url(url).build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Response response = caller.newCall(request).execute();
|
||||||
|
JSONObject json = new JSONObject(response.body().string());
|
||||||
|
try {
|
||||||
|
JSONObject data = json.getJSONObject("data");
|
||||||
|
JSONObject response1 = data.getJSONObject("response");
|
||||||
|
return response1.getString("url");
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
return json.getString("url");
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,22 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package com.bbn.hadder.utils;
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
import com.bbn.hadder.RethinkUser;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
|
|
||||||
|
|
@ -11,11 +27,11 @@ import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class MessageEditor {
|
public class MessageEditor {
|
||||||
|
|
||||||
private Rethink rethink;
|
private RethinkUser rethinkUser;
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
public MessageEditor(Rethink rethink, User user) {
|
public MessageEditor(RethinkUser rethinkUser, User user) {
|
||||||
this.rethink = rethink;
|
this.rethinkUser = rethinkUser;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,7 +50,7 @@ public class MessageEditor {
|
||||||
|
|
||||||
public EmbedBuilder getMessage(MessageType type, String title, String title_extra, String title_extra_two,
|
public EmbedBuilder getMessage(MessageType type, String title, String title_extra, String title_extra_two,
|
||||||
String description, String description_extra, String description_extra_two) {
|
String description, String description_extra, String description_extra_two) {
|
||||||
String language = (this.user!=null) ? rethink.getLanguage(this.user.getId()) : null;
|
String language = (this.user!=null) ? rethinkUser.getLanguage() : null;
|
||||||
EmbedBuilder eb = this.getDefaultSettings(type);
|
EmbedBuilder eb = this.getDefaultSettings(type);
|
||||||
if (!"".equals(title)) eb.setTitle(this.handle(language, title, title_extra, title_extra_two));
|
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));
|
||||||
|
|
@ -105,11 +121,11 @@ public class MessageEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTerm(String string) {
|
public String getTerm(String string) {
|
||||||
return this.handle(rethink.getLanguage(user.getId()), string, "", "");
|
return this.handle(rethinkUser.getLanguage(), string, "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTerm(String string, String extra, String extra_two) {
|
public String getTerm(String string, String extra, String extra_two) {
|
||||||
return this.handle(rethink.getLanguage(user.getId()), 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) {
|
private String handle(String language_code, String string, String extra, String extra_two) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
#
|
#
|
||||||
# @author Skidder / GregTCLTK
|
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
#
|
#
|
||||||
# @author Skidder / GregTCLTK
|
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
@ -9,6 +21,8 @@ none = None
|
||||||
success\! = Success\!
|
success\! = Success\!
|
||||||
|
|
||||||
commands.fun.avatar.success.title = Avatar of %extra%
|
commands.fun.avatar.success.title = Avatar of %extra%
|
||||||
|
commands.fun.avatar.error.title = User not found
|
||||||
|
commands.fun.avatar.error.description = I can not find a user with this id!
|
||||||
commands.fun.avatar.help.description = Sends the avatar of the specified member.
|
commands.fun.avatar.help.description = Sends the avatar of the specified member.
|
||||||
commands.fun.gif.error.description = Please try again with another term.
|
commands.fun.gif.error.description = Please try again with another term.
|
||||||
commands.fun.gif.help.description = Looks for a GIF on Giphy.
|
commands.fun.gif.help.description = Looks for a GIF on Giphy.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
#
|
#
|
||||||
# @author Skidder / GregTCLTK
|
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
#
|
#
|
||||||
# @author Skidder / GregTCLTK
|
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
#
|
#
|
||||||
# @author Skidder / GregTCLTK
|
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
#
|
#
|
||||||
# @author Skidder / GregTCLTK
|
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
#
|
#
|
||||||
# @author Skidder / GregTCLTK
|
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
Hadder = Hadder
|
Hadder = Hadder
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue