Browse Source

Initial code

master
Rubenlagus 11 years ago
commit
0358ec5e3b
  1. BIN
      .DS_Store
  2. 1
      .idea/.name
  3. 32
      .idea/compiler.xml
  4. 3
      .idea/copyright/profiles_settings.xml
  5. 7
      .idea/encodings.xml
  6. 39
      .idea/inspectionProfiles/Project_Default.xml
  7. 7
      .idea/inspectionProfiles/profiles_settings.xml
  8. 71
      .idea/jsLinters/jshint.xml
  9. 13
      .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_1.xml
  10. 13
      .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_1.xml
  11. 13
      .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_1.xml
  12. 13
      .idea/libraries/Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_base_2_5_1.xml
  13. 13
      .idea/libraries/Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_json_provider_2_5_1.xml
  14. 13
      .idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_5_1.xml
  15. 13
      .idea/libraries/Maven__com_sun_jersey_jersey_bundle_1_19.xml
  16. 13
      .idea/libraries/Maven__com_sun_jersey_jersey_core_1_19.xml
  17. 13
      .idea/libraries/Maven__com_sun_jersey_jersey_grizzly2_1_19.xml
  18. 13
      .idea/libraries/Maven__com_sun_jersey_jersey_grizzly2_servlet_1_19.xml
  19. 13
      .idea/libraries/Maven__com_sun_jersey_jersey_server_1_19.xml
  20. 13
      .idea/libraries/Maven__com_sun_jersey_jersey_servlet_1_19.xml
  21. 13
      .idea/libraries/Maven__commons_codec_commons_codec_1_9.xml
  22. 13
      .idea/libraries/Maven__commons_io_commons_io_2_4.xml
  23. 13
      .idea/libraries/Maven__commons_logging_commons_logging_1_2.xml
  24. 13
      .idea/libraries/Maven__javax_annotation_javax_annotation_api_1_2.xml
  25. 13
      .idea/libraries/Maven__javax_servlet_javax_servlet_api_3_0_1.xml
  26. 13
      .idea/libraries/Maven__javax_validation_validation_api_1_1_0_Final.xml
  27. 13
      .idea/libraries/Maven__javax_ws_rs_javax_ws_rs_api_2_0_1.xml
  28. 13
      .idea/libraries/Maven__javax_ws_rs_jsr311_api_1_1_1.xml
  29. 13
      .idea/libraries/Maven__mysql_mysql_connector_java_5_1_35.xml
  30. 13
      .idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5.xml
  31. 13
      .idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_1.xml
  32. 13
      .idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5.xml
  33. 13
      .idea/libraries/Maven__org_glassfish_grizzly_grizzly_framework_2_3_19.xml
  34. 13
      .idea/libraries/Maven__org_glassfish_grizzly_grizzly_http_2_3_19.xml
  35. 13
      .idea/libraries/Maven__org_glassfish_grizzly_grizzly_http_server_2_3_19.xml
  36. 13
      .idea/libraries/Maven__org_glassfish_grizzly_grizzly_http_servlet_2_2_16.xml
  37. 13
      .idea/libraries/Maven__org_glassfish_hk2_external_aopalliance_repackaged_2_4_0_b12.xml
  38. 13
      .idea/libraries/Maven__org_glassfish_hk2_external_javax_inject_2_4_0_b12.xml
  39. 13
      .idea/libraries/Maven__org_glassfish_hk2_hk2_api_2_4_0_b12.xml
  40. 13
      .idea/libraries/Maven__org_glassfish_hk2_hk2_locator_2_4_0_b12.xml
  41. 13
      .idea/libraries/Maven__org_glassfish_hk2_hk2_utils_2_4_0_b12.xml
  42. 13
      .idea/libraries/Maven__org_glassfish_hk2_osgi_resource_locator_1_0_1.xml
  43. 13
      .idea/libraries/Maven__org_glassfish_jersey_bundles_repackaged_jersey_guava_2_18.xml
  44. 13
      .idea/libraries/Maven__org_glassfish_jersey_containers_jersey_container_grizzly2_http_2_18.xml
  45. 13
      .idea/libraries/Maven__org_glassfish_jersey_core_jersey_client_2_18.xml
  46. 13
      .idea/libraries/Maven__org_glassfish_jersey_core_jersey_common_2_18.xml
  47. 13
      .idea/libraries/Maven__org_glassfish_jersey_core_jersey_server_2_18.xml
  48. 13
      .idea/libraries/Maven__org_glassfish_jersey_ext_jersey_entity_filtering_2_18.xml
  49. 13
      .idea/libraries/Maven__org_glassfish_jersey_media_jersey_media_jaxb_2_18.xml
  50. 13
      .idea/libraries/Maven__org_glassfish_jersey_media_jersey_media_json_jackson_2_18.xml
  51. 13
      .idea/libraries/Maven__org_javassist_javassist_3_18_1_GA.xml
  52. 13
      .idea/libraries/Maven__org_json_json_20141113.xml
  53. 13
      .idea/libraries/Maven__org_jsoup_jsoup_1_8_2.xml
  54. 77
      .idea/misc.xml
  55. 8
      .idea/modules.xml
  56. 124
      .idea/uiDesigner.xml
  57. 6
      .idea/vcs.xml
  58. 1671
      .idea/workspace.xml
  59. 60
      BotAPi.iml
  60. 165
      pom.xml
  61. BIN
      src/.DS_Store
  62. BIN
      src/main/.DS_Store
  63. BIN
      src/main/java/.DS_Store
  64. 14
      src/main/java/org/telegram/BotConfig.java
  65. 28
      src/main/java/org/telegram/BuildVars.java
  66. 43
      src/main/java/org/telegram/Commands.java
  67. 52
      src/main/java/org/telegram/CustomMessages.java
  68. 19
      src/main/java/org/telegram/Main.java
  69. 137
      src/main/java/org/telegram/SenderHelper.java
  70. 70
      src/main/java/org/telegram/api/Audio.java
  71. 73
      src/main/java/org/telegram/api/Chat.java
  72. 38
      src/main/java/org/telegram/api/Contact.java
  73. 82
      src/main/java/org/telegram/api/Document.java
  74. 71
      src/main/java/org/telegram/api/ForceReply.java
  75. 46
      src/main/java/org/telegram/api/Location.java
  76. 339
      src/main/java/org/telegram/api/Message.java
  77. 70
      src/main/java/org/telegram/api/PhotoSize.java
  78. 13
      src/main/java/org/telegram/api/ReplyKeyboard.java
  79. 66
      src/main/java/org/telegram/api/ReplyKeyboardHide.java
  80. 116
      src/main/java/org/telegram/api/ReplyKeyboardMarkup.java
  81. 42
      src/main/java/org/telegram/api/Sticker.java
  82. 55
      src/main/java/org/telegram/api/Update.java
  83. 54
      src/main/java/org/telegram/api/User.java
  84. 43
      src/main/java/org/telegram/api/UserProfilePhotos.java
  85. 117
      src/main/java/org/telegram/api/Video.java
  86. 112
      src/main/java/org/telegram/database/ConectionDB.java
  87. 93
      src/main/java/org/telegram/database/CreationStrings.java
  88. 320
      src/main/java/org/telegram/database/DatabaseManager.java
  89. 11
      src/main/java/org/telegram/methods/Constants.java
  90. 46
      src/main/java/org/telegram/methods/ForwardMessage.java
  91. 12
      src/main/java/org/telegram/methods/GetMe.java
  92. 63
      src/main/java/org/telegram/methods/GetUpdates.java
  93. 57
      src/main/java/org/telegram/methods/GetUserProfilePhotos.java
  94. 29
      src/main/java/org/telegram/methods/SendAudio.java
  95. 31
      src/main/java/org/telegram/methods/SendChatAction.java
  96. 76
      src/main/java/org/telegram/methods/SendDocument.java
  97. 24
      src/main/java/org/telegram/methods/SendLocation.java
  98. 68
      src/main/java/org/telegram/methods/SendMessage.java
  99. 29
      src/main/java/org/telegram/methods/SendPhoto.java
  100. 22
      src/main/java/org/telegram/methods/SendSticker.java

BIN
.DS_Store

Binary file not shown.

1
.idea/.name

@ -0,0 +1 @@
BotAPi

32
.idea/compiler.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
<profile default="false" name="Annotation profile for BotAPi" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="BotAPi" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="1.8">
<module name="BotAPi" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

3
.idea/copyright/profiles_settings.xml

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

7
.idea/encodings.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

39
.idea/inspectionProfiles/Project_Default.xml

@ -0,0 +1,39 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<option name="myLocal" value="true" />
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="JSLint" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date,brief" />
</inspection_tool>
</profile>
</component>

7
.idea/inspectionProfiles/profiles_settings.xml

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

71
.idea/jsLinters/jshint.xml

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSHintConfiguration" version="2.6.3" use-config-file="false">
<option asi="false" />
<option bitwise="false" />
<option boss="false" />
<option browser="true" />
<option camelcase="true" />
<option couch="false" />
<option curly="true" />
<option debug="false" />
<option devel="false" />
<option dojo="false" />
<option eqeqeq="true" />
<option eqnull="false" />
<option es3="false" />
<option esnext="false" />
<option evil="false" />
<option expr="false" />
<option forin="true" />
<option freeze="false" />
<option funcscope="false" />
<option gcl="false" />
<option globalstrict="false" />
<option immed="false" />
<option iterator="false" />
<option jquery="false" />
<option lastsemic="false" />
<option latedef="true" />
<option laxbreak="false" />
<option laxcomma="false" />
<option loopfunc="false" />
<option maxerr="50" />
<option maxlen="80" />
<option mootools="false" />
<option moz="false" />
<option multistr="false" />
<option newcap="false" />
<option noarg="true" />
<option node="false" />
<option noempty="true" />
<option nomen="false" />
<option nonbsp="true" />
<option nonew="true" />
<option nonstandard="false" />
<option notypeof="false" />
<option noyield="false" />
<option onevar="false" />
<option passfail="false" />
<option phantom="false" />
<option plusplus="false" />
<option proto="false" />
<option prototypejs="false" />
<option quotmark="false" />
<option rhino="false" />
<option scripturl="false" />
<option shadow="false" />
<option smarttabs="false" />
<option strict="true" />
<option sub="false" />
<option supernew="false" />
<option trailing="true" />
<option undef="true" />
<option unused="true" />
<option validthis="false" />
<option white="false" />
<option worker="false" />
<option wsh="false" />
<option yui="false" />
</component>
</project>

