Migrate from examples project

This commit is contained in:
Rubenlagus 2016-01-14 01:14:53 +01:00
commit 7957fa9623
117 changed files with 7843 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

35
.gitignore vendored Normal file
View File

@ -0,0 +1,35 @@
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
### Java template
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# unneeded files
.idea/dataSources.*
.idea/workspace.xml
# logs files
*.log
# Certs
*.jks
*.cer
*.pem

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
BotAPi

32
.idea/compiler.xml Normal file
View File

@ -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>

View File

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

7
.idea/encodings.xml Normal file
View File

@ -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>

View File

@ -0,0 +1,49 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<option name="myLocal" value="true" />
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="FieldMayBeStatic" enabled="true" level="WARNING" enabled_by_default="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>
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
<inspection_tool class="MethodMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_onlyPrivateOrFinal" value="false" />
<option name="m_ignoreEmptyMethods" value="true" />
</inspection_tool>
</profile>
</component>

View File

@ -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>

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

@ -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>

77
.idea/misc.xml Normal file
View File

@ -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 Normal file
View File

@ -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>

11
.idea/resourceBundles.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ResourceBundleManager">
<file url="file://$PROJECT_DIR$/src/main/resources/localisation/strings.properties" />
<file url="file://$PROJECT_DIR$/src/main/resources/localisation/strings_eo.properties" />
<file url="file://$PROJECT_DIR$/src/main/resources/localisation/strings_es.properties" />
<file url="file://$PROJECT_DIR$/src/main/resources/localisation/strings_it.properties" />
<file url="file://$PROJECT_DIR$/src/main/resources/localisation/strings_nl.properties" />
<file url="file://$PROJECT_DIR$/src/main/resources/localisation/strings_pt.properties" />
</component>
</project>

124
.idea/uiDesigner.xml Normal file
View File

@ -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 Normal file
View File

@ -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>

57
BotAPi.iml Normal file
View File

@ -0,0 +1,57 @@
<?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.21" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:javax.inject:2.4.0-b31" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http-server:2.3.22" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http:2.3.22" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-framework:2.3.22" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.21" 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.21" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.4.0-b31" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.4.0-b31" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.4.0-b31" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.4.0-b31" 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.21" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.21" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-jaxb:2.21" 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.21" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.ext:jersey-entity-filtering:2.21" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.5.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.5.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.5.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.5.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.5.4" 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.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.3" 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: org.apache.httpcomponents:httpmime:4.5.1" level="project" />
</component>
</module>

675
LICENSE Normal file
View File

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

51
README.md Normal file
View File

