Implement search for youtube / music

This commit is contained in:
Savvy 2017-07-11 21:56:47 -04:00
parent 25cd9f2b4c
commit 860251c46f
14 changed files with 465 additions and 82 deletions

View File

@ -45,7 +45,32 @@
<favorites_list name="Rixa" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="ConfigCommand.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/ConfigCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="442">
<caret line="41" column="0" lean-forward="true" selection-start-line="41" selection-start-column="0" selection-end-line="41" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="TwitterModule.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/twitter/TwitterModule.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-33">
<caret line="14" column="18" lean-forward="false" selection-start-line="14" selection-start-column="18" selection-end-line="14" selection-end-column="18" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2525#2526#0" expanded="true" />
<element signature="e#2557#2558#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
@ -510,12 +535,8 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/locale/Language.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/manager/org/json/JSONObject.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/manager/io/ThunderFile.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/manager/LanguageManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/DatabaseManager.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/Language.java" />
<option value="$PROJECT_DIR$/src/main/resources/config.json" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/json/JSONObject.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/thunderbolt/Thunderbolt.java" />
@ -546,21 +567,25 @@
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/action/Action.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/action/actions/MessageResponse.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/reactions/react/ConfigReaction.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/ConfigCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/MessageBuilder.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/MusicCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/UrbanDictionary.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/UrbanDictionaryCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/BotEvent.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/InfoCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/InviteCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/music/MusicModule.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/MessageEvent.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java" />
<option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/twitter/listeners/TwitterListeners.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/YoutubeSearch.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/WebUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/UrbanDictionaryCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/MusicCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/YoutubeCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/MessageEvent.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/Language.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/twitter/TwitterModule.java" />
<option value="$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/ConfigCommand.java" />
</list>
</option>
</component>
@ -656,6 +681,100 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="twitter" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="org.jetbrains.plugins.gradle.projectView.GradleTreeStructureProvider$GradleSourceSetDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="rixa" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="enums" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Rixa" />
@ -716,7 +835,7 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="general" />
<option name="myItemId" value="admin" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@ -1072,17 +1191,18 @@
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32932165" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32769555" sideWeight="0.5127932" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33615223" sideWeight="0.51458335" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.63424945" sideWeight="0.49573562" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33403805" sideWeight="0.48720682" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33403805" sideWeight="0.48541668" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.23958333" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.23958333" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
@ -1151,24 +1271,7 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="jar://C:/Program Files/Java/jdk1.8.0_101/src.zip!/java/sql/Connection.java" />
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/music/RixaMusic.java" />
<entry file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.sedmelluq/lavaplayer/1.2.39/8e8a26d38f2b50b251231f0d2483cf41a5b2f88/lavaplayer-1.2.39-sources.jar!/com/sedmelluq/discord/lavaplayer/source/nico/NicoAudioSourceManager.java" />
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/audio/RixaAudioReceiveHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="12" column="13" lean-forward="false" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.dv8tion/JDA/3.1.1_212/8edb52b94580eec7609d02f89317f3c411793cbe/JDA-3.1.1_212-sources.jar!/net/dv8tion/jda/core/managers/GuildManager.java" />
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="22" column="26" lean-forward="false" selection-start-line="22" selection-start-column="26" selection-end-line="22" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/Command.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="421">
@ -1331,13 +1434,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/MusicCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="602">
<caret line="273" column="26" lean-forward="false" selection-start-line="273" selection-start-column="26" selection-end-line="273" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/database/sql/DatabaseManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
@ -1352,13 +1448,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/ConfigCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-55">
<caret line="82" column="46" lean-forward="true" selection-start-line="82" selection-start-column="22" selection-end-line="82" selection-end-column="46" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/InfoCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
@ -1401,13 +1490,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/MessageEvent.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="51" column="5" lean-forward="false" selection-start-line="51" selection-start-column="5" selection-end-line="51" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
@ -1422,28 +1504,20 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-34">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/guild/RixaGuild.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="26" column="40" lean-forward="false" selection-start-line="26" selection-start-column="40" selection-end-line="26" selection-end-column="40" />
<folding>
<element signature="e#5297#5298#0" expanded="true" />
<element signature="e#5333#5334#0" expanded="true" />
<element signature="e#5398#5399#0" expanded="true" />
<element signature="e#5448#5449#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/twitter/listeners/TwitterListeners.java" />
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/twitter/TwitterModule.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="426">
<caret line="29" column="47" lean-forward="false" selection-start-line="29" selection-start-column="47" selection-end-line="29" selection-end-column="47" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="409">
@ -1452,26 +1526,120 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/UrbanDictionaryCommand.java">
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/WebUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="193">
<caret line="27" column="16" lean-forward="false" selection-start-line="27" selection-start-column="16" selection-end-line="27" selection-end-column="16" />
<folding />
<state relative-caret-position="680">
<caret line="40" column="5" lean-forward="false" selection-start-line="40" selection-start-column="5" selection-end-line="40" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/UrbanDictionary.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-118">
<caret line="14" column="13" lean-forward="false" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
<state relative-caret-position="201">
<caret line="19" column="11" lean-forward="false" selection-start-line="19" selection-start-column="11" selection-end-line="19" selection-end-column="11" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#437#438#0" expanded="true" />
<element signature="e#485#486#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/UrbanDictionaryCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="16" column="35" lean-forward="true" selection-start-line="16" selection-start-column="35" selection-end-line="16" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/utils/YoutubeSearch.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="193">
<caret line="13" column="13" lean-forward="false" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/MusicCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2381">
<caret line="348" column="0" lean-forward="false" selection-start-line="348" selection-start-column="0" selection-end-line="348" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/general/YoutubeCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="374">
<caret line="31" column="5" lean-forward="true" selection-start-line="31" selection-start-column="5" selection-end-line="31" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/handlers/CommandHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="13" column="23" lean-forward="false" selection-start-line="13" selection-start-column="23" selection-end-line="13" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/events/MessageEvent.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
<caret line="45" column="13" lean-forward="false" selection-start-line="45" selection-start-column="13" selection-end-line="45" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/enums/Result.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="5" column="26" lean-forward="false" selection-start-line="5" selection-start-column="26" selection-end-line="5" selection-end-column="26" />
<caret line="5" column="12" lean-forward="false" selection-start-line="5" selection-start-column="12" selection-end-line="5" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/data/locale/Language.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
<caret line="8" column="83" lean-forward="false" selection-start-line="8" selection-start-column="83" selection-end-line="8" selection-end-column="83" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/Rixa.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="137">
<caret line="118" column="32" lean-forward="true" selection-start-line="118" selection-start-column="32" selection-end-line="118" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/modules/twitter/TwitterModule.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-33">
<caret line="14" column="18" lean-forward="false" selection-start-line="14" selection-start-column="18" selection-end-line="14" selection-end-column="18" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2525#2526#0" expanded="true" />
<element signature="e#2557#2558#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/savvy/rixa/commands/admin/ConfigCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="442">
<caret line="41" column="0" lean-forward="true" selection-start-line="41" selection-start-column="0" selection-end-line="41" selection-end-column="0" />
<folding />
</state>
</provider>

