Added/Changed many things, need to switch from thunderbolt to irg.json, need sql cleanup
This commit is contained in:
parent
e5c86f1a7f
commit
25cd9f2b4c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.mashape.unirest/unirest-java/1.4.9/778cffcba803dc7d43932266aef4c91f5b6b4dd0/unirest-java-1.4.9.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.mashape.unirest/unirest-java/1.4.9/fc3504b646ef187849da8caa2e4e9c1b962b5caf/unirest-java-1.4.9-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,11 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Gradle: com.sedmelluq:lavaplayer:1.2.39">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.sedmelluq/lavaplayer/1.2.39/3ef943a8b689324c9ba7c341d97d217abb1b8c62/lavaplayer-1.2.39.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.sedmelluq/lavaplayer/1.2.39/8e8a26d38f2b50b251231f0d2483cf41a5b2f88/lavaplayer-1.2.39-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: commons-codec:commons-codec:1.9">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.9/9ce04e34240f674bc72680f8b843b1457383161a/commons-codec-1.9.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.9/3f15fff45d57656685abfee9e8302bf14580044c/commons-codec-1.9-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: commons-logging:commons-logging:1.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.2/4bfc12adfe4842bf07b657f0369c4cb522955686/commons-logging-1.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.2/ecf26c7507d67782a3bbd148d170b31dfad001aa/commons-logging-1.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: mysql:mysql-connector-java:5.1.38">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/mysql/mysql-connector-java/5.1.38/dbbd7cd309ce167ec8367de4e41c63c2c8593cc5/mysql-connector-java-5.1.38.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/mysql/mysql-connector-java/5.1.38/b83cac8c938dfb9b7a8e191e2d482be88eb8280c/mysql-connector-java-5.1.38-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-collections4/4.1/a4cf4688fe1c7e3a63aa636cc96d013af537768e/commons-collections4-4.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-collections4/4.1/f305f3aa45a3b208c013ef92328f8f230329f20e/commons-collections4-4.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.5/6c6c702c89bfff3cd9e80b04d668c5e190d588c6/commons-lang3-3.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.5/f7d878153e86a1cdddf6b37850e00a9f8bff726f/commons-lang3-3.5-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpasyncclient/4.1.1/dd624f5a0ff43eb5cdf828d9739d3177ee00a5a9/httpasyncclient-4.1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpasyncclient/4.1.1/548f9cae59a0d01571ac39f714f19682cb68c481/httpasyncclient-4.1.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.5.2/733db77aa8d9b2d68015189df76ab06304406e50/httpclient-4.5.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.5.2/b9f9e3e5255b6ddc3bf21be05428c7a60d00e042/httpclient-4.5.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.4.4/b31526a230871fbe285fbcbe2813f9c0839ae9b0/httpcore-4.4.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.4.4/c5c19e3e6af6b452def290cde12a3ee4c35c893c/httpcore-4.4.4-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore-nio/4.4.4/16badfc2d99db264c486ba8c57ae577301a58bd9/httpcore-nio-4.4.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore-nio/4.4.4/816d16779b3058b1454908757fbc9ec8d233d7ba/httpcore-nio-4.4.4-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: 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!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.5.2/22b4c53dd9b6761024258de8f9240c3dce6ea368/httpmime-4.5.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.5.2/ca23fd61a082eab682fc0ffd29e37d09eab07180/httpmime-4.5.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,8 +2,11 @@
|
||||
<library name="Gradle: org.json:json:20160810">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20160810/json-20160810.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.json/json/20160810/aca5eb39e2a12fddd6c472b240afe9ebea3a6733/json-20160810.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.json/json/20160810/92f4b89bc0bb4c7c3f7b52724568a901b7e0195b/json-20160810-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,19 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<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>
|
||||
</project>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="Rixa:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="1.0" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../src/main">
|
||||
@ -9,11 +9,10 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: net.dv8tion:JDA:3.1.1_212" level="project" />
|
||||
<orderEntry type="library" name="Gradle: net.dv8tion:JDA:3.1.1_215" level="project" />
|
||||
<orderEntry type="library" name="Gradle: mysql:mysql-connector-java:5.1.38" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.sedmelluq:lavaplayer:1.2.39" level="project" />
|
||||
<orderEntry type="library" name="Gradle: edu.cmu.sphinx:sphinx4-core:5prealpha-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Gradle: edu.cmu.sphinx:sphinx4-data:5prealpha-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.sedmelluq:lavaplayer:1.2.42" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.twitter4j:twitter4j-stream:4.0.6" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.5" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.json:json:20160810" level="project" />
|
||||
@ -29,7 +28,6 @@
|
||||
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-databind:2.8.5" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jsoup:jsoup:1.10.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: net.iharder:base64:2.3.9" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.commons:commons-math3:3.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpasyncclient:4.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
|
||||
@ -37,5 +35,6 @@
|
||||
<orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.twitter4j:twitter4j-core:4.0.6" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="Rixa:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="1.0" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../src/test">
|
||||
@ -10,11 +10,10 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="Rixa_main" />
|
||||
<orderEntry type="library" name="Gradle: net.dv8tion:JDA:3.1.1_212" level="project" />
|
||||
<orderEntry type="library" name="Gradle: net.dv8tion:JDA:3.1.1_215" level="project" />
|
||||
<orderEntry type="library" name="Gradle: mysql:mysql-connector-java:5.1.38" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.sedmelluq:lavaplayer:1.2.39" level="project" />
|
||||
<orderEntry type="library" name="Gradle: edu.cmu.sphinx:sphinx4-core:5prealpha-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Gradle: edu.cmu.sphinx:sphinx4-data:5prealpha-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.sedmelluq:lavaplayer:1.2.42" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.twitter4j:twitter4j-stream:4.0.6" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.5" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.json:json:20160810" level="project" />
|
||||
@ -30,7 +29,6 @@
|
||||
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-databind:2.8.5" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jsoup:jsoup:1.10.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: net.iharder:base64:2.3.9" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.commons:commons-math3:3.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpasyncclient:4.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
|
||||
@ -38,6 +36,7 @@
|
||||
<orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.twitter4j:twitter4j-core:4.0.6" level="project" />
|
||||
</component>
|
||||
<component name="TestModuleProperties" production-module="Rixa_main" />
|
||||
</module>
|
1479
.idea/workspace.xml
1479
.idea/workspace.xml
File diff suppressed because it is too large
Load Diff
@ -24,11 +24,11 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'net.dv8tion:JDA:3.1.1_212'
|
||||
compile 'net.dv8tion:JDA:3.1.1_215'
|
||||
compile 'mysql:mysql-connector-java:5.1.38'
|
||||
compile 'com.sedmelluq:lavaplayer:1.2.39'
|
||||
compile group: 'edu.cmu.sphinx', name: 'sphinx4-core', version:'5prealpha-SNAPSHOT'
|
||||
compile group: 'edu.cmu.sphinx', name: 'sphinx4-data', version:'5prealpha-SNAPSHOT'
|
||||
compile 'com.sedmelluq:lavaplayer:1.2.42'
|
||||
compile 'org.twitter4j:twitter4j-core:4.0.3'
|
||||
compile 'org.twitter4j:twitter4j-stream:4.0.6'
|
||||
}
|
||||
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
|
@ -14,8 +14,11 @@ import me.savvy.rixa.data.database.sql.DatabaseManager;
|
||||
import me.savvy.rixa.data.filemanager.ConfigManager;
|
||||
import me.savvy.rixa.data.filemanager.LanguageManager;
|
||||
import me.savvy.rixa.events.BotEvent;
|
||||
import me.savvy.rixa.events.MemberEvent;
|
||||
import me.savvy.rixa.events.MessageEvent;
|
||||
import me.savvy.rixa.modules.reactions.handlers.React;
|
||||
import me.savvy.rixa.modules.reactions.handlers.ReactionManager;
|
||||
import me.savvy.rixa.modules.reactions.react.ConfigReaction;
|
||||
import me.savvy.rixa.modules.reactions.react.HelpReaction;
|
||||
import net.dv8tion.jda.core.AccountType;
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
@ -60,7 +63,7 @@ public class Rixa {
|
||||
dbManager.createTable();
|
||||
getInstance().setLanguageManager(new LanguageManager());
|
||||
try {
|
||||
int shards = 3;
|
||||
int shards = 5;
|
||||
for(int i = 0; i < shards; i++) {
|
||||
Logger.getLogger("Rixa").info("Loading shard #" + i);
|
||||
JDABuilder jda = new JDABuilder(AccountType.BOT)
|
||||
@ -68,6 +71,7 @@ public class Rixa {
|
||||
.setEventManager(new AnnotatedEventManager())
|
||||
.addEventListener(new MessageEvent())
|
||||
.addEventListener(new BotEvent())
|
||||
.addEventListener(new MemberEvent())
|
||||
.setGame(Game.of(config.getConfig().getString("botGame")))
|
||||
.setAutoReconnect(true)
|
||||
.setStatus(OnlineStatus.ONLINE)
|
||||
@ -84,8 +88,8 @@ public class Rixa {
|
||||
new InfoCommand(), new ServerInfoCommand(), new HelpCommand(),
|
||||
new DeleteMessagesCommand(), new PingCommand(), new PurgeMessagesCommand(),
|
||||
new BatchMoveCommand(), new MuteCommand(), new MusicCommand(),
|
||||
new ConfigCommand()});
|
||||
ReactionManager.registerReaction(new HelpReaction());
|
||||
new ConfigCommand(), new UrbanDictionaryCommand(), /*new InviteCommand()*/});
|
||||
register(new React[] {new HelpReaction(), new ConfigReaction()});
|
||||
data = new Data(DataType.SQL);
|
||||
}
|
||||
|
||||
@ -115,6 +119,12 @@ public class Rixa {
|
||||
}
|
||||
}
|
||||
|
||||
private static void register(React react[]) {
|
||||
for (React reaction: react) {
|
||||
ReactionManager.registerReaction(reaction);
|
||||
}
|
||||
}
|
||||
|
||||
public static Rixa getInstance() {
|
||||
return instance;
|
||||
}
|
||||
@ -130,4 +140,8 @@ public class Rixa {
|
||||
public ConfigManager getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public List<JDA> getShardsList() {
|
||||
return shardsList;
|
||||
}
|
||||
}
|
||||
|
17
src/main/java/me/savvy/rixa/action/Action.java
Normal file
17
src/main/java/me/savvy/rixa/action/Action.java
Normal file
@ -0,0 +1,17 @@
|
||||
package me.savvy.rixa.action;
|
||||
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
/**
|
||||
* Created by savit on 6/24/2017.
|
||||
*/
|
||||
public interface Action {
|
||||
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
void execute();
|
||||
|
||||
void execute(GuildMessageReceivedEvent event);
|
||||
}
|
50
src/main/java/me/savvy/rixa/action/ActionManager.java
Normal file
50
src/main/java/me/savvy/rixa/action/ActionManager.java
Normal file
@ -0,0 +1,50 @@
|
||||
package me.savvy.rixa.action;
|
||||
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by savit on 6/24/2017.
|
||||
*/
|
||||
public class ActionManager {
|
||||
|
||||
private Guild guild;
|
||||
private Map<String, Action> actionMap;
|
||||
|
||||
public ActionManager(Guild guild) {
|
||||
this.guild = guild;
|
||||
actionMap = new HashMap<>();
|
||||
}
|
||||
|
||||
public Guild getGuild() {
|
||||
return guild;
|
||||
}
|
||||
|
||||
public Map<String, Action> getActionMap() {
|
||||
return actionMap;
|
||||
}
|
||||
|
||||
public Action getAction(String actionName) {
|
||||
return actionMap.get(actionName);
|
||||
}
|
||||
|
||||
public void addAction(String actionName, Action action) {
|
||||
if(hasAction(actionName)) {
|
||||
actionMap.remove(actionName);
|
||||
}
|
||||
actionMap.put(actionName, action);
|
||||
}
|
||||
|
||||
public void removeAction(String actionName) {
|
||||
if(!(hasAction(actionName))) {
|
||||
return;
|
||||
}
|
||||
actionMap.remove(actionName);
|
||||
}
|
||||
|
||||
public boolean hasAction(String actionName) {
|
||||
return actionMap.containsKey(actionName);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package me.savvy.rixa.action.actions;
|
||||
|
||||
import me.savvy.rixa.action.Action;
|
||||
import me.savvy.rixa.utils.MessageBuilder;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
/**
|
||||
* Created by savit on 6/24/2017.
|
||||
*/
|
||||
public class MessageResponse implements Action {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "MessageResponse";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Upon trigger, responds with messages";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(GuildMessageReceivedEvent event) {
|
||||
new MessageBuilder("MessageResponse action is still in development.")
|
||||
.setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
}
|
||||
|
||||
public void execute() {}
|
||||
}
|
@ -10,6 +10,7 @@ import me.savvy.rixa.utils.MessageBuilder;
|
||||
import net.dv8tion.jda.core.entities.ChannelType;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.Role;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
|
||||
@ -22,7 +23,9 @@ import java.util.List;
|
||||
public class ConfigCommand implements CommandExec {
|
||||
|
||||
private List<String> config;
|
||||
private static ConfigCommand instance;
|
||||
public ConfigCommand() {
|
||||
instance = this;
|
||||
config = Arrays.asList(
|
||||
"%pconfig set greetings ; Set channel where greeting messages are announced!",
|
||||
"%pconfig set farewell ; Set channel where farewell messages are announced!",
|
||||
@ -33,6 +36,7 @@ public class ConfigCommand implements CommandExec {
|
||||
"%pconfig joinMessage <joinMessage> ; Set the greetings message for when a user joins the server!",
|
||||
"%pconfig quitMessage <quitMessage> ; Set the quit message for when a user leaves the server!",
|
||||
"%pconfig joinPm <joinPm> ; Set the message to be private messaged when a user joins!",
|
||||
"%pconfig description <description> ; Set your server description!",
|
||||
"%pconfig addPerm <role> <permission> ; Give a role permission to access a command!",
|
||||
"%pconfig removePerm <role> <permission> ; Remove a role's permission to access a command!",
|
||||
"%pconfig enable <module> ; Enabled a Rixa Module!",
|
||||
@ -40,7 +44,6 @@ public class ConfigCommand implements CommandExec {
|
||||
}
|
||||
@Override
|
||||
@Command(mainCommand = "config",
|
||||
aliases = {},
|
||||
description = "Configure Rixa to your liking!",
|
||||
type = CommandType.ADMIN,
|
||||
channelType = ChannelType.TEXT)
|
||||
@ -57,36 +60,60 @@ public class ConfigCommand implements CommandExec {
|
||||
try {
|
||||
try {
|
||||
page = Integer.parseInt(messages[1]);
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix());
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix()).sendUser(event.getAuthor()).addReaction("\u2B05").addReaction("\u27A1");
|
||||
event.getMessage().delete().complete();
|
||||
new MessageBuilder(event.getMember().getAsMention() + ", the configuration menu has been private messaged to you").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
} catch(NumberFormatException ex) {
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix());
|
||||
ex.printStackTrace();
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix()).sendUser(event.getAuthor()).addReaction("\u2B05").addReaction("\u27A1");
|
||||
}
|
||||
} catch (IllegalArgumentException ex){
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix());
|
||||
ex.printStackTrace();
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix()).sendUser(event.getAuthor()).addReaction("\u2B05").addReaction("\u27A1");
|
||||
event.getMessage().delete().complete();
|
||||
new MessageBuilder(event.getMember().getAsMention() + ", the configuration menu has been private messaged to you").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
}
|
||||
return;
|
||||
}else if (messages.length < 3) {
|
||||
sendHelp(event.getMember(), 0, rixaGuild.getGuildSettings().getPrefix());
|
||||
sendHelp(event.getMember(), 0, rixaGuild.getGuildSettings().getPrefix()).sendUser(event.getAuthor()).addReaction("\u2B05").addReaction("\u27A1");
|
||||
event.getMessage().delete().complete();
|
||||
new MessageBuilder(event.getMember().getAsMention() + ", the configuration menu has been private messaged to you").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
return;
|
||||
}
|
||||
String message;
|
||||
if (messages[1].equalsIgnoreCase("joinmessage")) {
|
||||
message = getMessage(messages, 2);
|
||||
if(event.getMessage().getMentionedChannels().size() > 0) {
|
||||
for (TextChannel messageChannel : event.getMessage().getMentionedChannels()) {
|
||||
message = message.replace(messageChannel.getAsMention(), "<#" + messageChannel.getId() + ">");
|
||||
}
|
||||
}
|
||||
rixaGuild.getGuildSettings().setJoinMessage(message);
|
||||
new MessageBuilder("Successfully set Join Message to\n" + message.replace("{0}", event.getMember().getUser().getName())
|
||||
.replace("{1}", event.getGuild().getName())).setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
} else if (messages[1].equalsIgnoreCase("quitmessage")) {
|
||||
message = getMessage(messages, 2);
|
||||
if(event.getMessage().getMentionedChannels().size() > 0) {
|
||||
for (TextChannel messageChannel : event.getMessage().getMentionedChannels()) {
|
||||
message = message.replace(messageChannel.getAsMention(), "<#" + messageChannel.getId() + ">");
|
||||
}
|
||||
}
|
||||
rixaGuild.getGuildSettings().setQuitMessage(message);
|
||||
new MessageBuilder("Successfully set Quit Message to\n" + message.replace("{0}", event.getMember().getUser().getName())
|
||||
.replace("{1}", event.getGuild().getName())).setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
} else if (messages[1].equalsIgnoreCase("joinpm")) {
|
||||
message = getMessage(messages, 2);
|
||||
if(event.getMessage().getMentionedChannels().size() > 0) {
|
||||
for (TextChannel messageChannel : event.getMessage().getMentionedChannels()) {
|
||||
message = message.replace(messageChannel.getAsMention(), "<#" + messageChannel.getId() + ">");
|
||||
}
|
||||
}
|
||||
rixaGuild.getGuildSettings().setJoinPrivateMessage(message);
|
||||
new MessageBuilder("Successfully set Private Join Message to\n" + message.replace("{0}", event.getMember().getUser().getName())
|
||||
.replace("{1}", event.getGuild().getName())).setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
} else if (messages[1].equalsIgnoreCase("description")) {
|
||||
message = getMessage(messages, 2);
|
||||
rixaGuild.getGuildSettings().setDescription(message);
|
||||
new MessageBuilder("Successfully set Server Description to\n" + message.replace("{0}", event.getMember().getUser().getName())
|
||||
.replace("{1}", event.getGuild().getName())).setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
} else if (messages[1].equalsIgnoreCase("set")) {
|
||||
if (messages[2].equalsIgnoreCase("greetings")) {
|
||||
rixaGuild.getGuildSettings().setJoinMessageChannel(event.getChannel());
|
||||
@ -211,24 +238,32 @@ public class ConfigCommand implements CommandExec {
|
||||
new MessageBuilder("Successfully removed the permission " + perm.name() + " from the role " + role.getName() + "!").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
} else {
|
||||
int page = 0;
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix());
|
||||
sendHelp(event.getMember(), page, rixaGuild.getGuildSettings().getPrefix()).sendUser(event.getAuthor()).addReaction("\u2B05").addReaction("\u27A1");
|
||||
event.getMessage().delete().complete();
|
||||
new MessageBuilder(event.getMember().getAsMention() + ", the configuration menu has been private messaged to you").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
}
|
||||
}
|
||||
|
||||
private void sendHelp(Member member, int page, String prefix) {
|
||||
public MessageBuilder sendHelp(Member member, int page, String prefix) {
|
||||
int sizePerPage = 4;
|
||||
int maxPages = config.size() / sizePerPage + (config.size() % sizePerPage > 0 ? 1 : 0);
|
||||
int from = Math.max(0, (page + 1 )* sizePerPage);
|
||||
if(page < 0) {
|
||||
page = 0;
|
||||
}
|
||||
if(page > maxPages - 2) {
|
||||
page = maxPages - 3;
|
||||
}
|
||||
int from = Math.max(0, page * sizePerPage);
|
||||
int to = Math.min(config.size(), (page + 2) * sizePerPage);
|
||||
List<String> configList = config.subList(from, to);
|
||||
MessageBuilder builder = new MessageBuilder("\u2699" + " **Config**" +
|
||||
"\n" +
|
||||
"Click the back or forward reactions to switch between pages.");
|
||||
configList.forEach(object -> {
|
||||
builder.addField(object.split(" ; ")[0].replace("%p", prefix), object.split(" ; ")[1], true);
|
||||
builder.addField(object.split(" ; ")[0].replace("%p", prefix), object.split(" ; ")[1], false);
|
||||
});
|
||||
builder.footer("Page: (" + page + " / " + (maxPages - 2) + ")", member.getGuild().getIconUrl());
|
||||
builder.setColor(member.getColor()).sendUser(member.getUser()).setTitle("Config").addReaction("\u2B05").addReaction("\u27A1");
|
||||
return builder.setColor(member.getColor()).setTitle(String.format("Config: %s", member.getGuild().getId()));
|
||||
}
|
||||
|
||||
private String getMessage(String[] messages, int argToBegin) {
|
||||
@ -238,4 +273,8 @@ public class ConfigCommand implements CommandExec {
|
||||
}
|
||||
return builder.toString().trim();
|
||||
}
|
||||
|
||||
public static ConfigCommand getInstance() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package me.savvy.rixa.commands.admin;
|
||||
|
||||
import me.savvy.rixa.commands.handlers.Command;
|
||||
import me.savvy.rixa.commands.handlers.CommandExec;
|
||||
import me.savvy.rixa.commands.handlers.CommandType;
|
||||
import net.dv8tion.jda.core.entities.ChannelType;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.requests.restaction.InviteAction;
|
||||
|
||||
/**
|
||||
* Created by savit on 7/7/2017.
|
||||
*/
|
||||
public class InviteCommand implements CommandExec {
|
||||
|
||||
@Command(
|
||||
description = "Receive an invite from a server",
|
||||
type = CommandType.USER,
|
||||
channelType = ChannelType.TEXT,
|
||||
usage = "%pinvite", mainCommand = "invite")
|
||||
public void execute(GuildMessageReceivedEvent event) {
|
||||
User owner = event.getGuild().getOwner().getUser();
|
||||
if(!event.getAuthor().getId().equalsIgnoreCase(owner.getId())) {
|
||||
return;
|
||||
}
|
||||
TextChannel channel = event.getJDA().getGuildById(event.getMessage().getContent().split(" ")[1]).getTextChannels().get(0);
|
||||
InviteAction inviteAction = channel.createInvite();
|
||||
owner.openPrivateChannel().complete().sendMessage(
|
||||
"http://discord.gg/" + inviteAction.setMaxUses(1).complete().getCode()).queue();
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ public class HelpCommand implements CommandExec {
|
||||
" **Help**" +
|
||||
"\n" +
|
||||
"Click the corresponding number for more information about the command menu.";
|
||||
embedBuilder.setTitle("Help", "http://rixa.io")
|
||||
embedBuilder.setTitle(String.format("Help: %s", event.getGuild().getId()))
|
||||
.setDescription(stringBuilder)
|
||||
.addField("1 - General Commands", "Reveals usable commands intended for `everyone`", false)
|
||||
.addField("2 - Staff Commands", "Reveals usable commands intended for `staff` use only", false)
|
||||
|
@ -5,6 +5,7 @@ import me.savvy.rixa.commands.handlers.Command;
|
||||
import me.savvy.rixa.commands.handlers.CommandExec;
|
||||
import me.savvy.rixa.commands.handlers.CommandType;
|
||||
import net.dv8tion.jda.core.EmbedBuilder;
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
import net.dv8tion.jda.core.entities.ChannelType;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
@ -18,7 +19,7 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class InfoCommand implements CommandExec {
|
||||
|
||||
@Command(aliases = {""},
|
||||
@Command(
|
||||
description = "Receive information about Rixa",
|
||||
type = CommandType.USER,
|
||||
channelType = ChannelType.TEXT,
|
||||
@ -35,18 +36,24 @@ public class InfoCommand implements CommandExec {
|
||||
long hours = TimeUnit.SECONDS.toHours(seconds) - (day *24);
|
||||
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds)* 60);
|
||||
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
|
||||
messageEmbed
|
||||
.setTitle("Rixa Discord Bot", "http://rixa.io/")
|
||||
.setDescription("Rixa is a user-friendly, multi-purpose bot that is capable of being customized to your discord server needs. " +
|
||||
"Rixa is complete with a dashboard, user profile, server statistics system, and many more features such as assigning " +
|
||||
"roles on user join, music module, levels, and more. Rixa was created to bring ease and simplicity to managing discord" +
|
||||
" servers, it has since then grown into much more than just a bot used for moderation.")
|
||||
.addField("Created", event.getJDA().getSelfUser().getCreationTime().format(formatter), true)
|
||||
.addField("Bot Uptime ", "Uptime: " + day + " days " + hours + " hours " + minute + " minutes " + second + " seconds.", true)
|
||||
.addField("Total Guilds", event.getJDA().getGuilds().size() + "", true)
|
||||
.addField("Total Users", event.getJDA().getUsers().size() + "", true)
|
||||
.addField("Rixa Developer", botOwner.getName() + "#" + botOwner.getDiscriminator(), true)
|
||||
.setFooter("Requested by " + event.getAuthor().getName() + "#" + event.getAuthor().getDiscriminator(), event.getAuthor().getAvatarUrl());
|
||||
int guildCount = 0;
|
||||
int userCount = 0;
|
||||
for(JDA jda: Rixa.getInstance().getShardsList()) {
|
||||
guildCount += jda.getGuilds().size();
|
||||
userCount += jda.getUsers().size();
|
||||
}
|
||||
messageEmbed
|
||||
.setTitle("Rixa Discord Bot", "http://rixa.io/")
|
||||
.setDescription("Rixa is a user-friendly, multi-purpose bot currently in development which is capable of being customized to your Discord server needs. " +
|
||||
"Rixa is complete with a dashboard, user profile, server statistics system, and many more features such as assigning roles on user join, music module, " +
|
||||
"levels, and more. Rixa was created to bring ease and simplicity to managing Discord servers, and has since grown into much more than just a bot used for " +
|
||||
"moderation.")
|
||||
.addField("Created", event.getJDA().getSelfUser().getCreationTime().format(formatter), true)
|
||||
.addField("Bot Uptime ", "Uptime: " + day + " days " + hours + " hours " + minute + " minutes " + second + " seconds.", true)
|
||||
.addField("Total Guilds", String.valueOf(guildCount), true)
|
||||
.addField("Total Users", String.valueOf(userCount), true)
|
||||
.addField("Rixa Developer", botOwner.getName() + "#" + botOwner.getDiscriminator(), true)
|
||||
.setFooter("Requested by " + event.getAuthor().getName() + "#" + event.getAuthor().getDiscriminator(), event.getAuthor().getAvatarUrl());
|
||||
event.getChannel().sendMessage(messageEmbed.build()).queue();
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ public class MusicCommand implements CommandExec {
|
||||
musicManagers = new HashMap<>();
|
||||
}
|
||||
|
||||
@Command(aliases = {},
|
||||
description = "Play music in your voice chat.",
|
||||
@Command(description = "Play music in your voice chat.",
|
||||
type = CommandType.USER,
|
||||
channelType = ChannelType.TEXT,
|
||||
usage = "%pmusic", mainCommand = "music")
|
||||
@ -73,7 +72,13 @@ public class MusicCommand implements CommandExec {
|
||||
}
|
||||
if(rixaGuild.getMusicModule().isRoleRequired()) {
|
||||
Role role = event.getGuild().getRoleById(rixaGuild.getMusicModule().getMusicRole());
|
||||
if(!event.getMember().getRoles().contains(role)) {
|
||||
boolean hasRole = false;
|
||||
for (Role roleItem : event.getMember().getRoles()) {
|
||||
if (roleItem.getId().equalsIgnoreCase(role.getId())) {
|
||||
hasRole = true;
|
||||
}
|
||||
}
|
||||
if(!hasRole) {
|
||||
new MessageBuilder("You must have the " + role.getName() + " role to use the music module.").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
return;
|
||||
}
|
||||
@ -232,7 +237,7 @@ public class MusicCommand implements CommandExec {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(message[1].equalsIgnoreCase("play") || message[1].equalsIgnoreCase("pplay")) {
|
||||
} else if(message[1].equalsIgnoreCase("play") || message[1].equalsIgnoreCase("playlist")) {
|
||||
loadAndPlay(mng, event.getChannel(), message[2], false);
|
||||
} else if(message[1].equalsIgnoreCase("vol") || message[1].equalsIgnoreCase("volume")) {
|
||||
try {
|
||||
@ -254,7 +259,6 @@ public class MusicCommand implements CommandExec {
|
||||
String msg = "Adding to queue: " + track.getInfo().title;
|
||||
mng.scheduler.queue(track);
|
||||
new MessageBuilder(msg).setColor(Color.decode("#4CC276")).queue(channel);
|
||||
channel.sendMessage(msg).queue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,6 +35,7 @@ public class ServerInfoCommand implements CommandExec {
|
||||
.addField("Voice Channels", String.valueOf(event.getGuild().getVoiceChannels().size()), true)
|
||||
.addField("Roles", String.valueOf(event.getGuild().getRoles().size()), true)
|
||||
.addField("Owner", owner.getName() + "#" + owner.getDiscriminator(), true)
|
||||
.addField("Enlisted", String.valueOf(rixaGuild.getGuildSettings().isEnlisted()), true)
|
||||
.setThumbnail(event.getGuild().getIconUrl())
|
||||
.setFooter("ServerID: " + event.getGuild().getId(), event.getGuild().getIconUrl());
|
||||
event.getChannel().sendMessage(messageEmbed.build()).queue();
|
||||
|
@ -0,0 +1,56 @@
|
||||
package me.savvy.rixa.commands.general;
|
||||
|
||||
import me.savvy.rixa.commands.handlers.Command;
|
||||
import me.savvy.rixa.commands.handlers.CommandExec;
|
||||
import me.savvy.rixa.utils.MessageBuilder;
|
||||
import me.savvy.rixa.utils.UrbanDictionary;
|
||||
import net.dv8tion.jda.core.entities.ChannelType;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* Created by savit on 6/24/2017.
|
||||
*/
|
||||
public class UrbanDictionaryCommand implements CommandExec {
|
||||
|
||||
|
||||
@Override
|
||||
@Command(mainCommand = "urbandictionary",
|
||||
aliases = {"ud"},
|
||||
description = "Search urban dictionary for a command!",
|
||||
channelType = ChannelType.TEXT)
|
||||
public void execute(GuildMessageReceivedEvent event) {
|
||||
String[] message = event.getMessage().getContent().split(" ");
|
||||
String search = getMessage(message, 1);
|
||||
UrbanDictionary ud = null;
|
||||
try {
|
||||
ud = new UrbanDictionary(URLEncoder.encode(search, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(ud == null) {
|
||||
new MessageBuilder("Search term not found.").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
}
|
||||
try {
|
||||
if(!ud.search()) {
|
||||
new MessageBuilder("Search term not found.").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
return;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
new MessageBuilder("Search term not found.").setColor(event.getMember().getColor()).queue(event.getChannel());
|
||||
}
|
||||
new MessageBuilder(ud.getDefinition()).setTitle(String.format("Definition: %s", ud.getWordToSearch())).setColor(event.getMember().getColor())
|
||||
.addThumbnail("https://s-media-cache-ak0.pinimg.com/originals/f2/aa/37/f2aa3712516cfd0cf6f215301d87a7c2.jpg").queue(event.getChannel());
|
||||
}
|
||||
|
||||
private String getMessage(String[] messages, int argToBegin) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for(int i = argToBegin; i < messages.length; i++) {
|
||||
builder.append(messages[i]).append(" ");
|
||||
}
|
||||
return builder.toString().trim();
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@ import java.util.Collections;
|
||||
public class MuteCommand implements CommandExec {
|
||||
@Override
|
||||
@Command(mainCommand = "mute",
|
||||
aliases = "",
|
||||
description = "Mute a member.",
|
||||
type = CommandType.MOD,
|
||||
channelType = ChannelType.TEXT)
|
||||
|
@ -117,7 +117,6 @@ public class DatabaseManager {
|
||||
return Result.FALSE;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return Result.ERROR;
|
||||
}
|
||||
}
|
||||
|
60
src/main/java/me/savvy/rixa/events/MemberEvent.java
Normal file
60
src/main/java/me/savvy/rixa/events/MemberEvent.java
Normal file
@ -0,0 +1,60 @@
|
||||
package me.savvy.rixa.events;
|
||||
|
||||
import me.savvy.rixa.guild.RixaGuild;
|
||||
import me.savvy.rixa.guild.RixaManager;
|
||||
import me.savvy.rixa.utils.MessageBuilder;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Role;
|
||||
import net.dv8tion.jda.core.events.guild.member.GuildMemberJoinEvent;
|
||||
import net.dv8tion.jda.core.exceptions.PermissionException;
|
||||
import net.dv8tion.jda.core.hooks.SubscribeEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by savit on 6/18/2017.
|
||||
*/
|
||||
public class MemberEvent {
|
||||
|
||||
public static Map<String, Guild> joinMembers = new HashMap<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMember(GuildMemberJoinEvent event) {
|
||||
RixaGuild rixaGuild = RixaManager.getGuild(event.getGuild());
|
||||
if(rixaGuild.getGuildSettings().getJoinMessageChannel() != null) {
|
||||
try {
|
||||
new MessageBuilder(rixaGuild.getGuildSettings().getJoinMessage()
|
||||
.replace("{0}", event.getMember().getAsMention()).replace("{1}", event.getGuild().getName()).replace
|
||||
("{2}", String.valueOf(event.getGuild().getMembers().size()))).setColor
|
||||
(event.getMember().getColor()).queue(rixaGuild.getGuildSettings().getJoinMessageChannel());
|
||||
} catch(PermissionException ex) {
|
||||
new MessageBuilder(String.format("I do not have permission for %s in %s", ex.getPermission().getName(), rixaGuild.getGuild().getName()))
|
||||
.setColor(event.getMember().getColor()).send(rixaGuild.getGuild().getOwner().getUser());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(rixaGuild.getGuildSettings().isJoinVerification()) {
|
||||
joinMembers.put(event.getMember().getUser().getId(), event.getGuild());
|
||||
} else if(!rixaGuild.getGuildSettings().getDefaultRole().equalsIgnoreCase("default_value")) {
|
||||
try {
|
||||
Role role = event.getGuild().getRoleById(rixaGuild.getGuildSettings().getDefaultRole());
|
||||
event.getGuild().getController().addRolesToMember(event.getMember(), Collections.singleton(role)).complete();
|
||||
} catch(PermissionException ex) {
|
||||
new MessageBuilder(String.format("I do not have permission for %s in %s", ex.getPermission().getName(), rixaGuild.getGuild().getName()))
|
||||
.setColor(event.getMember().getColor()).send(rixaGuild.getGuild().getOwner().getUser());
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(rixaGuild.getGuildSettings().getJoinPrivateMessage().equalsIgnoreCase("default")) {
|
||||
return;
|
||||
}
|
||||
String message = rixaGuild.getGuildSettings().getJoinPrivateMessage().replace("{0}", event.getMember().getAsMention())
|
||||
.replace("{1}", event.getGuild().getName()).replace("{2}", String.valueOf
|
||||
(event.getGuild().getMembers().size()));
|
||||
new MessageBuilder(message).setColor(event.getMember().getColor()).send(event.getMember().getUser());
|
||||
}
|
||||
}
|
@ -1,19 +1,28 @@
|
||||
package me.savvy.rixa.events;
|
||||
|
||||
import com.mysql.jdbc.StringUtils;
|
||||
import me.savvy.rixa.Rixa;
|
||||
import me.savvy.rixa.commands.handlers.CommandHandler;
|
||||
import me.savvy.rixa.commands.handlers.CommandRegistrar;
|
||||
import me.savvy.rixa.guild.RixaGuild;
|
||||
import me.savvy.rixa.guild.RixaManager;
|
||||
import me.savvy.rixa.modules.reactions.handlers.ReactRegistrar;
|
||||
import me.savvy.rixa.modules.reactions.handlers.ReactionManager;
|
||||
import me.savvy.rixa.utils.MessageBuilder;
|
||||
import net.dv8tion.jda.core.Permission;
|
||||
import net.dv8tion.jda.core.entities.Message;
|
||||
import net.dv8tion.jda.core.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.core.events.guild.member.GuildMemberJoinEvent;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.events.message.priv.PrivateMessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.events.message.react.MessageReactionAddEvent;
|
||||
import net.dv8tion.jda.core.exceptions.PermissionException;
|
||||
import net.dv8tion.jda.core.hooks.SubscribeEvent;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Created by Timber on 5/7/2017.
|
||||
@ -35,12 +44,57 @@ public class MessageEvent {
|
||||
CommandRegistrar cmd = CommandHandler.get(splitContent[0]);
|
||||
Method m = cmd.getMethod();
|
||||
try {
|
||||
Rixa.getInstance().getLogger().info("Invoking: " + cmd.getCommandAnnotation().mainCommand());
|
||||
m.invoke(cmd.getExecutor(), event);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMemberJoin(PrivateMessageReceivedEvent event) {
|
||||
RixaGuild rixaGuild;
|
||||
if (MemberEvent.joinMembers.containsKey(event.getAuthor().getId())) {
|
||||
rixaGuild = RixaManager.getGuild(MemberEvent.joinMembers.get(event.getAuthor().getId()));
|
||||
if (event.getMessage().getContent().equalsIgnoreCase("I agree") ||
|
||||
event.getMessage().getContent().equalsIgnoreCase("I accept")
|
||||
|| event.getMessage().getContent().equalsIgnoreCase("Yes")) {
|
||||
MemberEvent.joinMembers.remove(event.getAuthor().getId());
|
||||
if (!rixaGuild.getGuildSettings().getDefaultRole().equalsIgnoreCase("default_value")) {
|
||||
try {
|
||||
rixaGuild.getGuild().getController().addRolesToMember(rixaGuild.getGuild()
|
||||
.getMember(event.getAuthor()), Collections.singleton(rixaGuild.getGuild().getRoleById(rixaGuild.getGuildSettings().getDefaultRole()))).complete();
|
||||
new MessageBuilder(String.format("You have been promoted on %s!", rixaGuild.getGuild().getName()))
|
||||
.setColor(rixaGuild.getGuild().getMember(event.getAuthor()).getColor()).send(event.getAuthor());
|
||||
} catch(PermissionException ex) {
|
||||
new MessageBuilder(String.format("I do not have permission for %s in %s", ex.getPermission().getName(), rixaGuild.getGuild().getName()))
|
||||
.setColor(Color.RED).send(rixaGuild.getGuild().getOwner().getUser());
|
||||
}
|
||||
}
|
||||
} else if (event.getMessage().getContent().equalsIgnoreCase("I disagree") ||
|
||||
event.getMessage().getContent().equalsIgnoreCase("I deny") ||
|
||||
event.getMessage().getContent().equalsIgnoreCase("No")) {
|
||||
try {
|
||||
new MessageBuilder(String.format("You have been removed from %s because you did not agree to the terms!", rixaGuild.getGuild().getName()))
|
||||
.setColor(Color.RED).send(event.getAuthor());
|
||||
MemberEvent.joinMembers.remove(event.getAuthor().getId());
|
||||
rixaGuild.getGuild().getController().kick(rixaGuild.getGuild().getMember(event.getAuthor())).complete();
|
||||
} catch (PermissionException ex) {
|
||||
if(ex.getPermission() == Permission.KICK_MEMBERS) {
|
||||
new MessageBuilder(String.format("I do not have permission to kick %s from %s", event.getAuthor().getName(), rixaGuild.getGuild().getName()))
|
||||
.setColor(Color.RED).send(rixaGuild.getGuild().getOwner().getUser());
|
||||
} else {
|
||||
new MessageBuilder(String.format("I do not have permission for %s in %s", ex.getPermission().getName(), rixaGuild.getGuild().getName()))
|
||||
.setColor(Color.RED).send(rixaGuild.getGuild().getOwner().getUser());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(!event.getAuthor().isBot())
|
||||
new MessageBuilder("Private messages are currently disabled!").setColor(Color.RED).send(event.getAuthor());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onReact(MessageReactionAddEvent event) {
|
||||
Message message = event.getChannel().getMessageById(event.getMessageId()).complete();
|
||||
|
@ -3,8 +3,10 @@ package me.savvy.rixa.guild;
|
||||
import me.savvy.rixa.Rixa;
|
||||
import me.savvy.rixa.commands.handlers.RixaPermission;
|
||||
import me.savvy.rixa.data.database.sql.DatabaseManager;
|
||||
import me.savvy.rixa.enums.Result;
|
||||
import me.savvy.rixa.guild.management.GuildSettings;
|
||||
import me.savvy.rixa.modules.music.MusicModule;
|
||||
import me.savvy.rixa.modules.twitter.TwitterModule;
|
||||
import net.dv8tion.jda.core.entities.*;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
@ -22,6 +24,7 @@ public class RixaGuild {
|
||||
private DatabaseManager db;
|
||||
private GuildSettings guildSettings;
|
||||
private MusicModule musicModule;
|
||||
private TwitterModule twitterModule;
|
||||
private List<String> mutedMembers = new ArrayList<>();
|
||||
|
||||
public RixaGuild(Guild guild) {
|
||||
@ -32,7 +35,13 @@ public class RixaGuild {
|
||||
}
|
||||
|
||||
private void load() {
|
||||
if(check()) return;
|
||||
if(!(checkExists())) {
|
||||
Rixa.getInstance().getDbManager()
|
||||
.insert("INSERT INTO `core` (`guild_id`, `guild_name`, `description`, `keywords`, `icon`) VALUES ('%id%', '%name%', 'Description not set.', 'No Keywords Found.', '%icon%')"
|
||||
.replace("%id%", guild.getId())
|
||||
.replace("%name%", guild.getName().replace("'", "\\'"))
|
||||
.replace("%icon%", guild.getIconId()));
|
||||
}
|
||||
setGuildSettings(new GuildSettings(this.guild));
|
||||
RixaManager.addGuild(this);
|
||||
}
|
||||
@ -45,11 +54,9 @@ public class RixaGuild {
|
||||
this.guildSettings = guildSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Check if Guild exists in database if not create new instance;
|
||||
*/
|
||||
public boolean check() {
|
||||
return guildSettings == null;
|
||||
private boolean checkExists() {
|
||||
Result r = Rixa.getInstance().getDbManager().checkExists("SELECT `guild_name` FROM `core` WHERE `guild_id` = '" + guild.getId() + "';");
|
||||
return r == Result.TRUE;
|
||||
}
|
||||
|
||||
public Guild getGuild() {
|
||||
@ -100,6 +107,7 @@ public class RixaGuild {
|
||||
ps.setBoolean(1, value);
|
||||
ps.setString(2, guild.getId());
|
||||
ps.setString(3, role.getId());
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -136,4 +144,12 @@ public class RixaGuild {
|
||||
public void setMusicModule(MusicModule musicModule) {
|
||||
this.musicModule = musicModule;
|
||||
}
|
||||
|
||||
public TwitterModule getTwitterModule() {
|
||||
return twitterModule;
|
||||
}
|
||||
|
||||
public void setTwitterModule(TwitterModule twitterModule) {
|
||||
this.twitterModule = twitterModule;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.savvy.rixa.guild.management;
|
||||
|
||||
import me.savvy.rixa.Rixa;
|
||||
import me.savvy.rixa.enums.Result;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
|
||||
@ -28,19 +29,40 @@ public class GuildSettings {
|
||||
}
|
||||
|
||||
private void load() throws SQLException {
|
||||
if(!checkExists()) {
|
||||
Rixa.getInstance().getDbManager().insert("INSERT INTO `settings` (`guild_id`, `log_enabled`, `log_channel`, `joinMessage`, `quitMessage`, `greetings`, `farewell`," +
|
||||
" `prefix`, `joinPm`, `joinVerification`, `defaultRole`, `muteRole`)" +
|
||||
" VALUES ('" + guild.getId() + "', '0', 'default_value', 'default_value', 'default_value', 'default_value', 'default_value', '/'," +
|
||||
" 'default', '0', 'default_value', 'default_value');");
|
||||
return;
|
||||
}
|
||||
PreparedStatement ps = Rixa.getInstance().getDbManager()
|
||||
.getConnection().prepareStatement("SELECT * FROM `settings` WHERE `guild_id` = ?");
|
||||
ps.setString(1, guild.getId());
|
||||
ResultSet set = Rixa.getInstance().getDbManager().getObject(ps);
|
||||
setPrefix(set.getString("prefix"));
|
||||
setDefaultRole(set.getString("defaultRole"));
|
||||
setJoinMessage(set.getString("joinMessage"));
|
||||
setQuitMessage(set.getString("quitMessage"));
|
||||
setJoinPrivateMessage(set.getString("joinPM"));
|
||||
setMuteRole(set.getString("muteRole"));
|
||||
setJoinVerification(set.getBoolean("joinVerification"));
|
||||
setDescription((String)Rixa.getInstance().getData().get("guild_id", guild.getId(), "description", "core"));
|
||||
setEnlisted((boolean) Rixa.getInstance().getData().get("guild_id", guild.getId(), "enlisted", "core"));
|
||||
this.prefix = (set.getString("prefix"));
|
||||
this.defaultRole = (set.getString("defaultRole"));
|
||||
this.joinMessage = (set.getString("joinMessage"));
|
||||
this.quitMessage = (set.getString("quitMessage"));
|
||||
this.joinPrivateMessage = (set.getString("joinPM"));
|
||||
this.muteRole = (set.getString("muteRole"));
|
||||
this.joinVerification = (set.getBoolean("joinVerification"));
|
||||
if(!set.getString("greetings").equalsIgnoreCase("default_value")) {
|
||||
joinMessageChannel = guild.getTextChannelById(set.getString("greetings"));
|
||||
}
|
||||
if(!set.getString("farewell").equalsIgnoreCase("default_value")) {
|
||||
quitMessageChannel = guild.getTextChannelById(set.getString("farewell"));
|
||||
}
|
||||
ps = Rixa.getInstance().getDbManager()
|
||||
.getConnection().prepareStatement("SELECT * FROM `core` WHERE `guild_id` = ?");
|
||||
ps.setString(1, guild.getId());
|
||||
set = Rixa.getInstance().getDbManager().getObject(ps);
|
||||
this.description = (set.getString("description"));
|
||||
this.enlisted = (set.getBoolean("enlisted"));
|
||||
}
|
||||
|
||||
private boolean checkExists() {
|
||||
return Rixa.getInstance().getDbManager().checkExists("SELECT `guild_id` FROM `settings` WHERE `guild_id` = '" + guild.getId() + "'") == Result.TRUE;
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
@ -57,6 +79,7 @@ public class GuildSettings {
|
||||
|
||||
public void setJoinMessage(String joinMessage) {
|
||||
this.joinMessage = joinMessage;
|
||||
Rixa.getInstance().getData().update("settings", "joinMessage", "guild_id", joinMessage, guild.getId());
|
||||
}
|
||||
|
||||
public String getQuitMessage() {
|
||||
@ -65,6 +88,7 @@ public class GuildSettings {
|
||||
|
||||
public void setQuitMessage(String quitMessage) {
|
||||
this.quitMessage = quitMessage;
|
||||
Rixa.getInstance().getData().update("settings", "quitMessage", "guild_id", quitMessage, guild.getId());
|
||||
}
|
||||
|
||||
public String getJoinPrivateMessage() {
|
||||
@ -73,6 +97,7 @@ public class GuildSettings {
|
||||
|
||||
public void setJoinPrivateMessage(String joinPrivateMessage) {
|
||||
this.joinPrivateMessage = joinPrivateMessage;
|
||||
Rixa.getInstance().getData().update("settings", "joinPM", "guild_id", joinPrivateMessage, guild.getId());
|
||||
}
|
||||
|
||||
public TextChannel getJoinMessageChannel() {
|
||||
@ -81,6 +106,7 @@ public class GuildSettings {
|
||||
|
||||
public void setJoinMessageChannel(TextChannel joinMessageChannel) {
|
||||
this.joinMessageChannel = joinMessageChannel;
|
||||
Rixa.getInstance().getData().update("settings", "greetings", "guild_id", joinMessageChannel.getId(), guild.getId());
|
||||
}
|
||||
|
||||
public TextChannel getQuitMessageChannel() {
|
||||
@ -89,6 +115,7 @@ public class GuildSettings {
|
||||
|
||||
public void setQuitMessageChannel(TextChannel quitMessageChannel) {
|
||||
this.quitMessageChannel = quitMessageChannel;
|
||||
Rixa.getInstance().getData().update("settings", "farewell", "guild_id", quitMessageChannel.getId(), guild.getId());
|
||||
}
|
||||
|
||||
public String getDefaultRole() {
|
||||
@ -97,6 +124,7 @@ public class GuildSettings {
|
||||
|
||||
public void setDefaultRole(String defaultRole) {
|
||||
this.defaultRole = defaultRole;
|
||||
Rixa.getInstance().getData().update("settings", "defaultRole", "guild_id", defaultRole, guild.getId());
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
@ -105,6 +133,7 @@ public class GuildSettings {
|
||||
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
Rixa.getInstance().getData().update("settings", "prefix", "guild_id", prefix, guild.getId());
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
@ -113,6 +142,7 @@ public class GuildSettings {
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
Rixa.getInstance().getData().update("core", "description", "guild_id", description, guild.getId());
|
||||
}
|
||||
|
||||
public boolean isEnlisted() {
|
||||
@ -121,6 +151,7 @@ public class GuildSettings {
|
||||
|
||||
public void setEnlisted(boolean enlisted) {
|
||||
this.enlisted = enlisted;
|
||||
Rixa.getInstance().getData().update("core", "enlisted", "guild_id", enlisted, guild.getId());
|
||||
}
|
||||
|
||||
public String getMuteRole() {
|
||||
@ -129,6 +160,7 @@ public class GuildSettings {
|
||||
|
||||
public void setMuteRole(String muteRole) {
|
||||
this.muteRole = muteRole;
|
||||
Rixa.getInstance().getData().update("settings", "muteRole", "guild_id", muteRole, guild.getId());
|
||||
}
|
||||
|
||||
public boolean isJoinVerification() {
|
||||
@ -137,5 +169,6 @@ public class GuildSettings {
|
||||
|
||||
public void setJoinVerification(boolean joinVerification) {
|
||||
this.joinVerification = joinVerification;
|
||||
Rixa.getInstance().getData().update("settings", "joinVerification", "guild_id", joinVerification, guild.getId());
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,9 @@ public class MusicModule implements RixaModule {
|
||||
}
|
||||
|
||||
public void load() {
|
||||
System.out.println("Testing " + guild.getName());
|
||||
if(!checkExists()) {
|
||||
db.insert("INSERT INTO `music` (`guild_id`, `music_role`, `enabled`)" +
|
||||
" VALUES ('" + guild.getId() + "', 'default_value', '0');");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
PreparedStatement ps = db.getConnection().prepareStatement
|
||||
@ -67,7 +65,7 @@ public class MusicModule implements RixaModule {
|
||||
}
|
||||
|
||||
public boolean isRoleRequired() {
|
||||
return (musicRole.equalsIgnoreCase("default_value") && guild.getRolesByName(musicRole, true).size() > 0);
|
||||
return (!musicRole.equalsIgnoreCase("default_value"));
|
||||
}
|
||||
|
||||
public String getMusicRole() {
|
||||
@ -84,6 +82,8 @@ public class MusicModule implements RixaModule {
|
||||
}
|
||||
|
||||
public boolean checkExists() {
|
||||
return Rixa.getInstance().getData().exists("SELECT `enabled` FROM `music` WHERE `guild_id` = '" + guild.getId() + "'") == Result.TRUE;
|
||||
Result r = Rixa.getInstance().getDbManager().checkExists("SELECT `guild_id` FROM `music` WHERE `guild_id` = '" +
|
||||
guild.getId() + "';");
|
||||
return r == Result.TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,19 @@
|
||||
package me.savvy.rixa.modules.reactions.react;
|
||||
|
||||
import me.savvy.rixa.commands.admin.ConfigCommand;
|
||||
import me.savvy.rixa.commands.handlers.CommandHandler;
|
||||
import me.savvy.rixa.commands.handlers.CommandType;
|
||||
import me.savvy.rixa.guild.RixaGuild;
|
||||
import me.savvy.rixa.guild.RixaManager;
|
||||
import me.savvy.rixa.modules.reactions.handlers.React;
|
||||
import me.savvy.rixa.modules.reactions.handlers.ReactHandle;
|
||||
import me.savvy.rixa.utils.MessageBuilder;
|
||||
import net.dv8tion.jda.core.EmbedBuilder;
|
||||
import net.dv8tion.jda.core.entities.ChannelType;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Message;
|
||||
import net.dv8tion.jda.core.events.message.react.MessageReactionAddEvent;
|
||||
import net.dv8tion.jda.core.exceptions.ErrorResponseException;
|
||||
|
||||
/**
|
||||
* Created by Timber on 6/9/2017.
|
||||
@ -12,5 +23,35 @@ public class ConfigReaction implements React {
|
||||
@Override
|
||||
@ReactHandle(title = "Config", description = "Configuration Menu for Rixa")
|
||||
public void reactionTrigger(MessageReactionAddEvent event) {
|
||||
if (event.getChannel().getType() != ChannelType.PRIVATE
|
||||
|| event.getUser().getId().equalsIgnoreCase(event.getJDA().getSelfUser().getId())) {
|
||||
return;
|
||||
}
|
||||
// "Page: (" + page
|
||||
// + "/ " + (maxPages - 2) + ")"
|
||||
Message message = event.getChannel().getMessageById(event.getMessageId()).complete();
|
||||
String title = message.getEmbeds().get(0).getTitle().split(": ")[1];
|
||||
Guild guild = event.getJDA().getGuildById(title);
|
||||
if(guild == null) {
|
||||
return;
|
||||
}
|
||||
RixaGuild rixaGuild = RixaManager.getGuild(guild);
|
||||
String prefix = rixaGuild.getGuildSettings().getPrefix();
|
||||
MessageBuilder builder = null;
|
||||
int page = 500;
|
||||
switch (event.getReaction().getEmote().getName()) {
|
||||
case "\u2B05":// previous
|
||||
page = Integer.parseInt(message.getEmbeds().get(0).getFooter().getText().split(" /")[0].replace("Page: (", "")) - 1;
|
||||
break;
|
||||
case "\u27A1":// next
|
||||
page = Integer.parseInt(message.getEmbeds().get(0).getFooter().getText().split(" /")[0].replace("Page: (", "")) + 1;
|
||||
break;
|
||||
}
|
||||
System.out.println(page);
|
||||
if(page != 500) {
|
||||
builder = ConfigCommand.getInstance().sendHelp
|
||||
(rixaGuild.getGuild().getMember(event.getUser()), page, prefix);
|
||||
message.editMessage(builder.getBuilder().build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package me.savvy.rixa.modules.reactions.react;
|
||||
|
||||
import me.savvy.rixa.commands.handlers.CommandHandler;
|
||||
import me.savvy.rixa.commands.handlers.CommandType;
|
||||
import me.savvy.rixa.guild.RixaGuild;
|
||||
import me.savvy.rixa.guild.RixaManager;
|
||||
import me.savvy.rixa.modules.reactions.handlers.React;
|
||||
import me.savvy.rixa.modules.reactions.handlers.ReactHandle;
|
||||
@ -24,8 +25,9 @@ public class HelpReaction implements React {
|
||||
return;
|
||||
}
|
||||
Message message = event.getChannel().getMessageById(event.getMessageId()).complete();
|
||||
String prefix = (event.getChannel().getType() != ChannelType.PRIVATE) ?
|
||||
RixaManager.getGuild(event.getGuild()).getGuildSettings().getPrefix() : "/";
|
||||
String title = message.getEmbeds().get(0).getTitle().split(": ")[1];
|
||||
RixaGuild rixaGuild = RixaManager.getGuild(event.getJDA().getGuildById(title));
|
||||
String prefix = rixaGuild.getGuildSettings().getPrefix();
|
||||
EmbedBuilder embedBuilder;
|
||||
try {
|
||||
switch(event.getReaction().getEmote().getName()) {
|
||||
@ -40,7 +42,7 @@ public class HelpReaction implements React {
|
||||
" **General Commands Help**" +
|
||||
"\n" +
|
||||
"Click a number below for information about other commands.";
|
||||
embedBuilder.setTitle("Help", "http://rixa.io");
|
||||
embedBuilder.setTitle(String.format("Help: %s", title));
|
||||
embedBuilder.setDescription(stringBuilder);
|
||||
CommandHandler.getCommands().values().stream().filter(cmd -> cmd.getCommandAnnotation().type() == CommandType.USER)
|
||||
.forEach(cmd -> embedBuilder.addField(prefix + cmd.getCommandAnnotation().mainCommand(),
|
||||
@ -53,11 +55,11 @@ public class HelpReaction implements React {
|
||||
" **Staff Commands Help**" +
|
||||
"\n" +
|
||||
"Click a number below for information about other commands.";
|
||||
embedBuilder.setTitle("Help", "http://rixa.io");
|
||||
embedBuilder.setTitle(String.format("Help: %s", title));
|
||||
embedBuilder.setDescription(stringBuilder);
|
||||
CommandHandler.getCommands().values().stream().filter(cmd -> cmd.getCommandAnnotation().type() == CommandType.ADMIN
|
||||
|| cmd.getCommandAnnotation().type() == CommandType.MOD)
|
||||
.forEach(cmd -> embedBuilder.addField(prefix, cmd.getCommandAnnotation().description(), false));
|
||||
.forEach(cmd -> embedBuilder.addField(prefix + cmd.getCommandAnnotation().mainCommand(), cmd.getCommandAnnotation().description(), false));
|
||||
message.editMessage(embedBuilder.build()).queue();
|
||||
break;
|
||||
case "\u0033\u20E3": // three emoji
|
||||
@ -66,14 +68,14 @@ public class HelpReaction implements React {
|
||||
" **Music Commands Help**" +
|
||||
"\n" +
|
||||
"Click a number below for information about other commands.";
|
||||
embedBuilder.setTitle("Help", "http://rixa.io");
|
||||
embedBuilder.setTitle(String.format("Help: %s", title));
|
||||
embedBuilder.setDescription(stringBuilder);
|
||||
embedBuilder.addField(prefix + "music join [name]", "Joins a voice channel that has the provided name", false)
|
||||
.addField(prefix + "music join [id]", "Joins a voice channel based on the provided id.", false)
|
||||
.addField(prefix + "music leave", "Leaves the voice channel that the bot is currently in.", false)
|
||||
.addField(prefix + "music play", "Plays songs from the current queue. Starts playing again if it was previously paused", false)
|
||||
.addField(prefix + "music play [url]", "Adds a new song to the queue and starts playing if it wasn't playing already", false)
|
||||
.addField(prefix + "music pplay", "Adds a playlist to the queue and starts playing if not already playing", false)
|
||||
.addField(prefix + "music playlist", "Adds a playlist to the queue and starts playing if not already playing", false)
|
||||
.addField(prefix + "music pause", "Pauses audio playback", false)
|
||||
.addField(prefix + "music stop", "Completely stops audio playback, skipping the current song.", false)
|
||||
.addField(prefix + "music skip", "Skips the current song, automatically starting the next", false)
|
||||
|
@ -0,0 +1,80 @@
|
||||
package me.savvy.rixa.modules.twitter;
|
||||
|
||||
import me.savvy.rixa.guild.RixaGuild;
|
||||
import twitter4j.*;
|
||||
import twitter4j.conf.ConfigurationBuilder;
|
||||
|
||||
/**
|
||||
* Created by savit on 7/9/2017.
|
||||
*/
|
||||
public class TwitterModule {
|
||||
|
||||
private final TwitterStream twitterStream;
|
||||
private ConfigurationBuilder configurationBuilder;
|
||||
private Twitter twitter;
|
||||
private TwitterFactory twitterFactory;
|
||||
private String consumerKey, consumerSecret, accessToken, accessTokenSecret;
|
||||
|
||||
public TwitterModule(RixaGuild rixaGuild, String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) {
|
||||
this.consumerKey = consumerKey;
|
||||
this.consumerSecret = consumerSecret;
|
||||
this.accessToken = accessToken;
|
||||
this.accessTokenSecret = accessTokenSecret;
|
||||
configurationBuilder = new ConfigurationBuilder()
|
||||
.setOAuthConsumerKey(getConsumerKey())
|
||||
.setOAuthConsumerSecret(getConsumerSecret())
|
||||
.setOAuthAccessToken(getAccessToken())
|
||||
.setOAuthAccessTokenSecret(getAccessTokenSecret());
|
||||
twitterFactory = new TwitterFactory(configurationBuilder.build());
|
||||
twitterStream = new TwitterStreamFactory().getInstance();
|
||||
twitter = twitterFactory.getInstance();
|
||||
}
|
||||
|
||||
public ConfigurationBuilder getConfigurationBuilder() {
|
||||
return configurationBuilder;
|
||||
}
|
||||
|
||||
public TwitterFactory getTwitterFactory() {
|
||||
return twitterFactory;
|
||||
}
|
||||
|
||||
public Twitter getTwitter() {
|
||||
return twitter;
|
||||
}
|
||||
|
||||
public String getConsumerKey() {
|
||||
return consumerKey;
|
||||
}
|
||||
|
||||
public void setConsumerKey(String consumerKey) {
|
||||
this.consumerKey = consumerKey;
|
||||
}
|
||||
|
||||
public String getConsumerSecret() {
|
||||
return consumerSecret;
|
||||
}
|
||||
|
||||
public void setConsumerSecret(String consumerSecret) {
|
||||
this.consumerSecret = consumerSecret;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getAccessTokenSecret() {
|
||||
return accessTokenSecret;
|
||||
}
|
||||
|
||||
public void setAccessTokenSecret(String accessTokenSecret) {
|
||||
this.accessTokenSecret = accessTokenSecret;
|
||||
}
|
||||
|
||||
public TwitterStream getTwitterStream() {
|
||||
return twitterStream;
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ public class MessageBuilder {
|
||||
}
|
||||
|
||||
public MessageBuilder setTitle(String title) {
|
||||
setTitle(title, "http://rixa.io/");
|
||||
builder.setTitle(title);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -37,6 +37,11 @@ public class MessageBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageBuilder addThumbnail(String url) {
|
||||
builder.setThumbnail(url);
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmbedBuilder getBuilder() {
|
||||
return builder;
|
||||
}
|
||||
|
57
src/main/java/me/savvy/rixa/utils/UrbanDictionary.java
Normal file
57
src/main/java/me/savvy/rixa/utils/UrbanDictionary.java
Normal file
@ -0,0 +1,57 @@
|
||||
package me.savvy.rixa.utils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Created by savit on 6/24/2017.
|
||||
*/
|
||||
public class UrbanDictionary {
|
||||
|
||||
private String wordToSearch;
|
||||
private String definition;
|
||||
private String permaLink;
|
||||
public UrbanDictionary(String wordToSearch) {
|
||||
this.wordToSearch = wordToSearch;
|
||||
}
|
||||
|
||||
public boolean search() throws IOException {
|
||||
URL url = new URL("http://api.urbandictionary.com/v0/define?term=" + wordToSearch);
|
||||
InputStream in = url.openStream();
|
||||
Scanner scan = new Scanner(in);
|
||||
String jsonString = "";
|
||||
while(scan.hasNext()){
|
||||
jsonString += scan.next() + " ";
|
||||
}
|
||||
scan.close();
|
||||
try {
|
||||
JSONObject obj = new JSONObject(jsonString.trim());
|
||||
JSONArray array = obj.getJSONArray("list");
|
||||
JSONObject newObj = array.getJSONObject(0);
|
||||
this.wordToSearch = newObj.getString("word");
|
||||
this.permaLink = newObj.getString("permalink");
|
||||
this.definition = newObj.getString("definition");
|
||||
return true;
|
||||
} catch(JSONException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPermaLink() {
|
||||
return permaLink;
|
||||
}
|
||||
|
||||
public String getWordToSearch() {
|
||||
return wordToSearch;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
}
|
7
src/main/java/me/savvy/rixa/utils/YoutubeSearch.java
Normal file
7
src/main/java/me/savvy/rixa/utils/YoutubeSearch.java
Normal file
@ -0,0 +1,7 @@
|
||||
package me.savvy.rixa.utils;
|
||||
|
||||
/**
|
||||
* Created by savit on 7/11/2017.
|
||||
*/
|
||||
public class YoutubeSearch {
|
||||
}
|
Loading…
Reference in New Issue
Block a user