@ -0,0 +1,51 @@
# Telegram Bot Java Library
A simple to use library to create Telegram Bots in Java (Still Beta Version)
## Translations
Bots are now supporting multilanguage. If you want to add your own, feel free to translate at [transifex](https://www.transifex.com/projects/p/telegrambots/)
## Contributions
Feel free to fork this project, work on it and then make a pull request. Most of the times I will accept them if they add something valuable to the code.
Please, **DO NOT PUSH ANY TOKEN OR API KEY**, I will never accept a pull request with that content.
## Webhooks vs GetUpdates
Both ways are supported (but I still didn't tested webhooks). To change between them, just go to *BuildVars.java* and change variable *useWebHook* value.
I recommend using getUpdates methods. Webhooks only works using a certificated that is not self-signed
## Example bots
Open them and send them */help* command to get some information about their capabilities:
https://telegram.me/weatherbot
https://telegram.me/directionsbot
https://telegram.me/filesbot
https://telegram.me/TGlanguagesbot
## Telegram Bot API
This library use [Telegram bot API](https://core.telegram.org/bots), you can find more information following the link.
## Questions or Suggestions
Feel free to create issues [here](https://github.com/rubenlagus/TelegramBots/issues) as you need
## Usage with eclipse
Follow the steps created by Rico [here](https://github.com/rubenlagus/TelegramBots/blob/master/eclipse%20configuration.md)
## License
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

27
eclipse configuration.md Normal file
View File

@ -0,0 +1,27 @@
# How to use TelegramBots with Eclipse
### Step 1: Install Maven
To get started, you need to install the Maven-Plugin for Eclipse. Click on Help > Eclipse Marketplace. After it finished loading, search for “Maven”.
Now install **“Maven (Java EE) Integration for Eclipse WTP”**. You have to restart, after the installation is completed.
### Step 2: Download the Project
Now you need to get the project itself.
Visit [TelegramBots - github.com][1] and choose “Download Zip”, to download the zip-file. [Here] is a direct link if you are lazy.
### Step 3: Create folder
Now lets setup the project-folder. Go to your Eclipse-Workspace and create a folder (name it whatever you want it to be called). I just named it **“TelegramBotApi”**. Afterwards copy everything from the zip-file into that folder.
### Step 4: Import project
To import your project into the workspace you have to go to File > Import > (Folder) Maven > Existing Maven Projects > Next. Choose the folder, you have created in Step 3. In my case: **“TelegramBotApi”**. Click on finish and let Maven import the dependencies.
### Step 5: Setting the compliance level
In this last step you need to change the Compiler compliance level. To do this right-click on your Project (in my case **“TelegramBotApi”**) > Properties > Java Compiler. Uncheck the “Use compliance from…” if necessary and set it to 1.7
*Now you are done. Everything should work fine. You need to set your Bot-Token in the BotConfig.java, afterwards you can run Main.java to check.*
**For a better intstruction sheet, visit [Google Drive]**
[Google Drive]:https://goo.gl/5jd40w
[here]:https://github.com/rubenlagus/TelegramBots/archive/master.zip
[1]:https://github.com/rubenlagus/TelegramBots/

146
pom.xml Normal file
View File

@ -0,0 +1,146 @@
<?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>TelegramBots</groupId>
<artifactId>org.telegram.telegrambots</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.21</jersey.version>
<httpcompontents.version>4.5.1</httpcompontents.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>${httpcompontents.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpcompontents.version}</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 vendored Normal file

Binary file not shown.

BIN
src/main/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/main/java/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,287 @@
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.StringEntity;
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.methods.*;
import org.telegram.services.BotLogger;
import org.telegram.updateshandlers.SentCallback;
import java.io.File;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Send Helper
* @date 20 of June of 2015
*/
public class SenderHelper {
private static final String LOGTAG = "SENDERHELPER";
private static final ExecutorService exe = Executors.newSingleThreadExecutor();
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());
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()));
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);
} catch (IOException e) {
BotLogger.error(LOGTAG, e);
} finally {
if (sendDocument.isNewDocument()) {
File fileToDelete = new File(sendDocument.getDocument());
fileToDelete.delete();
}
}
}
public static void SendPhoto(SendPhoto sendPhoto, String botToken) {
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = Constants.BASEURL + botToken + "/" + SendPhoto.PATH;
HttpPost httppost = new HttpPost(url);
if (sendPhoto.isNewPhoto()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendPhoto.CHATID_FIELD, sendPhoto.getChatId());
builder.addBinaryBody(SendPhoto.PHOTO_FIELD, new File(sendPhoto.getPhoto()), ContentType.APPLICATION_OCTET_STREAM, sendPhoto.getPhotoName());
if (sendPhoto.getReplayMarkup() != null) {
builder.addTextBody(SendPhoto.REPLYMARKUP_FIELD, sendPhoto.getReplayMarkup().toJson().toString());
}
if (sendPhoto.getReplayToMessageId() != null) {
builder.addTextBody(SendPhoto.REPLYTOMESSAGEID_FIELD, sendPhoto.getReplayToMessageId().toString());
}
if (sendPhoto.getCaption() != null) {
builder.addTextBody(SendPhoto.CAPTION_FIELD, sendPhoto.getCaption());
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
} else {
List<NameValuePair> nameValuePairs = new ArrayList<>();
nameValuePairs.add(new BasicNameValuePair(SendPhoto.CHATID_FIELD, sendPhoto.getChatId()));
nameValuePairs.add(new BasicNameValuePair(SendPhoto.PHOTO_FIELD, sendPhoto.getPhoto()));
if (sendPhoto.getReplayMarkup() != null) {
nameValuePairs.add(new BasicNameValuePair(SendPhoto.REPLYMARKUP_FIELD, sendPhoto.getReplayMarkup().toString()));
}
if (sendPhoto.getReplayToMessageId() != null) {
nameValuePairs.add(new BasicNameValuePair(SendPhoto.REPLYTOMESSAGEID_FIELD, sendPhoto.getReplayToMessageId().toString()));
}
if (sendPhoto.getCaption() != null) {
nameValuePairs.add(new BasicNameValuePair(SendPhoto.CAPTION_FIELD, sendPhoto.getCaption()));
}
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
}
CloseableHttpResponse response = httpClient.execute(httppost);
} catch (IOException e) {
BotLogger.error(LOGTAG, e);
}
}
public static void SendVideo(SendVideo sendVideo, String botToken) {
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = Constants.BASEURL + botToken + "/" + SendVideo.PATH;
HttpPost httppost = new HttpPost(url);
if (sendVideo.isNewVideo()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendVideo.CHATID_FIELD, sendVideo.getChatId());
builder.addBinaryBody(SendVideo.VIDEO_FIELD, new File(sendVideo.getVideo()), ContentType.APPLICATION_OCTET_STREAM, sendVideo.getVideoName());
if (sendVideo.getReplayMarkup() != null) {
builder.addTextBody(SendVideo.REPLYMARKUP_FIELD, sendVideo.getReplayMarkup().toJson().toString());
}
if (sendVideo.getReplayToMessageId() != null) {
builder.addTextBody(SendVideo.REPLYTOMESSAGEID_FIELD, sendVideo.getReplayToMessageId().toString());
}
if (sendVideo.getCaption() != null) {
builder.addTextBody(SendVideo.CAPTION_FIELD, sendVideo.getCaption());
}
if (sendVideo.getDuration() != null) {
builder.addTextBody(SendVideo.DURATION_FIELD, sendVideo.getDuration().toString());
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
} else {
List<NameValuePair> nameValuePairs = new ArrayList<>();
nameValuePairs.add(new BasicNameValuePair(SendVideo.CHATID_FIELD, sendVideo.getChatId()));
nameValuePairs.add(new BasicNameValuePair(SendVideo.VIDEO_FIELD, sendVideo.getVideo()));
if (sendVideo.getReplayMarkup() != null) {
nameValuePairs.add(new BasicNameValuePair(SendVideo.REPLYMARKUP_FIELD, sendVideo.getReplayMarkup().toString()));
}
if (sendVideo.getReplayToMessageId() != null) {
nameValuePairs.add(new BasicNameValuePair(SendVideo.REPLYTOMESSAGEID_FIELD, sendVideo.getReplayToMessageId().toString()));
}
if (sendVideo.getCaption() != null) {
nameValuePairs.add(new BasicNameValuePair(SendVideo.CAPTION_FIELD, sendVideo.getCaption()));
}
if (sendVideo.getDuration() != null) {
nameValuePairs.add(new BasicNameValuePair(SendVideo.DURATION_FIELD, sendVideo.getDuration().toString()));
}
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
}
CloseableHttpResponse response = httpClient.execute(httppost);
} catch (IOException e) {
BotLogger.error(LOGTAG, e);
}
}
public static void sendSticker(SendSticker sendSticker, String botToken) {
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = Constants.BASEURL + botToken + "/" + SendSticker.PATH;
HttpPost httppost = new HttpPost(url);
if (sendSticker.isNewSticker()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendSticker.CHATID_FIELD, sendSticker.getChatId());
builder.addBinaryBody(SendSticker.STICKER_FIELD, new File(sendSticker.getSticker()), ContentType.APPLICATION_OCTET_STREAM, sendSticker.getStickerName());
if (sendSticker.getReplayMarkup() != null) {
builder.addTextBody(SendSticker.REPLYMARKUP_FIELD, sendSticker.getReplayMarkup().toJson().toString());
}
if (sendSticker.getReplayToMessageId() != null) {
builder.addTextBody(SendSticker.REPLYTOMESSAGEID_FIELD, sendSticker.getReplayToMessageId().toString());
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
} else {
List<NameValuePair> nameValuePairs = new ArrayList<>();
nameValuePairs.add(new BasicNameValuePair(SendSticker.CHATID_FIELD, sendSticker.getChatId()));
nameValuePairs.add(new BasicNameValuePair(SendSticker.STICKER_FIELD, sendSticker.getSticker()));
if (sendSticker.getReplayMarkup() != null) {
nameValuePairs.add(new BasicNameValuePair(SendSticker.REPLYMARKUP_FIELD, sendSticker.getReplayMarkup().toString()));
}
if (sendSticker.getReplayToMessageId() != null) {
nameValuePairs.add(new BasicNameValuePair(SendSticker.REPLYTOMESSAGEID_FIELD, sendSticker.getReplayToMessageId().toString()));
}
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
}
CloseableHttpResponse response = httpClient.execute(httppost);
} catch (IOException e) {
BotLogger.error(LOGTAG, e);
} finally {
if (sendSticker.isNewSticker()) {
File fileToDelete = new File(sendSticker.getSticker());
fileToDelete.delete();
}
}
}
public static void SendWebhook(String webHookURL, String botToken, String publicCertificatePath, String publicCertificateName) {
try {
CloseableHttpClient httpclient = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
String url = Constants.BASEURL + botToken + "/" + SetWebhook.PATH;
HttpPost httppost = new HttpPost(url);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SetWebhook.URL_FIELD, webHookURL);
if (publicCertificatePath != null) {
builder.addBinaryBody(SetWebhook.CERTIFICATE_FIELD, new File(publicCertificatePath), ContentType.APPLICATION_OCTET_STREAM, publicCertificateName);
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
CloseableHttpResponse response = httpclient.execute(httppost);
HttpEntity ht = response.getEntity();
BufferedHttpEntity buf = new BufferedHttpEntity(ht);
String responseContent = EntityUtils.toString(buf, "UTF-8");
BotLogger.debug(LOGTAG, responseContent);
} catch (IOException e) {
BotLogger.error(LOGTAG, e);
}
}
public static void SendApiMethod(BotApiMethod method, String botToken) throws InvalidObjectException {
String responseContent = "{}";
try {
CloseableHttpClient httpclient = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
String url = Constants.BASEURL + botToken + "/" + method.getPath();
HttpPost httppost = new HttpPost(url);
httppost.addHeader("charset", "UTF-8");
httppost.setEntity(new StringEntity(method.toJson().toString(), ContentType.APPLICATION_JSON));
CloseableHttpResponse response = httpclient.execute(httppost);
HttpEntity ht = response.getEntity();
BufferedHttpEntity buf = new BufferedHttpEntity(ht);
responseContent = EntityUtils.toString(buf, "UTF-8");
} catch (IOException e) {
BotLogger.error(LOGTAG, e);
}
JSONObject jsonObject = new JSONObject(responseContent);
if (!jsonObject.getBoolean("ok")) {
throw new InvalidObjectException(jsonObject.getString("description"));
}
}
public static void SendApiMethodAsync(BotApiMethod method, String botToken, SentCallback callback) {
exe.submit(() -> {
try {
CloseableHttpClient httpclient = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
String url = Constants.BASEURL + botToken + "/" + method.getPath();
HttpPost httppost = new HttpPost(url);
httppost.addHeader("charset", "UTF-8");
httppost.setEntity(new StringEntity(method.toJson().toString(), ContentType.APPLICATION_JSON));
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")) {
callback.onError(method, jsonObject);
}
callback.onResult(method, jsonObject);
} catch (IOException e) {
BotLogger.error(LOGTAG, e);
}
});
}
}

View File

@ -0,0 +1,13 @@
package org.telegram.api.interfaces;
import com.fasterxml.jackson.databind.JsonSerializable;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief An object of Telegram Bots Api
* @date 07 of September of 2015
*/
public interface BotApiObject extends JsonSerializable {
}

View File

@ -0,0 +1,18 @@
package org.telegram.api.interfaces;
import org.json.JSONObject;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Add conversion to JSON object
* @date 08 of September of 2015
*/
public interface IToJson {
/**
* Convert to json object
* @return JSONObject created in the conversion
*/
JSONObject toJson();
}

View File

