summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/artifacts/Selfbot_jar.xml29
-rw-r--r--.idea/compiler.xml11
-rw-r--r--.idea/kotlinc.xml7
-rw-r--r--.idea/libraries/JDA_3_1_0_204_javadoc.xml13
-rw-r--r--.idea/libraries/Maven__com_mashape_unirest_unirest_java_1_4_9.xml13
-rw-r--r--.idea/libraries/Maven__com_neovisionaries_nv_websocket_client_2_0.xml13
-rw-r--r--.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml13
-rw-r--r--.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml13
-rw-r--r--.idea/libraries/Maven__net_dv8tion_JDA_3_1_1_212.xml13
-rw-r--r--.idea/libraries/Maven__net_java_dev_jna_jna_4_4_0.xml13
-rw-r--r--.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml13
-rw-r--r--.idea/libraries/Maven__org_apache_commons_commons_collections4_4_1.xml13
-rw-r--r--.idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml13
-rw-r--r--.idea/libraries/Maven__org_apache_httpcomponents_httpasyncclient_4_1_1.xml13
-rw-r--r--.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_2.xml13
-rw-r--r--.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_4.xml13
-rw-r--r--.idea/libraries/Maven__org_apache_httpcomponents_httpcore_nio_4_4_4.xml13
-rw-r--r--.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_2.xml13
-rw-r--r--.idea/libraries/Maven__org_json_json_20160810.xml13
-rw-r--r--.idea/misc.xml23
-rw-r--r--.idea/modules.xml4
-rw-r--r--Selfbot.iml42
-rw-r--r--build.gradle23
-rw-r--r--gradlew172
-rw-r--r--gradlew.bat84
-rw-r--r--pom.xml53
-rw-r--r--settings.gradle1
-rw-r--r--src/main/java/de/romjaki/selfbot/Main.java18
-rw-r--r--src/main/java/de/romjaki/selfbot/MessageListener.java62
-rw-r--r--src/main/java/de/romjaki/selfbot/Util.java5
30 files changed, 363 insertions, 379 deletions
diff --git a/.idea/artifacts/Selfbot_jar.xml b/.idea/artifacts/Selfbot_jar.xml
deleted file mode 100644
index c007e76..0000000
--- a/.idea/artifacts/Selfbot_jar.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<component name="ArtifactManager">
- <artifact type="jar" name="Selfbot:jar">
- <output-path>$PROJECT_DIR$/out/artifacts/Selfbot_jar</output-path>
- <root id="archive" name="Selfbot.jar">
- <element id="directory" name="META-INF">
- <element id="file-copy" path="$PROJECT_DIR$/src/main/META-INF/MANIFEST.MF" />
- </element>
- <element id="module-output" name="Selfbot" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore-nio/4.4.4/httpcore-nio-4.4.4.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$APPLICATION_HOME_DIR$/redist/annotations-java8.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$PROJECT_DIR$/../JDA-3.1.0_204-withDependencies.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/mashape/unirest/unirest-java/1.4.9/unirest-java-1.4.9.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/dv8tion/JDA-Client/0.2.0_9/JDA-Client-0.2.0_9.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/neovisionaries/nv-websocket-client/2.0/nv-websocket-client-2.0.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/dv8tion/JDA/3.1.1_212/JDA-3.1.1_212.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/json/json/20160810/json-20160810.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpasyncclient/4.1.1/httpasyncclient-4.1.1.jar" path-in-jar="/" />
- <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9.jar" path-in-jar="/" />
- </root>
- </artifact>
-</component> \ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 8e66cc3..856af7e 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,16 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
- <annotationProcessing>
- <profile name="Maven default annotation processors profile" enabled="true">
- <sourceOutputDir name="target/generated-sources/annotations" />
- <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
- <outputRelativeToContentRoot value="true" />
- <module name="Selfbot" />
- </profile>
- </annotationProcessing>
<bytecodeTargetLevel>
- <module name="Selfbot" target="1.8" />
+ <module name="Selfbot_main" target="1.8" />
+ <module name="Selfbot_test" target="1.8" />
</bytecodeTargetLevel>
</component>
</project> \ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
deleted file mode 100644
index 1c24f9a..0000000
--- a/.idea/kotlinc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="KotlinCommonCompilerArguments">
- <option name="languageVersion" value="1.1" />
- <option name="apiVersion" value="1.1" />
- </component>
-</project> \ No newline at end of file
diff --git a/.idea/libraries/JDA_3_1_0_204_javadoc.xml b/.idea/libraries/JDA_3_1_0_204_javadoc.xml
deleted file mode 100644
index 2b515a5..0000000
--- a/.idea/libraries/JDA_3_1_0_204_javadoc.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="JDA-3.1.0_204-javadoc">
- <CLASSES>
- <root url="jar://$PROJECT_DIR$/../JDA-3.1.0_204-withDependencies.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$PROJECT_DIR$/../JDA-3.1.0_204-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$PROJECT_DIR$/../JDA-3.1.0_204-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__com_mashape_unirest_unirest_java_1_4_9.xml b/.idea/libraries/Maven__com_mashape_unirest_unirest_java_1_4_9.xml
deleted file mode 100644
index d7792cc..0000000
--- a/.idea/libraries/Maven__com_mashape_unirest_unirest_java_1_4_9.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: com.mashape.unirest:unirest-java:1.4.9">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/com/mashape/unirest/unirest-java/1.4.9/unirest-java-1.4.9.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/com/mashape/unirest/unirest-java/1.4.9/unirest-java-1.4.9-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/com/mashape/unirest/unirest-java/1.4.9/unirest-java-1.4.9-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__com_neovisionaries_nv_websocket_client_2_0.xml b/.idea/libraries/Maven__com_neovisionaries_nv_websocket_client_2_0.xml
deleted file mode 100644
index 40e5e15..0000000
--- a/.idea/libraries/Maven__com_neovisionaries_nv_websocket_client_2_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: com.neovisionaries:nv-websocket-client:2.0">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/com/neovisionaries/nv-websocket-client/2.0/nv-websocket-client-2.0.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/com/neovisionaries/nv-websocket-client/2.0/nv-websocket-client-2.0-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/com/neovisionaries/nv-websocket-client/2.0/nv-websocket-client-2.0-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml b/.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml
deleted file mode 100644
index a66d039..0000000
--- a/.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: commons-codec:commons-codec:1.9">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml b/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml
deleted file mode 100644
index eab40b3..0000000
--- a/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: commons-logging:commons-logging:1.2">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__net_dv8tion_JDA_3_1_1_212.xml b/.idea/libraries/Maven__net_dv8tion_JDA_3_1_1_212.xml
deleted file mode 100644
index c33b566..0000000
--- a/.idea/libraries/Maven__net_dv8tion_JDA_3_1_1_212.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: net.dv8tion:JDA:3.1.1_212">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/net/dv8tion/JDA/3.1.1_212/JDA-3.1.1_212.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/net/dv8tion/JDA/3.1.1_212/JDA-3.1.1_212-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/net/dv8tion/JDA/3.1.1_212/JDA-3.1.1_212-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__net_java_dev_jna_jna_4_4_0.xml b/.idea/libraries/Maven__net_java_dev_jna_jna_4_4_0.xml
deleted file mode 100644
index 497fb5f..0000000
--- a/.idea/libraries/Maven__net_java_dev_jna_jna_4_4_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: net.java.dev.jna:jna:4.4.0">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna/4.4.0/jna-4.4.0-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna/4.4.0/jna-4.4.0-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml b/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml
deleted file mode 100644
index 72d4d7e..0000000
--- a/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: net.sf.trove4j:trove4j:3.0.3">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_1.xml b/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_1.xml
deleted file mode 100644
index 1e0b53d..0000000
--- a/.idea/libraries/Maven__org_apache_commons_commons_collections4_4_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.apache.commons:commons-collections4:4.1">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml
deleted file mode 100644
index 666266c..0000000
--- a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.apache.commons:commons-lang3:3.5">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpasyncclient_4_1_1.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpasyncclient_4_1_1.xml
deleted file mode 100644
index 8484ecb..0000000
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpasyncclient_4_1_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.1">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpasyncclient/4.1.1/httpasyncclient-4.1.1.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpasyncclient/4.1.1/httpasyncclient-4.1.1-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpasyncclient/4.1.1/httpasyncclient-4.1.1-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_2.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_2.xml
deleted file mode 100644
index fdb7ead..0000000
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.apache.httpcomponents:httpclient:4.5.2">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_4.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_4.xml
deleted file mode 100644
index 3a5aa19..0000000
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_4.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.apache.httpcomponents:httpcore:4.4.4">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_nio_4_4_4.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_nio_4_4_4.xml
deleted file mode 100644
index 1dab39e..0000000
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_nio_4_4_4.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.4">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore-nio/4.4.4/httpcore-nio-4.4.4.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore-nio/4.4.4/httpcore-nio-4.4.4-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore-nio/4.4.4/httpcore-nio-4.4.4-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_2.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_2.xml
deleted file mode 100644
index 4b2025a..0000000
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.apache.httpcomponents:httpmime:4.5.2">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_json_json_20160810.xml b/.idea/libraries/Maven__org_json_json_20160810.xml
deleted file mode 100644
index 774f062..0000000
--- a/.idea/libraries/Maven__org_json_json_20160810.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.json:json:20160810">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/json/json/20160810/json-20160810.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/json/json/20160810/json-20160810-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/json/json/20160810/json-20160810-sources.jar!/" />
- </SOURCES>
- </library>
-</component> \ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5755a99..2e47c90 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,13 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="MavenProjectsManager">
- <option name="originalFiles">
- <list>
- <option value="$PROJECT_DIR$/pom.xml" />
- </list>
- </option>
- </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
+ <component name="masterDetails">
+ <states>
+ <state key="ProjectJDKs.UI">
+ <settings>
+ <last-edited>1.8</last-edited>
+ <splitter-proportions>
+ <option name="proportions">
+ <list>
+ <option value="0.2" />
+ </list>
+ </option>
+ </splitter-proportions>
+ </settings>
+ </state>
+ </states>
+ </component>
</project> \ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 3decb3b..a184b1d 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,9 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
- <module fileurl="file://$PROJECT_DIR$/Selfbot.iml" filepath="$PROJECT_DIR$/Selfbot.iml" />
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/Selfbot.iml" filepath="$PROJECT_DIR$/.idea/modules/Selfbot.iml" />
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/Selfbot_main.iml" filepath="$PROJECT_DIR$/.idea/modules/Selfbot_main.iml" group="Selfbot" />
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/Selfbot_test.iml" filepath="$PROJECT_DIR$/.idea/modules/Selfbot_test.iml" group="Selfbot" />
</modules>
</component>
</project> \ No newline at end of file
diff --git a/Selfbot.iml b/Selfbot.iml
deleted file mode 100644
index 25688f6..0000000
--- a/Selfbot.iml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
- <excludeFolder url="file://$MODULE_DIR$/target" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$APPLICATION_HOME_DIR$/redist/annotations-java8.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="library" name="JDA-3.1.0_204-javadoc" level="project" />
- <orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.4" level="project" />
- <orderEntry type="library" name="Maven: net.dv8tion:JDA:3.1.1_212" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.json:json:20160810" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.dev.jna:jna:4.4.0" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: com.neovisionaries:nv-websocket-client:2.0" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: com.mashape.unirest:unirest-java:1.4.9" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: commons-logging:commons-logging:1.2" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: commons-codec:commons-codec:1.9" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.1" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
- <orderEntry type="library" name="Maven: net.dv8tion:JDA-Client:0.2.0_9" level="project" />
- </component>
-</module> \ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..d6fccbf
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,23 @@
+apply plugin: 'application'
+
+mainClassName = "de.romjaki.selfbot.Main"
+
+group = 'discordjda'
+version = '1.0-SNAPSHOT'
+
+description = """"""
+
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
+run {
+ systemProperty "config.file", project.getProperty("config.file")
+}
+
+repositories {
+ jcenter()
+}
+dependencies {
+ compile group: 'org.apache.commons', name: 'commons-math3', version:'3.4'
+ compile group: 'net.dv8tion', name: 'JDA', version:'3.3.0_272'
+}
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index e5b048f..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>discordjda</groupId>
- <artifactId>Selfbot</artifactId>
- <version>1.0-SNAPSHOT</version>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-math3</artifactId>
- <version>3.4</version>
- </dependency>
- <dependency>
- <groupId>net.dv8tion</groupId>
- <artifactId>JDA</artifactId>
- <version>${jda.version}</version>
- </dependency>
- <dependency>
- <groupId>net.dv8tion</groupId>
- <artifactId>JDA-Client</artifactId>
- <version>0.2.0_9</version>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <id>jcenter</id>
- <name>jcenter-bintray</name>
- <url>http://jcenter.bintray.com</url>
- </repository>
- </repositories>
-
- <properties>
- <jda.version>3.1.1_212</jda.version>
- </properties>
-
-</project> \ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..6ceaf79
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'Selfbot'
diff --git a/src/main/java/de/romjaki/selfbot/Main.java b/src/main/java/de/romjaki/selfbot/Main.java
index 5225df4..093f0b3 100644
--- a/src/main/java/de/romjaki/selfbot/Main.java
+++ b/src/main/java/de/romjaki/selfbot/Main.java
@@ -1,10 +1,7 @@
package de.romjaki.selfbot;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
-import net.dv8tion.jda.client.JDAClientBuilder;
-import net.dv8tion.jda.core.AccountType;
-import net.dv8tion.jda.core.JDA;
-import net.dv8tion.jda.core.JDABuilder;
+import net.dv8tion.jda.core.*;
import net.dv8tion.jda.core.exceptions.RateLimitedException;
import net.dv8tion.jda.core.utils.SimpleLog;
@@ -26,21 +23,18 @@ public class Main {
}
public static void main(String[] args) {
- Config c = Config.getConfig(String.join(" ", args));
+ System.out.println(JDAInfo.VERSION);
+ System.out.println(System.getProperty("config.file"));
+ Config c = Config.getConfig(System.getProperty("config.file"));
System.out.println(c.TOKEN);
jda = null;
try {
if (c.AUTH_METHOD.equalsIgnoreCase("TOKEN")) {
jda = new JDABuilder(AccountType.CLIENT)
.setToken(c.TOKEN)
+ .setStatus(OnlineStatus.INVISIBLE)
.addEventListener(new MessageListener(c))
.buildBlocking();
- } else {
- jda = new JDAClientBuilder()
- .setEmail(c.MAIL)
- .setPassword(c.PASSWORD)
- .addListener(new MessageListener(c))
- .buildBlocking().getJDA();
}
} catch (LoginException | RateLimitedException | InterruptedException e) {
SimpleLog.getLog("startup").fatal(String.format("Failed to connect: %s", e));
@@ -71,7 +65,7 @@ public class Main {
se.eval("var imports = new JavaImporter(" +
"java.nio.file," +
"java.lang," +
- "java.util.stream,"+
+ "java.util.stream," +
"java.lang.management," +
"java.text," +
"java.sql," +
diff --git a/src/main/java/de/romjaki/selfbot/MessageListener.java b/src/main/java/de/romjaki/selfbot/MessageListener.java
index 94465ae..2631f07 100644
--- a/src/main/java/de/romjaki/selfbot/MessageListener.java
+++ b/src/main/java/de/romjaki/selfbot/MessageListener.java
@@ -1,10 +1,7 @@
package de.romjaki.selfbot;
import net.dv8tion.jda.core.EmbedBuilder;
-import net.dv8tion.jda.core.entities.Game;
-import net.dv8tion.jda.core.entities.Message;
-import net.dv8tion.jda.core.entities.MessageEmbed;
-import net.dv8tion.jda.core.entities.MessageHistory;
+import net.dv8tion.jda.core.entities.*;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import net.dv8tion.jda.core.events.message.guild.react.GenericGuildMessageReactionEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;
@@ -19,7 +16,6 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.regex.Pattern;
import static de.romjaki.selfbot.Main.jda;
import static java.util.concurrent.TimeUnit.SECONDS;
@@ -29,8 +25,9 @@ import static java.util.concurrent.TimeUnit.SECONDS;
*/
public class MessageListener extends ListenerAdapter {
private static final Rot rotter = new Rot();
+ private static final String AFK_IMAGE = "http://unisci24.com/data_images/wlls/2/174841-afk.jpg";
+ static boolean AFK = false;
static AtomicInteger name = new AtomicInteger(0);
- static Pattern regionalPattern = Pattern.compile("regional_indicator_(?<char>[a-z])", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
private static String SANDUHRDINGS = " -`\n" +
" .o+`\n" +
" `ooo/\n" +
@@ -123,8 +120,27 @@ public class MessageListener extends ListenerAdapter {
@Override
public void onMessageReceived(MessageReceivedEvent event) {
if (!event.getAuthor().equals(event.getJDA().getSelfUser())) {
+ if (AFK && event.getMessage().getMentionedUsers().contains(jda.getSelfUser())) {
+ event.getChannel().sendMessage(new EmbedBuilder()
+ .setColor(Color.green)
+ .setImage(AFK_IMAGE)
+ .setTitle("AFK")
+ .setDescription(jda.getSelfUser().getAsMention() + " is AFK.")
+ .setFooter("This afk-disclaimer was triggered because you mentioned " + jda.getSelfUser().getAsMention(), jda.getSelfUser().getEffectiveAvatarUrl())
+ .build()).queue(message -> message.delete().queueAfter(20, SECONDS));
+ }
return;
}
+ List<MessageEmbed> embeds = event.getMessage().getEmbeds();
+ boolean containsAfk = false;
+ for (MessageEmbed embed : embeds) {
+ if (embed.getTitle().toLowerCase().contains("afk")) {
+ containsAfk = true;
+ }
+ }
+ if (!containsAfk && AFK) {
+ AFK = false;
+ }
Message message = event.getMessage();
String raw = message.getRawContent();
Message mes = null;
@@ -174,6 +190,14 @@ public class MessageListener extends ListenerAdapter {
t.start();
mes = null;
}
+ if (raw.matches("(?is)^::moveto\\s.*")) {
+ mes = moveTo(event);
+ }
+ if (raw.matches("(?is)^::afk.*")) {
+ AFK = true;
+ event.getMessage().delete().queue();
+ mes = null;
+ }
if (raw.matches("(?is)^::hangman\\s.*")) {
mes = hangman(event);
}
@@ -183,6 +207,32 @@ public class MessageListener extends ListenerAdapter {
}
+ private Message moveTo(MessageReceivedEvent event) {
+ Message m = event.getMessage();
+ String[] parts = m.getRawContent().split("\\s+", 3);
+ if (parts.length < 2) {
+ m.editMessage(new EmbedBuilder()
+ .setTitle("MOVE FAILED")
+ .setDescription("Missing category")
+ .build()).queue();
+ return m;
+ }
+ String cat = parts[1].replaceAll("#|>|<", "");
+ String reason = "Moved.";
+ if (parts.length == 3) {
+ reason = parts[2];
+ }
+ TextChannel toMove = event.getTextChannel();
+ Category moveTo = event.getGuild().getCategoryById(cat);
+ toMove.getManager().setParent(moveTo).reason(reason).queue();
+ m.editMessage(new EmbedBuilder()
+ .setTitle("MOVE SUCCEEDED")
+ .setDescription("Moved " + toMove.getAsMention() + " to <#" + moveTo.getId() + ">")
+ .setColor(Color.green)
+ .build()).queue();
+ return m;
+ }
+
private Message hangman(MessageReceivedEvent event) {
SimpleLog.getLog("info").info("in hangman");
String word = event.getMessage().getContent().replaceAll("(?is)^[>:]:hangman\\s+", "");
diff --git a/src/main/java/de/romjaki/selfbot/Util.java b/src/main/java/de/romjaki/selfbot/Util.java
index 892ca15..a41c5cd 100644
--- a/src/main/java/de/romjaki/selfbot/Util.java
+++ b/src/main/java/de/romjaki/selfbot/Util.java
@@ -1,29 +1,24 @@
package de.romjaki.selfbot;
import net.dv8tion.jda.core.entities.TextChannel;
-import org.jetbrains.annotations.Contract;
/**
* Created by RGR on 19.05.2017.
*/
public class Util {
- @Contract(value = " -> fail", pure = true)
private Util() {
Util.singleton(Util.class);
}
- @Contract(pure = true, value = "_ -> fail")
public static void singleton(Class<?> clazz) {
throw new Error("No " + clazz.toGenericString() + " instances for you!");
}
- @Contract(pure = true, value = "null -> fail")
public static boolean isBotChannel(TextChannel channel) {
return channel.getName().toLowerCase().contains("bot");
}
- @Contract(pure = true, value = "null -> fail ; !null -> !null")
public static String escape(String join) {
return join.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n").replace("\t", "\\t");
}