13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.5.1/jackson-annotations-2.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.5.1/jackson-annotations-2.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.5.1/jackson-annotations-2.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-core:2.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.5.1/jackson-core-2.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.5.1/jackson-core-2.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.5.1/jackson-core-2.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-databind:2.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.5.1/jackson-databind-2.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.5.1/jackson-databind-2.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.5.1/jackson-databind-2.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_base_2_5_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.5.1/jackson-jaxrs-base-2.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.5.1/jackson-jaxrs-base-2.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.5.1/jackson-jaxrs-base-2.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_json_provider_2_5_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.5.1/jackson-jaxrs-json-provider-2.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.5.1/jackson-jaxrs-json-provider-2.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.5.1/jackson-jaxrs-json-provider-2.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_5_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.5.1/jackson-module-jaxb-annotations-2.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.5.1/jackson-module-jaxb-annotations-2.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.5.1/jackson-module-jaxb-annotations-2.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_sun_jersey_jersey_bundle_1_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sun.jersey:jersey-bundle:1.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-bundle/1.19/jersey-bundle-1.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-bundle/1.19/jersey-bundle-1.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-bundle/1.19/jersey-bundle-1.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_sun_jersey_jersey_core_1_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sun.jersey:jersey-core:1.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-core/1.19/jersey-core-1.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-core/1.19/jersey-core-1.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-core/1.19/jersey-core-1.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_sun_jersey_jersey_grizzly2_1_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sun.jersey:jersey-grizzly2:1.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-grizzly2/1.19/jersey-grizzly2-1.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-grizzly2/1.19/jersey-grizzly2-1.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-grizzly2/1.19/jersey-grizzly2-1.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_sun_jersey_jersey_grizzly2_servlet_1_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sun.jersey:jersey-grizzly2-servlet:1.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-grizzly2-servlet/1.19/jersey-grizzly2-servlet-1.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-grizzly2-servlet/1.19/jersey-grizzly2-servlet-1.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-grizzly2-servlet/1.19/jersey-grizzly2-servlet-1.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_sun_jersey_jersey_server_1_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sun.jersey:jersey-server:1.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-server/1.19/jersey-server-1.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-server/1.19/jersey-server-1.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-server/1.19/jersey-server-1.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__com_sun_jersey_jersey_servlet_1_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sun.jersey:jersey-servlet:1.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-servlet/1.19/jersey-servlet-1.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-servlet/1.19/jersey-servlet-1.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-servlet/1.19/jersey-servlet-1.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: commons-codec:commons-codec:1.9">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__commons_io_commons_io_2_4.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: commons-io:commons-io:2.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: commons-logging:commons-logging:1.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__javax_annotation_javax_annotation_api_1_2.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.annotation:javax.annotation-api:1.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_0_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.servlet:javax.servlet-api:3.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__javax_validation_validation_api_1_1_0_Final.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.validation:validation-api:1.1.0.Final">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__javax_ws_rs_javax_ws_rs_api_2_0_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.ws.rs:javax.ws.rs-api:2.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__javax_ws_rs_jsr311_api_1_1_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.ws.rs:jsr311-api:1.1.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__mysql_mysql_connector_java_5_1_35.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: mysql:mysql-connector-java:5.1.35">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.35/mysql-connector-java-5.1.35.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.35/mysql-connector-java-5.1.35-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/5.1.35/mysql-connector-java-5.1.35-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.httpcomponents:httpclient:4.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5/httpclient-4.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5/httpclient-4.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5/httpclient-4.5-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.httpcomponents:httpcore:4.4.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.httpcomponents:httpmime:4.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5/httpmime-4.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5/httpmime-4.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5/httpmime-4.5-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_grizzly_grizzly_framework_2_3_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.grizzly:grizzly-framework:2.3.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-framework/2.3.19/grizzly-framework-2.3.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-framework/2.3.19/grizzly-framework-2.3.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-framework/2.3.19/grizzly-framework-2.3.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_grizzly_grizzly_http_2_3_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.grizzly:grizzly-http:2.3.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http/2.3.19/grizzly-http-2.3.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http/2.3.19/grizzly-http-2.3.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http/2.3.19/grizzly-http-2.3.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_grizzly_grizzly_http_server_2_3_19.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.grizzly:grizzly-http-server:2.3.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http-server/2.3.19/grizzly-http-server-2.3.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http-server/2.3.19/grizzly-http-server-2.3.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http-server/2.3.19/grizzly-http-server-2.3.19-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_grizzly_grizzly_http_servlet_2_2_16.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.grizzly:grizzly-http-servlet:2.2.16">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http-servlet/2.2.16/grizzly-http-servlet-2.2.16.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http-servlet/2.2.16/grizzly-http-servlet-2.2.16-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/grizzly/grizzly-http-servlet/2.2.16/grizzly-http-servlet-2.2.16-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_hk2_external_aopalliance_repackaged_2_4_0_b12.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.4.0-b12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/aopalliance-repackaged/2.4.0-b12/aopalliance-repackaged-2.4.0-b12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/aopalliance-repackaged/2.4.0-b12/aopalliance-repackaged-2.4.0-b12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/aopalliance-repackaged/2.4.0-b12/aopalliance-repackaged-2.4.0-b12-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_hk2_external_javax_inject_2_4_0_b12.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2.external:javax.inject:2.4.0-b12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/javax.inject/2.4.0-b12/javax.inject-2.4.0-b12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/javax.inject/2.4.0-b12/javax.inject-2.4.0-b12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/javax.inject/2.4.0-b12/javax.inject-2.4.0-b12-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_hk2_hk2_api_2_4_0_b12.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:hk2-api:2.4.0-b12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-api/2.4.0-b12/hk2-api-2.4.0-b12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-api/2.4.0-b12/hk2-api-2.4.0-b12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-api/2.4.0-b12/hk2-api-2.4.0-b12-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_hk2_hk2_locator_2_4_0_b12.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:hk2-locator:2.4.0-b12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-locator/2.4.0-b12/hk2-locator-2.4.0-b12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-locator/2.4.0-b12/hk2-locator-2.4.0-b12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-locator/2.4.0-b12/hk2-locator-2.4.0-b12-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_hk2_hk2_utils_2_4_0_b12.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:hk2-utils:2.4.0-b12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-utils/2.4.0-b12/hk2-utils-2.4.0-b12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-utils/2.4.0-b12/hk2-utils-2.4.0-b12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-utils/2.4.0-b12/hk2-utils-2.4.0-b12-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_hk2_osgi_resource_locator_1_0_1.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_bundles_repackaged_jersey_guava_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.bundles.repackaged:jersey-guava:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.18/jersey-guava-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.18/jersey-guava-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.18/jersey-guava-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_containers_jersey_container_grizzly2_http_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.containers:jersey-container-grizzly2-http:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/containers/jersey-container-grizzly2-http/2.18/jersey-container-grizzly2-http-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/containers/jersey-container-grizzly2-http/2.18/jersey-container-grizzly2-http-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/containers/jersey-container-grizzly2-http/2.18/jersey-container-grizzly2-http-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_core_jersey_client_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.core:jersey-client:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-client/2.18/jersey-client-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-client/2.18/jersey-client-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-client/2.18/jersey-client-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_core_jersey_common_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.core:jersey-common:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-common/2.18/jersey-common-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-common/2.18/jersey-common-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-common/2.18/jersey-common-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_core_jersey_server_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.core:jersey-server:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-server/2.18/jersey-server-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-server/2.18/jersey-server-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-server/2.18/jersey-server-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_ext_jersey_entity_filtering_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.ext:jersey-entity-filtering:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/ext/jersey-entity-filtering/2.18/jersey-entity-filtering-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/ext/jersey-entity-filtering/2.18/jersey-entity-filtering-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/ext/jersey-entity-filtering/2.18/jersey-entity-filtering-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_media_jersey_media_jaxb_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.media:jersey-media-jaxb:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/media/jersey-media-jaxb/2.18/jersey-media-jaxb-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/media/jersey-media-jaxb/2.18/jersey-media-jaxb-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/media/jersey-media-jaxb/2.18/jersey-media-jaxb-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_glassfish_jersey_media_jersey_media_json_jackson_2_18.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.media:jersey-media-json-jackson:2.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/media/jersey-media-json-jackson/2.18/jersey-media-json-jackson-2.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/media/jersey-media-json-jackson/2.18/jersey-media-json-jackson-2.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/media/jersey-media-json-jackson/2.18/jersey-media-json-jackson-2.18-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_javassist_javassist_3_18_1_GA.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.javassist:javassist:3.18.1-GA">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_json_json_20141113.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.json:json:20141113">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20141113/json-20141113.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20141113/json-20141113-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20141113/json-20141113-sources.jar!/" />
</SOURCES>
</library>
</component>

13
.idea/libraries/Maven__org_jsoup_jsoup_1_8_2.xml

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jsoup:jsoup:1.8.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jsoup/jsoup/1.8.2/jsoup-1.8.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jsoup/jsoup/1.8.2/jsoup-1.8.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jsoup/jsoup/1.8.2/jsoup-1.8.2-sources.jar!/" />
</SOURCES>
</library>
</component>

77
.idea/misc.xml

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ClientPropertiesManager">
<properties class="javax.swing.AbstractButton">
<property name="hideActionText" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JComponent">
<property name="html.disable" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JEditorPane">
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
<property name="charset" class="java.lang.String" />
</properties>
<properties class="javax.swing.JList">
<property name="List.isFileList" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JPasswordField">
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JSlider">
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
<property name="JSlider.isFilled" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTable">
<property name="Table.isFileList" class="java.lang.Boolean" />
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JToolBar">
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTree">
<property name="JTree.lineStyle" class="java.lang.String" />
</properties>
<properties class="javax.swing.text.JTextComponent">
<property name="caretAspectRatio" class="java.lang.Double" />
<property name="caretWidth" class="java.lang.Integer" />
</properties>
</component>
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="JSLintConfiguration" json="true">
<option indent="4" />
<option maxerr="50" />
<option maxlen="80" />
<option todo="true" />
<option unparam="true" />
<option vars="true" />
<option white="true" />
</component>
<component name="JsBowerSettings">
<exe-path>/usr/local/bin/bower</exe-path>
<config-path />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</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="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/BotAPi.iml" filepath="$PROJECT_DIR$/BotAPi.iml" />
</modules>
</component>
</project>

124
.idea/uiDesigner.xml

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

1671
.idea/workspace.xml

File diff suppressed because it is too large

60
BotAPi.iml

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.containers:jersey-container-grizzly2-http:2.18" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:javax.inject:2.4.0-b12" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http-server:2.3.19" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http:2.3.19" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-framework:2.3.19" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.18" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.bundles.repackaged:jersey-guava:2.18" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.4.0-b12" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.4.0-b12" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.4.0-b12" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.4.0-b12" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.18.1-GA" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-server:2.18" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.18" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-jaxb:2.18" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-json-jackson:2.18" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.ext:jersey-entity-filtering:2.18" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.5.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.5.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.5.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.5.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.5.1" level="project" />
<orderEntry type="library" name="Maven: com.sun.jersey:jersey-bundle:1.19" level="project" />
<orderEntry type="library" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
<orderEntry type="library" name="Maven: com.sun.jersey:jersey-grizzly2-servlet:1.19" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http-servlet:2.2.16" level="project" />
<orderEntry type="library" name="Maven: com.sun.jersey:jersey-grizzly2:1.19" level="project" />
<orderEntry type="library" name="Maven: com.sun.jersey:jersey-server:1.19" level="project" />
<orderEntry type="library" name="Maven: com.sun.jersey:jersey-core:1.19" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
<orderEntry type="library" name="Maven: com.sun.jersey:jersey-servlet:1.19" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20141113" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.1" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.35" level="project" />
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.8.2" level="project" />
</component>
</module>

165
pom.xml

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>BotApi</groupId>
<artifactId>org.telegram.botapi</artifactId>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jersey.version>2.18</jersey.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly2-servlet</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20141113</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
<build>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>org.telegram.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.telegram.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

BIN
src/.DS_Store

Binary file not shown.

BIN
src/main/.DS_Store

Binary file not shown.

BIN
src/main/java/.DS_Store

Binary file not shown.

14
src/main/java/org/telegram/BotConfig.java

@ -0,0 +1,14 @@
package org.telegram;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Bots configurations
* @date 20 of June of 2015
*/
public class BotConfig {
public static final String TOKENWEATHER = "<BOT TOKEN>";
public static final String TOKENTRANSIFEX = "<BOT TOKEN>";
public static final String TOKENFILES = "<BOT TOKEN>";
public static final String TOKENDIRECTIONS = "<BOT TOKEN>";
}

28
src/main/java/org/telegram/BuildVars.java

@ -0,0 +1,28 @@
package org.telegram;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Custom build vars FILL EVERYTHING CORRECTLY
* @date 20 of June of 2015
*/
public class BuildVars {
public static final Boolean debug = true;
public static final Boolean useWebHook = true;
public static final String BASEWEBHOOKURL = "http://YOUREXTERNALADDRES";
public static final String INTERNALWEBHOOKURL = "http://localhost";
public static final String OPENWEATHERAPIKEY = "<your-api-key>";
public static final String DirectionsApiKey = "<your-api-key>";
public static final String TRANSIFEXUSER = "<transifex-user>";
public static final String TRANSIFEXPASSWORD = "<transifex-password>";
public static final String pathToLogs = "./";
public static final String linkDB = "jdbc:mysql://localhost:3306/YOURDATABSENAME?useUnicode=true&characterEncoding=UTF-8";
public static final String controllerDB = "com.mysql.jdbc.Driver";
public static final String userDB = "<your-database-user>";
public static final String password = "<your-databas-user-password>";
}

43
src/main/java/org/telegram/Commands.java