@ -0,0 +1,138 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONArray;
import org.json.JSONObject;
import org.telegram.api.objects.InlineQueryResult;
import java.io.IOException;
import java.util.List;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send answers to an inline query. On success, True is returned.
* @date 01 of January of 2016
*/
public class AnswerInlineQuery extends BotApiMethod<Boolean> {
public static final String PATH = "answerInlineQuery";
public static final String INLINEQUERYID_FIELD = "inline_query_id";
private String inlineQueryId; ///< Unique identifier for answered query
public static final String RESULTS_FIELD = "results";
private List<InlineQueryResult> results; ///< A JSON-serialized array of results for the inline query
public static final String CACHETIME_FIELD = "cache_time";
private Integer cacheTime; ///< Optional The maximum amount of time the result of the inline query may be cached on the server
public static final String ISPERSONAL_FIELD = "is_personal";
private Boolean isPersonal; ///< Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
public static final String NEXTOFFSET_FIELD = "next_offset";
private String nextOffset; ///< Optional Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you dont support pagination. Offset length cant exceed 64 bytes.
public AnswerInlineQuery() {
super();
}
public String getInlineQueryId() {
return inlineQueryId;
}
public void setInlineQueryId(String inlineQueryId) {
this.inlineQueryId = inlineQueryId;
}
public List<InlineQueryResult> getResults() {
return results;
}
public void setResults(List<InlineQueryResult> results) {
this.results = results;
}
public Integer getCacheTime() {
return cacheTime;
}
public void setCacheTime(Integer cacheTime) {
this.cacheTime = cacheTime;
}
public Boolean getPersonal() {
return isPersonal;
}
public void setPersonal(Boolean personal) {
isPersonal = personal;
}
public String getNextOffset() {
return nextOffset;
}
public void setNextOffset(String nextOffset) {
this.nextOffset = nextOffset;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(INLINEQUERYID_FIELD, inlineQueryId);
JSONArray JSONResults = new JSONArray();
for (InlineQueryResult result: results) {
JSONResults.put(result.toJson());
}
jsonObject.put(RESULTS_FIELD, JSONResults);
if (cacheTime != null) {
jsonObject.put(CACHETIME_FIELD, cacheTime);
}
if (isPersonal != null) {
jsonObject.put(ISPERSONAL_FIELD, isPersonal);
}
if (nextOffset != null) {
jsonObject.put(NEXTOFFSET_FIELD, nextOffset);
}
return jsonObject;
}
@Override
public String getPath() {
return PATH;
}
@Override
public Boolean deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return answer.getBoolean("result");
}
return null;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(METHOD_FIELD, PATH);
gen.writeArrayFieldStart(RESULTS_FIELD);
for (InlineQueryResult result: results) {
gen.writeObject(result);
}
gen.writeEndArray();
if (cacheTime != null) {
gen.writeNumberField(CACHETIME_FIELD, cacheTime);
}
if (isPersonal != null) {
gen.writeBooleanField(ISPERSONAL_FIELD, isPersonal);
}
if (nextOffset != null) {
gen.writeStringField(NEXTOFFSET_FIELD, nextOffset);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,28 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.databind.JsonSerializable;
import org.json.JSONObject;
import org.telegram.api.interfaces.IToJson;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief A method of Telegram Bots Api that is fully supported in json format
* @date 07 of September of 2015
*/
public abstract class BotApiMethod<T> implements JsonSerializable, IToJson {
protected static final String METHOD_FIELD = "method";
/**
* Getter for method path (that is the same as method name)
* @return Method path
*/
public abstract String getPath();
/**
* Deserialize a json answer to the response type to a method
* @param answer Json answer received
* @return Answer for the method
*/
public abstract T deserializeResponse(JSONObject answer);
}

View File

@ -0,0 +1,11 @@
package org.telegram.api.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";
}

View File

@ -0,0 +1,92 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.objects.Message;
import java.io.IOException;
/**
* @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 extends BotApiMethod<Message> {
public static final String PATH = "forwardmessage";
public static final String CHATID_FIELD = "chat_id";
private String chatId; ///< Unique identifier for the chat to send the message to (or username for channels)
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 String getChatId() {
return chatId;
}
public void setChatId(String 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;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(METHOD_FIELD, PATH);
gen.writeStringField(CHATID_FIELD, chatId);
gen.writeNumberField(FROMCHATID_FIELD, fromChatId);
gen.writeNumberField(MESSAGEID_FIELD, messageId);
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(CHATID_FIELD, chatId);
jsonObject.put(FROMCHATID_FIELD, fromChatId);
jsonObject.put(MESSAGEID_FIELD, messageId);
return jsonObject;
}
@Override
public String getPath() {
return PATH;
}
@Override
public Message deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return new Message(answer.getJSONObject("result"));
}
return null;
}
}

View File

@ -0,0 +1,74 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.objects.File;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to get basic info about a file and prepare it for downloading.
* For the moment, bots can download files of up to 20MB in size.
* On success, a File object is returned.
* The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>,
* where <file_path> is taken from the response.
* It is guaranteed that the link will be valid for at least 1 hour.
* When the link expires, a new one can be requested by calling getFile again.
* @date 20 of June of 2015
*/
public class GetFile extends BotApiMethod<File> {
public static final String PATH = "getfield";
public static final String FILEID_FIELD = "file_id";
private String fileId; ///< File identifier to get info about
public GetFile() {
super();
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(METHOD_FIELD, PATH);
gen.writeStringField(FILEID_FIELD, fileId);
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(FILEID_FIELD, fileId);
return jsonObject;
}
@Override
public String getPath() {
return PATH;
}
@Override
public File deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return new File(answer.getJSONObject("result"));
}
return null;
}
}

View File