View File

@ -2,6 +2,7 @@ package me.savvy.rixa;
import me.savvy.rixa.commands.admin.BatchMoveCommand;
import me.savvy.rixa.commands.admin.ConfigCommand;
import me.savvy.rixa.commands.admin.InviteCommand;
import me.savvy.rixa.commands.general.*;
import me.savvy.rixa.commands.handlers.CommandExec;
import me.savvy.rixa.commands.handlers.CommandHandler;
@ -88,7 +89,7 @@ public class Rixa {
new InfoCommand(), new ServerInfoCommand(), new HelpCommand(),
new DeleteMessagesCommand(), new PingCommand(), new PurgeMessagesCommand(),
new BatchMoveCommand(), new MuteCommand(), new MusicCommand(),
new ConfigCommand(), new UrbanDictionaryCommand(), /*new InviteCommand()*/});
new ConfigCommand(), new UrbanDictionaryCommand(), new YoutubeCommand()});
register(new React[] {new HelpReaction(), new ConfigReaction()});
data = new Data(DataType.SQL);
}

View File

@ -33,6 +33,13 @@ public class ConfigCommand implements CommandExec {
"%pconfig set defaultRole <role> ; Set role to be assigned when a user joins the server!",
"%pconfig set muteRole <role> ; Set role to be assigned when a user is muted!",
"%pconfig set musicRole <musicRole> ; Set role required to use the music functions! (Not required)",
"%pconfig set twitterCKey <key> ; Set Twitter Consumer Key!",
"%pconfig set twitterCSecret <key> ; Set Twitter Consumer Secret!",
"%pconfig set twitterAToken <key> ; Set Twitter Access Key!",
"%pconfig set twitterASecret <key> ; Set Twitter Access Secret!",
"%config set twitterChannel ; Set the channel for Twitter feed updates!",
"%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!",
@ -40,7 +47,8 @@ public class ConfigCommand implements CommandExec {
"%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!",
"%pconfig disable <module> ; Disable a Rixa Module!");
"%pconfig disable <module> ; Disable a Rixa Module!"
);
}
@Override
@Command(mainCommand = "config",

View File

@ -24,12 +24,14 @@ import me.savvy.rixa.guild.RixaManager;
import me.savvy.rixa.modules.music.MusicManager;
import me.savvy.rixa.modules.music.TrackScheduler;
import me.savvy.rixa.utils.MessageBuilder;
import me.savvy.rixa.utils.YoutubeSearch;
import net.dv8tion.jda.core.Permission;
import net.dv8tion.jda.core.entities.*;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.core.exceptions.PermissionException;
import java.awt.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -249,6 +251,18 @@ public class MusicCommand implements CommandExec {
new MessageBuilder(message[2] + " is not a valid integer. Try a number between 10 and 100.").setColor(event.getMember().getColor()).queue(event.getChannel());
}
}
} // music youtube <query
if(message.length >= 3) {
if(message[1].equalsIgnoreCase("youtube") || message[1].equalsIgnoreCase("yt") || message[1].equalsIgnoreCase("search")
|| message[1].equalsIgnoreCase("ytsearch")) {
String search = getMessage(message, 2);
try {
YoutubeSearch ytSearch = new YoutubeSearch(search);
loadAndPlay(mng, event.getChannel(), ytSearch.getUrl(0), false);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@ -323,4 +337,12 @@ public class MusicCommand implements CommandExec {
private void sendHelp() {
}
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();
}
}

View File

@ -16,7 +16,6 @@ import java.net.URLEncoder;
*/
public class UrbanDictionaryCommand implements CommandExec {
@Override
@Command(mainCommand = "urbandictionary",
aliases = {"ud"},

View File

@ -0,0 +1,41 @@
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.YoutubeSearch;
import net.dv8tion.jda.core.entities.ChannelType;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import java.io.IOException;
/**
* Created by savit on 7/11/2017.
*/
public class YoutubeCommand implements CommandExec {
@Override
@Command(mainCommand = "youtube",
aliases = {"yt"},
description = "Search youtube for music videos!",
channelType = ChannelType.TEXT)
public void execute(GuildMessageReceivedEvent event) {
String[] message = event.getMessage().getContent().split(" ");
String search = getMessage(message, 1);
try {
YoutubeSearch ytSearch = new YoutubeSearch(search);
new MessageBuilder(ytSearch.getUrl(0))
.setColor(event.getMember().getColor()).queue(event.getChannel());
} catch (IOException e) {
e.printStackTrace();
}
}
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();
}
}

View File

@ -44,7 +44,6 @@ 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();

View File

@ -13,9 +13,14 @@ public class TwitterModule {
private ConfigurationBuilder configurationBuilder;
private Twitter twitter;
private TwitterFactory twitterFactory;
private String consumerKey, consumerSecret, accessToken, accessTokenSecret;
private final RixaGuild rixaGuild;
private String consumerKey;
private String consumerSecret;
private String accessToken;
private String accessTokenSecret;
public TwitterModule(RixaGuild rixaGuild, String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) {
this.rixaGuild = rixaGuild;
this.consumerKey = consumerKey;
this.consumerSecret = consumerSecret;
this.accessToken = accessToken;
@ -77,4 +82,8 @@ public class TwitterModule {
public TwitterStream getTwitterStream() {
return twitterStream;
}
public RixaGuild getRixaGuild() {
return rixaGuild;
}
}

View File

@ -0,0 +1,42 @@
package me.savvy.rixa.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by savit on 7/11/2017.
*/
public class WebUtil {
public static String getWebPage(String url) throws IOException {
URL searchURL = new URL(url);
HttpURLConnection conn = (HttpURLConnection) searchURL.openConnection();
return getWebPage(conn);
}
public static String getWebPage(HttpURLConnection conn) throws IOException {
StringBuilder sb = new StringBuilder();
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
conn.setRequestProperty("Referer", "http://www.google.com");
int response = conn.getResponseCode();
if (response == 403) {
System.out.println("Quota Exceeded");
}
else if (response != 200) {
System.out.println("DEBUG: Response code: " + response);
}
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
sb.append(line).append("\n");
}
in.close();
return sb.toString();
}
}

View File

@ -1,7 +1,101 @@
package me.savvy.rixa.utils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
/**
* Created by savit on 7/11/2017.
*/
public class YoutubeSearch {
private static final String API_KEY;
private JSONArray items;
private final String YOUTUBE_WATCH_BASE_URL = "https://www.youtube.com/watch?v=";
static {
API_KEY = "AIzaSyD1wjRGbzKgvjqAU25pREy1dVio9WpcuS0";
}
public YoutubeSearch(String query) throws IOException {
try {
String url = "https://www.googleapis.com/youtube/v3/search?"
+ "q=" + URLEncoder.encode(query, "UTF-8")
+ "&part=id%2Csnippet"
+ "&safeSearch=none"
+ "&key=" + API_KEY;
search(url);
}
catch (UnsupportedEncodingException ignored) {}
}
public String getKind(int index) {
return items.getJSONObject(index).getString("kind");
}
public String getIdKind(int index) {
return items.getJSONObject(index).getJSONObject("id").getString("kind");
}
public String getVideoId(int index) {
return items.getJSONObject(index).getJSONObject("id").getString("videoId");
}
public String getPublishedTime(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getString("publishedAt");
}
public String getChannelId(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getString("channelId");
}
public String getTitle(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getString("title");
}
public String getDescription(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getString("description");
}
public String getChannelTitle(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getString("channelTitle");
}
public String getLiveBroadcastContent(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getString("liveBroadcastContent");
}
public String getThumbnailDefaultUrl(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getJSONObject("default").getString("url");
}
public String getThumbnailMediumUrl(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getJSONObject("medium").getString("url");
}
public String getThumbnailHighUrl(int index) {
return items.getJSONObject(index).getJSONObject("snippet").getJSONObject("high").getString("url");
}
public String getUrl(int index) {
return YOUTUBE_WATCH_BASE_URL + getVideoId(index);
}
private void search(String url) throws IOException {
String json = WebUtil.getWebPage(url);
JSONObject obj = new JSONObject(json);
try {
items = obj.getJSONArray("items");
}
catch (JSONException e) {
System.out.println("No search results found.");// throw new NotFoundException("No results found.");
}
}
}