@ -0,0 +1,43 @@
package org.telegram;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Command for the bots
* @date 20 of June of 2015
*/
public class Commands {
public static final String commandInitChar = "/";
/// Weather forecast command
public static final String WEATHERCOMMAND = commandInitChar + "weather";
/// Current wether command
public static final String CURRENTWEATHERCOMMAND = commandInitChar + "current";
/// Transifex iOS command
public static final String transifexiOSCommand = commandInitChar + "langios";
/// Transifex android command
public static final String transifexAndroidCommand = commandInitChar + "langdroid";
/// Transifex android command
public static final String transifexTDesktop = commandInitChar + "langdesk";
/// Transifex android command
public static final String transifexWebogram = commandInitChar + "langweb";
/// Transifex android command
public static final String transifexWP = commandInitChar + "langwp";
/// Transifex android command
public static final String transifexOSX = commandInitChar + "langosx";
/// Transifex android support command
public static final String transifexAndroidSupportCommand = commandInitChar + "langtestdroid";
/// Help command
public static final String help = commandInitChar + "help";
/// Upload command
public static final String uploadCommand = commandInitChar + "upload";
/// Start command
public static final String startCommand = commandInitChar + "start";
/// Cancel command
public static final String cancelCommand = commandInitChar + "cancel";
/// Delete command
public static final String deleteCommand = commandInitChar + "delete";
/// List command
public static final String listCommand = commandInitChar + "list";
/// Start directions command
public static final String startDirectionCommand = commandInitChar + "directions";
}

52
src/main/java/org/telegram/CustomMessages.java

@ -0,0 +1,52 @@
package org.telegram;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Custom messages to be sent to the user
* @date 21 of June of 2015
*/
public class CustomMessages {
public static final String helpWeather = "Curious about the weather?\nJust send me these commands and you'll know a lot better.\n\n" +
"|-- " + Commands.WEATHERCOMMAND + " CITY,COUNTRY : Get a 3-day weather forecast for a city.\n" +
"|-- " + Commands.CURRENTWEATHERCOMMAND + " CITY,COUNTRY : Get the current weather of a city.\n" +
"|-- Send a location to get the forecast for it.";
public static final String helpTransifex = "Tricks with words is the game that I play, give it a shot, I might make your day.\n\n" +
"To get the latest Telegram localization file for a language: \n" +
"|-- " + Commands.transifexiOSCommand + " LANG_CODE : Get the latest iOS language.\n" +
"|-- " + Commands.transifexAndroidCommand + " LANG_CODE : Get the latest android language.\n" +
"|-- " + Commands.transifexWebogram + " LANG_CODE : Get the latest webogram language.\n" +
"|-- " + Commands.transifexiOSCommand + " LANG_CODE : Get the latest iOS language.\n" +
"|-- " + Commands.transifexAndroidCommand + " LANG_CODE : Get the latest android language.\n" +
"|-- " + Commands.transifexWebogram + " LANG_CODE : Get the latest webogram language.\n" +
"|-- " + Commands.transifexTDesktop + " LANG_CODE : Get the latest Tdesktop language.\n" +
"|-- " + Commands.transifexOSX + " LANG_CODE : Get the latest OSX-App language.\n" +
"|-- " + Commands.transifexWP + " LANG_CODE : Get the latest Windows Phone language.\n\n" +
"2. To get an updated localization file for your Android beta-app: \n" +
"|-- " + Commands.transifexAndroidSupportCommand + " LANG_CODE : Get the latest Android-beta language.\n\n";
public static final String helpFiles = "Leaving a file for some others to find? Just dock your boat here and a bay comes to mind.\n\n"+
"Share files through a custom link: \n" +
"|-- " + Commands.startCommand + " FILEID : Get a file by id.\n" +
"|-- " + Commands.uploadCommand + " : Start your file upload.\n" +
"|-- " + Commands.deleteCommand + " : Choose one of your files to delete it.\n" +
"|-- " + Commands.listCommand + " : Show a list of your shared files.\n\n";
public static final String helpDirections = "The road ahead, paved with good intentions, the right path ahead however is what I tend to mention.\n\n" +
"To get directions between two locations: \n" +
"|-- " + Commands.startDirectionCommand + " : Start to get directions\n";
public static final String sendFileToUpload = "Please send me a file you want to share. Make sure you attach it as file, not as an image or video.";
public static final String fileUploaded = "Great, your file has been uploaded. Send this link to anyone you want and they will be able to download the file:\n\n";
public static final String deleteUploadedFile = "Please select the file you want to delete:";
public static final String fileDeleted = "The file was deleted";
public static final String wrongFileId = "Sorry, we can't find a file with that ID. Either a typo was made or it was deleted already.";
public static final String listOfFiles = "This your currently shared files list:";
public static final String noFiles = "You haven't shared any file yet.";
public static final String processFinished = "The current process was cancelled.";
public static final String uploadedFileURL = "https://telegram.me/filesbot?start=";
public static final String chooseFromRecentWeather = "Please choose an option from your recent requests:";
public static final String initDirections = "Please reply with your departing location.";
public static final String sendDestination = "Please reply with your destination.";
public static final String youNeedReplyDirections = "I'm sorry, I can't help you unless you reply to the message I sent you.";
public static final String pleaseSendMeCityWeather = "Send me the city and country you are interested in, use this format: CITY,COUNTRY";
}

19
src/main/java/org/telegram/Main.java

@ -0,0 +1,19 @@
package org.telegram;
import org.telegram.updateshandlers.*;
import org.telegram.updatesreceivers.UpdatesThread;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Main class to create all bots
* @date 20 of June of 2015
*/
public class Main {
public static void main(String[] args) {
UpdatesCallback weatherBot = new WeatherHandlers();
UpdatesCallback transifexBot = new TransifexHandlers();
UpdatesCallback filesBot = new FilesHandlers();
UpdatesCallback directionsBot = new DirectionsHandlers();
}
}

137
src/main/java/org/telegram/SenderHelper.java