@ -0,0 +1,50 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.objects.User;
import java.io.IOException;
/**
* @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 extends BotApiMethod<User> {
public static final String PATH = "getme";
@Override
public JSONObject toJson() {
return new JSONObject();
}
@Override
public String getPath() {
return PATH;
}
@Override
public User deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return new User(answer.getJSONObject("result"));
}
return null;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(METHOD_FIELD, PATH);
gen.writeEndObject();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,77 @@
package org.telegram.api.methods;
import org.json.JSONObject;
import org.telegram.api.interfaces.IToJson;
/**
* @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 implements IToJson {
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;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
if (offset != null) {
jsonObject.put(OFFSET_FIELD, offset);
}
if (limit != null) {
jsonObject.put(LIMIT_FIELD, limit);
}
if (timeout != null) {
jsonObject.put(TIMEOUT_FIELD, timeout);
}
return jsonObject;
}
}

View File

@ -0,0 +1,102 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.objects.UserProfilePhotos;
import java.io.IOException;
/**
* @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 extends BotApiMethod<UserProfilePhotos> {
public static final String PATH = "getuserprofilephotos";
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";
/**
* Optional. 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;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(USERID_FIELD, userId);
jsonObject.put(OFFSET_FIELD, offset);
if (limit != null) {
jsonObject.put(LIMIT_FIELD, limit);
}
return jsonObject;
}
@Override
public String getPath() {
return PATH;
}
@Override
public UserProfilePhotos deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return new UserProfilePhotos(answer.getJSONObject("result"));
}
return null;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(METHOD_FIELD, PATH);
gen.writeNumberField(USERID_FIELD, userId);
gen.writeNumberField(OFFSET_FIELD, offset);
if (limit != null) {
gen.writeNumberField(LIMIT_FIELD, limit);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,104 @@
package org.telegram.api.methods;
import org.telegram.api.objects.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send audio files,
* Use this method to send audio files, if you want Telegram clients to display them in the music player.
* Your audio must be in an .mp3 format. On success, the sent Message is returned.
* Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
*
* @note For backward compatibility, when both fields title and description are empty and mime-type of the sent
* file is not audio/mpeg, file is sent as playable voice message.
* In this case, your audio must be in an .ogg file encoded with OPUS.
* This will be removed in the future. You need to use sendVoice method instead.
*
* @date 16 of July of 2015
*/
public class SendAudio {
public static final String PATH = "sendaudio";
public static final String CHATID_FIELD = "chat_id";
private String chatId; ///< Unique identifier for the chat to send the message to (or Username fro channels)
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 static final String PERFOMER_FIELD = "performer";
private String performer; ///< Optional. Performer of sent audio
public static final String TITLE_FIELD = "title";
private String title; ///< Optional. Title of sent audio
private boolean isNewAudio;
private String audioName;
public SendAudio() {
super();
}
public String getChatId() {
return chatId;
}
public void setChatId(String chatId) {
this.chatId = chatId;
}
public String getAudio() {
return audio;
}
public void setAudio(String audio) {
this.audio = audio;
this.isNewAudio = false;
}
public void setNewAudio(String audio, String audioName) {
this.audio = audio;
this.isNewAudio = true;
this.audioName = audioName;
}
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 String getPerformer() {
return performer;
}
public void setPerformer(String performer) {
this.performer = performer;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isNewAudio() {
return isNewAudio;
}
public String getAudioName() {
return audioName;
}
}

View File

@ -0,0 +1,86 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import java.io.IOException;
/**
* @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 extends BotApiMethod<Boolean>{
public static final String PATH = "sendChatAction";
public static final String CHATID_FIELD = "chat_id";
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
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 String action;
public String getChatId() {
return chatId;
}
public void setChatId(String chatId) {
this.chatId = chatId;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
@Override
public String getPath() {
return PATH;
}
@Override
public Boolean deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return answer.getBoolean("result");
}
return null;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(CHATID_FIELD, chatId);
jsonObject.put(ACTION_FIELD, action);
return jsonObject;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(CHATID_FIELD, chatId);
gen.writeStringField(ACTION_FIELD, action);
gen.writeEndObject();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,76 @@
package org.telegram.api.methods;
import org.telegram.api.objects.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 String chatId; ///< Unique identifier for the chat to send the message to or Username for the channel to send the message to
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 String getChatId() {
return chatId;
}
public void setChatId(String 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;
}
}

View File

@ -0,0 +1,123 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.objects.Message;
import org.telegram.api.objects.ReplyKeyboard;
import java.io.IOException;
/**
* @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 extends BotApiMethod<Message> {
public static final String PATH = "sendlocation";
public static final String CHATID_FIELD = "chat_id";
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
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
public String getChatId() {
return chatId;
}
public void setChatId(String chatId) {
this.chatId = chatId;
}
public Float getLatitude() {
return latitude;
}
public void setLatitude(Float latitude) {
this.latitude = latitude;
}
public Float getLongitude() {
return longitude;
}
public void setLongitude(Float longitude) {
this.longitude = longitude;
}
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;
}
@Override
public String getPath() {
return PATH;
}
@Override
public Message deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return new Message(answer.getJSONObject("result"));
}
return null;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(CHATID_FIELD, chatId);
jsonObject.put(LATITUDE_FIELD, latitude);
jsonObject.put(LONGITUDE_FIELD, longitude);
if (replayToMessageId != null) {
jsonObject.put(REPLYTOMESSAGEID_FIELD, replayToMessageId);
}
if (replayMarkup != null) {
jsonObject.put(REPLYMARKUP_FIELD, replayMarkup.toJson());
}
return jsonObject;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(METHOD_FIELD, PATH);
gen.writeStringField(CHATID_FIELD, chatId);
gen.writeNumberField(LATITUDE_FIELD, latitude);
gen.writeNumberField(LONGITUDE_FIELD, longitude);
if (replayToMessageId != null) {
gen.writeNumberField(REPLYTOMESSAGEID_FIELD, replayToMessageId);
}
if (replayMarkup != null) {
gen.writeObjectField(REPLYMARKUP_FIELD, replayMarkup);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,148 @@
package org.telegram.api.methods;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.objects.Message;
import org.telegram.api.objects.ReplyKeyboard;
import java.io.IOException;
/**
* @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 extends BotApiMethod<Message> {
public static final String PATH = "sendmessage";
public static final String CHATID_FIELD = "chat_id";
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
public static final String TEXT_FIELD = "text";
private String text; ///< Text of the message to be sent
public static final String PARSEMODE_FIELD = "parse_mode";
private String parseMode; ///< Optional. Send Markdown, if you want Telegram apps to show bold, italic and URL text in your bot's message.
public static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
private Boolean disableWebPagePreview; ///< Optional. 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 String getChatId() {
return chatId;
}
public void setChatId(String 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;
}
public void enableMarkdown(boolean enable) {
if (enable) {
this.parseMode = "Markdown";
} else {
this.parseMode = null;
}
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(CHATID_FIELD, chatId);
jsonObject.put(TEXT_FIELD, text);
if (parseMode != null) {
jsonObject.put(PARSEMODE_FIELD, parseMode);
}
if (disableWebPagePreview != null) {
jsonObject.put(DISABLEWEBPAGEPREVIEW_FIELD, disableWebPagePreview);
}
if (replayToMessageId != null) {
jsonObject.put(REPLYTOMESSAGEID_FIELD, replayToMessageId);
}
if (replayMarkup != null) {
jsonObject.put(REPLYMARKUP_FIELD, replayMarkup.toJson());
}
return jsonObject;
}
@Override
public String getPath() {
return PATH;
}
@Override
public Message deserializeResponse(JSONObject answer) {
if (answer.getBoolean("ok")) {
return new Message(answer.getJSONObject("result"));
}
return null;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(METHOD_FIELD, PATH);
gen.writeStringField(CHATID_FIELD, chatId);
gen.writeStringField(TEXT_FIELD, text);
if (parseMode != null) {
gen.writeStringField(PARSEMODE_FIELD, parseMode);
}
if (disableWebPagePreview != null) {
gen.writeBooleanField(DISABLEWEBPAGEPREVIEW_FIELD, disableWebPagePreview);
}
if (replayToMessageId != null) {
gen.writeNumberField(REPLYTOMESSAGEID_FIELD, replayToMessageId);
}
if (replayMarkup != null) {
gen.writeObjectField(REPLYMARKUP_FIELD, replayMarkup);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,87 @@
package org.telegram.api.methods;
import org.telegram.api.objects.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 String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
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
private boolean isNewPhoto; ///< True if the photo must be uploaded from a file, file if it is a fileId
private String photoName; ///< Name of the photo
public SendPhoto() {
super();
}
public String getChatId() {
return chatId;
}
public void setChatId(String chatId) {
this.chatId = chatId;
}
public String getPhoto() {
return photo;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
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 isNewPhoto() {
return isNewPhoto;
}
public String getPhotoName() {
return photoName;
}
public void setPhoto(String photo) {
this.photo = photo;
this.isNewPhoto = false;
}
public void setNewPhoto(String photo, String photoName) {
this.photo = photo;
this.isNewPhoto = true;
this.photoName = photoName;
}
}

View File

@ -0,0 +1,76 @@
package org.telegram.api.methods;
import org.telegram.api.objects.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 = "chat_id";
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
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
private boolean isNewSticker;
private String stickerName;
public SendSticker() {
super();
}
public String getChatId() {
return chatId;
}
public void setChatId(String chatId) {
this.chatId = chatId;
}
public String getSticker() {
return sticker;
}
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 void setSticker(String sticker) {
this.sticker = sticker;
this.isNewSticker = false;
}
public void setSticker(String sticker, String stickerName) {
this.sticker = sticker;
this.isNewSticker = true;
this.stickerName = stickerName;
}
public boolean isNewSticker() {
return isNewSticker;
}
public String getStickerName() {
return stickerName;
}
}

View File

@ -0,0 +1,98 @@
package org.telegram.api.methods;
import org.telegram.api.objects.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send video files,
* Telegram clients support mp4 videos (other formats may be sent as Document).
* On success, the sent Message is returned.
* @date 20 of June of 2015
*/
public class SendVideo {
public static final String PATH = "sendvideo";
public static final String CHATID_FIELD = "chat_id";
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
public static final String VIDEO_FIELD = "video";
private String video; ///< Video to send. file_id as String to resend a video that is already on the Telegram servers
public static final String DURATION_FIELD = "duration";
private Integer duration; ///< Optional. Duration of sent video in seconds
public static final String CAPTION_FIELD = "caption";
private String caption; ///< OptionaL. Video caption (may also be used when resending videos 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
private boolean isNewVideo; ///< True to upload a new video, false to use a fileId
private String videoName; ///< Name of the video
public SendVideo() {
super();
}
public String getChatId() {
return chatId;
}
public void setChatId(String chatId) {
this.chatId = chatId;
}
public String getVideo() {
return video;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
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 isNewVideo() {
return isNewVideo;
}
public String getVideoName() {
return videoName;
}
public void setVideo(String video) {
this.video = video;
this.isNewVideo = false;
}
public void setNewVideo(String video, String videoName) {
this.video = video;
this.isNewVideo = true;
this.videoName = videoName;
}
}

View File

@ -0,0 +1,31 @@
package org.telegram.api.methods;
import org.telegram.api.objects.ReplyKeyboard;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to send voice notes, 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 Audio or Document).
* @date 16 of July of 2015
*/
public class SendVoice {
public static final String PATH = "sendvoice";
public static final String CHATID_FIELD = "chat_id";
private String chatId; ///< Unique identifier for the chat sent message to (Or username for channels)
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 static final String DURATION_FIELD = "duration";
private Integer duration; ///< Optional. Duration of sent audio in seconds
public SendVoice() {
super();
}
}

View File

@ -0,0 +1,39 @@
package org.telegram.api.methods;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Use this method to specify a url and receive incoming updates via an outgoing webhook.
* Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url,
* containing a JSON-serialized Update. In case of an unsuccessful request,
* we will give up after a reasonable amount of attempts.
* @date 20 of June of 2015
*/
public class SetWebhook {
public static final String PATH = "setwebhook";
public static final String URL_FIELD = "url";
private String url; ///< Optional. HTTPS url to send updates to. Use an empty string to remove webhook integration
public static final String CERTIFICATE_FIELD = "certificate";
private String certificateFile; ///< Optional. Upload your public key certificate so that the root certificate in use can be checked
public SetWebhook() {
this.url = "";
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getCertificateFile() {
return certificateFile;
}
public void setCertificateFile(String certificateFile) {
this.certificateFile = certificateFile;
}
}

View File

@ -0,0 +1,134 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents an audio file
* @date 16 of July of 2015
*/
public class Audio implements BotApiObject {
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 static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title of the audio as defined by sender or by audio tags
public static final String PERFORMER_FIELD = "performer";
@JsonProperty(PERFORMER_FIELD)
private String performer; ///< Optional. Performer of the audio as defined by sender or by audio tags
public Audio() {
super();
}
public Audio(JSONObject jsonObject) {
super();
this.fileId = jsonObject.getString(FILEID_FIELD);
this.duration = jsonObject.getInt(DURATION_FIELD);
if (jsonObject.has(MIMETYPE_FIELD)) {
this.mimeType = jsonObject.getString(MIMETYPE_FIELD);
}
if (jsonObject.has(FILEID_FIELD)) {
this.fileSize = jsonObject.getInt(FILESIZE_FIELD);
}
if (jsonObject.has(TITLE_FIELD)) {
this.title = jsonObject.getString(TITLE_FIELD);
}
if (jsonObject.has(PERFORMER_FIELD)) {
this.performer = jsonObject.getString(PERFORMER_FIELD);
}
}
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;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPerformer() {
return performer;
}
public void setPerformer(String performer) {
this.performer = performer;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(FILEID_FIELD, fileId);
gen.writeNumberField(DURATION_FIELD, duration);
if (mimeType != null) {
gen.writeStringField(MIMETYPE_FIELD, mimeType);
}
if (fileSize != null) {
gen.writeNumberField(FILESIZE_FIELD, fileSize);
}
if (title != null) {
gen.writeStringField(TITLE_FIELD, title);
}
if (performer != null) {
gen.writeStringField(PERFORMER_FIELD, performer);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,129 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @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 implements BotApiObject {
private static final String USERCHATTYPE = "private";
private static final String GROUPCHATTYPE = "group";
private static final String CHANNELCHATTYPE = "channel";
private static final String SUPERGROUPCHATTYPE = "supergroup";
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private Long id; ///< Unique identifier for this chat, not exciding 1e13 by absolute value
public static final String TYPE_FIELD = "type";
@JsonProperty(TYPE_FIELD)
private String type; ///< Type of the chat, one of private, group or channel
public static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title of the chat, only for channels and group chat
public static final String FIRSTNAME_FIELD = "first_name";
@JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< Optional. Username of the chat, only for private chats and channels if available
public static final String LASTNAME_FIELD = "last_name";
@JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. Interlocutor's first name for private chats
public static final String USERNAME_FIELD = "username";
@JsonProperty(USERNAME_FIELD)
private String userName; ///< Optional. Interlocutor's last name for private chats
public Chat() {
super();
}
public Chat(JSONObject jsonObject) {
super();
this.id = jsonObject.getLong(ID_FIELD);
this.type = jsonObject.getString(TYPE_FIELD);
if (jsonObject.has(TITLE_FIELD)) {
this.title = jsonObject.getString(TITLE_FIELD);
}
if (jsonObject.has(FIRSTNAME_FIELD)) {
this.firstName = jsonObject.getString(FIRSTNAME_FIELD);
}
if (jsonObject.has(LASTNAME_FIELD)) {
this.lastName = jsonObject.getString(LASTNAME_FIELD);
}
if (jsonObject.has(USERNAME_FIELD)) {
this.userName = jsonObject.getString(USERNAME_FIELD);
}
}
public Long getId() {
return id;
}
public Boolean isGroupChat() {
return GROUPCHATTYPE.equals(type);
}
public Boolean isChannelChat() {
return CHANNELCHATTYPE.equals(type);
}
public Boolean isUserChat() {
return USERCHATTYPE.equals(type);
}
public Boolean isSuperGroupChat() {
return SUPERGROUPCHATTYPE.equals(type);
}
public String getTitle() {
return title;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getUserName() {
return userName;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeNumberField(ID_FIELD, id);
gen.writeStringField(TYPE_FIELD, type);
if (isUserChat()) {
if (firstName != null) {
gen.writeStringField(FIRSTNAME_FIELD, firstName);
}
if (lastName != null) {
gen.writeStringField(LASTNAME_FIELD, lastName);
}
} else {
if (title != null) {
gen.writeStringField(TITLE_FIELD, title);
}
}
if (!isGroupChat() && userName != null) {
gen.writeStringField(USERNAME_FIELD, userName);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,66 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a result of an inline query that was chosen by the user and sent to their chat partner.
* @date 01 of January of 2016
*/
public class ChosenInlineQuery implements BotApiObject {
public static final String RESULTID_FIELD = "id";
@JsonProperty(RESULTID_FIELD)
private String resultId; ///< The unique identifier for the result that was chosen.
public static final String FROM_FIELD = "from";
@JsonProperty(FROM_FIELD)
private User from; ///< The user that chose the result.
public static final String QUERY_FIELD = "query";
@JsonProperty(QUERY_FIELD)
private String query; ///< The query that was used to obtain the result.
public ChosenInlineQuery() {
super();
}
public ChosenInlineQuery(JSONObject jsonObject) {
super();
this.resultId = jsonObject.getString(RESULTID_FIELD);
this.from = new User(jsonObject.getJSONObject(FROM_FIELD));
this.query = jsonObject.getString(QUERY_FIELD);
}
public String getResultId() {
return resultId;
}
public User getFrom() {
return from;
}
public String getQuery() {
return query;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(RESULTID_FIELD, resultId);
gen.writeObjectField(FROM_FIELD, from);
gen.writeStringField(QUERY_FIELD, query);
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,68 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a phone contact.
* @date 20 of June of 2015
*/
public class Contact implements BotApiObject {
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 Integer 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);
if (jsonObject.has(LASTNAME_FIELD)) {
this.lastName = jsonObject.getString(LASTNAME_FIELD);
}
if (jsonObject.has(USERID_FIELD)) {
this.userID = jsonObject.getInt(USERID_FIELD);
}
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(PHONENUMBER_FIELD, phoneNumber);
gen.writeStringField(FIRSTNAME_FIELD, firstName);
if (lastName != null) {
gen.writeStringField(LASTNAME_FIELD, lastName);
}
if (userID != null) {
gen.writeNumberField(USERID_FIELD, userID);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,119 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @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 implements BotApiObject {
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);
if (jsonObject.has(THUMB_FIELD)) {
this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD));
}
if (jsonObject.has(FILENAME_FIELD)) {
this.fileName = jsonObject.getString(FILENAME_FIELD);
}
if (jsonObject.has(MIMETYPE_FIELD)) {
this.mimeType = jsonObject.getString(MIMETYPE_FIELD);
}
if (jsonObject.has(FILESIZE_FIELD)) {
this.fileSize = jsonObject.getInt(FILESIZE_FIELD);
}
}
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;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(FILEID_FIELD, fileId);
gen.writeObjectField(THUMB_FIELD, thumb);
if (fileName != null) {
gen.writeStringField(FILENAME_FIELD, fileName);
}
if (mimeType != null) {
gen.writeStringField(MIMETYPE_FIELD, mimeType);
}
if (fileSize != null) {
gen.writeNumberField(FILESIZE_FIELD, fileSize);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,86 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a file ready to be downloaded
* @date 24 of June of 2015
*/
public class File implements BotApiObject {
public static final String FILE_ID = "file_id";
@JsonProperty(FILE_ID)
private String fileId; ///< Unique identifier for this file
public static final String FILE_SIZE_FIELD = "file_size";
@JsonProperty(FILE_SIZE_FIELD)
private Integer fileSize; ///< Optional. File size, if known
public static final String FILE_PATH_FIELD = "first_name";
@JsonProperty(FILE_PATH_FIELD)
private String filePath; ///< Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
public File() {
super();
}
public File(JSONObject jsonObject) {
super();
this.fileId = jsonObject.getString(FILE_ID);
if (jsonObject.has(FILE_SIZE_FIELD)) {
this.fileSize = jsonObject.getInt(FILE_SIZE_FIELD);
}
if (jsonObject.has(FILE_PATH_FIELD)) {
this.filePath = jsonObject.getString(FILE_PATH_FIELD);
}
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(FILE_ID, fileId);
if (fileSize != null) {
gen.writeNumberField(FILE_SIZE_FIELD, fileSize);
}
if (filePath != null) {
gen.writeStringField(FILE_PATH_FIELD, filePath);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,94 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import java.io.IOException;
/**
* @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 ForceReplyKeyboard 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 ForceReplyKeyboard() {
super();
this.forceReply = true;
}
public ForceReplyKeyboard(JSONObject jsonObject) {
super();
if (jsonObject.has(FORCEREPLY_FIELD)) {
this.forceReply = jsonObject.getBoolean(FORCEREPLY_FIELD);
}
if (jsonObject.has(SELECTIVE_FIELD)) {
this.selective = jsonObject.getBoolean(SELECTIVE_FIELD);
}
}
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;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeBooleanField(FORCEREPLY_FIELD, forceReply);
gen.writeBooleanField(SELECTIVE_FIELD, selective);
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,76 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents an incoming inline query.
* When the user sends an empty query, your bot could return some default or trending results.
* @date 01 of January of 2016
*/
public class InlineQuery implements BotApiObject {
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private String id; ///< Unique identifier for this query
public static final String FROM_FIELD = "from";
@JsonProperty(FROM_FIELD)
private User from; ///< Sender
public static final String QUERY_FIELD = "query";
@JsonProperty(QUERY_FIELD)
private String query; ///< Text of the query
public static final String OFFSET_FIELD = "offset";
@JsonProperty(OFFSET_FIELD)
private String offset; ///< Offset of the results to be returned, can be controlled by the bot
public InlineQuery() {
super();
}
public InlineQuery(JSONObject jsonObject) {
super();
this.id = jsonObject.getString(ID_FIELD);
this.from = new User(jsonObject.getJSONObject(FROM_FIELD));
this.query = jsonObject.getString(QUERY_FIELD);
this.offset = jsonObject.getString(OFFSET_FIELD);
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(ID_FIELD, id);
gen.writeObjectField(FROM_FIELD, from);
gen.writeStringField(QUERY_FIELD, query);
gen.writeStringField(OFFSET_FIELD, offset);
gen.writeEndObject();
gen.flush();
}
public String getId() {
return id;
}
public User getFrom() {
return from;
}
public String getQuery() {
return query;
}
public String getOffset() {
return offset;
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,13 @@
package org.telegram.api.objects;
import org.telegram.api.interfaces.BotApiObject;
import org.telegram.api.interfaces.IToJson;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents one result of an inline query.
* @date 01 of January of 2016
*/
public interface InlineQueryResult extends BotApiObject, IToJson {
}

View File

@ -0,0 +1,233 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Represents a link to an article or web page.
* @date 01 of January of 2016
*/
public class InlineQueryResultArticle implements InlineQueryResult {
public static final String TYPE_FIELD = "type";
@JsonProperty(TYPE_FIELD)
private final String type = "article"; ///< Type of the result, must be article
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private String id; ///< Unique identifier of this result
public static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Title of the result
public static final String MESSAGETEXT_FIELD = "message_text";
@JsonProperty(MESSAGETEXT_FIELD)
private String messageText; ///< Text of a message to be sent
public static final String PARSEMODE_FIELD = "parse_mode";
@JsonProperty(PARSEMODE_FIELD)
private String parseMode; ///< Optional. Send Markdown, if you want Telegram apps to show bold, italic and inline URLs in your bot's message.
public static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
@JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD)
private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in the sent message
public static final String URL_FIELD = "url";
@JsonProperty(URL_FIELD)
private String url; ///< Optional. URL of the result
public static final String HIDEURL_FIELD = "hide_url";
@JsonProperty(HIDEURL_FIELD)
private Boolean hideUrl; ///< Optional. Pass True, if you don't want the URL to be shown in the message
public static final String DESCRIPTION_FIELD = "description";
@JsonProperty(DESCRIPTION_FIELD)
private String description; ///< Optional. Short description of the result
public static final String THUMBURL_FIELD = "thumb_url";
@JsonProperty(THUMBURL_FIELD)
private String thumbUrl; ///< Optional. Url of the thumbnail for the result
public static final String THUMBWIDTH_FIELD = "thumb_width";
@JsonProperty(THUMBWIDTH_FIELD)
private Integer thumbWidth; ///< Optional. Thumbnail width
public static final String THUMBHEIGHT_FIELD = "thumb_height";
@JsonProperty(THUMBHEIGHT_FIELD)
private Integer thumbHeight; ///< Optional. Thumbnail height
public String getType() {
return type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessageText() {
return messageText;
}
public void setMessageText(String messageText) {
this.messageText = messageText;
}
public String getParseMode() {
return parseMode;
}
public void setParseMode(String parseMode) {
this.parseMode = parseMode;
}
public void setMarkdown(boolean enabled) {
if (enabled) {
parseMode = "Markdown";
} else {
parseMode = null;
}
}
public Boolean getDisableWebPagePreview() {
return disableWebPagePreview;
}
public void setDisableWebPagePreview(Boolean disableWebPagePreview) {
this.disableWebPagePreview = disableWebPagePreview;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Boolean getHideUrl() {
return hideUrl;
}
public void setHideUrl(Boolean hideUrl) {
this.hideUrl = hideUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getThumbUrl() {
return thumbUrl;
}
public void setThumbUrl(String thumbUrl) {
this.thumbUrl = thumbUrl;
}
public Integer getThumbWidth() {
return thumbWidth;
}
public void setThumbWidth(Integer thumbWidth) {
this.thumbWidth = thumbWidth;
}
public Integer getThumbHeight() {
return thumbHeight;
}
public void setThumbHeight(Integer thumbHeight) {
this.thumbHeight = thumbHeight;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(TYPE_FIELD, this.type);
jsonObject.put(ID_FIELD, this.id);
jsonObject.put(TITLE_FIELD, this.title);
jsonObject.put(MESSAGETEXT_FIELD, this.messageText);
if (parseMode != null) {
jsonObject.put(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
jsonObject.put(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (url != null) {
jsonObject.put(URL_FIELD, this.url);
}
if (hideUrl != null) {
jsonObject.put(HIDEURL_FIELD, this.hideUrl);
}
if (description != null) {
jsonObject.put(DESCRIPTION_FIELD, this.description);
}
if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl);
}
if (thumbWidth != null) {
jsonObject.put(THUMBWIDTH_FIELD, this.thumbWidth);
}
if (thumbHeight != null) {
jsonObject.put(THUMBHEIGHT_FIELD, this.thumbHeight);
}
return jsonObject;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(TYPE_FIELD, type);
gen.writeStringField(ID_FIELD, id);
gen.writeStringField(TITLE_FIELD, title);
gen.writeStringField(MESSAGETEXT_FIELD, messageText);
if (parseMode != null) {
gen.writeStringField(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
gen.writeBooleanField(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (url != null) {
gen.writeStringField(URL_FIELD, this.url);
}
if (hideUrl != null) {
gen.writeBooleanField(HIDEURL_FIELD, this.hideUrl);
}
if (description != null) {
gen.writeStringField(DESCRIPTION_FIELD, this.description);
}
if (thumbUrl != null) {
gen.writeStringField(THUMBURL_FIELD, this.thumbUrl);
}
if (thumbWidth != null) {
gen.writeNumberField(THUMBWIDTH_FIELD, this.thumbWidth);
}
if (thumbHeight != null) {
gen.writeNumberField(THUMBHEIGHT_FIELD, this.thumbHeight);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,213 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption.
* Alternatively, you can provide message_text to send it instead of the animation.
* @date 01 of January of 2016
*/
public class InlineQueryResultGif implements InlineQueryResult {
public static final String TYPE_FIELD = "type";
@JsonProperty(TYPE_FIELD)
private final String type = "gif"; ///< Type of the result, must be "gif"
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private String id; ///< Unique identifier of this result
public static final String GIFURL_FIELD = "gif_url";
@JsonProperty(GIFURL_FIELD)
private String gifUrl; ///< A valid URL for the GIF file. File size must not exceed 1MB
public static final String GIFWIDTH_FIELD = "gif_width";
@JsonProperty(GIFWIDTH_FIELD)
private Integer gifWidth; ///< Optional. Width of the GIF
public static final String GIFHEIGHT_FIELD = "gif_height";
@JsonProperty(GIFHEIGHT_FIELD)
private Integer gifHeight; ///< Optional. Height of the GIF
public static final String THUMBURL_FIELD = "thumb_url";
@JsonProperty(THUMBURL_FIELD)
private String thumbUrl; ///< Optional. URL of a static thumbnail for the result (jpeg or gif)
public static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title for the result
public static final String CAPTION_FIELD = "caption";
@JsonProperty(CAPTION_FIELD)
private String caption; ///< Optional. Caption of the GIF file to be sent
public static final String MESSAGETEXT_FIELD = "message_text";
@JsonProperty(MESSAGETEXT_FIELD)
private String messageText; ///< Optional. Text of a message to be sent instead of the animation
public static final String PARSEMODE_FIELD = "parse_mode";
@JsonProperty(PARSEMODE_FIELD)
private String parseMode; ///< Optional. Send Markdown, if you want Telegram apps to show bold, italic and inline URLs in your bot's message.
public static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
@JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD)
private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in the sent message
public String getType() {
return type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessageText() {
return messageText;
}
public void setMessageText(String messageText) {
this.messageText = messageText;
}
public String getParseMode() {
return parseMode;
}
public void setParseMode(String parseMode) {
this.parseMode = parseMode;
}
public Boolean getDisableWebPagePreview() {
return disableWebPagePreview;
}
public void setDisableWebPagePreview(Boolean disableWebPagePreview) {
this.disableWebPagePreview = disableWebPagePreview;
}
public String getGifUrl() {
return gifUrl;
}
public void setGifUrl(String gifUrl) {
this.gifUrl = gifUrl;
}
public Integer getGifWidth() {
return gifWidth;
}
public void setGifWidth(Integer gifWidth) {
this.gifWidth = gifWidth;
}
public Integer getGifHeight() {
return gifHeight;
}
public void setGifHeight(Integer gifHeight) {
this.gifHeight = gifHeight;
}
public String getThumbUrl() {
return thumbUrl;
}
public void setThumbUrl(String thumbUrl) {
this.thumbUrl = thumbUrl;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(TYPE_FIELD, this.type);
jsonObject.put(ID_FIELD, this.id);
jsonObject.put(GIFURL_FIELD, this.gifUrl);
if (parseMode != null) {
jsonObject.put(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
jsonObject.put(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (gifWidth != null) {
jsonObject.put(GIFWIDTH_FIELD, this.gifWidth);
}
if (gifHeight != null) {
jsonObject.put(GIFHEIGHT_FIELD, this.gifHeight);
}
if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl);
}
if (title != null) {
jsonObject.put(TITLE_FIELD, this.title);
}
if (caption != null) {
jsonObject.put(CAPTION_FIELD, this.caption);
}
if (messageText != null) {
jsonObject.put(MESSAGETEXT_FIELD, this.messageText);
}
return jsonObject;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(TYPE_FIELD, type);
gen.writeStringField(ID_FIELD, id);
gen.writeStringField(GIFURL_FIELD, this.gifUrl);
if (parseMode != null) {
gen.writeStringField(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
gen.writeBooleanField(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (gifWidth != null) {
gen.writeNumberField(GIFWIDTH_FIELD, this.gifWidth);
}
if (gifHeight != null) {
gen.writeNumberField(GIFHEIGHT_FIELD, this.gifHeight);
}
if (thumbUrl != null) {
gen.writeStringField(THUMBURL_FIELD, this.thumbUrl);
}
if (title != null) {
gen.writeStringField(TITLE_FIELD, this.title);
}
if (caption != null) {
gen.writeStringField(CAPTION_FIELD, this.caption);
}
if (messageText != null) {
gen.writeStringField(MESSAGETEXT_FIELD, this.messageText);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,214 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Represents a link to a video animation (H.264/MPEG-4 AVC video without sound).
* By default, this animated MPEG-4 file will be sent by the user with optional caption.
* Alternatively, you can provide message_text to send it instead of the animation.
* @date 01 of January of 2016
*/
public class InlineQueryResultMpeg4Gif implements InlineQueryResult {
public static final String TYPE_FIELD = "type";
@JsonProperty(TYPE_FIELD)
private final String type = "mpeg4_gif"; ///< Type of the result, must be "mpeg4_gif"
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private String id; ///< Unique identifier of this result
public static final String MPEG4URL_FIELD = "mpeg4_url";
@JsonProperty(MPEG4URL_FIELD)
private String mpeg4Url; ///< A valid URL for the MP4 file. File size must not exceed 1MB
public static final String MPEG4WIDTH_FIELD = "mpeg4_width";
@JsonProperty(MPEG4WIDTH_FIELD)
private Integer mpeg4Width; ///< Optional. Video width
public static final String MPEG4HEIGHT_FIELD = "mpeg4_height";
@JsonProperty(MPEG4HEIGHT_FIELD)
private Integer mpeg4Height; ///< Optional. Video height
public static final String THUMBURL_FIELD = "thumb_url";
@JsonProperty(THUMBURL_FIELD)
private String thumbUrl; ///< Optional. URL of the static thumbnail (jpeg or gif) for the result
public static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title for the result
public static final String CAPTION_FIELD = "caption";
@JsonProperty(CAPTION_FIELD)
private String caption; ///< Optional. Caption of the MPEG-4 file to be sent
public static final String MESSAGETEXT_FIELD = "message_text";
@JsonProperty(MESSAGETEXT_FIELD)
private String messageText; ///< Optional. Text of a message to be sent instead of the animation
public static final String PARSEMODE_FIELD = "parse_mode";
@JsonProperty(PARSEMODE_FIELD)
private String parseMode; ///< Optional. Send Markdown, if you want Telegram apps to show bold, italic and inline URLs in your bot's message.
public static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
@JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD)
private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in the sent message
public String getType() {
return type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessageText() {
return messageText;
}
public void setMessageText(String messageText) {
this.messageText = messageText;
}
public String getParseMode() {
return parseMode;
}
public void setParseMode(String parseMode) {
this.parseMode = parseMode;
}
public Boolean getDisableWebPagePreview() {
return disableWebPagePreview;
}
public void setDisableWebPagePreview(Boolean disableWebPagePreview) {
this.disableWebPagePreview = disableWebPagePreview;
}
public String getMpeg4Url() {
return mpeg4Url;
}
public void setMpeg4Url(String mpeg4Url) {
this.mpeg4Url = mpeg4Url;
}
public Integer getMpeg4Width() {
return mpeg4Width;
}
public void setMpeg4Width(Integer mpeg4Width) {
this.mpeg4Width = mpeg4Width;
}
public Integer getMpeg4Height() {
return mpeg4Height;
}
public void setMpeg4Height(Integer mpeg4Height) {
this.mpeg4Height = mpeg4Height;
}
public String getThumbUrl() {
return thumbUrl;
}
public void setThumbUrl(String thumbUrl) {
this.thumbUrl = thumbUrl;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(TYPE_FIELD, this.type);
jsonObject.put(ID_FIELD, this.id);
jsonObject.put(MPEG4URL_FIELD, this.mpeg4Url);
if (parseMode != null) {
jsonObject.put(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
jsonObject.put(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (mpeg4Width != null) {
jsonObject.put(MPEG4WIDTH_FIELD, this.mpeg4Width);
}
if (mpeg4Height != null) {
jsonObject.put(MPEG4HEIGHT_FIELD, this.mpeg4Height);
}
if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl);
}
if (title != null) {
jsonObject.put(TITLE_FIELD, this.title);
}
if (caption != null) {
jsonObject.put(CAPTION_FIELD, this.caption);
}
if (messageText != null) {
jsonObject.put(MESSAGETEXT_FIELD, this.messageText);
}
return jsonObject;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(TYPE_FIELD, type);
gen.writeStringField(ID_FIELD, id);
gen.writeStringField(MPEG4URL_FIELD, this.mpeg4Url);
if (parseMode != null) {
gen.writeStringField(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
gen.writeBooleanField(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (mpeg4Width != null) {
gen.writeNumberField(MPEG4WIDTH_FIELD, this.mpeg4Width);
}
if (mpeg4Height != null) {
gen.writeNumberField(MPEG4HEIGHT_FIELD, this.mpeg4Height);
}
if (thumbUrl != null) {
gen.writeStringField(THUMBURL_FIELD, this.thumbUrl);
}
if (title != null) {
gen.writeStringField(TITLE_FIELD, this.title);
}
if (caption != null) {
gen.writeStringField(CAPTION_FIELD, this.caption);
}
if (messageText != null) {
gen.writeStringField(MESSAGETEXT_FIELD, this.messageText);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,249 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Represents a link to a photo. By default, this photo will be sent by the user with optional caption.
* Alternatively, you can provide message_text to send it instead of photo.
* @date 01 of January of 2016
*/
public class InlineQueryResultPhoto implements InlineQueryResult {
public static final String TYPE_FIELD = "type";
@JsonProperty(TYPE_FIELD)
private final String type = "photo"; ///< Type of the result, must be photo
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private String id; ///< Unique identifier of this result
public static final String PHOTOURL_FIELD = "photo_url";
@JsonProperty(PHOTOURL_FIELD)
private String photoUrl; ///< A valid URL of the photo. Photo size must not exceed 5MB
public static final String MIMETYPE_FIELD = "mime_type";
@JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Optional. MIME type of the photo, defaults to image/jpeg
public static final String PHOTOWIDTH_FIELD = "photo_width";
@JsonProperty(PHOTOWIDTH_FIELD)
private Integer photoWidth; ///< Optional. Width of the photo
public static final String PHOTOHEIGHT_FIELD = "photo_height";
@JsonProperty(PHOTOHEIGHT_FIELD)
private Integer photoHeight; ///< Optional. Height of the photo
public static final String THUMBURL_FIELD = "thumb_url";
@JsonProperty(THUMBURL_FIELD)
private String thumbUrl; ///< Optional. URL of the thumbnail for the photo
public static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title for the result
public static final String DESCRIPTION_FIELD = "description";
@JsonProperty(DESCRIPTION_FIELD)
private String description; ///< Optional. Short description of the result
public static final String CAPTION_FIELD = "caption";
@JsonProperty(CAPTION_FIELD)
private String caption; ///< Optional. Caption of the photo to be sent
public static final String MESSAGETEXT_FIELD = "message_text";
@JsonProperty(MESSAGETEXT_FIELD)
private String messageText; ///< Optional. Text of a message to be sent instead of the photo
public static final String PARSEMODE_FIELD = "parse_mode";
@JsonProperty(PARSEMODE_FIELD)
private String parseMode; ///< Optional. Send Markdown, if you want Telegram apps to show bold, italic and inline URLs in your bot's message.
public static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
@JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD)
private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in the sent message
public String getType() {
return type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessageText() {
return messageText;
}
public void setMessageText(String messageText) {
this.messageText = messageText;
}
public String getParseMode() {
return parseMode;
}
public void setParseMode(String parseMode) {
this.parseMode = parseMode;
}
public Boolean getDisableWebPagePreview() {
return disableWebPagePreview;
}
public void setDisableWebPagePreview(Boolean disableWebPagePreview) {
this.disableWebPagePreview = disableWebPagePreview;
}
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(String photoUrl) {
this.photoUrl = photoUrl;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public Integer getPhotoWidth() {
return photoWidth;
}
public void setPhotoWidth(Integer photoWidth) {
this.photoWidth = photoWidth;
}
public Integer getPhotoHeight() {
return photoHeight;
}
public void setPhotoHeight(Integer photoHeight) {
this.photoHeight = photoHeight;
}
public String getThumbUrl() {
return thumbUrl;
}
public void setThumbUrl(String thumbUrl) {
this.thumbUrl = thumbUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(TYPE_FIELD, this.type);
jsonObject.put(ID_FIELD, this.id);
jsonObject.put(PHOTOURL_FIELD, this.photoUrl);
if (parseMode != null) {
jsonObject.put(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
jsonObject.put(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (mimeType != null) {
jsonObject.put(MIMETYPE_FIELD, this.mimeType);
}
if (photoWidth != null) {
jsonObject.put(PHOTOWIDTH_FIELD, this.photoWidth);
}
if (photoHeight != null) {
jsonObject.put(PHOTOHEIGHT_FIELD, this.photoHeight);
}
if (description != null) {
jsonObject.put(DESCRIPTION_FIELD, this.description);
}
if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl);
}
if (title != null) {
jsonObject.put(TITLE_FIELD, this.title);
}
if (description != null) {
jsonObject.put(DESCRIPTION_FIELD, this.description);
}
if (caption != null) {
jsonObject.put(CAPTION_FIELD, this.caption);
}
if (messageText != null) {
jsonObject.put(MESSAGETEXT_FIELD, this.messageText);
}
return jsonObject;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(TYPE_FIELD, type);
gen.writeStringField(ID_FIELD, id);
gen.writeStringField(PHOTOURL_FIELD, this.photoUrl);
if (parseMode != null) {
gen.writeStringField(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
gen.writeBooleanField(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (mimeType != null) {
gen.writeStringField(MIMETYPE_FIELD, this.mimeType);
}
if (photoWidth != null) {
gen.writeNumberField(PHOTOWIDTH_FIELD, this.photoWidth);
}
if (photoHeight != null) {
gen.writeNumberField(PHOTOHEIGHT_FIELD, this.photoHeight);
}
if (thumbUrl != null) {
gen.writeStringField(THUMBURL_FIELD, this.thumbUrl);
}
if (description != null) {
gen.writeStringField(DESCRIPTION_FIELD, this.description);
}
if (title != null) {
gen.writeStringField(TITLE_FIELD, this.title);
}
if (caption != null) {
gen.writeStringField(CAPTION_FIELD, this.caption);
}
if (messageText != null) {
gen.writeStringField(MESSAGETEXT_FIELD, this.messageText);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,245 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief Represents link to a page containing an embedded video player or a video file.
* @date 01 of January of 2016
*/
public class InlineQueryResultVideo implements InlineQueryResult {
public static final String TYPE_FIELD = "type";
@JsonProperty(TYPE_FIELD)
private final String type = "video"; ///< Type of the result, must be "video"
public static final String ID_FIELD = "id";
@JsonProperty(ID_FIELD)
private String id; ///< Unique identifier of this result
public static final String MIMETYPE_FIELD = "mime_type";
@JsonProperty(MIMETYPE_FIELD)
private String mimeType; ///< Mime type of the content of video url, i.e. text/html or video/mp4
public static final String VIDEOURL_FIELD = "video_url";
@JsonProperty(VIDEOURL_FIELD)
private String videoUrl; ///< A valid URL for the embedded video player or video file
public static final String VIDEOWIDTH_FIELD = "video_width";
@JsonProperty(VIDEOWIDTH_FIELD)
private Integer videoWidth; ///< Optional. Video width
public static final String VIDEOHEIGHT_FIELD = "video_height";
@JsonProperty(VIDEOHEIGHT_FIELD)
private Integer videoHeight; ///< Optional. Video height
public static final String VIDEODURATION_FIELD = "video_duration";
@JsonProperty(VIDEODURATION_FIELD)
private Integer videoDuration; ///< Optional. Video duration in seconds
public static final String THUMBURL_FIELD = "thumb_url";
@JsonProperty(THUMBURL_FIELD)
private String thumbUrl; ///< Optional. URL of the thumbnail (jpeg only) for the video
public static final String TITLE_FIELD = "title";
@JsonProperty(TITLE_FIELD)
private String title; ///< Optional. Title for the result
public static final String DESCRIPTION_FIELD = "description";
@JsonProperty(DESCRIPTION_FIELD)
private String description; ///< Optional. Short description of the result
public static final String MESSAGETEXT_FIELD = "message_text";
@JsonProperty(MESSAGETEXT_FIELD)
private String messageText; ///< Optional. Text of a message to be sent instead of the video
public static final String PARSEMODE_FIELD = "parse_mode";
@JsonProperty(PARSEMODE_FIELD)
private String parseMode; ///< Optional. Send Markdown, if you want Telegram apps to show bold, italic and inline URLs in your bot's message.
public static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
@JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD)
private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in the sent message
public String getType() {
return type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessageText() {
return messageText;
}
public void setMessageText(String messageText) {
this.messageText = messageText;
}
public String getParseMode() {
return parseMode;
}
public void setParseMode(String parseMode) {
this.parseMode = parseMode;
}
public Boolean getDisableWebPagePreview() {
return disableWebPagePreview;
}
public void setDisableWebPagePreview(Boolean disableWebPagePreview) {
this.disableWebPagePreview = disableWebPagePreview;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public Integer getVideoWidth() {
return videoWidth;
}
public void setVideoWidth(Integer videoWidth) {
this.videoWidth = videoWidth;
}
public Integer getVideoHeight() {
return videoHeight;
}
public void setVideoHeight(Integer videoHeight) {
this.videoHeight = videoHeight;
}
public Integer getVideoDuration() {
return videoDuration;
}
public void setVideoDuration(Integer videoDuration) {
this.videoDuration = videoDuration;
}
public String getThumbUrl() {
return thumbUrl;
}
public void setThumbUrl(String thumbUrl) {
this.thumbUrl = thumbUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
jsonObject.put(TYPE_FIELD, this.type);
jsonObject.put(ID_FIELD, this.id);
jsonObject.put(VIDEOURL_FIELD, this.videoUrl);
if (mimeType != null) {
jsonObject.put(MIMETYPE_FIELD, this.mimeType);
}
if (messageText != null) {
jsonObject.put(MESSAGETEXT_FIELD, this.messageText);
}
if (parseMode != null) {
jsonObject.put(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
jsonObject.put(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (videoWidth != null) {
jsonObject.put(VIDEOWIDTH_FIELD, this.videoWidth);
}
if (videoHeight != null) {
jsonObject.put(VIDEOHEIGHT_FIELD, this.videoHeight);
}
if (videoDuration != null) {
jsonObject.put(VIDEODURATION_FIELD, this.videoDuration);
}
if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl);
}
if (title != null) {
jsonObject.put(TITLE_FIELD, this.title);
}
if (description != null) {
jsonObject.put(DESCRIPTION_FIELD, this.description);
}
return jsonObject;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField(TYPE_FIELD, type);
gen.writeStringField(ID_FIELD, id);
gen.writeStringField(VIDEOURL_FIELD, this.videoUrl);
if (mimeType != null) {
gen.writeStringField(MIMETYPE_FIELD, this.mimeType);
}
if (messageText != null) {
gen.writeStringField(MESSAGETEXT_FIELD, this.messageText);
}
if (parseMode != null) {
gen.writeStringField(PARSEMODE_FIELD, this.parseMode);
}
if (disableWebPagePreview != null) {
gen.writeBooleanField(DISABLEWEBPAGEPREVIEW_FIELD, this.disableWebPagePreview);
}
if (videoWidth != null) {
gen.writeNumberField(VIDEOWIDTH_FIELD, this.videoWidth);
}
if (videoHeight != null) {
gen.writeNumberField(VIDEOHEIGHT_FIELD, this.videoHeight);
}
if (videoDuration != null) {
gen.writeNumberField(VIDEODURATION_FIELD, this.videoDuration);
}
if (thumbUrl != null) {
gen.writeStringField(THUMBURL_FIELD, this.thumbUrl);
}
if (title != null) {
gen.writeStringField(TITLE_FIELD, this.title);
}
if (description != null) {
gen.writeStringField(DESCRIPTION_FIELD, this.description);
}
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -0,0 +1,66 @@
package org.telegram.api.objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.api.interfaces.BotApiObject;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief This object represents a point on the map.
* @date 20 of June of 2015
*/
public class Location implements BotApiObject {
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;
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeNumberField(LONGITUDE_FIELD, longitude);
gen.writeNumberField(LATITUDE_FIELD, latitude);
gen.writeEndObject();
gen.flush();
}
@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

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