@ -0,0 +1,137 @@
package org.telegram;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.telegram.api.Message;
import org.telegram.methods.Constants;
import org.telegram.methods.SendDocument;
import org.telegram.methods.SendMessage;
import org.telegram.methods.SetWebhook;
import java.io.File;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Send Helper
* @date 20 of June of 2015
*/
public class SenderHelper {
public static Message SendMessage(SendMessage message, String botToken) {
try {
CloseableHttpClient httpclient = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
String url = Constants.BASEURL + botToken + "/" + SendMessage.PATH;
HttpPost httppost = new HttpPost(url);
httppost.addHeader("Content-type", "application/x-www-form-urlencoded");
httppost.addHeader("charset", "UTF-8");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair(SendMessage.CHATID_FIELD, message.getChatId().toString()));
nameValuePairs.add(new BasicNameValuePair(SendMessage.TEXT_FIELD, message.getText()));
if (message.getDisableWebPagePreview() != null) {
nameValuePairs.add(new BasicNameValuePair(SendMessage.DISABLEWEBPAGEPREVIEW_FIELD, message.getDisableWebPagePreview().toString()));
}
if (message.getReplayMarkup() != null) {
nameValuePairs.add(new BasicNameValuePair(SendMessage.REPLYMARKUP_FIELD, message.getReplayMarkup().toJson().toString()));
}
if (message.getReplayToMessageId() != null) {
nameValuePairs.add(new BasicNameValuePair(SendMessage.REPLYTOMESSAGEID_FIELD, message.getReplayToMessageId().toString()));
}
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
CloseableHttpResponse response = httpclient.execute(httppost);
HttpEntity ht = response.getEntity();
BufferedHttpEntity buf = new BufferedHttpEntity(ht);
String responseContent = EntityUtils.toString(buf, "UTF-8");
JSONObject jsonObject = new JSONObject(responseContent);
if (!jsonObject.getBoolean("ok")) {
throw new InvalidObjectException(jsonObject.toString());
}
JSONObject jsonMessage = jsonObject.getJSONObject("result");
return new Message(jsonMessage);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static void SendDocument(SendDocument sendDocument, String botToken) {
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = Constants.BASEURL + botToken + "/" + SendDocument.PATH;
HttpPost httppost = new HttpPost(url);
if (sendDocument.isNewDocument()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendDocument.CHATID_FIELD, sendDocument.getChatId().toString());
builder.addBinaryBody(SendDocument.DOCUMENT_FIELD, new File(sendDocument.getDocument()), ContentType.APPLICATION_OCTET_STREAM, sendDocument.getDocumentName());
if (sendDocument.getReplayMarkup() != null) {
builder.addTextBody(SendDocument.REPLYMARKUP_FIELD, sendDocument.getReplayMarkup().toJson().toString());
}
if (sendDocument.getReplayToMessageId() != null) {
builder.addTextBody(SendDocument.REPLYTOMESSAGEID_FIELD, sendDocument.getReplayToMessageId().toString());
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
} else {
List<NameValuePair> nameValuePairs = new ArrayList<>();
nameValuePairs.add(new BasicNameValuePair(SendDocument.CHATID_FIELD, sendDocument.getChatId().toString()));
nameValuePairs.add(new BasicNameValuePair(SendDocument.DOCUMENT_FIELD, sendDocument.getDocument()));
if (sendDocument.getReplayMarkup() != null) {
nameValuePairs.add(new BasicNameValuePair(SendDocument.REPLYMARKUP_FIELD, sendDocument.getReplayMarkup().toString()));
}
if (sendDocument.getReplayToMessageId() != null) {
nameValuePairs.add(new BasicNameValuePair(SendDocument.REPLYTOMESSAGEID_FIELD, sendDocument.getReplayToMessageId().toString()));
}
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
}
CloseableHttpResponse response = httpClient.execute(httppost);
if (sendDocument.isNewDocument()) {
File fileToDelete = new File(sendDocument.getDocument());
fileToDelete.delete();
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void SendWebhook(String webHookURL, String botToken) {
try {
CloseableHttpClient httpclient = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
String url = Constants.BASEURL + botToken + "/" + SetWebhook.PATH;
HttpPost httppost = new HttpPost(url);
httppost.addHeader("Content-type", "application/x-www-form-urlencoded");
httppost.addHeader("charset", "UTF-8");
List<NameValuePair> nameValuePairs = new ArrayList<>();
nameValuePairs.add(new BasicNameValuePair(SetWebhook.URL_FIELD, webHookURL));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
CloseableHttpResponse response = httpclient.execute(httppost);
HttpEntity ht = response.getEntity();
BufferedHttpEntity buf = new BufferedHttpEntity(ht);
String responseContent = EntityUtils.toString(buf, "UTF-8");
} catch (IOException e) {
e.printStackTrace();
}
}
}

70
src/main/java/org/telegram/api/Audio.java

@ -0,0 +1,70 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents an audio file (voice note)
* @date 20 of June of 2015
*/
public class Audio {
public static final String FILEID_FIELD = "file_id";
@JsonProperty(FILEID_FIELD)
private String fileId; ///< Unique identifier for this file
public static final String DURATION_FIELD = "duration";
@JsonProperty(DURATION_FIELD)
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender
public static final String MIMETYPE_FIELD = "mime_type";
@JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. MIME type of the file as defined by sender
public static final String FILESIZE_FIELD = "file_size";
@JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size
public Audio() {
super();
}
public Audio(JSONObject jsonObject) {
super();
this.fileId = jsonObject.getString(FILEID_FIELD);
this.duration = jsonObject.getInt(DURATION_FIELD);
this.mimeType = jsonObject.optString(MIMETYPE_FIELD, "");
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
}

73
src/main/java/org/telegram/api/Chat.java

@ -0,0 +1,73 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a Telegram chat with an user or a group
* @date 24 of June of 2015
*/
public class Chat {
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private Integer id; ///< Unique identifier for this chat
public static final String FIRSTNAME_FIELD = "first_name";
@JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< User‘s or bot’s first name
public static final String LASTNAME_FIELD = "last_name";
@JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. User‘s or bot’s last name
public static final String USERNAME_FIELD = "username";
@JsonProperty(USERNAME_FIELD)
private String userName; ///< Optional. User‘s or bot’s username
public static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Group name
public Chat() {
super();
}
public Chat(JSONObject jsonObject) {
super();
this.id = jsonObject.getInt(ID_FIELD);
if (this.id > 0) {
this.firstName = jsonObject.getString(FIRSTNAME_FIELD);
this.lastName = jsonObject.optString(LASTNAME_FIELD, "");
this.userName = jsonObject.optString(USERNAME_FIELD, "");
} else {
this.title = jsonObject.getString(TITLE_FIELD);
}
}
public Integer getId() {
return id;
}
public Boolean isGroupChat() {
if (id < 0) {
return true;
} else {
return false;
}
}
public String getTitle() {
return title;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getUserName() {
return userName;
}
}

38
src/main/java/org/telegram/api/Contact.java

@ -0,0 +1,38 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a phone contact.
* @date 20 of June of 2015
*/
public class Contact {
public static final String PHONENUMBER_FIELD = "phone_number";
@JsonProperty(PHONENUMBER_FIELD)
private String phoneNumber; ///< Contact's phone number
public static final String FIRSTNAME_FIELD = "first_name";
@JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< Contact's first name
public static final String LASTNAME_FIELD = "last_name";
@JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. Contact's last name
public static final String USERID_FIELD = "user_id";
@JsonProperty(USERID_FIELD)
private String userID; ///< Optional. Contact's user identifier in Telegram
public Contact() {
super();
}
public Contact(JSONObject jsonObject) {
super();
this.phoneNumber = jsonObject.getString(PHONENUMBER_FIELD);
this.firstName = jsonObject.getString(FIRSTNAME_FIELD);
this.lastName = jsonObject.optString(LASTNAME_FIELD, "");
this.userID = jsonObject.optString(USERID_FIELD, "");
}
}

82
src/main/java/org/telegram/api/Document.java

@ -0,0 +1,82 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a general file (as opposed to photos and audio files).
* Telegram users can send files of any type of up to 1.5 GB in size.
* @date 20 of June of 2015
*/
public class Document {
public static final String FILEID_FIELD = "file_id";
@JsonProperty(FILEID_FIELD)
private String fileId; ///< Unique identifier for this file
public static final String THUMB_FIELD = "thumb";
@JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Document thumbnail as defined by sender
public static final String FILENAME_FIELD = "file_name";
@JsonProperty(FILENAME_FIELD)
private String fileName; ///< Optional. Original filename as defined by sender
public static final String MIMETYPE_FIELD = "mime_type";
@JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. Mime type of a file as defined by sender
public static final String FILESIZE_FIELD = "file_size";
@JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size
public Document() {
super();
}
public Document(JSONObject jsonObject) {
this.fileId = jsonObject.getString(FILEID_FIELD);
this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD));
this.fileName = jsonObject.optString(FILENAME_FIELD, "");
this.mimeType = jsonObject.optString(MIMETYPE_FIELD, "");
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public PhotoSize getThumb() {
return thumb;
}
public void setThumb(PhotoSize thumb) {
this.thumb = thumb;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
}

71
src/main/java/org/telegram/api/ForceReply.java

@ -0,0 +1,71 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Upon receiving a message with this object, Telegram clients will display a reply interface to the user
* (act as if the user has selected the bots message and tapped Reply').
* This can be extremely useful if you want to create user-friendly step-by-step
* interfaces without having to sacrifice privacy mode.
* @date 22 of June of 2015
*/
public class ForceReply implements ReplyKeyboard {
public static final String FORCEREPLY_FIELD = "force_reply";
/**
* Shows reply interface to the user, as if they manually selected the bots message and tapped Reply'
*/
@JsonProperty(FORCEREPLY_FIELD)
private Boolean forceReply;
public static final String SELECTIVE_FIELD = "selective";
/**
* Use this parameter if you want to force reply from specific users only.
* Targets:
* 1) users that are @mentioned in the text of the Message object;
* 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
*/
@JsonProperty(SELECTIVE_FIELD)
private Boolean selective;
public ForceReply() {
super();
this.forceReply = true;
}
public ForceReply(JSONObject jsonObject) {
super();
this.forceReply = jsonObject.optBoolean(FORCEREPLY_FIELD, true);
this.selective = jsonObject.optBoolean(SELECTIVE_FIELD, false);
}
public Boolean getForceReply() {
return forceReply;
}
public void setForceReply(Boolean forceReply) {
this.forceReply = forceReply;
}
public Boolean getSelective() {
return selective;
}
public void setSelective(Boolean selective) {
this.selective = selective;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(FORCEREPLY_FIELD, this.forceReply);
if (this.selective != null) {
jsonObject.put(SELECTIVE_FIELD, this.selective);
}
return jsonObject;
}
}

46
src/main/java/org/telegram/api/Location.java

@ -0,0 +1,46 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a point on the map.
* @date 20 of June of 2015
*/
public class Location {
public static final String LONGITUDE_FIELD = "longitude";
@JsonProperty(LONGITUDE_FIELD)
private Double longitude; ///< Longitude as defined by sender
public static final String LATITUDE_FIELD = "latitude";
@JsonProperty(LATITUDE_FIELD)
private Double latitude; ///< Latitude as defined by sender
public Location() {
super();
}
public Location(JSONObject jsonObject) {
super();
this.longitude = jsonObject.getDouble(LONGITUDE_FIELD);
this.latitude = jsonObject.getDouble(LATITUDE_FIELD);
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
}

339
src/main/java/org/telegram/api/Message.java

@ -0,0 +1,339 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a message.
* @date 20 of June of 2015
*/
public class Message {
public static final String MESSAGEID_FIELD = "message_id";
@JsonProperty(MESSAGEID_FIELD)
private Integer messageId; ///< Integer Unique message identifier
public static final String FROM_FIELD = "from";
@JsonProperty(FROM_FIELD)
private User from; ///< Sender
public static final String DATE_FIELD = "date";
@JsonProperty(DATE_FIELD)
private Integer date; ///< Date the message was sent in Unix time
public static final String CHAT_FIELD = "chat";
/**
* Conversation the message belongs to in case of a private message (@see User)or
* Conversation the message belongs to in case of a group (@see GroupChat)
*/
@JsonProperty(CHAT_FIELD)
private Chat chat; ///< Conversation the message belongs to in case of a private message
public static final String FORWARDFROM_FIELD = "forward_from";
@JsonProperty(FORWARDFROM_FIELD)
private User forwardFrom; ///< Optional. For forwarded messages, sender of the original message
public static final String FORWARDDATE_FIELD = "forward_date";
@JsonProperty(FORWARDDATE_FIELD)
private Integer forwardDate; ///< Optional. For forwarded messages, date the original message was sent
public static final String TEXT_FIELD = "text";
@JsonProperty(TEXT_FIELD)
private String text; ///< Optional. For text messages, the actual UTF-8 text of the message
public static final String AUDIO_FIELD = "audio";
@JsonProperty(AUDIO_FIELD)
private Audio audio; ///< Optional. Message is an audio file, information about the file
public static final String DOCUMENT_FIELD = "document";
@JsonProperty(DOCUMENT_FIELD)
private Document document; ///< Optional. Message is a general file, information about the file
public static final String PHOTO_FIELD = "photo";
@JsonProperty(PHOTO_FIELD)
private List<PhotoSize> photo; ///< Optional. Message is a photo, available sizes of the photo
public static final String STICKER_FIELD = "sticker";
@JsonProperty(STICKER_FIELD)
private Sticker sticker; ///< Optional. Message is a sticker, information about the sticker
public static final String VIDEO_FIELD = "video";
@JsonProperty(VIDEO_FIELD)
private Video video; ///< Optional. Message is a video, information about the video
public static final String CONTACT_FIELD = "contact";
@JsonProperty(CONTACT_FIELD)
private Contact contact; ///< Optional. Message is a shared contact, information about the contact
public static final String LOCATION_FIELD = "location";
@JsonProperty(LOCATION_FIELD)
private Location location; ///< Optional. Message is a shared location, information about the location
public static final String NEWCHATPARTICIPANT_FIELD = "new_chat_participant";
@JsonProperty(NEWCHATPARTICIPANT_FIELD)
private User newChatParticipant; ///< Optional. A new member was added to the group, information about them (this member may be bot itself)
public static final String LEFTCHATPARTICIPANT_FIELD = "left_chat_participant";
@JsonProperty(LEFTCHATPARTICIPANT_FIELD)
private User leftChatParticipant; ///< Optional. A member was removed from the group, information about them (this member may be bot itself)
public static final String NEWCHATTITLE_FIELD = "new_chat_title";
@JsonProperty(NEWCHATTITLE_FIELD)
private String newChatTitle; ///< Optional. A group title was changed to this value
public static final String NEWCHATPHOTO_FIELD = "new_chat_photo";
@JsonProperty(NEWCHATPHOTO_FIELD)
private String newChatPhoto; ///< Optional. A group photo was change to this value
public static final String DELETECHATPHOTO_FIELD = "delete_chat_photo";
@JsonProperty(DELETECHATPHOTO_FIELD)
private Boolean deleteChatPhoto; ///< Optional. Informs that the group photo was deleted
public static final String GROUPCHATCREATED_FIELD = "group_chat_created";
@JsonProperty(GROUPCHATCREATED_FIELD)
private Boolean groupchatCreated; ///< Optional. Informs that the group has been created
public static final String REPLYTOMESSAGE_FIELD = "reply_to_message";
@JsonProperty(REPLYTOMESSAGE_FIELD)
private Message replyToMessage;
public Message() {
super();
}
public Message(JSONObject jsonObject) {
super();
this.messageId = jsonObject.getInt(MESSAGEID_FIELD);
this.from = new User(jsonObject.getJSONObject(FROM_FIELD));
this.date = jsonObject.getInt(DATE_FIELD);
this.chat = new Chat(jsonObject.getJSONObject(CHAT_FIELD));
if (jsonObject.has(FORWARDFROM_FIELD)) {
this.forwardFrom = new User(jsonObject.getJSONObject(FORWARDFROM_FIELD));
}
if (jsonObject.has(FORWARDDATE_FIELD)) {
this.forwardDate = jsonObject.getInt(FORWARDDATE_FIELD);
}
if (jsonObject.has(TEXT_FIELD)) {
this.text = jsonObject.getString(TEXT_FIELD);
}
if (jsonObject.has(AUDIO_FIELD)) {
this.audio = new Audio(jsonObject.getJSONObject(AUDIO_FIELD));
}
if (jsonObject.has(DOCUMENT_FIELD)) {
this.document = new Document(jsonObject.getJSONObject(DOCUMENT_FIELD));
}
this.photo = new ArrayList<PhotoSize>();
if (jsonObject.has(PHOTO_FIELD)) {
JSONArray photos = jsonObject.getJSONArray(PHOTO_FIELD);
for (int i = 0; i < photos.length(); i++) {
this.photo.add(new PhotoSize(photos.getJSONObject(i)));
}
}
if (jsonObject.has(STICKER_FIELD)) {
this.sticker = new Sticker(jsonObject.getJSONObject(STICKER_FIELD));
}
if (jsonObject.has(VIDEO_FIELD)) {
this.video = new Video(jsonObject.getJSONObject(VIDEO_FIELD));
}
if (jsonObject.has(CONTACT_FIELD)) {
this.contact = new Contact(jsonObject.getJSONObject(CONTACT_FIELD));
}
if (jsonObject.has(LOCATION_FIELD)) {
this.location = new Location(jsonObject.getJSONObject(LOCATION_FIELD));
}
if (jsonObject.has(NEWCHATPARTICIPANT_FIELD)) {
this.newChatParticipant = new User(jsonObject.getJSONObject(NEWCHATPARTICIPANT_FIELD));
}
if (jsonObject.has(LEFTCHATPARTICIPANT_FIELD)) {
this.leftChatParticipant = new User(jsonObject.getJSONObject(LEFTCHATPARTICIPANT_FIELD));
}
if (jsonObject.has(REPLYTOMESSAGE_FIELD)) {
this.replyToMessage = new Message(jsonObject.getJSONObject(REPLYTOMESSAGE_FIELD));
}
this.newChatTitle = jsonObject.optString(NEWCHATTITLE_FIELD, "");
this.newChatPhoto = jsonObject.optString(NEWCHATPHOTO_FIELD, "");
this.deleteChatPhoto = jsonObject.optBoolean(DELETECHATPHOTO_FIELD, false);
this.groupchatCreated = jsonObject.optBoolean(GROUPCHATCREATED_FIELD, false);
}
public Integer getMessageId() {
return messageId;
}
public void setMessageId(Integer messageId) {
this.messageId = messageId;
}
public User getFrom() {
return from;
}
public void setFrom(User from) {
this.from = from;
}
public Integer getDate() {
return date;
}
public void setDate(Integer date) {
this.date = date;
}
public boolean isGroupMessage() {
return chat.isGroupChat();
}
public Integer getChatId() {
return chat.getId();
}
public Chat getChat() {
return chat;
}
public void setChat(Chat chat) {
this.chat = chat;
}
public User getForwardFrom() {
return forwardFrom;
}
public void setForwardFrom(User forwardFrom) {
this.forwardFrom = forwardFrom;
}
public Integer getForwardDate() {
return forwardDate;
}
public void setForwardDate(Integer forwardDate) {
this.forwardDate = forwardDate;
}
public boolean hasText() {
return text != null;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Audio getAudio() {
return audio;
}
public void setAudio(Audio audio) {
this.audio = audio;
}
public boolean hasDocument() {
return this.document != null;
}
public Document getDocument() {
return document;
}
public void setDocument(Document document) {
this.document = document;
}
public List<PhotoSize> getPhoto() {
return photo;
}
public void setPhoto(List<PhotoSize> photo) {
this.photo = photo;
}
public Sticker getSticker() {
return sticker;
}
public void setSticker(Sticker sticker) {
this.sticker = sticker;
}
public Video getVideo() {
return video;
}
public void setVideo(Video video) {
this.video = video;
}
public Contact getContact() {
return contact;
}
public void setContact(Contact contact) {
this.contact = contact;
}
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public User getNewChatParticipant() {
return newChatParticipant;
}
public void setNewChatParticipant(User newChatParticipant) {
this.newChatParticipant = newChatParticipant;
}
public User getLeftChatParticipant() {
return leftChatParticipant;
}
public void setLeftChatParticipant(User leftChatParticipant) {
this.leftChatParticipant = leftChatParticipant;
}
public String getNewChatTitle() {
return newChatTitle;
}
public void setNewChatTitle(String newChatTitle) {
this.newChatTitle = newChatTitle;
}
public String getNewChatPhoto() {
return newChatPhoto;
}
public void setNewChatPhoto(String newChatPhoto) {
this.newChatPhoto = newChatPhoto;
}
public Boolean getDeleteChatPhoto() {
return deleteChatPhoto;
}
public void setDeleteChatPhoto(Boolean deleteChatPhoto) {
this.deleteChatPhoto = deleteChatPhoto;
}
public Boolean getGroupchatCreated() {
return groupchatCreated;
}
public void setGroupchatCreated(Boolean groupchatCreated) {
this.groupchatCreated = groupchatCreated;
}
public boolean hasReplayMessage() {
return replyToMessage != null;
}
public Message getReplyToMessage() {
return replyToMessage;
}
public void setReplyToMessage(Message replyToMessage) {
this.replyToMessage = replyToMessage;
}
public boolean isReply() {
return this.replyToMessage != null;
}
public boolean hasLocation() {
return location != null;
}
}

70
src/main/java/org/telegram/api/PhotoSize.java

@ -0,0 +1,70 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents one size of a photo or a file / sticker thumbnail.
* @date 20 of June of 2015
*/
public class PhotoSize {
public static final String FILEID_FIELD = "file_id";
@JsonProperty(FILEID_FIELD)
private String fileId; ///< Unique identifier for this file
public static final String WIDTH_FIELD = "width";
@JsonProperty(WIDTH_FIELD)
private Integer width; ///< Photo width
public static final String HEIGHT_FIELD = "height";
@JsonProperty(HEIGHT_FIELD)
private Integer height; ///< Photo height
public static final String FILESIZE_FIELD = "file_size";
@JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size
public PhotoSize() {
super();
}
public PhotoSize(JSONObject jsonObject) {
super();
this.fileId = jsonObject.optString(FILEID_FIELD, "");
this.width = jsonObject.optInt(WIDTH_FIELD, 0);
this.height = jsonObject.optInt(HEIGHT_FIELD, 0);
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public Integer getWidth() {
return width;
}
public void setWidth(Integer width) {
this.width = width;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
}

13
src/main/java/org/telegram/api/ReplyKeyboard.java

@ -0,0 +1,13 @@
package org.telegram.api;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Reply keyboard abstract type
* @date 20 of June of 2015
*/
public interface ReplyKeyboard {
JSONObject toJson();
}

66
src/main/java/org/telegram/api/ReplyKeyboardHide.java

@ -0,0 +1,66 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Upon receiving a message with this object,
* Telegram clients will hide the current custom keyboard and display the default letter-keyboard.
* By default, custom keyboards are displayed until a new keyboard is sent by a bot.
* An exception is made for one-time keyboards that are hidden immediately after the user presses a button
* (@see ReplyKeyboardMarkup).
* @date 20 of June of 2015
*/
public class ReplyKeyboardHide implements ReplyKeyboard{
public static final String HIDEKEYBOARD_FIELD = "hide_keyboard";
@JsonProperty(HIDEKEYBOARD_FIELD)
private Boolean hideKeyboard; ///< Requests clients to hide the custom keyboard
public static final String SELECTIVE_FIELD = "selective";
/**
* Optional. Use this parameter if you want to show the keyboard to specific users only.
* Targets:
* 1) users that are @mentioned in the text of the Message object;
* 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
*/
@JsonProperty(SELECTIVE_FIELD)
private Boolean selective;
public ReplyKeyboardHide() {
super();
this.selective = true;
}
public ReplyKeyboardHide(JSONObject jsonObject) {
super();
this.hideKeyboard = jsonObject.optBoolean(HIDEKEYBOARD_FIELD, true);
this.selective = jsonObject.optBoolean(SELECTIVE_FIELD, true);
}
public Boolean getHideKeyboard() {
return hideKeyboard;
}
public void setHideKeyboard(Boolean hideKeyboard) {
this.hideKeyboard = hideKeyboard;
}
public Boolean getSelective() {
return selective;
}
public void setSelective(Boolean selective) {
this.selective = selective;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(HIDEKEYBOARD_FIELD, this.hideKeyboard);
jsonObject.put(SELECTIVE_FIELD, this.selective);
return jsonObject;
}
}

116
src/main/java/org/telegram/api/ReplyKeyboardMarkup.java

@ -0,0 +1,116 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a custom keyboard with reply options.
* @date 20 of June of 2015
*/
public class ReplyKeyboardMarkup implements ReplyKeyboard {
public static final String KEYBOARD_FIELD = "keyboard";
@JsonProperty(KEYBOARD_FIELD)
private List<List<String>> keyboard; ///< Array of button rows, each represented by an Array of Strings
public static final String RESIZEKEYBOARD_FIELD = "resize_keyboard";
@JsonProperty(RESIZEKEYBOARD_FIELD)
private Boolean resizeKeyboard; ///< Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false.
public static final String ONETIMEKEYBOARD_FIELD = "one_time_keyboard";
@JsonProperty(ONETIMEKEYBOARD_FIELD)
private Boolean oneTimeKeyboad; ///< Optional. Requests clients to hide the keyboard as soon as it's been used. Defaults to false.
public static final String SELECTIVE_FIELD = "selective";
/**
* Optional. Use this parameter if you want to show the keyboard to specific users only.
* Targets:
* 1) users that are @mentioned in the text of the Message object;
* 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
*/
private Boolean selective;
public ReplyKeyboardMarkup() {
super();
keyboard = new ArrayList<List<String>>();
}
public ReplyKeyboardMarkup(JSONObject jsonObject) {
super();
this.keyboard = new ArrayList<List<String>>();
JSONArray keyboard = jsonObject.getJSONArray(KEYBOARD_FIELD);
for (int i=0; i< keyboard.length(); i++) {
JSONArray keyboardRow = keyboard.getJSONArray(i);
List<String> row = new ArrayList<String>();
for (int j=0; j < keyboardRow.length(); j++) {
row.add(keyboardRow.getString(j));
}
this.keyboard.add(row);
}
this.resizeKeyboard = jsonObject.optBoolean(RESIZEKEYBOARD_FIELD, false);
this.oneTimeKeyboad = jsonObject.optBoolean(ONETIMEKEYBOARD_FIELD, false);
this.selective = jsonObject.optBoolean(SELECTIVE_FIELD, false);
}
public List<List<String>> getKeyboard() {
return keyboard;
}
public void setKeyboard(List<List<String>> keyboard) {
this.keyboard = keyboard;
}
public Boolean getResizeKeyboard() {
return resizeKeyboard;
}
public void setResizeKeyboard(Boolean resizeKeyboard) {
this.resizeKeyboard = resizeKeyboard;
}
public Boolean getOneTimeKeyboad() {
return oneTimeKeyboad;
}
public void setOneTimeKeyboad(Boolean oneTimeKeyboad) {
this.oneTimeKeyboad = oneTimeKeyboad;
}
public Boolean getSelective() {
return selective;
}
public void setSelective(Boolean selective) {
this.selective = selective;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
JSONArray jsonkeyboard = new JSONArray();
for (List<String> innerRow : this.keyboard) {
JSONArray innerJSONKeyboard = new JSONArray();
for (String element: innerRow) {
innerJSONKeyboard.put(element);
}
jsonkeyboard.put(innerJSONKeyboard);
}
jsonObject.put(ReplyKeyboardMarkup.KEYBOARD_FIELD, jsonkeyboard);
if (this.oneTimeKeyboad != null) {
jsonObject.put(ReplyKeyboardMarkup.ONETIMEKEYBOARD_FIELD, this.oneTimeKeyboad);
}
if (this.resizeKeyboard != null) {
jsonObject.put(ReplyKeyboardMarkup.RESIZEKEYBOARD_FIELD, this.resizeKeyboard);
}
if (this.selective != null) {
jsonObject.put(ReplyKeyboardMarkup.SELECTIVE_FIELD, this.selective);
}
return jsonObject;
}
}

42
src/main/java/org/telegram/api/Sticker.java

@ -0,0 +1,42 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a sticker.
* @date 20 of June of 2015
*/
public class Sticker {
public static final String FILEID_FIELD = "file_id";
@JsonProperty(FILEID_FIELD)
private String fileId; ///< Unique identifier for this file
public static final String WIDTH_FIELD = "width";
@JsonProperty(WIDTH_FIELD)
private Integer width; ///< Sticker width
public static final String HEIGHT_FIELD = "height";
@JsonProperty(HEIGHT_FIELD)
private Integer height; ///< Sticker height
public static final String THUMB_FIELD = "thumb";
@JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Sticker thumbnail in .webp or .jpg format
public static final String FILESIZE_FIELD = "file_size";
@JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size
public Sticker() {
super();
}
public Sticker(JSONObject jsonObject) {
super();
this.fileId = jsonObject.getString(FILEID_FIELD);
this.width = jsonObject.getInt(WIDTH_FIELD);
this.height = jsonObject.getInt(HEIGHT_FIELD);
this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD));
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);
}
}

55
src/main/java/org/telegram/api/Update.java

@ -0,0 +1,55 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import org.json.JSONObject;
import sun.print.UnixPrintJob;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief TODO
* @date 20 of June of 2015
*/
public class Update {
/*
update_id Integer
message Message
*/
public static final String UPDATEID_FIELD = "update_id";
/**
* The updates unique identifier.
* Update identifiers start from a certain positive number and increase sequentially.
* This ID becomes especially handy if youre using Webhooks,
* since it allows you to ignore repeated updates or to restore the
* correct update sequence, should they get out of order.
*/
@JsonProperty(UPDATEID_FIELD)
private Integer updateId;
public static final String MESSAGE_FIELD = "message";
@JsonProperty(MESSAGE_FIELD)
private Message message; ///< Optional. New incoming message of any kind — text, photo, sticker, etc.
public Update() {
super();
}
public Update(JSONObject jsonObject) {
super();
this.updateId = jsonObject.getInt(UPDATEID_FIELD);
JSONObject messageJSON = jsonObject.optJSONObject(MESSAGE_FIELD);
if (messageJSON == null) {
this.message = null;
} else {
this.message = new Message(messageJSON);
}
}
public Integer getUpdateId() {
return updateId;
}
public Message getMessage() {
return message;
}
}

54
src/main/java/org/telegram/api/User.java

@ -0,0 +1,54 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a Telegram user or bot.
* @date 20 of June of 2015
*/
public class User {
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private Integer id; ///< Unique identifier for this user or bot
public static final String FIRSTNAME_FIELD = "first_name";
@JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< User‘s or bot’s first name
public static final String LASTNAME_FIELD = "last_name";
@JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. User‘s or bot’s last name
public static final String USERNAME_FIELD = "username";
@JsonProperty(USERNAME_FIELD)
private String userName; ///< Optional. User‘s or bot’s username
public User() {
super();
}
public User(JSONObject jsonObject) {
super();
this.id = jsonObject.getInt(ID_FIELD);
this.firstName = jsonObject.getString(FIRSTNAME_FIELD);
this.lastName = jsonObject.optString(LASTNAME_FIELD, "");
this.userName = jsonObject.optString(USERNAME_FIELD, "");
}
public Integer getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getUserName() {
return userName;
}
}

43
src/main/java/org/telegram/api/UserProfilePhotos.java

@ -0,0 +1,43 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represent a user's profile pictures.
* @date 22 of June of 2015
*/
public class UserProfilePhotos {
public static final String TOTALCOUNT_FIELD = "total_count";
@JsonProperty(TOTALCOUNT_FIELD)
private Integer totalCount; ///< Total number of profile pictures the target user has
public static final String PHOTOS_FIELD = "photos";
@JsonProperty(PHOTOS_FIELD)
private List<List<PhotoSize>> photos; ///< Requested profile pictures (in up to 4 sizes each)
public UserProfilePhotos() {
super();
}
public UserProfilePhotos(JSONObject jsonObject) {
super();
this.totalCount = jsonObject.getInt(TOTALCOUNT_FIELD);
this.photos = new ArrayList<>();
JSONArray photos = jsonObject.getJSONArray(PHOTOS_FIELD);
for (int i = 0; i < photos.length(); i++) {
JSONArray innerArray = photos.getJSONArray(i);
List<PhotoSize> innerPhotos = new ArrayList<>();
for (int j = 0; j < innerArray.length(); j ++) {
innerPhotos.add(new PhotoSize(innerArray.getJSONObject(j)));
}
this.photos.add(innerPhotos);
}
}
}

117
src/main/java/org/telegram/api/Video.java

@ -0,0 +1,117 @@
package org.telegram.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a video file.
* @date 20 of June of 2015
*/
public class Video {
public static final String FILEID_FIELD = "file_id";
@JsonProperty(FILEID_FIELD)
private String fileId; ///< Unique identifier for this file
public static final String WIDTH_FIELD = "width";
@JsonProperty(WIDTH_FIELD)
private Integer width; ///< Video width as defined by sender
public static final String HEIGHT_FIELD = "height";
@JsonProperty(HEIGHT_FIELD)
private Integer height; ///< Video height as defined by sender
public static final String DURATION_FIELD = "duration";
@JsonProperty(DURATION_FIELD)
private Integer duration; ///< Duration of the video in seconds as defined by sender
public static final String THUMB_FIELD = "thumb";
@JsonProperty(THUMB_FIELD)
private PhotoSize thumb; ///< Video thumbnail
public static final String MIMETYPE_FIELD = "mime_type";
@JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. Mime type of a file as defined by sender
public static final String FILESIZE_FIELD = "file_size";
@JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size
public static final String CAPTION_FIELD = "caption";
@JsonProperty(CAPTION_FIELD)
private String caption; ///< Optional. Text description of the video (usually empty)
public Video() {
super();
}
public Video(JSONObject jsonObject) {
this.fileId = jsonObject.getString(FILEID_FIELD);
this.width = jsonObject.getInt(WIDTH_FIELD);
this.height = jsonObject.getInt(HEIGHT_FIELD);
this.duration = jsonObject.getInt(DURATION_FIELD);
this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD));
this.mimeType = jsonObject.optString(MIMETYPE_FIELD, "");
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);
this.caption = jsonObject.optString(CAPTION_FIELD, "");
}
public Integer getWidth() {
return width;
}
public void setWidth(Integer width) {
this.width = width;
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public PhotoSize getThumb() {
return thumb;
}
public void setThumb(PhotoSize thumb) {
this.thumb = thumb;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
}

112
src/main/java/org/telegram/database/ConectionDB.java

@ -0,0 +1,112 @@
/*
* This is the source code of Telegram Bot v. 2.0
* It is licensed under GNU GPL v. 3 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Ruben Bermudez, 3/12/14.
*/
package org.telegram.database;
import org.telegram.BuildVars;
import org.telegram.services.BotLogger;
import java.sql.*;
/**
* @author Ruben Bermudez
* @version 2.0
* @brief Connector to database
* @date 3/12/14
*/
public class ConectionDB {
private static volatile BotLogger log = BotLogger.getLogger(ConectionDB.class.getName());
private Connection currentConection;
public ConectionDB() {
this.currentConection = openConexion();
}
private Connection openConexion() {
Connection connection = null;
try {
Class.forName(BuildVars.controllerDB).newInstance();
connection = DriverManager.getConnection(BuildVars.linkDB, BuildVars.userDB, BuildVars.password);
} catch (SQLException | ClassNotFoundException | IllegalAccessException | InstantiationException e) {
log.error(e);
}
return connection;
}
public void closeConexion() {
try {
this.currentConection.close();
} catch (SQLException e) {
log.error(e);
}
}
public ResultSet runSqlQuery(String query) throws SQLException {
final Statement statement;
statement = this.currentConection.createStatement();
return statement.executeQuery(query);
}
public Boolean executeQuery(String query) throws SQLException {
final Statement statement = this.currentConection.createStatement();
return statement.execute(query);
}
public PreparedStatement getPreparedStatement(String query) throws SQLException {
return this.currentConection.prepareStatement(query);
}
public PreparedStatement getPreparedStatement(String query, int flags) throws SQLException {
return this.currentConection.prepareStatement(query, flags);
}
public int checkVersion() {
int max = 0;
try {
final DatabaseMetaData metaData = this.currentConection.getMetaData();
final ResultSet res = metaData.getTables(null, null, null,
new String[]{"TABLE"});
while (res.next()) {
if (res.getString("TABLE_NAME").compareTo("Versions") == 0) {
final ResultSet result = runSqlQuery("SELECT Max(Version) FROM Versions");
while (result.next()) {
max = (max > result.getInt(1)) ? max : result.getInt(1);
}
}
}
} catch (SQLException e) {
log.error(e);
}
return max;
}
/**
* Initilize a transaction in database
* @throws SQLException If initialization fails
*/
public void initTransaction() throws SQLException {
this.currentConection.setAutoCommit(false);
}
/**
* Finish a transaction in database and commit changes
* @throws SQLException If a rollback fails
*/
public void commitTransaction() throws SQLException {
try {
this.currentConection.commit();
} catch (SQLException e) {
if (this.currentConection != null) {
this.currentConection.rollback();
}
} finally {
this.currentConection.setAutoCommit(false);
}
}
}

93
src/main/java/org/telegram/database/CreationStrings.java

@ -0,0 +1,93 @@
package org.telegram.database;
/**
* @author Ruben Bermudez
* @version 2.0
* @brief Strings to create database
* @date 15 of May of 2015
*/
public class CreationStrings {
public static final int version = 3;
public static final String createVersionTable = "CREATE TABLE IF NOT EXISTS Versions(ID INTEGER PRIMARY KEY AUTO_INCREMENT, Version INTEGER);";
public static final String insertCurrentVersion = "INSERT IGNORE INTO Versions (Version) VALUES(" + version + ");";
public static final String createFilesTable = "CREATE TABLE IF NOT EXISTS Files (fileId VARCHAR(100) PRIMARY KEY, userId INTEGER NOT NULL, caption TEXT NOT NULL)";
public static final String createUsersForFilesTable = "CREATE TABLE IF NOT EXISTS FilesUsers (userId INTEGER PRIMARY KEY, status INTEGER NOT NULL DEFAULT 0)";
public static final String createRecentWeatherTable = "CREATE TABLE IF NOT EXISTS RecentWeather (ID INTEGER PRIMARY KEY AUTO_INCREMENT, userId INTEGER NOT NULL, " +
"date TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, cityId INTEGER NOT NULL, cityName VARCHAR(60) NOT NULL," +
"CONSTRAINT unique_cistyuser UNIQUE (userId,cityId))";
public static final String createDirectionsDatabase = "CREATE TABLE IF NOT EXISTS Directions (userId INTEGER PRIMARY KEY, status INTEGER NOT NULL, " +
"messageId INTEGER NOT NULL DEFAULT 0, origin VARCHAR(100));";
/*public static final String createOperatingSystemsVersion = "CREATE TABLE IF NOT EXISTS OperatingSystems (operatingSystem VARCHAR(20) PRIMARY KEY);";
public static final String createLanguagesTable = "CREATE TABLE IF NOT EXISTS Languages(languageCode VARCHAR(6) PRIMARY KEY, languageName VARCHAR(30) NOT NULL);";
public static final String insertEnglishLanguage = "INSERT IGNORE INTO Languages (languageCode, languageName) VALUES('en', 'English');";
public static final String insertPortugueseLanguage = "INSERT IGNORE INTO Languages (languageCode, languageName) VALUES('pt', 'Portuguese');";
public static final String insertItalianLanguage = "INSERT IGNORE INTO Languages (languageCode, languageName) VALUES('it', 'Italian');";
public static final String createCountriesTable = "CREATE TABLE IF NOT EXISTS Countries(countryCode VARCHAR(6) PRIMARY KEY, name VARCHAR(20) NOT NULL);";
public static final String createLoginTable = "CREATE TABLE IF NOT EXISTS Logins(username VARCHAR(30) PRIMARY KEY, password VARCHAR(30) NOT NULL, " +
"hash VARCHAR(130) NOT NULL, securityLevel INTEGER DEFAULT 0);";
public static final String createLanguagesPerCountryTable = "CREATE TABLE IF NOT EXISTS LanguagesPerCountry( countryCode VARCHAR(6) PRIMARY KEY, firstLanguage VARCHAR(6) NOT NULL, " +
"secondLanguage VARCHAR(6) DEFAULT NULL, FOREIGN KEY (firstLanguage) REFERENCES Languages (languageCode) ON UPDATE CASCADE ON DELETE CASCADE, " +
"FOREIGN KEY (secondLanguage) REFERENCES Languages (languageCode) ON UPDATE CASCADE ON DELETE CASCADE);";
public static final String createUsersTable = "CREATE TABLE IF NOT EXISTS Users(userId INTEGER NOT NULL, bot INTEGER NOT NULL, needVolunteer BOOLEAN NOT NULL, phone VARCHAR(15) DEFAULT NULL, firstName VARCHAR(100) NOT NULL, " +
"lastName VARCHAR(100) NOT NULL, userName VARCHAR(100) DEFAULT NULL, isContact BOOLEAN NOT NULL, lastAnswer DATETIME, userHash VARCHAR(40) NOT NULL, lastScore FLOAT, hashtag VARCHAR(15), countryCode VARCHAR(6), denied INTEGER NOT NULL DEFAULT 0, " +
"customCommand VARCHAR(60) DEFAULT NULL, deleted BOOLEAN NOT NULL DEFAULT FALSE, " +
"CONSTRAINT `usersCountryCode` FOREIGN KEY (countryCode) REFERENCES Countries(countryCode) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `userPrimaryKey` PRIMARY KEY(userId,bot));";
public static final String createAnswersTable = "CREATE TABLE IF NOT EXISTS AnswersXXXX (ID INTEGER PRIMARY KEY AUTO_INCREMENT, name VARCHAR(250) NOT NULL," +
"content VARCHAR(2000) NOT NULL, operatingSystem VARCHAR(20) NOT NULL, appVersion VARCHAR(10)," +
"CONSTRAINT `answersOSXXXX` FOREIGN KEY (operatingSystem) REFERENCES OperatingSystems(operatingSystem) ON UPDATE CASCADE ON DELETE CASCADE);";
public static final String insertEmptyAnswer = "INSERT IGNORE INTO AnswersXXXX (name, content, operatingSystem, appVersion, ID) VALUES ('Empty Answer','','All','',100);";
public static final String insertNotFoundAnswer = "INSERT IGNORE INTO AnswersXXXX (name, content, operatingSystem, appVersion, ID) VALUES ('Not found','','All','',99);";
public static final String createHistoryTable = "CREATE TABLE IF NOT EXISTS History( ID INTEGER PRIMARY KEY AUTO_INCREMENT, userId INTEGER NOT NULL, date DATETIME NOT NULL, answerId INTEGER NOT NULL, " +
"languageCode VARCHAR(6) NOT NULL, CONSTRAINT `historyUserId` FOREIGN KEY (userId) REFERENCES Users(userId) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `historyLanguageCode` FOREIGN KEY (languageCode) REFERENCES Languages(languageCode) ON UPDATE CASCADE ON DELETE CASCADE);";
public static final String createQuestionsTable = "CREATE TABLE IF NOT EXISTS QuestionsXXXX (ID INTEGER PRIMARY KEY AUTO_INCREMENT, content VARCHAR(300) NOT NULL, " +
"languageCode VARCHAR(6) NOT NULL, answerAll INTEGER DEFAULT NULL, answerIos INTEGER DEFAULT NULL, answerWebogram INTEGER DEFAULT NULL, answerAndroid INTEGER DEFAULT NULL, " +
"answerOsx INTEGER DEFAULT NULL, answerDesktop INTEGER DEFAULT NULL, answerWP INTEGER DEFAULT NULL, " +
"CONSTRAINT `questionsAnswerAllXXXX` FOREIGN KEY (answerAll) REFERENCES AnswersXXXX(ID) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `questionsAnswerIosXXXX` FOREIGN KEY (answerIos) REFERENCES AnswersXXXX(ID) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `questionsAnswerWebogramXXXX` FOREIGN KEY (answerWebogram) REFERENCES AnswersXXXX(ID) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `questionsAnswerAndroidXXXX` FOREIGN KEY (answerAndroid) REFERENCES AnswersXXXX(ID) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `questionsAnswerOsxXXXX` FOREIGN KEY (answerOsx) REFERENCES AnswersXXXX(ID) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `questionsAnswerDesktopXXXX` FOREIGN KEY (answerDesktop) REFERENCES AnswersXXXX(ID) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `questionsAnswerWPXXXX` FOREIGN KEY (answerWP) REFERENCES AnswersXXXX(ID) ON UPDATE CASCADE ON DELETE CASCADE);";
public static final String createTrelloTable = "CREATE TABLE IF NOT EXISTS trello (shortLink VARCHAR(10) PRIMARY KEY NOT NULL, listName VARCHAR(20) NOT NULL, listId VARCHAR(30), " +
"closed BOOLEAN NOT NULL, creationDate DATETIME NOT NULL, notificationDate DATETIME NOT NULL, affectedUserCount INTEGER NOT NULL DEFAULT 0, tittle VARCHAR(100) NOT NULL, " +
"description TEXT NOT NULL);";
public static final String createTemplatesTable = "CREATE TABLE IF NOT EXISTS Templates (id INTEGER PRIMARY KEY AUTO_INCREMENT, hash VARCHAR(130) NOT NULL, " +
"languageCode VARCHAR(8), content TEXT);";
public static final String createTemplatesLogTable = "CREATE TABLE IF NOT EXISTS TemplatesLog (id INTEGER PRIMARY KEY AUTO_INCREMENT, hash VARCHAR(130) NOT NULL, type INTEGER, content TEXT);";
public static final String createTemplatesFileTable = "CREATE TABLE IF NOT EXISTS TemplatesFile (id INTEGER PRIMARY KEY AUTO_INCREMENT, hash VARCHAR(130) NOT NULL, date DATETIME, languageCode VARCHAR(8)," +
" CONSTRAINT unique_filelanguage UNIQUE (hash,languageCode));";
public static final String createFiltersTable = "create table if not exists Filters (filterId INTEGER PRIMARY KEY AUTO_INCREMENT," +
" words VARCHAR(300) NOT NULL, languageCode VARCHAR(6) NOT NULL," +
" CONSTRAINT `filtersLanguageCode` FOREIGN KEY (languageCode) REFERENCES Languages(languageCode) ON UPDATE CASCADE ON DELETE CASCADE" +
");";
public static final String createMessagesDiscardedTable = "create table if not exists MessagesDiscarded (id INTEGER PRIMARY KEY AUTO_INCREMENT," +
" userId INTEGER NOT NULL, filterId INTEGER NOT NULL, message TEXT NOT NULL, date TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," +
" partial BOOLEAN NOT NULL DEFAULT false, CONSTRAINT `messagesDiscardedUserId` FOREIGN KEY (userId) REFERENCES Users(userId) ON UPDATE CASCADE ON DELETE CASCADE," +
" CONSTRAINT `messageDiscardedFilterId` FOREIGN KEY (filterId) REFERENCES Filters(filterId) ON UPDATE CASCADE ON DELETE CASCADE);";
public static final String createMessagesAnsweredTable = "create table if not exists MessagesAnswered (id INTEGER PRIMARY KEY AUTO_INCREMENT," +
" userId INTEGER NOT NULL, answer INTEGER NOT NULL, message TEXT NOT NULL, matchValue FLOAT NOT NULL, date TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," +
" partial BOOLEAN NOT NULL DEFAULT false, CONSTRAINT `messagesAnswerdUserId` FOREIGN KEY (userId) REFERENCES Users(userId) ON UPDATE CASCADE ON DELETE CASCADE);";
public static final String createChatListTable = "create table if not exists Chats (chatId INTEGER PRIMARY KEY NOT NULL, " +
"title VARCHAR(50) NOT NULL);";
public static final String createChatsStatsTable = "create table if not exists ChatStats (id INTEGER PRIMARY KEY AUTO_INCREMENT," +
" userId INTEGER NOT NULL, chatId INTEGER NOT NULL, date TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," +
" forwarded BOOLEAN NOT NULL DEFAULT false, type INTEGER NOT NULL," +
"CONSTRAINT `chatsStatsUserId` FOREIGN KEY (userId) REFERENCES Users(userId) ON UPDATE CASCADE ON DELETE CASCADE, " +
"CONSTRAINT `chatsStatsChatId` FOREIGN KEY (chatId) REFERENCES Chats(chatId) ON UPDATE CASCADE ON DELETE CASCADE);";
public static volatile List<String> operatingSystems = new ArrayList<>();
static {
operatingSystems.add("All");
operatingSystems.add("iOS");
operatingSystems.add("Webogram");
operatingSystems.add("Android");
operatingSystems.add("OSX");
operatingSystems.add("Desktop");
operatingSystems.add("WP");
}*/
}

320
src/main/java/org/telegram/database/DatabaseManager.java

@ -0,0 +1,320 @@
/*
* This is the source code of Telegram Bot v. 2.0
* It is licensed under GNU GPL v. 3 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Ruben Bermudez, 3/12/14.
*/
package org.telegram.database;
import org.telegram.services.BotLogger;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
/**
* @author Ruben Bermudez
* @version 2.0
* @brief Database Manager to perform database operations
* @date 3/12/14
*/
public class DatabaseManager {
private static volatile BotLogger log = BotLogger.getLogger(DatabaseManager.class.getName()); ///< Logger
private static volatile DatabaseManager instance;
private static volatile ConectionDB connetion;
/**
* Private constructor (due to Singleton)
*/
private DatabaseManager() {
connetion = new ConectionDB();
final int currentVersion = connetion.checkVersion();
log.info("Current db version: " + currentVersion);
if (currentVersion < CreationStrings.version) {
recreateTable(currentVersion);
}
}
/**
* Get Singleton instance
*
* @return instance of the class
*/
public static DatabaseManager getInstance() {
final DatabaseManager currentInstance;
if (instance == null) {
synchronized (DatabaseManager.class) {
if (instance == null) {
instance = new DatabaseManager();
}
currentInstance = instance;
}
} else {
currentInstance = instance;
}
return currentInstance;
}
/**
* Recreates the DB
*/
private void recreateTable(int currentVersion) {
try {
connetion.initTransaction();
if (currentVersion == 0) {
currentVersion = createNewTables();
}
if (currentVersion == 1) {
currentVersion = updateToVersion2();
}
if (currentVersion == 2) {
currentVersion = updateToVersion3();
}
connetion.commitTransaction();
} catch (SQLException e) {
log.error(e);
}
}
private int updateToVersion2() throws SQLException {
connetion.executeQuery(CreationStrings.createRecentWeatherTable);
connetion.executeQuery("INSERT IGNORE INTO Versions (Version) VALUES(2);");
return 2;
}
private int updateToVersion3() throws SQLException {
connetion.executeQuery(CreationStrings.createDirectionsDatabase);
connetion.executeQuery("INSERT IGNORE INTO Versions (Version) VALUES(3);");
return 2;
}
private int createNewTables() throws SQLException {
connetion.executeQuery(CreationStrings.createVersionTable);
connetion.executeQuery(CreationStrings.createFilesTable);
connetion.executeQuery(CreationStrings.insertCurrentVersion);
connetion.executeQuery(CreationStrings.createUsersForFilesTable);
connetion.executeQuery(CreationStrings.createRecentWeatherTable);
connetion.executeQuery(CreationStrings.createDirectionsDatabase);
return CreationStrings.version;
}
public boolean addFile(String fileId, Integer userId, String caption) {
int updatedRows = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("REPLACE INTO Files (fileId, userId, caption) VALUES(?, ?, ?)");
preparedStatement.setString(1, fileId);
preparedStatement.setInt(2, userId);
preparedStatement.setString(3, caption);
updatedRows = preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return updatedRows > 0;
}
public HashMap<String, String> getFilesByUser(Integer userId) {
HashMap<String, String> files = new HashMap<>();
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("SELECT * FROM Files WHERE userId = ?");
preparedStatement.setInt(1, userId);
final ResultSet result = preparedStatement.executeQuery();
while (result.next()) {
files.put(result.getString("fileId"), result.getString("caption"));
}
result.close();
} catch (SQLException e) {
e.printStackTrace();
}
return files;
}
public boolean addUserForFile(Integer userId, int status) {
int updatedRows = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("REPLACE INTO FilesUsers (userId, status) VALUES(?, ?)");
preparedStatement.setInt(1, userId);
preparedStatement.setInt(2, status);
updatedRows = preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return updatedRows > 0;
}
public boolean deleteUserForFile(Integer userId) {
int updatedRows = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("DELETE FROM FilesUsers WHERE userId=?;");
preparedStatement.setInt(1, userId);
updatedRows = preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return updatedRows > 0;
}
public int getUserStatusForFile(Integer userId) {
int status = -1;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("Select status FROM FilesUsers WHERE userId=?");
preparedStatement.setInt(1, userId);
final ResultSet result = preparedStatement.executeQuery();
if (result.next()) {
status = result.getInt("status");
}
} catch (SQLException e) {
e.printStackTrace();
}
return status;
}
public boolean doesFileExists(String fileId) {
boolean exists = false;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("Select fileID FROM Files WHERE fileId=?");
preparedStatement.setString(1, fileId);
final ResultSet result = preparedStatement.executeQuery();
exists = result.next();
} catch (SQLException e) {
e.printStackTrace();
}
return exists;
}
public boolean deleteFile(String fileId) {
int updatedRows = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("DELETE FROM Files WHERE fileId=?;");
preparedStatement.setString(1, fileId);
updatedRows = preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return updatedRows > 0;
}
public boolean addRecentWeather(Integer userId, Integer cityId, String cityName) {
int updatedRows = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("REPLACE INTO RecentWeather (userId, cityId, cityName) VALUES(?, ?, ?)");
preparedStatement.setInt(1, userId);
preparedStatement.setInt(2, cityId);
preparedStatement.setString(3, cityName);
updatedRows = preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
cleanUpRecent(userId);
return updatedRows > 0;
}
public HashMap<Integer,String> getRecentWeather(Integer userId) {
HashMap<Integer,String> recentWeather = new HashMap<>();
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("select * FROM RecentWeather WHERE userId=?");
preparedStatement.setInt(1, userId);
final ResultSet result = preparedStatement.executeQuery();
while (result.next()) {
recentWeather.put(result.getInt("cityId"), result.getString("cityName"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return recentWeather;
}
private void cleanUpRecent(Integer userId) {
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("DELETE FROM RecentWeather WHERE userid = ? AND ID <= (SELECT ID FROM (SELECT id From RecentWeather where userId = ? ORDER BY id DESC LIMIT 1 OFFSET 4 ) AS T1 )");
preparedStatement.setInt(1, userId);
preparedStatement.setInt(2, userId);
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public boolean addUserForDirection(Integer userId, int status, int messageId, String origin) {
int updatedRows = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("REPLACE INTO Directions (userId, status, messageId, origin) VALUES(?, ?, ?, ?)");
preparedStatement.setInt(1, userId);
preparedStatement.setInt(2, status);
preparedStatement.setInt(3, messageId);
if (origin == null || origin.isEmpty()) {
preparedStatement.setNull(4, Types.VARCHAR);
} else {
preparedStatement.setString(4, origin);
}
updatedRows = preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return updatedRows > 0;
}
public int getUserDestinationStatus(Integer userId) {
int status = -1;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("SELECT status FROM Directions WHERE userId = ?");
preparedStatement.setInt(1, userId);
final ResultSet result = preparedStatement.executeQuery();
if (result.next()) {
status = result.getInt("status");
}
} catch (SQLException e) {
e.printStackTrace();
}
return status;
}
public int getUserDestinationMessageId(Integer userId) {
int messageId = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("SELECT messageId FROM Directions WHERE userId = ?");
preparedStatement.setInt(1, userId);
final ResultSet result = preparedStatement.executeQuery();
if (result.next()) {
messageId = result.getInt("messageId");
}
} catch (SQLException e) {
e.printStackTrace();
}
return messageId;
}
public String getUserOrigin(Integer userId) {
String origin = "";
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("SELECT origin FROM Directions WHERE userId = ?");
preparedStatement.setInt(1, userId);
final ResultSet result = preparedStatement.executeQuery();
if (result.next()) {
origin = result.getString("origin");
}
} catch (SQLException e) {
e.printStackTrace();
}
return origin;
}
public boolean deleteUserForDirections(Integer userId) {
int updatedRows = 0;
try {
final PreparedStatement preparedStatement = connetion.getPreparedStatement("DELETE FROM Directions WHERE userId=?;");
preparedStatement.setInt(1, userId);
updatedRows = preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return updatedRows > 0;
}
}

11
src/main/java/org/telegram/methods/Constants.java

@ -0,0 +1,11 @@
package org.telegram.methods;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief TODO
* @date 20 of June of 2015
*/
public class Constants {
public static final String BASEURL = "https://api.telegram.org/bot";
}

46
src/main/java/org/telegram/methods/ForwardMessage.java

@ -0,0 +1,46 @@
package org.telegram.methods;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send text messages. On success, the sent Message is returned.
* @date 20 of June of 2015
*/
public class ForwardMessage {
public static final String PATH = "forwardmessage";
public static final String CHATID_FIELD = "chat_id";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String FROMCHATID_FIELD = "from_chat_id";
private Integer fromChatId; ///< Unique identifier for the chat where the original message was sent — User or GroupChat id
public static final String MESSAGEID_FIELD = "message_id";
private Integer messageId; ///< Unique message identifier
public ForwardMessage() {
super();
}
public Integer getChatId() {
return chatId;
}
public void setChatId(Integer chatId) {
this.chatId = chatId;
}
public Integer getFromChatId() {
return fromChatId;
}
public void setFromChatId(Integer fromChatId) {
this.fromChatId = fromChatId;
}
public Integer getMessageId() {
return messageId;
}
public void setMessageId(Integer messageId) {
this.messageId = messageId;
}
}

12
src/main/java/org/telegram/methods/GetMe.java

@ -0,0 +1,12 @@
package org.telegram.methods;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief A simple method for testing your bot's auth token. Requires no parameters.
* Returns basic information about the bot in form of a User object
* @date 20 of June of 2015
*/
public class GetMe {
public static final String PATH = "getme";
}

63
src/main/java/org/telegram/methods/GetUpdates.java

@ -0,0 +1,63 @@
package org.telegram.methods;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to receive incoming updates using long polling (wiki).
* An Array of Update objects is returned.
* @date 20 of June of 2015
*/
public class GetUpdates {
public static final String PATH = "getupdates";
public static final String OFFSET_FIELD = "offset";
/**
* Optional Identifier of the first update to be returned.
* Must be greater by one than the highest among the identifiers of previously received updates.
* By default, updates starting with the earliest unconfirmed update are returned.
*/
private Integer offset;
public static final String LIMIT_FIELD = "limit";
/**
* Optional Limits the number of updates to be retrieved.
* Values between 1100 are accepted. Defaults to 100
*/
private Integer limit;
public static final String TIMEOUT_FIELD = "timeout";
/**
* Optional Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling
*/
private Integer timeout;
public GetUpdates() {
super();
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getTimeout() {
return timeout;
}
public void setTimeout(Integer timeout) {
this.timeout = timeout;
}
public String getUrlParams() {
return "?" + OFFSET_FIELD + "=" + offset ;
}
}

57
src/main/java/org/telegram/methods/GetUserProfilePhotos.java

@ -0,0 +1,57 @@
package org.telegram.methods;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
* @date 20 of June of 2015
*/
public class GetUserProfilePhotos {
public static final String PATH = "getuserprofilephotos";
/*
user_id Integer Yes
offset Integer
limit Integer Optional
*/
public static final String USERID_FIELD = "user_id";
private Integer userId; ///< Unique identifier of the target user
public static final String OFFSET_FIELD = "offset";
/**
* Sequential number of the first photo to be returned. By default, all photos are returned.
*/
private Integer offset;
public static final String LIMIT_FIELD = "limit";
/**
* Limits the number of photos to be retrieved. Values between 1100 are accepted. Defaults to 100.
*/
private Integer limit;
public GetUserProfilePhotos() {
super();
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
}

29
src/main/java/org/telegram/methods/SendAudio.java

@ -0,0 +1,29 @@
package org.telegram.methods;
import org.telegram.api.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send audio files,
* if you want Telegram clients to display the file as a playable voice message.
* For this to work, your audio must be in an .ogg file encoded with OPUS
* (other formats may be sent as Document). On success, the sent Message is returned.
* @date 20 of June of 2015
*/
public class SendAudio {
public static final String PATH = "sendaudio";
public static final String CHATID_FIELD = "chat_id";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String AUDIO_FIELD = "audio";
private String audio; ///< Audio file to send. file_id as String to resend an audio that is already on the Telegram servers
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
public static final String REPLYMARKUP_FIELD = "reply_markup";
private ReplyKeyboard replayMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
public SendAudio() {
super();
}
}

31
src/main/java/org/telegram/methods/SendChatAction.java

@ -0,0 +1,31 @@
package org.telegram.methods;
import org.telegram.api.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method when you need to tell the user that something is happening on the bot's side.
* The status is set for 5 seconds or less (when a message arrives from your bot,
* Telegram clients clear its typing status).
* @date 20 of June of 2015
*/
public class SendChatAction {
public static final String PATH = "sendChatAction";
public static final String CHATID_FIELD = "chat_id";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String ACTION_FIELD = "action";
/**
* Type of action to broadcast.
* Choose one, depending on what the user is about to receive:
* 'typing' for text messages
* 'upload_photo' for photos
* 'record_video' or 'upload_video' for videos
* 'record_audio' or 'upload_audio' for audio files
* 'upload_document' for general files,
* 'find_location' for location data.
*/
private Float action;
}

76
src/main/java/org/telegram/methods/SendDocument.java

@ -0,0 +1,76 @@
package org.telegram.methods;
import org.telegram.api.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send general files. On success, the sent Message is returned.
* @date 20 of June of 2015
*/
public class SendDocument {
public static final String PATH = "senddocument";
public static final String CHATID_FIELD = "chat_id";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String DOCUMENT_FIELD = "document";
private String document; ///< File file to send. file_id as String to resend a file that is already on the Telegram servers
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
public static final String REPLYMARKUP_FIELD = "reply_markup";
private ReplyKeyboard replayMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
private boolean isNewDocument;
private String documentName;
public SendDocument() {
super();
}
public Integer getChatId() {
return chatId;
}
public void setChatId(Integer chatId) {
this.chatId = chatId;
}
public String getDocument() {
return document;
}
public void setDocument(String document) {
this.document = document;
this.isNewDocument = false;
}
public void setNewDocument(String document, String documentName) {
this.document = document;
this.isNewDocument = true;
this.documentName = documentName;
}
public boolean isNewDocument() {
return isNewDocument;
}
public String getDocumentName() {
return documentName;
}
public Integer getReplayToMessageId() {
return replayToMessageId;
}
public void setReplayToMessageId(Integer replayToMessageId) {
this.replayToMessageId = replayToMessageId;
}
public ReplyKeyboard getReplayMarkup() {
return replayMarkup;
}
public void setReplayMarkup(ReplyKeyboard replayMarkup) {
this.replayMarkup = replayMarkup;
}
}

24
src/main/java/org/telegram/methods/SendLocation.java

@ -0,0 +1,24 @@
package org.telegram.methods;
import org.telegram.api.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send point on the map. On success, the sent Message is returned.
* @date 20 of June of 2015
*/
public class SendLocation {
public static final String PATH = "sendlocation";
public static final String CHATID_FIELD = "chat_id";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String LATITUDE_FIELD = "latitude";
private Float latitude; ///< Latitude of location
public static final String LONGITUDE_FIELD = "longitude";
private Float longitude; ///< Longitude of location
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
public static final String REPLYMARKUP_FIELD = "reply_markup";
private ReplyKeyboard replayMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
}

68
src/main/java/org/telegram/methods/SendMessage.java

@ -0,0 +1,68 @@
package org.telegram.methods;
import org.telegram.api.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send text messages. On success, the sent Message is returned.
* @date 20 of June of 2015
*/
public class SendMessage {
public static final String PATH = "sendmessage";
public static final String CHATID_FIELD = "chat_id";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String TEXT_FIELD = "text";
private String text; ///< Text of the message to be sent
public static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
private Boolean disableWebPagePreview; ///< Disables link previews for links in this message
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
public static final String REPLYMARKUP_FIELD = "reply_markup";
private ReplyKeyboard replayMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
public SendMessage() {
super();
}
public Integer getChatId() {
return chatId;
}
public void setChatId(Integer chatId) {
this.chatId = chatId;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Integer getReplayToMessageId() {
return replayToMessageId;
}
public void setReplayToMessageId(Integer replayToMessageId) {
this.replayToMessageId = replayToMessageId;
}
public ReplyKeyboard getReplayMarkup() {
return replayMarkup;
}
public void setReplayMarkup(ReplyKeyboard replayMarkup) {
this.replayMarkup = replayMarkup;
}
public Boolean getDisableWebPagePreview() {
return disableWebPagePreview;
}
public void setDisableWebPagePreview(Boolean disableWebPagePreview) {
this.disableWebPagePreview = disableWebPagePreview;
}
}

29
src/main/java/org/telegram/methods/SendPhoto.java

@ -0,0 +1,29 @@
package org.telegram.methods;
import org.telegram.api.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send photos. On success, the sent Message is returned.
* @date 20 of June of 2015
*/
public class SendPhoto {
public static final String PATH = "sendphoto";
public static final String CHATID_FIELD = "chat_id";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String PHOTO_FIELD = "photo";
private String photo; ///< Photo to send. file_id as String to resend a photo that is already on the Telegram servers
public static final String CAPTION_FIELD = "photo";
private String caption; ///< Optional Photo caption (may also be used when resending photos by file_id).
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
public static final String REPLYMARKUP_FIELD = "reply_markup";
private ReplyKeyboard replayMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
public SendPhoto() {
super();
}
}

22
src/main/java/org/telegram/methods/SendSticker.java

@ -0,0 +1,22 @@
package org.telegram.methods;
import org.telegram.api.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief TODO
* @date 20 of June of 2015
*/
public class SendSticker {
public static final String PATH = "sendsticker";
public static final String CHATID_FIELD = "document";
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String STICKER_FIELD = "sticker";
private String sticker; ///< Sticker file to send. file_id as String to resend a sticker that is already on the Telegram servers
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
public static final String REPLYMARKUP_FIELD = "reply_markup";
private ReplyKeyboard replayMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save